MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
InfluenceContext.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <glm/vec2.hpp>
4#include <glm/vec3.hpp>
5
6namespace MayaFlux::Buffers {
7class RenderProcessor;
8}
9
10namespace MayaFlux::Nexus {
11
12/**
13 * @struct InfluenceUBO
14 * @brief GPU-side std140 layout matching InfluenceContext plain data fields.
15 *
16 * Packs into two vec4 slots plus one partial (48 bytes total).
17 * GLSL declaration:
18 * @code
19 * layout(set = 1, binding = 1) uniform Influence {
20 * vec3 position;
21 * float intensity;
22 * vec3 color;
23 * float radius;
24 * float size;
25 * };
26 * @endcode
27 */
28struct alignas(16) InfluenceUBO {
29 glm::vec3 position { 0.0F };
30 float intensity { 1.0F };
31 glm::vec3 color { 1.0F, 1.0F, 1.0F };
32 float radius { 1.0F };
33 float size { 1.0F };
34 float _pad[3] {};
35};
36
37static_assert(sizeof(InfluenceUBO) == 48, "InfluenceUBO must be 48 bytes for std140 alignment");
38
39/**
40 * @struct InfluenceContext
41 * @brief Data passed to an Emitter or Agent influence function on each commit.
42 *
43 * Only the fields relevant to the active execution path are populated.
44 * Fields marked @note future are reserved for later domain expansions and
45 * are always default-initialised in the current implementation.
46 */
48 glm::vec3 position {}; ///< Position of the influence point in world space.
49
50 float intensity { 1.0F }; ///< Intensity of the influence, typically in the range [0, 1], but may exceed 1 for strong influences.
51
52 float radius { 1.0F }; ///< Radius of influence around the position, defining the area of effect for spatially-dependent influences.
53
54 std::optional<glm::vec3> color; ///< Optional color hint for the influence, may be used for visualisation or shader effects.
55
56 std::optional<float> size; ///< Optional size hint for the influence, may be used for visualisation or shader effects.
57
58 std::optional<glm::vec2> cursor_pos; ///< Optional cursor position for pending interactions, useful for real-time editing or previewing influence effects.
59
60 // @note future: ShaderProcessor* shader_proc { nullptr };
61 // @note future: std::span<const double> audio_snapshot;
62
63 std::weak_ptr<Buffers::RenderProcessor> render_proc;
64};
65
66} // namespace MayaFlux::Nexus
std::weak_ptr< Buffers::RenderProcessor > render_proc
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...
Data passed to an Emitter or Agent influence function on each commit.
GPU-side std140 layout matching InfluenceContext plain data fields.