KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::Mesh Class Reference

An organized collection of vertex and index buffers along with rest of the model specific information which includes colors, texture coordinates and perhaps animation attributes. More...

#include <Mesh.h>

Inheritance diagram for Karma::Mesh:

Public Member Functions

 Mesh (std::shared_ptr< VertexBuffer > vertexBuffer, std::shared_ptr< IndexBuffer > indexBuffer, const std::string &meshName="NoName", MeshType mType=MeshType::Mesh)
 
 Mesh (const std::string &filePath)
 
virtual void ProcessMesh (aiMesh *meshToProcess)
 
void ProcessNode (aiNode *nodeToProcess, const aiScene *theScene)
 
std::shared_ptr< VertexBufferGetVertexBuffer () const
 
std::shared_ptr< IndexBufferGetIndexBuffer () const
 
void SetVertexBuffer (std::shared_ptr< VertexBuffer > vBuffer)
 
void SetIndexBuffer (std::shared_ptr< IndexBuffer > iBuffer)
 

Static Public Member Functions

static std::shared_ptr< MeshProcessTheRawMesh (aiMesh *meshToProcess, const std::string &mName="NoName")
 Generate a layout (BufferLayout) for the supplied mesh.
 
static void DealVertexIndexBufferData (float *&vertexData, uint32_t &vertexDataSize, uint32_t *&indexData, uint32_t &indexDataLength, aiMesh *meshToProcess, BufferLayout &buffLayout)
 Routine for gauging the vertexbuffer data.
 
static void GaugeVertexDataLayout (aiMesh *meshToProcess, BufferLayout &buffLayout)
 Routine for extracting the format (BufferLayout) of vertexbuffer.
 
static float LayoutElementToAttributeValue (unsigned int vertexNumber, uint32_t counter, aiMesh *meshToProcess, const BufferElement &layoutElem)
 
static void InitializeAttributeDictionary ()
 

Protected Attributes

std::shared_ptr< VertexBufferm_VertexBuffer
 
std::shared_ptr< IndexBufferm_IndexBuffer
 
std::string m_MeshName
 
MeshType m_MeshType
 

Static Protected Attributes

static std::shared_ptr< std::unordered_map< std::string, MeshAttribute > > m_NameToAttributeDictionary = std::make_shared<std::unordered_map<std::string, MeshAttribute>>()
 

Detailed Description

An organized collection of vertex and index buffers along with rest of the model specific information which includes colors, texture coordinates and perhaps animation attributes.

Member Function Documentation

◆ DealVertexIndexBufferData()

void Karma::Mesh::DealVertexIndexBufferData ( float *& vertexData,
uint32_t & vertexDataSize,
uint32_t *& indexData,
uint32_t & indexDataLength,
aiMesh * meshToProcess,
BufferLayout & buffLayout )
static

Routine for gauging the vertexbuffer data.

Parameters
vertexDataReference to float array containing the vertexbuffer data
vertexDataSizeReference to the size (in bytes) of the vertex buffer (number of mesh vertices * each vertex attribute's size)
indexDataReference to the float containing the index buffer data
indexDataLengthReference to the total number of face indices of all the faces of the geometry
meshToProcessReference to the mesh to be processed
buffLayoutReference to the buffer layout to be gauged (
See also
Mesh::GaugeVertexDataLayout)
Since
Karma 1.0.0

◆ GaugeVertexDataLayout()

void Karma::Mesh::GaugeVertexDataLayout ( aiMesh * meshToProcess,
BufferLayout & buffLayout )
static

Routine for extracting the format (BufferLayout) of vertexbuffer.

Parameters
meshToProcessThe mesh being analyzed
buffLayoutReference to the format
Since
Karma 1.0.0

◆ ProcessMesh()

void Karma::Mesh::ProcessMesh ( aiMesh * meshToProcess)
virtual

Reimplemented in Karma::SkeletalMesh.

◆ ProcessTheRawMesh()

std::shared_ptr< Mesh > Karma::Mesh::ProcessTheRawMesh ( aiMesh * meshToProcess,
const std::string & mName = "NoName" )
static

Generate a layout (BufferLayout) for the supplied mesh.

Parameters
meshToProcessThe Assimp mesh whose layout is to be generated
mNameMesh name
Since
Karma 1.0.0

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