Class for generating revolution meshes. More...
#include <RevolutionMesh.hpp>
Public Member Functions | |
RevolutionMesh (mesh_info_t &mesh_info, const Camera &cam) | |
Constructor for the RevolutionMesh class. | |
~RevolutionMesh ()=default | |
Default destructor for the RevolutionMesh class. | |
void | generate_vertices () override |
Generates the vertices for the revolution mesh. | |
void | generate_faces () override |
Generates the faces for the revolution mesh. | |
![]() | |
Mesh ()=delete | |
Construct a new Mesh object (deleted constructor). | |
virtual | ~Mesh ()=default |
Default virtual destructor for the Mesh class. | |
Mesh (mesh_info_t &mesh_info) | |
Construct a new Mesh object with mesh information. | |
const std::vector< glm::fvec4 > & | get_vertices () const |
Get the vertices object. | |
const std::vector< face_t > & | get_faces () const |
Get the faces object. | |
const size_t | get_total_vertices () const |
Get the total vertices object. | |
size_t | get_total_vertices () |
Get the total vertices object. | |
void | recalculate () |
Recalculate the mesh vertices and faces. | |
void | apply_transform_to_vertices () |
Apply the current transformation to the vertices of the mesh. This method applies the transformation matrix obtained from the Transform class to each vertex in the mesh. This is useful for updating the mesh vertices after any transformation has been applied, such as translation, rotation, or scaling. It modifies the vertices in place, transforming them according to the current transformation matrix. | |
void | set_color (uint16_t new_color) |
Set the color of the mesh. | |
uint16_t | get_color () const |
Get the color of the mesh. | |
![]() | |
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. | |
Component & | operator= (const Component &)=delete |
Deleted assignment operator for the Component class. | |
Component & | operator= (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. | |
![]() | |
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. | |
Node & | operator= (const Node &)=delete |
Deleted assignment operator for Node. Prevents assignment of Node instances. | |
Node & | operator= (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. | |
![]() | |
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 | |
const Camera & | cam |
Reference to the camera used for rendering, providing view direction and other properties. | |
bool | faces_can_be_quads |
Flag indicating whether the faces can be rendered as quads or triangles. | |
![]() | |
mesh_info_t | mesh_info |
Information about the mesh, including coordinates and rendering type. | |
uint16_t | color = 0xFFFF |
Color of the mesh, default is white (0xFFFF). | |
std::vector< glm::fvec4 > | vertices |
Vector of vertices representing the mesh in 3D space. | |
std::vector< face_t > | faces |
Vector of faces representing the mesh, each face can be a triangle or a quad. | |
int | slices = 16 |
Number of slices for generating the mesh, default is 16. | |
![]() | |
std::vector< std::shared_ptr< Component > > | components |
Collection of components managed by this Component instance. | |
![]() | |
std::vector< std::shared_ptr< Node > > | children |
List of child nodes. | |
Node * | parent = nullptr |
Pointer to the parent node. | |
![]() | |
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. | |
Static Protected Attributes | |
static constexpr float | PI = 3.14159265358979323846f |
Constant value for Pi, used in calculations involving angles and rotations. | |
Class for generating revolution meshes.
This class generates a mesh by revolving a 2D profile around an axis. It inherits from the Mesh class and implements the methods to generate vertices and faces.
|
inline |
Constructor for the RevolutionMesh class.
Initializes the mesh with the provided mesh information and camera.
mesh_info | Information about the mesh, including coordinates and rendering type. |
cam | Reference to the camera used for rendering. |
|
default |
Default destructor for the RevolutionMesh class.
Cleans up resources used by the mesh.
|
overridevirtual |
Generates the faces for the revolution mesh.
This method creates the faces of the mesh by connecting the vertices generated by generate_vertices. It can create either triangles or quads based on the mesh information and the flag faces_can_be_quads.
Implements Ragot::Mesh.
|
overridevirtual |
Generates the vertices for the revolution mesh.
This method calculates the vertices by revolving the 2D profile around the specified axis. It uses the camera's view direction to determine the local space for the vertices.
Implements Ragot::Mesh.
|
protected |
Reference to the camera used for rendering, providing view direction and other properties.
|
protected |
Flag indicating whether the faces can be rendered as quads or triangles.
|
staticconstexprprotected |
Constant value for Pi, used in calculations involving angles and rotations.