MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nexus::Emitter Class Reference

Object that acts on existing MayaFlux objects when committed. More...

#include <Emitter.hpp>

+ Collaboration diagram for MayaFlux::Nexus::Emitter:

Public Types

using InfluenceFn = std::function< void(const InfluenceContext &)>
 

Public Member Functions

void attach (const std::shared_ptr< Buffers::VKBuffer > &buf, const AttachConfig &config={})
 Make an existing, already rendered buffer the look of this object.
 
bool attached () const
 True while a buffer is attached.
 
const std::vector< AudioSink > & audio_sinks () const
 
void clear_color ()
 Clear the color, resetting it to an unset state.
 
void clear_influence ()
 Remove the target set with set_influence().
 
void clear_position ()
 Clear the position, removing this object from spatial queries.
 
void clear_size ()
 Clear the size, resetting it to an unset state.
 
const std::optional< glm::vec3 > & color () const
 Get the current color, if set.
 
void detach ()
 Release the attached buffer and reset its placement.
 
 Emitter ()=default
 Construct with no function, for an Emitter whose behaviour comes from a typed influence.
 
 Emitter (InfluenceFn fn)
 Construct with an influence function.
 
 Emitter (std::string fn_name, InfluenceFn fn)
 Construct with a named influence function.
 
const InfluenceFn & fn () const
 The influence function itself.
 
const std::string & fn_name () const
 Identifier assigned to the influence function, empty if anonymous.
 
std::shared_ptr< Buffers::RenderProcessor > get_render_processor (const std::shared_ptr< Core::Window > &window) const
 
uint32_t id () const
 Return the stable object id assigned by Fabric.
 
float intensity () const
 Get the current intensity.
 
void invoke (const InfluenceContext &ctx) const
 Invoke the influence function with the supplied context.
 
const std::optional< glm::vec3 > & position () const
 Return the current position, if set.
 
float radius () const
 Get the current radius.
 
void recenter ()
 Read the attached buffer's geometry again and move the anchor to match.
 
void remove_audio_sink (Buffers::BufferManager &mgr, uint32_t channel)
 Unregister the audio sink on channel.
 
void remove_render (Buffers::BufferManager &mgr, const std::shared_ptr< Core::Window > &window)
 Unregister the render sink targeting window.
 
void render (Buffers::BufferManager &mgr, const Portal::Graphics::RenderConfig &config)
 Register a render output targeting window.
 
void render (Buffers::BufferManager &mgr, const Portal::Graphics::RenderConfig &config, std::string fn_name, RenderFn fn)
 Register a render output targeting window with a producer function.
 
const std::vector< RenderSink > & render_sinks () const
 
void set_audio_data (std::span< const double > samples)
 Push samples to all registered audio sinks.
 
void set_color (const glm::vec3 &c)
 Set the color, a general-purpose parameter for influence functions.
 
void set_fn_name (std::string name)
 Set or replace the influence function's identifier.
 
template<typename T >
void set_influence (typename Influence< T >::Producer producer, typename Influence< T >::Target target)
 Set the one target of an influence of any type.
 
void set_intensity (float i)
 Set the intensity, a general-purpose parameter for influence functions.
 
void set_position (const glm::vec3 &p)
 Set the position, enabling spatial indexing for this object.
 
void set_radius (float r)
 Set the radius, a general-purpose parameter for influence functions.
 
void set_size (float s)
 Set the size, a general-purpose parameter for influence functions.
 
void set_vertices (const void *data, size_t byte_count)
 Set pre-packed interleaved vertex bytes to all registered render sinks.
 
template<typename T >
void set_vertices (std::span< const T > vertices)
 Set typed vertex data to all registered render sinks.
 
void sink_audio (Buffers::BufferManager &mgr, uint32_t channel)
 Register an audio output on channel.
 
void sink_audio (Buffers::BufferManager &mgr, uint32_t channel, std::function< Kakshya::DataVariant(const InfluenceContext &)> fn, std::string fn_name="")
 Register an audio output on channel with a producer function.
 
const std::optional< float > & size () const
 Get the current size, if set.
 

Private Member Functions

void follow_attachment ()
 

Private Attributes

std::optional< Attachment > m_attachment
 
std::vector< AudioSink > m_audio_sinks
 
std::optional< glm::vec3 > m_color
 
InfluenceFn m_fn
 
std::string m_fn_name
 
uint32_t m_id {}
 
InfluenceFn m_influence
 
float m_intensity { 1.0F }
 
std::optional< glm::vec3 > m_position
 
float m_radius { 1.0F }
 
std::vector< RenderSink > m_render_sinks
 
std::optional< float > m_size
 

Friends

class Fabric
 

Detailed Description

Object that acts on existing MayaFlux objects when committed.

Constructed with an optional influence function. Position is optional: call set_position before registering with Fabric if spatial indexing is required. Entities without a position are committed normally but are not inserted into the spatial index.

The id is assigned by Fabric::wire and is stable for the object's lifetime. It is zero until the object has been registered.

RenderConfig takes a designated initializer.

emitter->render(mgr, { .target_window = window });
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
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.
static InfluenceBlock from(const InfluenceContext &ctx)
The block for ctx, with white and size 1 where the context has none.
Definition Influence.hpp:60
Host mirror of the Influence push constant block the library's lit shaders declare.
Definition Influence.hpp:51

Definition at line 32 of file Emitter.hpp.


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