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

◆ as_line_vertex_access()

MAYAFLUX_API std::optional< VertexAccess > MayaFlux::Kakshya::as_line_vertex_access ( const DataVariant variant,
const VertexAccessConfig config = {} 
)

Convert DataVariant to line-vertex-compatible bytes.

Output layout matches VertexLayout::for_lines(): stride 36, position (vec3, offset 0), color (vec3, offset 12), thickness (float, offset 24), uv (vec2, offset 28), normal (vec3, offset 36), tangent (vec3, offset 48). Compatible with line.vert.spv without any user-defined shaders.

Parameters
variantSource data.
configDefault attribute values (color, thickness, uv).
Returns
Populated VertexAccess, or std::nullopt on incompatible type.

Definition at line 325 of file VertexAccess.cpp.

328{
329 auto positions = extract_positions(variant);
330 if (positions.empty()) {
331 MF_ERROR(Journal::Component::Kakshya, Journal::Context::Runtime,
332 "as_line_vertex_access: unsupported or empty variant");
333 return std::nullopt;
334 }
335
336 const auto count = static_cast<uint32_t>(positions.size());
337 VertexAccess va;
338 va.conversion_buffer.resize((size_t)count * 60);
339 write_line_vertices(positions, config, va.conversion_buffer.data());
340 va.data_ptr = va.conversion_buffer.data();
341 va.byte_count = va.conversion_buffer.size();
342 va.layout = VertexLayout::for_lines();
343 va.layout.vertex_count = count;
344 return va;
345}
#define MF_ERROR(comp, ctx,...)
Eigen::Index count

References MayaFlux::Kakshya::VertexAccess::byte_count, MayaFlux::Kakshya::VertexAccess::conversion_buffer, count, MayaFlux::Kakshya::VertexAccess::data_ptr, MayaFlux::Kakshya::VertexLayout::for_lines(), MayaFlux::Journal::Kakshya, MayaFlux::Kakshya::VertexAccess::layout, MF_ERROR, MayaFlux::Journal::Runtime, and MayaFlux::Kakshya::VertexLayout::vertex_count.

Referenced by MayaFlux::Buffers::GeometryWriteProcessor::processing_function().

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