MayaFlux 1.0.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 131 of file TopologyGeneratorNode.cpp.

134{
135 if (num_points < 2 || m_vertices.empty()) {
136 return;
137 }
138
139 const size_t num_segments = num_points - 1;
140 const size_t count = m_vertices.size() / 2 + 1;
141 const auto span = static_cast<float>(count - 1);
142
143 for (size_t i = 0; i + 1 < count; ++i) {
144 const float t0 = static_cast<float>(i) / span;
145 const float t1 = static_cast<float>(i + 1) / span;
146
147 const auto s0 = std::min<size_t>(
148 static_cast<size_t>(t0 * static_cast<float>(num_segments)), num_segments - 1);
149 const auto s1 = std::min<size_t>(
150 static_cast<size_t>(t1 * static_cast<float>(num_segments)), num_segments - 1);
151
152 LineVertex& v0 = m_vertices[i * 2];
153 LineVertex& v1 = m_vertices[i * 2 + 1];
154
156 v1.color = m_force_uniform_color ? m_line_color : points[s1].color;
157
158 v0.thickness = m_force_uniform_thickness ? m_line_thickness : points[s0].thickness;
159 v1.thickness = m_force_uniform_thickness ? m_line_thickness : points[s1].thickness;
160 }
161}
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:9

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: