3#include <glm/gtc/quaternion.hpp>
54 glm::vec3
color { 1.0F, 1.0F, 1.0F };
65 .color = ctx.
color.value_or(glm::vec3(1.0F)),
67 .size = ctx.
size.value_or(1.0F),
72static_assert(
sizeof(InfluenceBlock) == 48);
90template <
typename T,
typename Context = InfluenceContext>
93 using Producer = std::function<T(
const Context&)>;
94 using Target = std::function<void(
const T&)>;
std::vector< Target > m_targets
void invoke(const Context &ctx) const
Build the value from ctx and hand it to every target.
std::function< T(const Context &)> Producer
void clear_targets()
Remove every target.
Influence(Producer producer)
Influence & add_target(Target target)
Add a target.
std::function< void(const T &)> Target
size_t target_count() const
Number of targets currently added.
A value of any type, built from the influence context and handed to its targets.
static InfluenceBlock from(const InfluenceContext &ctx)
The block for ctx, with white and size 1 where the context has none.
Host mirror of the Influence push constant block the library's lit shaders declare.
glm::vec3 position
Position of the influence point in world space.
std::optional< glm::vec2 > cursor_pos
Optional cursor position for pending interactions, useful for real-time editing or previewing influen...
std::optional< glm::vec3 > color
Optional color hint for the influence, may be used for visualisation or shader effects.
std::optional< float > size
Optional size hint for the influence, may be used for visualisation or shader effects.
float intensity
Intensity of the influence, typically in the range [0, 1], but may exceed 1 for strong influences.
float radius
Radius of influence around the position, defining the area of effect for spatially-dependent influenc...
std::optional< glm::quat > orientation
Optional orientation of the influencer. Local +Z is its forward direction.
Data passed to an Emitter or Agent influence function on each commit.