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

◆ seed_from_upstream()

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

Seed vertex data from the upstream operator's current output.

Called by OperatorChain when consumes_upstream() is true. No-op if already initialised (m_count > 0) or if upstream is null. Derives vertex type from the upstream layout stride matching k_stride.

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

Definition at line 55 of file FieldOperator.cpp.

56{
57 if (m_count > 0 || !upstream)
58 return;
59
60 const auto data = upstream->get_vertex_data();
61 const auto layout = upstream->get_vertex_layout();
62 std::string type_name = upstream->get_vertex_type_name();
63
64 if (type_name == "PointVertex") {
66 } else if (type_name == "LineVertex") {
68 } else if (type_name == "MeshVertex") {
70 } else {
72 "FieldOperator::seed_from_upstream: unrecognized vertex type '{}', defaulting to LineVertex",
73 type_name);
75 }
76
77 if (data.empty() || layout.stride_bytes == 0)
78 return;
79
80 if (layout.stride_bytes != k_stride) {
82 "FieldOperator::seed_from_upstream: upstream stride {} != k_stride {}, skipping",
83 layout.stride_bytes, k_stride);
84 return;
85 }
86
87 const size_t count = data.size() / k_stride;
88 if (count == 0)
89 return;
90
91 store_reference(data.data(), count);
92
94 "FieldOperator seeded {} vertices from upstream '{}'",
95 count, upstream->get_type_name());
96}
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
size_t count
void store_reference(const void *data, size_t count)
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
constexpr std::string_view type_name() noexcept
Returns the fully qualified compile-time type name of T.
Definition TypeInfo.hpp:28

References count, MayaFlux::Nodes::Network::NetworkOperator::get_type_name(), MayaFlux::Nodes::Network::GraphicsOperator::get_vertex_data(), MayaFlux::Nodes::Network::GraphicsOperator::get_vertex_layout(), MayaFlux::Nodes::Network::GraphicsOperator::get_vertex_type_name(), k_stride, LINE, m_count, m_vertex_type, MESH, MF_DEBUG, MF_WARN, MayaFlux::Journal::NodeProcessing, MayaFlux::Journal::Nodes, POINT, and store_reference().

+ Here is the call graph for this function: