MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nodes::Network::MeshFieldOperator Class Reference

Chain operator that applies Tendency field deformation to the vertex data of individual MeshNetwork slots. More...

#include <MeshFieldOperator.hpp>

+ Inheritance diagram for MayaFlux::Nodes::Network::MeshFieldOperator:
+ Collaboration diagram for MayaFlux::Nodes::Network::MeshFieldOperator:

Public Member Functions

void bind (uint32_t slot_index, FieldTarget target, Kinesis::SpatialField field)
 Bind a SpatialField to a slot.
 
void bind (uint32_t slot_index, FieldTarget target, Kinesis::UVField field)
 Bind a UVField to a slot.
 
void bind (uint32_t slot_index, FieldTarget target, Kinesis::VectorField field)
 Bind a VectorField to a slot.
 
std::string_view get_type_name () const override
 Type name for introspection.
 
 MeshFieldOperator ()=default
 
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 set_mode (uint32_t slot_index, FieldMode mode)
 Set the field application mode for a slot's FieldOperator.
 
void unbind (uint32_t slot_index, FieldTarget target)
 Remove all fields bound to a target on a specific slot.
 
void unbind_all ()
 Remove all per-slot FieldOperators.
 
void unbind_slot (uint32_t slot_index)
 Remove the entire FieldOperator for a slot.
 
 ~MeshFieldOperator () override=default
 
- Public Member Functions inherited from MayaFlux::Nodes::Network::MeshOperator
void process (float dt) override
 Iterate slots in topological order and call process_slot() on each.
 
std::optional< double > query_state (std::string_view) const override
 Query operator internal state.
 
void set_parameter (std::string_view, double) override
 Set operator parameter.
 
void set_slots (std::vector< MeshSlot > &slots, const std::vector< uint32_t > &order)
 Supply the slot list and processing order for the coming cycle.
 
 ~MeshOperator () override=default
 
- Public Member Functions inherited from MayaFlux::Nodes::Network::NetworkOperator
virtual void apply_one_to_one (std::string_view param, const std::shared_ptr< NodeNetwork > &source)
 Apply ONE_TO_ONE parameter mapping (per-point control)
 
virtual ~NetworkOperator ()=default
 

Private Member Functions

std::shared_ptr< FieldOperatorget_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 vertex data.
 

Private Attributes

std::unordered_map< uint32_t, std::shared_ptr< FieldOperator > > m_field_ops
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Nodes::Network::MeshOperator
const std::vector< uint32_t > * m_order { nullptr }
 
std::vector< MeshSlot > * m_slots { nullptr }
 

Detailed Description

Chain operator that applies Tendency field deformation to the vertex data of individual MeshNetwork slots.

Holds one FieldOperator per bound slot, keyed by slot index. bind() creates or replaces the per-slot FieldOperator and initialises it from the slot's current MeshVertex array so the reference frame is always the geometry as it existed at bind time.

process_slot() runs the slot's FieldOperator::process(dt) then writes the resulting MeshVertex array back via slot.node->set_mesh_vertices(). That call sets m_vertex_data_dirty on the MeshWriterNode, which any_slot_dirty() in MeshNetworkProcessor already checks.

Slots without a bound FieldOperator are skipped entirely.

This operator belongs in the OperatorChain, not as the primary operator. MeshTransformOperator runs first (as primary) to propagate world transforms; MeshFieldOperator runs after to deform vertex positions in local space.

Usage:

auto field_op = std::make_shared<MeshFieldOperator>();
net->get_operator_chain()->emplace<MeshFieldOperator>();
// Retrieve the typed pointer from the chain or hold it before emplacing.
field_op->bind(torso_idx, FieldTarget::POSITION,
Kinesis::make_radial_pull(glm::vec3(0), 4.0F));
void bind(uint32_t slot_index, FieldTarget target, Kinesis::VectorField field)
Bind a VectorField to a slot.
Chain operator that applies Tendency field deformation to the vertex data of individual MeshNetwork s...

Definition at line 41 of file MeshFieldOperator.hpp.


The documentation for this class was generated from the following files: