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

◆ as_point_vertex_access()

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

Convert DataVariant to point-vertex-compatible bytes.

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

All accepted DataVariant types produce a position per element: GLM types map position directly; scalar and integer types produce a waveform (x=normalised index, y=value, z=0). Color and size are filled from config defaults throughout.

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

Definition at line 302 of file VertexAccess.cpp.

305{
306 auto positions = extract_positions(variant);
307 if (positions.empty()) {
308 MF_ERROR(Journal::Component::Kakshya, Journal::Context::Runtime,
309 "as_point_vertex_access: unsupported or empty variant");
310 return std::nullopt;
311 }
312
313 const auto count = static_cast<uint32_t>(positions.size());
314 VertexAccess va;
315 va.conversion_buffer.resize((size_t)count * 60);
316 write_point_vertices(positions, config, va.conversion_buffer.data());
317 va.data_ptr = va.conversion_buffer.data();
318 va.byte_count = va.conversion_buffer.size();
319 va.layout = VertexLayout::for_points();
320 va.layout.vertex_count = count;
321
322 return va;
323}
#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_points(), 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: