utility 2026.2.0
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
utility::graphic::Primitive Class Reference

The Primitive class represents a basic geometric shape that can be rendered in the graphics application. More...

#include <headers/utility/graphic/primitive.hpp>

Inheritance diagram for utility::graphic::Primitive:
Collaboration diagram for utility::graphic::Primitive:

Public Member Functions

 Primitive (const std::vector< Mesh > &meshes)
 Constructs a Primitive object with the specified meshes.
 
 Primitive (const Primitive &)=delete
 Deleted copy constructor for Primitive.
 
 ~Primitive ()=default
 Default destructor for Primitive.
 
void addMesh (const Mesh &mesh)
 Add a mesh to the primitive.
 
RenderableType getRenderableType (void) const override
 Get the type of this renderable object.
 
std::string getMaterialName (void) const override
 Get the material name.
 
Primitive & operator= (const Primitive &)=delete
 Deleted copy assignment operator for Primitive.
 
- Public Member Functions inherited from utility::graphic::Renderable
 Renderable (const PoseF &pose, const Color32Bit &color)
 Default constructor for Renderable.
 
virtual ~Renderable ()=default
 Virtual destructor for Renderable.
 
Renderable & setPose (const PoseF &pose)
 Set the text pose.
 
void setPose (PoseF &&pose)
 Set the text pose.
 
const PoseF & getPose (void) const
 Get the text pose.
 
glm::mat4 getModelMatrix (void) const
 Get the object-to-world model matrix of this renderable.
 
Renderable & setColor (const graphic::Color32Bit &color)
 Set the text color.
 
void setColor (graphic::Color32Bit &&color)
 Set the text color.
 
const graphic::Color32Bit & getColor (void) const
 Get the text color.].
 
std::vector< std::shared_ptr< Mesh > > getMeshes () const
 Get the meshes associated with this renderable object.
 

Additional Inherited Members

- Public Types inherited from utility::graphic::Renderable
enum class  RenderableType { Unknown = 0 , Model = 1 , Text = 3 , Mesh = 4 }
 
- Protected Attributes inherited from utility::graphic::Renderable
std::vector< std::shared_ptr< Mesh > > _meshes
 Meshes associated with this renderable object.
 
Color32Bit _color
 Text RGBA color.
 
PoseF _pose
 World pose (position and orientation) of the text.
 

Detailed Description

The Primitive class represents a basic geometric shape that can be rendered in the graphics application.

The Primitive class serves as a base class for simple geometric shapes such as cubes, spheres, and planes. It provides a common interface and properties for these shapes, allowing for consistent handling and rendering within the graphics application. The Primitive class can be extended to create specific types of primitives with additional properties and behaviors as needed.

Definition at line 26 of file primitive.hpp.

Constructor & Destructor Documentation

◆ Primitive()

utility::graphic::Primitive::Primitive ( const std::vector< Mesh > &  meshes)

Constructs a Primitive object with the specified meshes.

Parameters
meshesA vector of Mesh objects representing the geometry of the primitive.

This constructor initializes the Primitive object with the provided meshes, which define the geometry of the primitive for rendering. The meshes are stored internally and can be accessed or modified as needed for rendering or further processing.

Definition at line 12 of file primitive.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addMesh()

void utility::graphic::Primitive::addMesh ( const Mesh &  mesh)

Add a mesh to the primitive.

Parameters
meshThe Mesh object representing the geometry to be added to the primitive.

This method appends the provided mesh to the internal list of meshes of the primitive, allowing for dynamic construction of the primitive geometry. The added mesh will be included in the rendering of the primitive, and it can be used to create more complex shapes by combining multiple meshes together.

Definition at line 20 of file primitive.cpp.

Here is the caller graph for this function:

◆ getMaterialName()

std::string utility::graphic::Primitive::getMaterialName ( void  ) const
overridevirtual

Get the material name.

Returns
The name of the material used for rendering the primitive.

Implements utility::graphic::Renderable.

Definition at line 30 of file primitive.cpp.

◆ getRenderableType()

Renderable::RenderableType utility::graphic::Primitive::getRenderableType ( void  ) const
overridevirtual

Get the type of this renderable object.

This method returns the RenderableType enumeration value that indicates the specific type of this renderable object. The RenderableType can be used to identify whether the object is a model, text, mesh, or any other defined renderable type. This information can be useful for rendering systems to handle different types of renderable objects appropriately based on their characteristics and requirements.

Returns
The RenderableType of this renderable object.

Implements utility::graphic::Renderable.

Definition at line 25 of file primitive.cpp.


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