MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nodes::Network::FieldOperator Class Reference

Pure field-driven vertex manipulation via Tendency evaluation. More...

#include <FieldOperator.hpp>

+ Inheritance diagram for MayaFlux::Nodes::Network::FieldOperator:
+ Collaboration diagram for MayaFlux::Nodes::Network::FieldOperator:

Public Member Functions

void apply_one_to_one (std::string_view param, const std::shared_ptr< NodeNetwork > &source) override
 Apply ONE_TO_ONE parameter mapping (per-point control)
 
void bind (FieldTarget target, Kinesis::SpatialField field)
 Bind a SpatialField to a scalar target.
 
void bind (FieldTarget target, Kinesis::UVField field)
 Bind a UVField to the UV target.
 
void bind (FieldTarget target, Kinesis::VectorField field)
 Bind a VectorField to a vec3 target.
 
std::vector< LineVertexextract_line_vertices () const
 
std::vector< MeshVertexextract_mesh_vertices () const
 
std::vector< PointVertexextract_point_vertices () const
 
 FieldOperator (FieldMode mode=FieldMode::ABSOLUTE)
 
FieldMode get_mode () const
 Get current field mode.
 
size_t get_point_count () const override
 Get source point count (before topology expansion)
 
std::string_view get_type_name () const override
 Type name for introspection.
 
size_t get_vertex_count () const override
 Get number of vertices (may differ from point count for topology/path)
 
std::span< const uint8_t > get_vertex_data () const override
 Get vertex data for GPU upload.
 
std::span< const uint8_t > get_vertex_data_for_collection (uint32_t idx) const override
 Get vertex data for specific collection (if multiple)
 
Kakshya::VertexLayout get_vertex_layout () const override
 Get vertex layout describing vertex structure.
 
const char * get_vertex_type_name () const override
 Get human-readable vertex type name (for validation/debugging)
 
void initialize (const std::vector< LineVertex > &vertices)
 Initialize from LineVertex data.
 
void initialize (const std::vector< MeshVertex > &vertices)
 Initialize from MeshVertex data.
 
void initialize (const std::vector< PointVertex > &vertices)
 Initialize from PointVertex data.
 
bool is_vertex_data_dirty () const override
 Check if geometry changed this frame.
 
void mark_vertex_data_clean () override
 Clear dirty flag after GPU upload.
 
void process (float dt) override
 Process for one batch cycle.
 
std::optional< double > query_state (std::string_view query) const override
 Query operator internal state.
 
void set_mode (FieldMode mode)
 Set field application mode.
 
void set_parameter (std::string_view param, double value) override
 Set operator parameter.
 
void unbind (FieldTarget target)
 Remove all fields bound to a target.
 
void unbind_all ()
 Remove all bound fields.
 
- Public Member Functions inherited from MayaFlux::Nodes::Network::GraphicsOperator
void apply_one_to_one (std::string_view param, const std::shared_ptr< NodeNetwork > &source) override
 Apply ONE_TO_ONE parameter mapping.
 
- Public Member Functions inherited from MayaFlux::Nodes::Network::NetworkOperator
virtual ~NetworkOperator ()=default
 

Protected Member Functions

void * get_data_at (size_t global_index) override
 Get mutable access to point at global index.
 

Private Types

enum class  VertexType : uint8_t { NONE , POINT , LINE , MESH }
 Tracks which vertex type was used at initialization. More...
 

Private Member Functions

float & float_at (size_t i, size_t offset)
 
glm::vec3 ref_position_at (size_t i) const
 
void store_reference (const void *data, size_t count)
 
glm::vec3 & vec3_at (size_t i, size_t offset)
 

Private Attributes

std::vector< Kinesis::VectorFieldm_color_fields
 
size_t m_count { 0 }
 
bool m_dirty { false }
 
FieldMode m_mode
 
std::vector< Kinesis::VectorFieldm_normal_fields
 
std::vector< Kinesis::VectorFieldm_position_fields
 
std::vector< uint8_t > m_reference_data
 
std::vector< Kinesis::SpatialFieldm_scalar_fields
 
std::vector< Kinesis::VectorFieldm_tangent_fields
 
std::vector< Kinesis::UVFieldm_uv_fields
 
std::vector< uint8_t > m_vertex_data
 
VertexType m_vertex_type { VertexType::NONE }
 

Static Private Attributes

static constexpr size_t k_color_offset = 12
 
static constexpr size_t k_normal_offset = 36
 
static constexpr size_t k_position_offset = 0
 
static constexpr size_t k_scalar_offset = 24
 
static constexpr size_t k_stride = 60
 
static constexpr size_t k_tangent_offset = 48
 
static constexpr size_t k_uv_offset = 28
 

Detailed Description

Pure field-driven vertex manipulation via Tendency evaluation.

No velocity, no mass, no integration. Each frame, evaluates bound Tendency fields at each vertex position and writes results into the targeted vertex attributes.

ABSOLUTE mode: restores full reference vertex state before evaluation. Deterministic, stateless, frame-rate independent.

ACCUMULATE mode: applies on top of current state. Produces drift and evolution, frame-rate dependent.

Works with both PointVertex and LineVertex (identical 60-byte layout).

Implemented targets: POSITION VectorField displacement added to position COLOR VectorField direct RGB assignment at position NORMAL VectorField direction assignment at position (auto-normalized) TANGENT VectorField direction assignment at position (auto-normalized) SCALAR SpatialField direct assignment (size/thickness) UV UVField direct assignment (UV coordinates)

Usage with ParticleNetwork:

auto field_op = particles->create_operator<FieldOperator>();
field_op->bind(FieldTarget::SCALAR, Kinesis::SpatialField { ... });
void bind(FieldTarget target, Kinesis::VectorField field)
Bind a VectorField to a vec3 target.
Pure field-driven vertex manipulation via Tendency evaluation.
Typed, composable, stateless callable from domain D to range R.
Definition Tendency.hpp:22

Usage with PointCloudNetwork:

auto field_op = cloud->create_operator<FieldOperator>();

Definition at line 69 of file FieldOperator.hpp.


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