|
MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
|
| bool MayaFlux::IO::write_operator_sample | ( | SpatialCache & | cache, |
| const std::string & | stream_name, | ||
| const Nodes::Network::GraphicsOperator * | op | ||
| ) |
Pack one GraphicsOperator's current vertex state into a SpatialCache stream, as a Points or Curves sample depending on what the operator declares.
Reads op->get_vertex_data() as Kakshya::Vertex records: PointVertex, LineVertex, and MeshVertex all share its exact 60-byte layout, so this works unchanged for any GraphicsOperator, not only PhysicsOperator. Every field comes along, not only position: color, scalar (size/thickness/ weight depending on the concrete type), uv, normal, and tangent each become their own SpatialAttribute, so a vertex reaches the archive whole rather than reduced to a coordinate. Always attaches a "cluster" attribute from op->build_cluster_ids() (0 for every vertex on an operator that never overrides it), plus one SpatialAttribute per op->extract_vertex_attributes() entry (extra state beyond the vertex record itself, e.g. PhysicsOperator's mass).
op->declared_topology() decides the sample's shape:
| cache | Target cache, already open(). |
| stream_name | Stream to write. |
| op | Source operator. Must be non-null, report at least one vertex, and use the Kakshya::Vertex record layout (every GraphicsOperator does today). |
Definition at line 156 of file SpatialExport.cpp.
References MayaFlux::Nodes::Network::GraphicsOperator::build_cluster_ids(), count, MayaFlux::Nodes::Network::GraphicsOperator::declared_topology(), MayaFlux::Nodes::Network::GraphicsOperator::extract_vertex_attributes(), MayaFlux::Nodes::Network::GraphicsOperator::extract_vertex_velocities(), MayaFlux::Journal::FileIO, MayaFlux::Nodes::Network::GraphicsOperator::get_vertex_count(), MayaFlux::Nodes::Network::GraphicsOperator::get_vertex_data(), MayaFlux::Nodes::Network::GraphicsOperator::get_vertex_layout(), MayaFlux::Journal::IO, MayaFlux::Portal::Graphics::LINE_LIST, MayaFlux::Portal::Graphics::LINE_STRIP, MF_ERROR, name, MayaFlux::IO::SpatialAttribute::name, MayaFlux::Portal::Graphics::POINT_LIST, MayaFlux::Kakshya::VertexLayout::stride_bytes, MayaFlux::IO::SpatialSample::topology, values, Varying, and MayaFlux::IO::SpatialCache::write().
Referenced by write_network_geometry_buffer_sample().
Here is the call graph for this function:
Here is the caller graph for this function: