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

◆ seed_from_upstream()

void MayaFlux::Nodes::Network::PhysicsOperator::seed_from_upstream ( const GraphicsOperator upstream)
overridevirtual

Seed physics state from upstream operator's vertex data.

Extracts positions, colors, sizes from upstream and initializes physics state (velocity = 0, mass = 1) for each particle. Supports PointVertex input; other vertex types are ignored with a warning.

Parameters
upstreamUpstream operator to seed from

Reimplemented from MayaFlux::Nodes::Network::GraphicsOperator.

Definition at line 96 of file PhysicsOperator.cpp.

97{
98 if (get_vertex_count() > 0 || !upstream)
99 return;
100
101 const auto data = upstream->get_vertex_data();
102 if (data.empty())
103 return;
104
105 const size_t count = data.size() / sizeof(PointVertex);
106 if (count == 0)
107 return;
108
109 std::vector<PointVertex> vertices(count);
110 std::memcpy(vertices.data(), data.data(), data.size());
111 initialize(vertices);
112
114 "PhysicsOperator seeded {} vertices from upstream '{}'",
115 count, upstream->get_type_name());
116}
#define MF_DEBUG(comp, ctx,...)
size_t count
size_t get_vertex_count() const override
Get number of vertices (may differ from point count for topology/path)
void initialize()
Definition main.cpp:11
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
Kakshya::PointVertex PointVertex
Definition VertexSpec.hpp:7

References count, MayaFlux::Nodes::Network::NetworkOperator::get_type_name(), get_vertex_count(), MayaFlux::Nodes::Network::GraphicsOperator::get_vertex_data(), initialize(), MF_DEBUG, MayaFlux::Journal::NodeProcessing, and MayaFlux::Journal::Nodes.

+ Here is the call graph for this function: