MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
PointNode.cpp
Go to the documentation of this file.
1#include "PointNode.hpp"
3
5
7 : PointNode(PointVertex { .position = glm::vec3(0.0F), .color = glm::vec3(1.0F), .size = 10.0F })
8{
9}
10
11PointNode::PointNode(const glm::vec3& position, const glm::vec3& color, float size)
12 : PointNode(PointVertex { .position = position, .color = color, .size = size })
13{
14}
15
18 , m_point_vertex(point)
19{
21
23 layout.vertex_count = 1;
24 layout.stride_bytes = sizeof(PointVertex);
25
26 // Location 0: position
29 .offset_in_vertex = 0,
30 .name = "position" });
31
32 // Location 1: color
35 .offset_in_vertex = sizeof(glm::vec3),
36 .name = "color" });
37
38 // Location 2: size
41 .offset_in_vertex = sizeof(glm::vec3) + sizeof(glm::vec3),
42 .name = "size" });
43
44 set_vertex_layout(layout);
45
46 resize_vertex_buffer(1, false);
47
49 "Created PointNode at position ({}, {}, {}), color ({}, {}, {}), size {}",
52}
53
54void PointNode::set_position(const glm::vec3& position)
55{
56 m_point_vertex.position = position;
58}
59
60void PointNode::set_color(const glm::vec3& color)
61{
62 m_point_vertex.color = color;
64}
65
66void PointNode::set_size(float size)
67{
68 m_point_vertex.size = size;
70}
71
73{
74 set_vertices<PointVertex>(std::span { &m_point_vertex, 1 });
75
77 "PointNode: position ({}, {}, {}), color ({}, {}, {}), size {}",
80}
81
82} // namespace MayaFlux::Nodes
#define MF_TRACE(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
bool m_vertex_data_dirty
Flag: vertex data or layout changed since last GPU upload.
void set_vertex_layout(const Kakshya::VertexLayout &layout)
Set cached vertex layout.
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)
Base class for nodes that generate 3D geometry data.
PointNode()
Create point at origin.
Definition PointNode.cpp:6
void set_color(const glm::vec3 &color)
Set point color.
Definition PointNode.cpp:60
void set_size(float size)
Set point size.
Definition PointNode.cpp:66
void set_position(const glm::vec3 &position)
Set point position.
Definition PointNode.cpp:54
void compute_frame() override
Compute frame - upload single point to vertex buffer.
Definition PointNode.cpp:72
Single 3D point in space.
Definition PointNode.hpp:27
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
@ UNKNOWN
Unknown or undefined modality.
DataModality component_modality
Semantic type of this attribute e.g., VERTEX_POSITIONS_3D → vec3, TEXTURE_COORDS_2D → vec2.
Semantic description of a single vertex attribute.
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...
uint32_t vertex_count
Total number of vertices in this buffer.
std::vector< VertexAttributeLayout > attributes
All attributes that make up one vertex Ordered by shader location (0, 1, 2, ...)
Complete description of vertex data layout in a buffer.