MayaFlux 1.0.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 98 of file PhysicsOperator.cpp.

99{
100 if (get_vertex_count() > 0 || !upstream)
101 return;
102
103 const auto data = upstream->get_vertex_data();
104 if (data.empty())
105 return;
106
107 const size_t count = data.size() / sizeof(PointVertex);
108 if (count == 0)
109 return;
110
111 std::vector<PointVertex> vertices(count);
112 std::memcpy(vertices.data(), data.data(), data.size());
113 initialize(vertices);
114
116 "PhysicsOperator seeded {} vertices from upstream '{}'",
117 count, upstream->get_type_name());
118}
#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:10
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
Kakshya::PointVertex PointVertex
Definition VertexSpec.hpp:8

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: