|
MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
|
Motion-focused point network with swappable operators. More...
#include <ParticleNetwork.hpp>
Inheritance diagram for MayaFlux::Nodes::Network::ParticleNetwork:
Collaboration diagram for MayaFlux::Nodes::Network::ParticleNetwork:Public Member Functions | |
| ParticleNetwork (size_t num_particles, const glm::vec3 &bounds_min=glm::vec3(-10.0F), const glm::vec3 &bounds_max=glm::vec3(10.0F), Kinesis::SpatialDistribution init_mode=Kinesis::SpatialDistribution::RANDOM_VOLUME) | |
| Create particle network with spatial bounds. | |
| void | initialize () override |
| Called once before first process_batch() | |
| void | reset () override |
| Reset network to initial state. | |
| void | process_batch (unsigned int num_samples) override |
| Process the network for the given number of samples. | |
| void | reinitialize (size_t num_particles, const glm::vec3 &bounds_min, const glm::vec3 &bounds_max, Kinesis::SpatialDistribution init_mode) |
| Reinitialize particle network with new parameters. | |
| size_t | get_node_count () const override |
| Get number of particles in network. | |
| size_t | get_point_count () const |
| Get point count (alias for get_node_count) | |
| std::optional< double > | get_node_output (size_t index) const override |
| Get output value for specific particle. | |
| std::unordered_map< std::string, std::string > | get_metadata () const override |
| Get network metadata for debugging/visualization. | |
| void | set_operator (std::unique_ptr< NetworkOperator > op) |
| Set active operator (runtime switching) | |
| template<typename OpType , typename... Args> | |
| OpType * | create_operator (Args &&... args) |
| Create and set operator in one call. | |
| template<typename OpType > | |
| OpType * | as_operator () |
| Get current operator with type-safe cast. | |
| template<typename OpType > | |
| const OpType * | as_operator () const |
| NetworkOperator * | get_operator () override |
| const NetworkOperator * | get_operator () const override |
| bool | has_operator () const override |
| void | set_timestep (float dt) |
| float | get_timestep () const |
| void | set_bounds (const glm::vec3 &min, const glm::vec3 &max) |
| Kinesis::SamplerBounds | get_bounds () const |
| void | set_topology (Topology topology) override |
| Set the network's topology. | |
| void | map_parameter (const std::string ¶m_name, const std::shared_ptr< Node > &source, MappingMode mode=MappingMode::BROADCAST) override |
| Map external node output to network parameter. | |
| void | unmap_parameter (const std::string ¶m_name) override |
| Remove parameter mapping. | |
Public Member Functions inherited from MayaFlux::Nodes::Network::NodeNetwork | |
| virtual | ~NodeNetwork ()=default |
| virtual std::optional< std::vector< double > > | get_audio_buffer () const |
| Get cached audio buffer from last process_batch() | |
| virtual std::optional< std::span< const double > > | get_node_audio_buffer (size_t) const |
| Get output of specific internal node as audio buffer (for ONE_TO_ONE mapping) | |
| void | set_output_mode (OutputMode mode) |
| Set the network's output routing mode. | |
| OutputMode | get_output_mode () const |
| Get the current output routing mode. | |
| Topology | get_topology () const |
| Get the current topology. | |
| void | set_enabled (bool enabled) |
| Enable/disable the network. | |
| bool | is_enabled () const |
| Check if network is enabled. | |
| virtual void | map_parameter (const std::string ¶m_name, const std::shared_ptr< NodeNetwork > &source_network) |
| Map external node network to network parameters (ONE_TO_ONE) | |
| void | set_output_scale (double scale) |
| Set the scalar multiplier applied to the network's output buffer after processing. | |
| double | get_output_scale () const |
| Get the current output scale factor. | |
| void | add_channel_usage (uint32_t channel_id) |
| Register network usage on a specific channel. | |
| void | remove_channel_usage (uint32_t channel_id) |
| Unregister network from a specific channel. | |
| bool | is_registered_on_channel (uint32_t channel_id) const |
| Check if network is registered on a channel. | |
| std::vector< uint32_t > | get_registered_channels () const |
| Get all channels this network is registered on. | |
| uint32_t | get_channel_mask () const |
| Get channel mask (bitfield of registered channels) | |
| void | set_channel_mask (uint32_t mask) |
| Set channel mask directly. | |
| bool | is_processed_this_cycle () const |
| Check if network has been processed this cycle (lock-free) | |
| void | mark_processing (bool processing) |
| Mark network as processing or not (lock-free) | |
| void | mark_processed (bool processed) |
| Mark network as processed this cycle (lock-free) | |
| bool | is_processing () const |
| Check if network is currently processing (lock-free) | |
| void | request_reset_from_channel (uint32_t channel_id) |
| Request a reset from a specific channel. | |
| const RoutingState & | get_routing_state () const |
| Retrieves the current routing state of the network. | |
| RoutingState & | get_routing_state () |
| Retrieves the current routing state of the network (non-const) | |
| bool | needs_channel_routing () const |
| Checks if the network is currently in a routing transition phase. | |
| void | set_sample_rate (uint32_t sample_rate) |
| uint32_t | get_sample_rate () const |
| void | set_block_size (uint32_t block_size) |
| uint32_t | get_block_size () const |
Private Member Functions | |
| void | ensure_initialized () |
| std::vector< PointVertex > | generate_initial_vertices () |
| PointVertex | generate_single_vertex (Kinesis::SpatialDistribution mode, size_t index, size_t total) |
| void | update_mapped_parameters () |
| Update mapped parameters before physics step. | |
Private Attributes | |
| std::unique_ptr< NetworkOperator > | m_operator |
| Kinesis::Stochastic::Stochastic | m_random_gen |
| size_t | m_num_points |
| Kinesis::SamplerBounds | m_bounds |
| Kinesis::SpatialDistribution | m_init_mode |
| float | m_timestep { 0.016F } |
Additional Inherited Members | |
Protected Member Functions inherited from MayaFlux::Nodes::Network::NodeNetwork | |
| void | ensure_initialized () |
| Ensure initialize() is called exactly once. | |
| void | apply_output_scale () |
| Apply m_output_scale to m_last_audio_buffer. | |
Static Protected Member Functions inherited from MayaFlux::Nodes::Network::NodeNetwork | |
| static std::unordered_map< size_t, std::vector< size_t > > | build_grid_2d_neighbors (size_t width, size_t height) |
| Build neighbor map for GRID_2D topology. | |
| static std::unordered_map< size_t, std::vector< size_t > > | build_grid_3d_neighbors (size_t width, size_t height, size_t depth) |
| Build neighbor map for GRID_3D topology. | |
| static std::unordered_map< size_t, std::vector< size_t > > | build_ring_neighbors (size_t count) |
| Build neighbor map for RING topology. | |
| static std::unordered_map< size_t, std::vector< size_t > > | build_chain_neighbors (size_t count) |
| Build neighbor map for CHAIN topology. | |
Protected Attributes inherited from MayaFlux::Nodes::Network::NodeNetwork | |
| Topology | m_topology = Topology::INDEPENDENT |
| OutputMode | m_output_mode = OutputMode::NONE |
| bool | m_enabled = true |
| bool | m_initialized = false |
| uint32_t | m_sample_rate { 48000 } |
| uint32_t | m_block_size { 512 } |
| std::vector< ParameterMapping > | m_parameter_mappings |
| std::atomic< uint32_t > | m_channel_mask { 0 } |
| Bitfield of channels this network is registered on. | |
| std::atomic< uint32_t > | m_pending_reset_mask { 0 } |
| std::atomic< bool > | m_processing_state { false } |
| Per-channel processing state (lock-free atomic flags) | |
| std::atomic< bool > | m_processed_this_cycle { false } |
| std::vector< double > | m_last_audio_buffer |
| double | m_output_scale { 1.0 } |
| Post-processing scalar applied to m_last_audio_buffer each batch. | |
Motion-focused point network with swappable operators.
Philosophy: ParticleNetwork is for MOTION. Operators define how points move (physics, flocking, fields). When you need connectivity visualization (topology, paths), use PointCloudNetwork instead.
Supported operators (motion-based):
Unsupported operators (connectivity-based):
External nodes can control motion behavior:
BROADCAST (one node → all particles):
Definition at line 54 of file ParticleNetwork.hpp.