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

◆ write_vertices()

void MayaFlux::Nodes::GpuSync::GlyphGeometryNode::write_vertices ( )
private

Definition at line 149 of file GlyphGeometryNode.cpp.

150{
151 size_t total_pairs = 0;
152
153 for (const auto& ol : m_outlines) {
154 uint32_t prev_end = 0;
155 for (uint32_t end : ol.contour_ends) {
156 const uint32_t count = end - prev_end;
157 if (count >= 2)
158 total_pairs += count - 1;
159 prev_end = end;
160 }
161 }
162
163 std::vector<Kakshya::LineVertex> verts;
164 verts.reserve(total_pairs * 2);
165
166 for (size_t gi = 0; gi < m_outlines.size(); ++gi) {
167 const auto& ol = m_outlines[gi];
168 const glm::vec2 off = m_pen_offsets[gi];
169
170 uint32_t prev_end = 0;
171 for (uint32_t end : ol.contour_ends) {
172 const uint32_t count = end - prev_end;
173 if (count < 2) {
174 prev_end = end;
175 continue;
176 }
177
178 for (uint32_t pi = prev_end; pi < end - 1; ++pi) {
179 const glm::vec2 a = ol.points[pi] + off;
180 const glm::vec2 b = ol.points[pi + 1] + off;
181 verts.push_back({ .position = { a.x, a.y, 0.F }, .color = m_color, .thickness = m_thickness });
182 verts.push_back({ .position = { b.x, b.y, 0.F }, .color = m_color, .thickness = m_thickness });
183 }
184
185 prev_end = end;
186 }
187 }
188
189 set_vertices<Kakshya::LineVertex>(std::span { verts.data(), verts.size() });
190
191 auto layout = get_vertex_layout();
192 layout->vertex_count = static_cast<uint32_t>(verts.size());
193 set_vertex_layout(*layout);
194
195 m_vertex_data_dirty = true;
196 m_dirty = false;
197}
std::vector< uint32_t > * contour_ends
size_t a
size_t b
size_t count
bool m_vertex_data_dirty
Flag: vertex data or layout changed since last GPU upload.
std::optional< Kakshya::VertexLayout > get_vertex_layout() const
Get cached vertex layout.
void set_vertex_layout(const Kakshya::VertexLayout &layout)
Set cached vertex layout.
std::vector< Portal::Text::GlyphOutline > m_outlines

References a, b, count, MayaFlux::Nodes::GpuSync::GeometryWriterNode::get_vertex_layout(), m_color, m_dirty, m_outlines, m_pen_offsets, m_thickness, MayaFlux::Nodes::GpuSync::GeometryWriterNode::m_vertex_data_dirty, and MayaFlux::Nodes::GpuSync::GeometryWriterNode::set_vertex_layout().

Referenced by compute_frame(), and rebuild_outlines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: