Rendering Engine 0.2.17
Modular Graphics Rendering Engine | v0.2.17
Loading...
Searching...
No Matches
rendering_engine::Mesh Class Reference

Represents a single geometric mesh imported from a model file. More...

#include <mesh.hpp>

Public Member Functions

 Mesh (const Mesh &)=default
 
Mesh & operator= (const Mesh &)=default
 
 Mesh (Mesh &&)=default
 
Mesh & operator= (Mesh &&)=default
 
 ~Mesh ()=default
 
Model & GetModel ()
 Returns the parent model that owns this mesh.
 
std::shared_ptr< ModelMaterial > GetMaterial () const
 Returns the material associated with this mesh.
 
const std::string & Name () const
 Returns the mesh name as imported from the source file.
 
const std::vector< glm::vec3 > & Vertices () const
 Returns the vertex position array.
 
const std::vector< glm::vec3 > & Normals () const
 Returns the vertex normal array.
 
const std::vector< glm::vec3 > & Tangents () const
 Returns the vertex tangent array.
 
const std::vector< glm::vec3 > & BiNormals () const
 Returns the vertex binormal array.
 
const std::vector< std::vector< glm::vec3 > > & TextureCoordinates () const
 Returns texture coordinate sets.
 
const std::vector< std::vector< glm::vec4 > > & VertexColors () const
 Returns per-vertex color sets.
 
std::uint32_t FaceCount () const
 Returns the number of faces in the mesh.
 
const std::vector< std::uint32_t > & Indices () const
 Returns the vertex index buffer.
 

Friends

class Model
 

Detailed Description

Represents a single geometric mesh imported from a model file.

The Mesh class stores all CPU-side vertex attributes and index data for one mesh, as imported from an Assimp aiMesh. It acts as an intermediate container before the data is transferred to GPU buffers (via MeshDataGpu).

Each Mesh instance is associated with:

  • One parent Model
  • One ModelMaterial describing surface properties
  • One or more vertex attribute streams (positions, normals, tangents, etc.)
Note
This class does not handle GPU resource management.
See also
Model, ModelMaterial, MeshDataGpu

Definition at line 36 of file mesh.hpp.

Constructor & Destructor Documentation

◆ Mesh() [1/2]

rendering_engine::Mesh::Mesh ( const Mesh &  )
default

◆ Mesh() [2/2]

rendering_engine::Mesh::Mesh ( Mesh &&  )
default

◆ ~Mesh()

rendering_engine::Mesh::~Mesh ( )
default

Member Function Documentation

◆ BiNormals()

const std::vector< glm::vec3 > & rendering_engine::Mesh::BiNormals ( ) const

Returns the vertex binormal array.

Returns
Vector of binormal vectors (glm::vec3).

Definition at line 131 of file mesh.cpp.

132{
133 return mBiNormals;
134}

◆ FaceCount()

std::uint32_t rendering_engine::Mesh::FaceCount ( ) const

Returns the number of faces in the mesh.

Returns
Face count.

Definition at line 146 of file mesh.cpp.

147{
148 return mFaceCount;
149}

◆ GetMaterial()

std::shared_ptr< ModelMaterial > rendering_engine::Mesh::GetMaterial ( ) const

Returns the material associated with this mesh.

Returns
Shared pointer to ModelMaterial.

Definition at line 106 of file mesh.cpp.

107{
108 return mMaterial;
109}

◆ GetModel()

Model & rendering_engine::Mesh::GetModel ( )

Returns the parent model that owns this mesh.

Returns
Reference to the parent Model.

Definition at line 101 of file mesh.cpp.

102{
103 return *mModel;
104}

◆ Indices()

const std::vector< std::uint32_t > & rendering_engine::Mesh::Indices ( ) const

Returns the vertex index buffer.

Returns
Vector of vertex indices.

Definition at line 151 of file mesh.cpp.

152{
153 return mIndices;
154}

◆ Name()

const std::string & rendering_engine::Mesh::Name ( ) const

Returns the mesh name as imported from the source file.

Returns
Mesh name string.

Definition at line 111 of file mesh.cpp.

112{
113 return mName;
114}

◆ Normals()

const std::vector< glm::vec3 > & rendering_engine::Mesh::Normals ( ) const

Returns the vertex normal array.

Returns
Vector of normal vectors (glm::vec3).

Definition at line 121 of file mesh.cpp.

122{
123 return mNormals;
124}

◆ operator=() [1/2]

Mesh & rendering_engine::Mesh::operator= ( const Mesh &  )
default

◆ operator=() [2/2]

Mesh & rendering_engine::Mesh::operator= ( Mesh &&  )
default

◆ Tangents()

const std::vector< glm::vec3 > & rendering_engine::Mesh::Tangents ( ) const

Returns the vertex tangent array.

Returns
Vector of tangent vectors (glm::vec3).

Definition at line 126 of file mesh.cpp.

127{
128 return mTangents;
129}

◆ TextureCoordinates()

const std::vector< std::vector< glm::vec3 > > & rendering_engine::Mesh::TextureCoordinates ( ) const

Returns texture coordinate sets.

Each inner vector represents one texture coordinate channel. Assimp supports up to 8 UV sets per mesh.

Returns
Vector of texture coordinate arrays.

Definition at line 136 of file mesh.cpp.

137{
138 return mTextureCoordinates;
139}

◆ VertexColors()

const std::vector< std::vector< glm::vec4 > > & rendering_engine::Mesh::VertexColors ( ) const

Returns per-vertex color sets.

Each inner vector corresponds to one color channel.

Returns
Vector of vertex color arrays (each color is a vec4).

Definition at line 141 of file mesh.cpp.

142{
143 return mVertexColors;
144}

◆ Vertices()

const std::vector< glm::vec3 > & rendering_engine::Mesh::Vertices ( ) const

Returns the vertex position array.

Returns
Vector of vertex positions (glm::vec3).

Definition at line 116 of file mesh.cpp.

117{
118 return mVertices;
119}

Friends And Related Symbol Documentation

◆ Model

friend class Model
friend

Definition at line 38 of file mesh.hpp.


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