MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
PointNode.hpp
Go to the documentation of this file.
1#pragma once
2
4
6
7struct PointVertex {
8 glm::vec3 position;
9 glm::vec3 color = glm::vec3(1.0F);
10 float size = 10.0F;
11};
12
13/**
14 * @class PointNode
15 * @brief Single 3D point in space
16 *
17 * GeometryWriterNode that renders exactly ONE point.
18 * Can be used standalone or as building block in NodeNetworks.
19 *
20 * Usage:
21 * ```cpp
22 * auto point = std::make_shared<PointNode>(glm::vec3(0.0f, 0.0f, 0.0f));
23 * auto buffer = std::make_shared<GeometryBuffer>(point);
24 * buffer->initialize();
25 * ```
26 */
27class MAYAFLUX_API PointNode : public GeometryWriterNode {
28public:
29 /**
30 * @brief Create point at origin
31 */
32 PointNode();
33
34 /**
35 * @brief Create point from PointVertex
36 * @param point Initial point data
37 */
38 explicit PointNode(const PointVertex& point);
39
40 /**
41 * @brief Create point at specific position
42 * @param position Initial 3D position
43 * @param color Initial color
44 * @param size Initial point size
45 */
46 PointNode(const glm::vec3& position, const glm::vec3& color = glm::vec3(1.0F), float size = 10.0F);
47
48 /**
49 * @brief Set point position
50 * @param position New 3D position
51 */
52 void set_position(const glm::vec3& position);
53
54 /**
55 * @brief Set point size
56 * @param size New point size
57 */
58 void set_size(float size);
59
60 /**
61 * @brief Set point color
62 * @param color New point color
63 */
64 void set_color(const glm::vec3& color);
65
66 /**
67 * @brief Get current position
68 * @return 3D position
69 */
70 [[nodiscard]] glm::vec3 get_position() const { return m_point_vertex.position; }
71
72 /**
73 * @brief Get current color
74 * @return Point color
75 */
76 [[nodiscard]] glm::vec3 get_color() const { return m_point_vertex.color; }
77
78 /**
79 * @brief Get current size
80 * @return Point size
81 */
82 [[nodiscard]] float get_size() const { return m_point_vertex.size; }
83
84 /**
85 * @brief Compute frame - upload single point to vertex buffer
86 */
87 void compute_frame() override;
88
89private:
91};
92
93} // namespace MayaFlux::Nodes
Base class for nodes that generate 3D geometry data.
glm::vec3 get_color() const
Get current color.
Definition PointNode.hpp:76
float get_size() const
Get current size.
Definition PointNode.hpp:82
glm::vec3 get_position() const
Get current position.
Definition PointNode.hpp:70
Single 3D point in space.
Definition PointNode.hpp:27