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

Base class for components in the Ragot engine. More...

#include <Components.hpp>

Inheritance diagram for Ragot::Component:
Inheritance graph
Collaboration diagram for Ragot::Component:
Collaboration graph

Public Member Functions

 Component ()=default
 Default constructor for the Component class.
 
virtual ~Component ()=default
 Default virtual destructor for the Component class.
 
 Component (const Component &)=delete
 Deleted copy constructor for the Component class.
 
 Component (const Component &&)=delete
 Deleted move constructor for the Component class.
 
Componentoperator= (const Component &)=delete
 Deleted assignment operator for the Component class.
 
Componentoperator= (const Component &&)=delete
 Deleted move assignment operator for the Component class.
 
void add_component (std::shared_ptr< Component > component)
 Adds a component to the collection.
 
void remove_component (std::shared_ptr< Component > component)
 Removes a component from the collection.
 
const std::vector< std::shared_ptr< Component > > get_components () const
 Gets the collection of components.
 
- Public Member Functions inherited from Ragot::Node
 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< Component > > components
 Collection of components managed by this Component instance.
 
- Protected Attributes inherited from Ragot::Node
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

Base class for components in the Ragot engine.

The Component class serves as a base class for all components in the Ragot engine. It allows for the management of a collection of components, providing methods to add and remove components, and access the list of components.

Constructor & Destructor Documentation

◆ Component() [1/3]

Ragot::Component::Component ( )
default

Default constructor for the Component class.

Initializes an empty component with no parent.

Here is the caller graph for this function:

◆ ~Component()

virtual Ragot::Component::~Component ( )
virtualdefault

Default virtual destructor for the Component class.

Cleans up the component and its resources.

◆ Component() [2/3]

Ragot::Component::Component ( const Component & )
delete

Deleted copy constructor for the Component class.

Here is the call graph for this function:

◆ Component() [3/3]

Ragot::Component::Component ( const Component && )
delete

Deleted move constructor for the Component class.

Prevents moving a Component instance.

Here is the call graph for this function:

Member Function Documentation

◆ add_component()

void Ragot::Component::add_component ( std::shared_ptr< Component > component)
inline

Adds a component to the collection.

This method adds a shared pointer to a component to the collection and sets its parent to this Component instance.

Parameters
componentShared pointer to the component to be added.

◆ get_components()

const std::vector< std::shared_ptr< Component > > Ragot::Component::get_components ( ) const
inline

Gets the collection of components.

This method returns a constant reference to the vector of components managed by this Component instance.

Returns
const std::vector<std::shared_ptr<Component>>& Reference to the vector of components.

◆ operator=() [1/2]

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

Deleted move assignment operator for the Component class.

Prevents moving a Component instance.

Here is the call graph for this function:

◆ operator=() [2/2]

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

Deleted assignment operator for the Component class.

Prevents assignment of a Component instance.

Here is the call graph for this function:

◆ remove_component()

void Ragot::Component::remove_component ( std::shared_ptr< Component > component)
inline

Removes a component from the collection.

This method removes a shared pointer to a component from the collection and sets its parent to nullptr.

Parameters
componentShared pointer to the component to be removed.

Member Data Documentation

◆ components

std::vector< std::shared_ptr < Component > > Ragot::Component::components
protected

Collection of components managed by this Component instance.

This vector holds shared pointers to the components that are part of this Component instance.


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