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

◆ write_path_attributes()

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

Write colour and thickness for the interpolated path.

Parameters
pointsControl point source.
num_pointsControl point count.

Definition at line 106 of file TopologyGeneratorNode.cpp.

109{
110 if (num_points < 2 || m_vertices.empty()) {
111 return;
112 }
113
114 const size_t num_segments = num_points - 1;
115 const size_t count = m_vertices.size() / 2 + 1;
116 const auto span = static_cast<float>(count - 1);
117
118 for (size_t i = 0; i + 1 < count; ++i) {
119 const float t0 = static_cast<float>(i) / span;
120 const float t1 = static_cast<float>(i + 1) / span;
121
122 const auto s0 = std::min<size_t>(
123 static_cast<size_t>(t0 * static_cast<float>(num_segments)), num_segments - 1);
124 const auto s1 = std::min<size_t>(
125 static_cast<size_t>(t1 * static_cast<float>(num_segments)), num_segments - 1);
126
127 LineVertex& v0 = m_vertices[i * 2];
128 LineVertex& v1 = m_vertices[i * 2 + 1];
129
131 v1.color = m_force_uniform_color ? m_line_color : points[s1].color;
132
133 v0.thickness = m_force_uniform_thickness ? m_line_thickness : points[s0].thickness;
134 v1.thickness = m_force_uniform_thickness ? m_line_thickness : points[s1].thickness;
135 }
136}
std::vector< glm::vec2 > * points
size_t count
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:8

References MayaFlux::Kakshya::LineVertex::color, count, m_force_uniform_color, m_force_uniform_thickness, m_line_color, m_line_thickness, m_vertices, points, and MayaFlux::Kakshya::LineVertex::thickness.

Referenced by build_interpolated_path(), and refresh_attributes().

+ Here is the caller graph for this function: