utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
utility::graphic::Vertex< VectorComponent > Class Template Reference

Vertex type containing common mesh attributes. More...

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

Public Member Functions

 Vertex (void)
 Default constructor.
 
 Vertex (const Position< VectorComponent > &position, const math::Vector< VectorComponent, 3 > &normal, const math::Vector< VectorComponent, 2 > &textureCoordinates, const Color32Bit &color)
 Construct from all vertex attributes.
 
void setPosition (const Position< VectorComponent > &position)
 Set vertex position.
 
Position< VectorComponent > getPosition (void) const
 Get vertex position.
 
void setNormal (const math::Vector< VectorComponent, 3 > &normal)
 Set vertex normal.
 
math::Vector< VectorComponent, 3 > getNormal (void) const
 Get vertex normal.
 
void setTextureCoordinates (const math::Vector< VectorComponent, 2 > &textureCoordinates)
 Set vertex texture coordinates.
 
math::Vector< VectorComponent, 2 > getTextureCoordinates (void) const
 Get vertex texture coordinates.
 
void setColor (const Color32Bit &color)
 Set vertex color.
 
Color32Bit getColor (void) const
 Get vertex color.
 
VertexsetAttributes (const Position< VectorComponent > &position, const math::Vector< VectorComponent, 3 > &normal, const math::Vector< VectorComponent, 2 > &textureCoordinates, const Color32Bit &color)
 Set all vertex attributes at once.
 
bool hasUnitNormal (VectorComponent epsilon=VectorComponent { 1e-5 }) const
 Check if the normal is approximately unit length.
 
bool operator== (const Vertex &other) const
 Equality comparison.
 
bool operator!= (const Vertex &other) const
 Inequality comparison.
 

Detailed Description

template<CanBeVectorComponent VectorComponent>
class utility::graphic::Vertex< VectorComponent >

Vertex type containing common mesh attributes.

Template Parameters
VectorComponentArithmetic type for vertex components (e.g., float, double).
ColorComponentArithmetic type for color components (e.g., float, uint8_t).

Definition at line 37 of file vertex.hpp.

Constructor & Destructor Documentation

◆ Vertex() [1/2]

template<CanBeVectorComponent VectorComponent>
utility::graphic::Vertex< VectorComponent >::Vertex ( void  )
inline

Default constructor.

Initializes:

  • Position to (0, 0, 0)
  • Normal to (0, 0, 0)
  • Texture coordinates to (0, 0)
  • Color to white (1, 1, 1, 1)

Definition at line 57 of file vertex.hpp.

◆ Vertex() [2/2]

template<CanBeVectorComponent VectorComponent>
utility::graphic::Vertex< VectorComponent >::Vertex ( const Position< VectorComponent > &  position,
const math::Vector< VectorComponent, 3 > &  normal,
const math::Vector< VectorComponent, 2 > &  textureCoordinates,
const Color32Bit color 
)
inline

Construct from all vertex attributes.

Parameters
positionVertex position.
normalVertex normal.
textureCoordinatesVertex texture coordinates.
colorVertex color in RGBA.

Definition at line 72 of file vertex.hpp.

Member Function Documentation

◆ getColor()

template<CanBeVectorComponent VectorComponent>
Color32Bit utility::graphic::Vertex< VectorComponent >::getColor ( void  ) const
inline

Get vertex color.

Returns
Color in RGBA.

Definition at line 151 of file vertex.hpp.

◆ getNormal()

template<CanBeVectorComponent VectorComponent>
math::Vector< VectorComponent, 3 > utility::graphic::Vertex< VectorComponent >::getNormal ( void  ) const
inline

Get vertex normal.

Returns
Normal vector.

Definition at line 114 of file vertex.hpp.

◆ getPosition()

template<CanBeVectorComponent VectorComponent>
Position< VectorComponent > utility::graphic::Vertex< VectorComponent >::getPosition ( void  ) const
inline

Get vertex position.

Returns
Position vector.

Definition at line 96 of file vertex.hpp.

◆ getTextureCoordinates()

template<CanBeVectorComponent VectorComponent>
math::Vector< VectorComponent, 2 > utility::graphic::Vertex< VectorComponent >::getTextureCoordinates ( void  ) const
inline

Get vertex texture coordinates.

Returns
Texture coordinates.

Definition at line 133 of file vertex.hpp.

◆ hasUnitNormal()

template<CanBeVectorComponent VectorComponent>
bool utility::graphic::Vertex< VectorComponent >::hasUnitNormal ( VectorComponent  epsilon = VectorComponent { 1e-5 }) const
inline

Check if the normal is approximately unit length.

Parameters
epsilonAbsolute tolerance for squared-length comparison.
Returns
True when ||normal||^2 is close to 1.

Definition at line 182 of file vertex.hpp.

◆ operator!=()

template<CanBeVectorComponent VectorComponent>
bool utility::graphic::Vertex< VectorComponent >::operator!= ( const Vertex< VectorComponent > &  other) const
inline

Inequality comparison.

Parameters
otherVertex to compare with.
Returns
True when any attribute differs.

Definition at line 207 of file vertex.hpp.

◆ operator==()

template<CanBeVectorComponent VectorComponent>
bool utility::graphic::Vertex< VectorComponent >::operator== ( const Vertex< VectorComponent > &  other) const
inline

Equality comparison.

Parameters
otherVertex to compare with.
Returns
True when all attributes are equal.

Definition at line 195 of file vertex.hpp.

◆ setAttributes()

template<CanBeVectorComponent VectorComponent>
Vertex & utility::graphic::Vertex< VectorComponent >::setAttributes ( const Position< VectorComponent > &  position,
const math::Vector< VectorComponent, 3 > &  normal,
const math::Vector< VectorComponent, 2 > &  textureCoordinates,
const Color32Bit color 
)
inline

Set all vertex attributes at once.

Parameters
positionVertex position.
normalVertex normal.
textureCoordinatesVertex texture coordinates.
colorVertex color.
Returns
Reference to this vertex for chaining.

Definition at line 164 of file vertex.hpp.

◆ setColor()

template<CanBeVectorComponent VectorComponent>
void utility::graphic::Vertex< VectorComponent >::setColor ( const Color32Bit color)
inline

Set vertex color.

Parameters
colorColor in RGBA.

Definition at line 142 of file vertex.hpp.

◆ setNormal()

template<CanBeVectorComponent VectorComponent>
void utility::graphic::Vertex< VectorComponent >::setNormal ( const math::Vector< VectorComponent, 3 > &  normal)
inline

Set vertex normal.

Parameters
normalNormal vector.

Definition at line 105 of file vertex.hpp.

◆ setPosition()

template<CanBeVectorComponent VectorComponent>
void utility::graphic::Vertex< VectorComponent >::setPosition ( const Position< VectorComponent > &  position)
inline

Set vertex position.

Parameters
positionPosition vector.

Definition at line 87 of file vertex.hpp.

Here is the caller graph for this function:

◆ setTextureCoordinates()

template<CanBeVectorComponent VectorComponent>
void utility::graphic::Vertex< VectorComponent >::setTextureCoordinates ( const math::Vector< VectorComponent, 2 > &  textureCoordinates)
inline

Set vertex texture coordinates.

Parameters
textureCoordinatesTexture coordinates.

Definition at line 123 of file vertex.hpp.


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