15 if (initial_capacity > 0) {
24 "Cannot resize vertex buffer: stride is 0. Call set_vertex_stride() first");
28 size_t new_size_bytes =
static_cast<size_t>(vertex_count) *
m_vertex_stride;
44 "GeometryWriterNode: Resized vertex buffer to {} vertices ({} bytes total)",
45 vertex_count, new_size_bytes);
50 if (!data || size_bytes == 0) {
52 "Cannot set vertex data: null data or zero size");
58 "Cannot set vertex data: stride is 0");
62 auto expected_vertex_count =
static_cast<uint32_t
>(size_bytes /
m_vertex_stride);
66 "Vertex data size {} is not multiple of stride {}",
80 "GeometryWriterNode: Set vertex data ({} vertices, {} bytes)",
86 if (!data || size_bytes == 0) {
88 "Cannot set vertex: null data or zero size");
94 "Cannot set vertex: stride is 0");
100 "Vertex index {} out of range (count: {})",
107 "Vertex data size {} exceeds stride {}; truncating",
116 "Vertex {} lies beyond the vertex buffer ({} bytes)",
124 "GeometryWriterNode: Set vertex {} ({} bytes)", vertex_index, size_bytes);
135 "GeometryWriterNode: Set index buffer ({} indices, {} bytes)",
158 "Vertex index {} out of range (count: {})",
197 return std::vector<double>(num_samples, 0.0);
212 "GeometryWriterNode: Saved state ({} vertices, {} bytes)",
220 "GeometryWriterNode: No saved state to restore");
233 "GeometryWriterNode: Restored state ({} vertices, {} bytes)",
#define MF_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::vector< uint32_t > indices
std::span< const uint8_t > m_gpu_data
GeometryWriterNode(uint32_t initial_capacity=1024)
Constructor.
void save_state() override
Save current geometry state.
std::span< const uint8_t > get_vertex(uint32_t vertex_index) const
Get a single vertex by index.
void restore_state() override
Restore saved geometry state.
std::vector< uint8_t > m_vertex_buffer
Vertex data buffer (flat array of bytes)
bool m_vertex_data_dirty
Flag: vertex data or layout changed since last GPU upload.
GeometryContext m_context
void clear()
Clear vertex buffer and reset count.
size_t get_vertex_buffer_size_bytes() const
Get vertex buffer size in bytes.
std::optional< GeometryState > m_saved_state
std::vector< double > process_batch(unsigned int num_samples) override
Process batch for geometry generation.
std::span< const uint32_t > get_index_data() const
Get raw index buffer data.
void clear_and_resize(uint32_t vertex_count)
Clear vertex buffer and resize to specified count.
size_t m_vertex_stride
Bytes per vertex (stride for vertex buffer binding)
void set_indices(std::span< const uint32_t > indices)
Set index buffer for indexed drawing.
std::optional< Kakshya::VertexLayout > m_vertex_layout
Cached vertex layout for descriptor binding.
NodeContext & get_last_context() override
Retrieves the last created context object.
std::vector< uint32_t > m_index_buffer
Optional index buffer for indexed drawing (not used by default)
void set_vertex_data(const void *data, size_t size_bytes)
Copy raw vertex data into buffer.
void resize_vertex_buffer(uint32_t vertex_count, bool preserve_data=false)
Resize vertex buffer to hold specified number of vertices.
void set_vertex_stride(size_t stride)
Set vertex stride (bytes per vertex)
bool m_needs_layout_update
Flag indicating if layout needs update.
void update_context(double value) override
Updates the context object with the current node state.
uint32_t m_vertex_count
Number of vertices in buffer.
void set_vertex(uint32_t vertex_index, const void *data, size_t size_bytes)
Set a single vertex by index.
virtual void compute_frame()=0
Compute GPU data for this frame.
double value
Current sample value.
Base context class for node callbacks.
uint8_t m_node_capability
Bitmask of capabilities declared by this node.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
@ STRUCTURED
Context also implements GpuStructuredData.
std::vector< uint8_t > vertex_buffer
std::optional< Kakshya::VertexLayout > vertex_layout
std::vector< uint32_t > index_buffer