34 "FieldOperator initialized with {} PointVertex", vertices.size());
43 "FieldOperator initialized with {} LineVertex", vertices.size());
52 "FieldOperator initialized with {} MeshVertex", vertices.size());
75 for (
size_t i = 0; i <
m_count; ++i) {
79 glm::vec3 displacement(0.0F);
81 displacement += field(pos);
87 glm::vec3
color(0.0F);
95 glm::vec3 normal(0.0F);
99 float len = glm::length(normal);
104 glm::vec3 tangent(0.0F);
106 tangent += field(pos);
108 float len = glm::length(tangent);
125 *
reinterpret_cast<glm::vec2*
>(
154 "Cannot bind VectorField to scalar target {:d}",
155 static_cast<int>(target));
168 "UV target requires a UVField, not a SpatialField. "
169 "Use bind(FieldTarget::UV, Kinesis::UVField) instead.");
173 "Cannot bind SpatialField to vector target {:d}",
174 static_cast<int>(target));
183 "UVField can only be bound to FieldTarget::UV");
300 return "PointVertex";
312 std::vector<PointVertex> result(
m_count);
319 std::vector<LineVertex> result(
m_count);
326 std::vector<MeshVertex> result(
m_count);
335 if (param ==
"mode") {
342 if (query ==
"point_count") {
343 return static_cast<double>(
m_count);
345 if (query ==
"field_count") {
346 return static_cast<double>(
355 std::string_view param,
356 const std::shared_ptr<NodeNetwork>& source)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::optional< glm::vec3 > color
static constexpr size_t k_position_offset
size_t get_point_count() const override
Get source point count (before topology expansion)
std::vector< uint8_t > m_reference_data
void store_reference(const void *data, size_t count)
std::vector< Kinesis::VectorField > m_position_fields
std::vector< uint8_t > m_vertex_data
static constexpr size_t k_tangent_offset
size_t get_vertex_count() const override
Get number of vertices (may differ from point count for topology/path)
void set_parameter(std::string_view param, double value) override
Set operator parameter.
static constexpr size_t k_normal_offset
bool is_vertex_data_dirty() const override
Check if geometry changed this frame.
void unbind_all()
Remove all bound fields.
std::vector< LineVertex > extract_line_vertices() const
std::vector< Kinesis::VectorField > m_tangent_fields
std::vector< Kinesis::SpatialField > m_scalar_fields
glm::vec3 & vec3_at(size_t i, size_t offset)
std::vector< Kinesis::VectorField > m_color_fields
Kakshya::VertexLayout get_vertex_layout() const override
Get vertex layout describing vertex structure.
std::span< const uint8_t > get_vertex_data_for_collection(uint32_t idx) const override
Get vertex data for specific collection (if multiple)
std::span< const uint8_t > get_vertex_data() const override
Get vertex data for GPU upload.
static constexpr size_t k_scalar_offset
void * get_data_at(size_t global_index) override
Get mutable access to point at global index.
std::vector< PointVertex > extract_point_vertices() const
void mark_vertex_data_clean() override
Clear dirty flag after GPU upload.
void unbind(FieldTarget target)
Remove all fields bound to a target.
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)
std::vector< Kinesis::VectorField > m_normal_fields
std::optional< double > query_state(std::string_view query) const override
Query operator internal state.
void bind(FieldTarget target, Kinesis::VectorField field)
Bind a VectorField to a vec3 target.
float & float_at(size_t i, size_t offset)
static constexpr size_t k_stride
std::vector< Kinesis::UVField > m_uv_fields
static constexpr size_t k_color_offset
static constexpr size_t k_uv_offset
const char * get_vertex_type_name() const override
Get human-readable vertex type name (for validation/debugging)
std::vector< MeshVertex > extract_mesh_vertices() const
void process(float dt) override
Process for one batch cycle.
void initialize(const std::vector< PointVertex > &vertices)
Initialize from PointVertex data.
FieldOperator(FieldMode mode=FieldMode::ABSOLUTE)
glm::vec3 ref_position_at(size_t i) const
void apply_one_to_one(std::string_view param, const std::shared_ptr< NodeNetwork > &source) override
Apply ONE_TO_ONE parameter mapping.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
FieldMode
How fields are applied each frame.
FieldTarget
Vertex attribute targets for Tendency field evaluation.
uint32_t vertex_count
Total number of vertices in this buffer.
static VertexLayout for_lines(uint32_t stride=60)
Factory: layout for LineVertex (position, color, thickness, uv, normal, tangent)
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)
static VertexLayout for_points(uint32_t stride=60)
Factory: layout for PointVertex (position, color, size, uv, normal, tangent)
Complete description of vertex data layout in a buffer.
Typed, composable, stateless callable from domain D to range R.