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

◆ write_vertices()

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

Definition at line 145 of file GlyphGeometryNode.cpp.

146{
147 size_t total_pairs = 0;
148
149 for (const auto& ol : m_outlines) {
150 uint32_t prev_end = 0;
151 for (uint32_t end : ol.contour_ends) {
152 const uint32_t count = end - prev_end;
153 if (count >= 2)
154 total_pairs += count - 1;
155 prev_end = end;
156 }
157 }
158
159 std::vector<Kakshya::LineVertex> verts;
160 verts.reserve(total_pairs * 2);
161
162 for (size_t gi = 0; gi < m_outlines.size(); ++gi) {
163 const auto& ol = m_outlines[gi];
164 const glm::vec2 off = m_pen_offsets[gi];
165
166 uint32_t prev_end = 0;
167 for (uint32_t end : ol.contour_ends) {
168 const uint32_t count = end - prev_end;
169 if (count < 2) {
170 prev_end = end;
171 continue;
172 }
173
174 for (uint32_t pi = prev_end; pi < end - 1; ++pi) {
175 const glm::vec2 a = ol.points[pi] + off;
176 const glm::vec2 b = ol.points[pi + 1] + off;
177 verts.push_back({ .position = { a.x, a.y, 0.F }, .color = m_color, .thickness = m_thickness });
178 verts.push_back({ .position = { b.x, b.y, 0.F }, .color = m_color, .thickness = m_thickness });
179 }
180
181 prev_end = end;
182 }
183 }
184
185 set_vertices<Kakshya::LineVertex>(std::span { verts.data(), verts.size() });
186
187 auto layout = get_vertex_layout();
188 layout->vertex_count = static_cast<uint32_t>(verts.size());
189 set_vertex_layout(*layout);
190
191 m_vertex_data_dirty = true;
192 m_dirty = false;
193}
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: