Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
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
Meshoperator= (const Mesh &)=default
 Mesh (Mesh &&)=default
Meshoperator= (Mesh &&)=default
 ~Mesh ()=default
ModelGetModel ()
 Returns the parent model that owns this mesh.
std::shared_ptr< ModelMaterialGetMaterial () 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 133 of file mesh.cpp.

134{
135 return mBiNormals;
136}

◆ FaceCount()

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

Returns the number of faces in the mesh.

Returns
Face count.

Definition at line 148 of file mesh.cpp.

149{
150 return mFaceCount;
151}

◆ 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 108 of file mesh.cpp.

109{
110 return mMaterial;
111}

◆ GetModel()

Model & rendering_engine::Mesh::GetModel ( )

Returns the parent model that owns this mesh.

Returns
Reference to the parent Model.

Definition at line 103 of file mesh.cpp.

104{
105 return *mModel;
106}

◆ 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 153 of file mesh.cpp.

154{
155 return mIndices;
156}

◆ 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 113 of file mesh.cpp.

114{
115 return mName;
116}

◆ 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 123 of file mesh.cpp.

124{
125 return mNormals;
126}

◆ 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 128 of file mesh.cpp.

129{
130 return mTangents;
131}

◆ 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 138 of file mesh.cpp.

139{
140 return mTextureCoordinates;
141}

◆ 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 143 of file mesh.cpp.

144{
145 return mVertexColors;
146}

◆ 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 118 of file mesh.cpp.

119{
120 return mVertices;
121}

◆ Model

friend class Model
friend

Definition at line 38 of file mesh.hpp.


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