3D Graphics Engine for ESP32
 
Loading...
Searching...
No Matches
Ragot::Node Class Reference

Represents a node in a scene graph for 3D rendering. More...

#include <Node.hpp>

Inheritance diagram for Ragot::Node:
Inheritance graph
Collaboration diagram for Ragot::Node:
Collaboration graph

Public Member Functions

 Node ()=default
 Default constructor for Node. Initializes an empty node with no parent and no children.
 
virtual ~Node ()=default
 Default destructor for Node. Cleans up the node and its children.
 
 Node (const Node &)=delete
 Deleted copy constructor for Node. Prevents copying of Node instances.
 
 Node (const Node &&)=delete
 Deleted move constructor for Node. Prevents moving of Node instances.
 
Nodeoperator= (const Node &)=delete
 Deleted assignment operator for Node. Prevents assignment of Node instances.
 
Nodeoperator= (const Node &&)=delete
 Deleted move assignment operator for Node. Prevents moving of Node instances.
 
void add_child (std::shared_ptr< Node > child)
 Get the parent node.
 
void remove_child (std::shared_ptr< Node > child)
 Remove a child node.
 
const std::vector< std::shared_ptr< Node > > & get_children () const
 Get the parent node.
 
mat4 get_transform_matrix () override
 Get the transform matrix object.
 
- Public Member Functions inherited from Ragot::Transform
 Transform ()
 Default constructor for the Transform class.
 
virtual ~Transform ()=default
 Virtual destructor for the Transform class.
 
void set_position (const vec3 &pos)
 Sets the position of the object.
 
vec3 get_position () const
 Gets the current position of the object.
 
void set_rotation (const vec3 &rot)
 Moves the object by a specified vector.
 
vec3 get_rotation () const
 Gets the current rotation of the object.
 
void rotate (const float angle, const vec3 &axis)
 Rotates the object by a specified angle around a given axis.
 
void set_scale (const vec3 &scale)
 Sets the scale of the object.
 
vec3 get_scale () const
 Sets the scale of the object uniformly.
 
bool is_dirty () const
 Checks if the transformation matrix is dirty (needs recalculation).
 

Protected Attributes

std::vector< std::shared_ptr< Node > > children
 List of child nodes.
 
Nodeparent = nullptr
 Pointer to the parent node.
 
- Protected Attributes inherited from Ragot::Transform
vec3 position
 The position of the object in 3D space.
 
vec3 rotation
 The rotation of the object in degrees around each axis (x, y, z).
 
vec3 scale
 The scale of the object in 3D space, default is (1, 1, 1).
 
bool dirty = true
 Flag indicating whether the transformation matrix needs to be recalculated.
 

Detailed Description

Represents a node in a scene graph for 3D rendering.

The Node class extends the Transform class to include child nodes, allowing for hierarchical transformations and management of child nodes.

Constructor & Destructor Documentation

◆ Node() [1/3]

Ragot::Node::Node ( )
default

Default constructor for Node. Initializes an empty node with no parent and no children.

Here is the caller graph for this function:

◆ ~Node()

virtual Ragot::Node::~Node ( )
virtualdefault

Default destructor for Node. Cleans up the node and its children.

◆ Node() [2/3]

Ragot::Node::Node ( const Node & )
delete

Deleted copy constructor for Node. Prevents copying of Node instances.

Here is the call graph for this function:

◆ Node() [3/3]

Ragot::Node::Node ( const Node && )
delete

Deleted move constructor for Node. Prevents moving of Node instances.

Here is the call graph for this function:

Member Function Documentation

◆ add_child()

void Ragot::Node::add_child ( std::shared_ptr< Node > child)
inline

Get the parent node.

Returns
Node* Pointer to the parent node, or nullptr if no parent exists.

◆ get_children()

const std::vector< std::shared_ptr< Node > > & Ragot::Node::get_children ( ) const
inline

Get the parent node.

Returns
Node* Pointer to the parent node, or nullptr if no parent exists.

◆ get_transform_matrix()

mat4 Ragot::Node::get_transform_matrix ( )
inlineoverridevirtual

Get the transform matrix object.

Returns
mat4 The transformation matrix of the node, including its parent's transformation.

Reimplemented from Ragot::Transform.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

Node & Ragot::Node::operator= ( const Node && )
delete

Deleted move assignment operator for Node. Prevents moving of Node instances.

Returns
Node& Reference to the current object.
Here is the call graph for this function:

◆ operator=() [2/2]

Node & Ragot::Node::operator= ( const Node & )
delete

Deleted assignment operator for Node. Prevents assignment of Node instances.

Here is the call graph for this function:

◆ remove_child()

void Ragot::Node::remove_child ( std::shared_ptr< Node > child)
inline

Remove a child node.

This method removes the specified child node from the list of children. If the child exists, it is removed and its parent pointer is set to nullptr.

Parameters
childThe child node to remove.

Member Data Documentation

◆ children

std::vector< std::shared_ptr < Node > > Ragot::Node::children
protected

List of child nodes.

◆ parent

Node* Ragot::Node::parent = nullptr
protected

Pointer to the parent node.


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