13 template <
typename D,
typename R>
16 return { .
fn = [cell](
const D& d) -> R {
return cell->fn ? cell->fn(d) : R(0.0F); } };
33template <
typename Field,
typename Operator>
38 auto cell = std::make_shared<Field>();
40 return [cell](
const Field& field) { *cell = field; };
47template <
typename Field,
typename Operator>
53 auto cell = std::make_shared<Field>();
55 return [cell](
const Field& field) { *cell = field; };
66template <
typename Operator>
69 auto cell = std::make_shared<Kinesis::VectorField>();
79template <
typename Operator>
82 auto cell = std::make_shared<Kinesis::VectorField>();
97template <
typename Operator>
100 using Transform =
typename std::remove_cvref_t<
decltype(*op)>::TransformField;
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) {
108 op->bind(slot, [cell](
float seconds) {
109 return *cell ? (*cell)(seconds) : glm::mat4(1.0F);
119template <
typename Region>
122 return [expanse](
const Kinesis::AABB3D& bounds) { expanse->set_bounds(bounds); };
132template <
typename Operator>
135 return [op](
const glm::vec4& params) { op->set_params(params); };
153template <
typename T,
typename Receiver>
156 if constexpr (
requires { target->get_push_constant_data(); }) {
157 if (target->get_push_constant_data().size() <
offset +
sizeof(T)) {
158 target->set_push_constant_size(
offset +
sizeof(T));
162 return [target,
offset](
const T& data) {
163 if constexpr (
requires { target->push_constants(data); }) {
164 target->push_constants(data);
166 if (target->get_push_constant_data().size() <
offset +
sizeof(T)) {
167 target->set_push_constant_size(
offset +
sizeof(T));
169 std::memcpy(target->get_push_constant_data().data() +
offset, &data,
sizeof(T));
181template <
typename Receiver>
184 return bind_push_constants<InfluenceBlock>(target,
offset);
std::function< void(const T &)> Target
FieldTarget
What a Tendency drives when applied to a vertex record.
Kinesis::Tendency< D, R > forwarding(const std::shared_ptr< Kinesis::Tendency< D, R > > &cell)
Influence< Field >::Target bind_field(const Operator &op, Kinesis::FieldTarget target)
Target that feeds an influence of fields into an operator's vertex attributes.
Influence< InfluenceBlock >::Target bind_influence_block(const Receiver &target, size_t offset=0)
Target that pushes an InfluenceBlock to a render processor for the library's lit shaders.
auto bind_transform(const Operator &op, uint32_t slot)
Target that feeds an influence of transform functions into one slot.
Influence< T >::Target bind_push_constants(const Receiver &target, size_t offset=0)
Target that pushes an influence's value to a GPU executor as push constants.
Influence< Kinesis::VectorField >::Target bind_force(const Operator &op)
Target that feeds an influence of vector fields into a PhysicsOperator as a force.
Influence< Kinesis::VectorField >::Target bind_position(const Operator &op, uint32_t slot)
Target that feeds an influence of vector fields into one instance's position.
Influence< glm::vec4 >::Target bind_params(const Operator &op)
Target that sets the parameter block of a GpuFieldOperator's parametric fields.
Influence< Kinesis::AABB3D >::Target bind_bounds(const Region &expanse)
Target that moves or resizes an Expanse's bounds from an influence of boxes.
Axis-aligned bounding box in 3D world space.
std::function< R(const D &)> fn
Typed, composable, stateless callable from domain D to range R.