12std::shared_ptr<FieldOperator>
22 op->initialize(slot.
node->get_mesh_vertices());
24 "MeshFieldOperator: initialised FieldOperator for slot {} ({} vertices)",
25 slot_index, slot.
node->get_mesh_vertex_count());
28 "MeshFieldOperator: slot {} has no node at bind time -- "
29 "FieldOperator initialised with empty vertex data",
46 "MeshFieldOperator::bind called before set_slots() -- "
47 "FieldOperator will be initialised lazily on first process()");
51 if (slot_index >=
m_slots->size()) {
53 "MeshFieldOperator::bind: slot_index {} out of range ({})",
58 op->bind(target, std::move(field));
63 op->bind(target, std::move(field));
76 op->bind(target, std::move(field));
89 op->bind(target, std::move(field));
97 it->second->unbind(target);
114 it->second->set_mode(mode);
127 auto& field_op = it->second;
129 if (field_op->get_vertex_count() == 0 && slot.
node
130 && slot.
node->get_mesh_vertex_count() > 0) {
131 field_op->initialize(slot.
node->get_mesh_vertices());
133 "MeshFieldOperator: lazy-initialised slot {} ({} vertices)",
134 slot.
index, slot.
node->get_mesh_vertex_count());
137 field_op->process(dt);
139 if (field_op->is_vertex_data_dirty() && slot.
node) {
140 slot.
node->set_mesh_vertices(field_op->extract_mesh_vertices());
141 field_op->mark_vertex_data_clean();
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::unordered_map< uint32_t, std::shared_ptr< FieldOperator > > m_field_ops
void bind(uint32_t slot_index, FieldTarget target, Kinesis::VectorField field)
Bind a VectorField to a slot.
void set_mode(uint32_t slot_index, FieldMode mode)
Set the field application mode for a slot's FieldOperator.
std::shared_ptr< FieldOperator > get_or_create(MeshSlot &slot, uint32_t slot_index)
Return an existing FieldOperator for the slot, or create and initialise one from the slot's current v...
void unbind_slot(uint32_t slot_index)
Remove the entire FieldOperator for a slot.
void unbind(uint32_t slot_index, FieldTarget target)
Remove all fields bound to a target on a specific slot.
void process_slot(MeshSlot &slot, float dt) override
Run the slot's FieldOperator (if bound) and write results back to slot.node via set_mesh_vertices().
void unbind_all()
Remove all per-slot FieldOperators.
std::vector< MeshSlot > * m_slots
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
Tendency< glm::vec3, glm::vec2 > UVField
FieldMode
How fields are applied each frame.
FieldTarget
Vertex attribute targets for Tendency field evaluation.
Typed, composable, stateless callable from domain D to range R.
std::shared_ptr< GpuSync::MeshWriterNode > node
Geometry node for this slot.
uint32_t index
Position of this slot in MeshNetwork::m_slots. Stable after insertion.
Named, independently transformable mesh unit within a MeshNetwork.