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

Primary operator that drives slot local transforms via Tendency fields and propagates world transforms down the slot DAG. More...

#include <MeshTransformOperator.hpp>

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

Public Types

using TransformField = std::function< glm::mat4(float)>
 Field type: maps accumulated time (seconds) to a local glm::mat4.
 

Public Member Functions

void bind (uint32_t slot_index, TransformField field)
 Bind a TransformField to a slot.
 
std::string_view get_type_name () const override
 Type name for introspection.
 
 MeshTransformOperator ()=default
 
void process (float dt) override
 Iterate slots in topological order and call process_slot() on each.
 
void process_slot (MeshSlot &slot, float dt) override
 Evaluate the bound field (if any), update local_transform, then propagate the world_transform from the parent.
 
void unbind (uint32_t slot_index)
 Remove the TransformField bound to a slot.
 
void unbind_all ()
 Remove all bound fields.
 
 ~MeshTransformOperator () override=default
 
- Public Member Functions inherited from MayaFlux::Nodes::Network::MeshOperator
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

glm::mat4 parent_world (const MeshSlot &slot) const
 Resolve the world transform of a slot's parent, or identity if root.
 

Private Attributes

std::unordered_map< uint32_t, float > m_accumulated_time
 Per-slot accumulated time in seconds, keyed by slot index.
 
std::unordered_map< uint32_t, TransformFieldm_fields
 
std::chrono::steady_clock::time_point m_last_tick { std::chrono::steady_clock::now() }
 Wall-clock timestamp of the last process() call.
 

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

Primary operator that drives slot local transforms via Tendency fields and propagates world transforms down the slot DAG.

Each slot may have at most one bound TemporalField (glm::mat4 -> glm::mat4). On process_slot() the field is evaluated with dt as the scalar input, converting it to a glm::vec3 (unused) placeholder – in practice the mat4 overload is used: the field receives the slot's current local_transform and returns the new local_transform for the cycle.

Because transform propagation requires the parent's world_transform to already be resolved before a child is processed, process_slot() is called in topological order (guaranteed by MeshOperator::process()). Each call:

  1. Evaluates the bound field (if any) to update local_transform.
  2. Derives world_transform as parent_world * local_transform.
  3. Sets slot.dirty = true so MeshNetworkProcessor triggers a re-upload.

Slots without a bound field still receive world transform propagation – their local_transform is used as-is, matching the behaviour of the manual example in the fracture example (which drives local_transform and dirty directly without an operator).

The TemporalField signature: glm::mat4 -> glm::mat4. In Kinesis terms this is modelled as a std::function<glm::mat4(float)> where the float argument is the accumulated time in seconds. The operator tracks per-slot accumulated time independently.

Usage:

auto xf_op = net->create_operator<MeshTransformOperator>();
// rotate slot 0 around Y at 1 rad/s
xf_op->bind(0, [](float t) {
return glm::rotate(glm::mat4(1.0F), t, glm::vec3(0, 1, 0));
});
void bind(uint32_t slot_index, TransformField field)
Bind a TransformField to a slot.
Primary operator that drives slot local transforms via Tendency fields and propagates world transform...

Definition at line 45 of file MeshTransformOperator.hpp.


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