MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ build_direct_connections()

void MayaFlux::Nodes::GpuSync::TopologyGeneratorNode::build_direct_connections ( std::span< LineVertex >  points,
size_t  num_points 
)
private

Definition at line 476 of file TopologyGeneratorNode.cpp.

479{
480 size_t valid_connections = std::ranges::count_if(m_connections,
481 [num_points](const auto& conn) {
482 return conn.first < num_points && conn.second < num_points;
483 });
484
485 m_vertices.clear();
486 m_vertices.reserve(valid_connections * 2);
487
488 for (const auto& [a, b] : m_connections) {
489 if (a >= num_points || b >= num_points) {
490 continue;
491 }
492
493 glm::vec3 color_a = m_force_uniform_color ? m_line_color : points[a].color;
494 glm::vec3 color_b = m_force_uniform_color ? m_line_color : points[b].color;
495
496 float thick_a = m_force_uniform_thickness ? m_line_thickness : points[a].thickness;
497 float thick_b = m_force_uniform_thickness ? m_line_thickness : points[b].thickness;
498
499 const glm::vec3 edge = points[b].position - points[a].position;
500
501 m_vertices.emplace_back(LineVertex {
502 .position = points[a].position,
503 .color = color_a,
504 .thickness = thick_a,
505 .tangent = edge });
506
507 m_vertices.emplace_back(LineVertex {
508 .position = points[b].position,
509 .color = color_b,
510 .thickness = thick_b,
511 .tangent = edge });
512 }
513}
std::vector< glm::vec2 > * points
size_t a
size_t b
std::vector< std::pair< size_t, size_t > > m_connections
bool m_force_uniform_color
If true, all vertices use m_line_color instead of per-vertex color.
bool m_force_uniform_thickness
If true, all vertices use m_line_thickness instead of per-vertex thickness.
Kakshya::LineVertex LineVertex
Definition VertexSpec.hpp:9

References a, b, m_connections, m_force_uniform_color, m_force_uniform_thickness, m_line_color, m_line_thickness, m_vertices, points, and MayaFlux::Kakshya::LineVertex::position.

Referenced by build_vertex_buffer(), and refresh_attributes().

+ Here is the caller graph for this function: