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

◆ bind_transform()

template<typename Operator >
auto MayaFlux::Nexus::bind_transform ( const Operator &  op,
uint32_t  slot 
)

Target that feeds an influence of transform functions into one slot.

Parameters
opInstanceFieldOperator or MeshTransformOperator, raw pointer or shared_ptr.
slotSlot the function drives.

The influence's value is the operator's own TransformField: for an InstanceFieldOperator a function from the slot's current transform to its next one, for a MeshTransformOperator a function from accumulated seconds to the slot's local transform.

Definition at line 98 of file FieldTargets.hpp.

99{
100 using Transform = typename std::remove_cvref_t<decltype(*op)>::TransformField;
101
102 auto cell = std::make_shared<Transform>();
103 if constexpr (requires { op->bind_transform(slot, std::declval<Transform>()); }) {
104 op->bind_transform(slot, [cell](const glm::mat4& current) {
105 return *cell ? (*cell)(current) : current;
106 });
107 } else {
108 op->bind(slot, [cell](float seconds) {
109 return *cell ? (*cell)(seconds) : glm::mat4(1.0F);
110 });
111 }
112 return typename Influence<Transform>::Target { [cell](const Transform& field) { *cell = field; } };
113}
glm::vec2 current

References current.