Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::Mesh Class Referencefinal

Represents a polygon mesh with vertex attributes and index data. More...

#include <aeongames/Mesh.hpp>

Inheritance diagram for AeonGames::Mesh:
Inheritance graph
Collaboration diagram for AeonGames::Mesh:
Collaboration graph

Public Types

enum  AttributeSemantic : uint32_t {
  POSITION = "VertexPosition"_crc32 , NORMAL = "VertexNormal"_crc32 , TANGENT = "VertexTangent"_crc32 , BITANGENT = "VertexBitangent"_crc32 ,
  TEXCOORD = "VertexUV"_crc32 , WEIGHT_INDEX = "VertexWeightIndices"_crc32 , WEIGHT_VALUE = "VertexWeights"_crc32 , COLOR = "VertexColor"_crc32
}
 Semantic meaning of a vertex attribute, identified by CRC32 of its name. More...
enum  AttributeType : uint8_t {
  BYTE = 0 , UNSIGNED_BYTE = 1 , SHORT = 2 , UNSIGNED_SHORT = 3 ,
  HALF_FLOAT = 4 , INT = 5 , UNSIGNED_INT = 6 , FLOAT = 7 ,
  FIXED = 8 , DOUBLE = 9
}
 Data type of a vertex attribute component. More...
enum  AttributeFlag : uint8_t { NORMALIZED = 0b00000001 , INTEGER = 0b00000010 }
 Flags that modify how a vertex attribute is interpreted. More...
enum  BindingLocations : uint32_t { MATRICES = "Matrices"_crc32 , MATERIAL = "Material"_crc32 , SKELETON = "Skeleton"_crc32 , SAMPLERS = "Samplers"_crc32 }
 CRC32-based binding location identifiers for descriptor sets. More...
using AttributeSize = uint8_t
 Type alias for the number of components in a vertex attribute.
using AttributeFlags = uint8_t
 Type alias for vertex attribute flag bits.
using AttributeTuple = std::tuple<AttributeSemantic, AttributeSize, AttributeType, AttributeFlags>
 Tuple describing a single vertex attribute (semantic, component count, type, flags).

Public Member Functions

DLL Mesh ()
 Default constructor.
DLL ~Mesh () final
 Destructor.
DLL void LoadFromPBMsg (const MeshMsg &aMeshMsg)
 Load mesh data from a protobuf message.
DLL void LoadFromMemory (const void *aBuffer, size_t aBufferSize) final
 Load mesh data from a raw memory buffer.
DLL void Unload () final
 Unload mesh data and release resources.
DLL const std::vector< AttributeTuple > & GetAttributes () const
 Get the list of vertex attributes.
DLL uint32_t GetIndexSize () const
 Get the size in bytes of a single index.
DLL uint32_t GetIndexCount () const
 Get the total number of indices.
DLL uint32_t GetVertexCount () const
 Get the total number of vertices.
DLL const std::vector< uint8_t > & GetVertexBuffer () const
 Get the raw vertex data buffer.
DLL const std::vector< uint8_t > & GetIndexBuffer () const
 Get the raw index data buffer.
DLL const AABBGetAABB () const
 Get the axis-aligned bounding box of the mesh.
DLL size_t GetStride () const
 Get the stride (bytes per vertex) for the vertex buffer.
Public Member Functions inherited from AeonGames::Resource
virtual ~Resource ()
 Virtual destructor.
DLL void LoadFromId (uint32_t aId)
 Load the resource identified by a numeric id.
DLL void LoadFromFile (const std::string &aFilename)
 Load the resource from a file on disk.
DLL size_t GetConsecutiveId () const
 Get the Consecutive Id for the resource object.

Detailed Description

Represents a polygon mesh with vertex attributes and index data.

Definition at line 30 of file Mesh.hpp.

Member Typedef Documentation

◆ AttributeFlags

Type alias for vertex attribute flag bits.

Definition at line 80 of file Mesh.hpp.

◆ AttributeSize

Type alias for the number of components in a vertex attribute.

Definition at line 78 of file Mesh.hpp.

◆ AttributeTuple

Tuple describing a single vertex attribute (semantic, component count, type, flags).

Definition at line 82 of file Mesh.hpp.

Member Enumeration Documentation

◆ AttributeFlag

Flags that modify how a vertex attribute is interpreted.

Enumerator
NORMALIZED 

Values are normalized to [0,1] or [-1,1].

INTEGER 

Values are passed as integers (no conversion).

Definition at line 62 of file Mesh.hpp.

◆ AttributeSemantic

Semantic meaning of a vertex attribute, identified by CRC32 of its name.

Enumerator
POSITION 

Vertex position.

NORMAL 

Vertex normal.

TANGENT 

Vertex tangent.

BITANGENT 

Vertex bitangent.

TEXCOORD 

Texture coordinate.

WEIGHT_INDEX 

Bone weight indices.

WEIGHT_VALUE 

Bone weight values.

COLOR 

Vertex color.

Definition at line 34 of file Mesh.hpp.

◆ AttributeType

Data type of a vertex attribute component.

Enumerator
BYTE 

Signed 8-bit integer.

UNSIGNED_BYTE 

Unsigned 8-bit integer.

SHORT 

Signed 16-bit integer.

UNSIGNED_SHORT 

Unsigned 16-bit integer.

HALF_FLOAT 

16-bit floating point.

INT 

Signed 32-bit integer.

UNSIGNED_INT 

Unsigned 32-bit integer.

FLOAT 

32-bit floating point.

FIXED 

Fixed-point.

DOUBLE 

64-bit floating point.

Definition at line 47 of file Mesh.hpp.

◆ BindingLocations

CRC32-based binding location identifiers for descriptor sets.

Enumerator
MATRICES 

Matrices binding.

MATERIAL 

Material binding.

SKELETON 

Skeleton binding.

SAMPLERS 

Samplers binding.

Definition at line 69 of file Mesh.hpp.

Constructor & Destructor Documentation

◆ ~Mesh()

AeonGames::Mesh::~Mesh ( )
final

Destructor.

Definition at line 33 of file Mesh.cpp.

Member Function Documentation

◆ GetAABB()

const AABB & AeonGames::Mesh::GetAABB ( ) const

Get the axis-aligned bounding box of the mesh.

Returns
Const reference to the AABB.

Definition at line 68 of file Mesh.cpp.

◆ GetAttributes()

const std::vector< Mesh::AttributeTuple > & AeonGames::Mesh::GetAttributes ( ) const

Get the list of vertex attributes.

Returns
Const reference to the attribute tuple vector.

Definition at line 38 of file Mesh.cpp.

◆ GetIndexBuffer()

const std::vector< uint8_t > & AeonGames::Mesh::GetIndexBuffer ( ) const

Get the raw index data buffer.

Returns
Const reference to the index byte vector.

Definition at line 63 of file Mesh.cpp.

◆ GetIndexCount()

uint32_t AeonGames::Mesh::GetIndexCount ( ) const

Get the total number of indices.

Returns
Index count.

Definition at line 48 of file Mesh.cpp.

◆ GetIndexSize()

uint32_t AeonGames::Mesh::GetIndexSize ( ) const

Get the size in bytes of a single index.

Returns
Index element size.

Definition at line 43 of file Mesh.cpp.

◆ GetStride()

size_t AeonGames::Mesh::GetStride ( ) const

Get the stride (bytes per vertex) for the vertex buffer.

Returns
Stride in bytes.

Definition at line 98 of file Mesh.cpp.

◆ GetVertexBuffer()

const std::vector< uint8_t > & AeonGames::Mesh::GetVertexBuffer ( ) const

Get the raw vertex data buffer.

Returns
Const reference to the vertex byte vector.

Definition at line 58 of file Mesh.cpp.

◆ GetVertexCount()

uint32_t AeonGames::Mesh::GetVertexCount ( ) const

Get the total number of vertices.

Returns
Vertex count.

Definition at line 53 of file Mesh.cpp.

◆ LoadFromMemory()

void AeonGames::Mesh::LoadFromMemory ( const void * aBuffer,
size_t aBufferSize )
finalvirtual

Load mesh data from a raw memory buffer.

Parameters
aBufferPointer to the buffer.
aBufferSizeSize of the buffer in bytes.

Implements AeonGames::Resource.

Definition at line 108 of file Mesh.cpp.

◆ LoadFromPBMsg()

void AeonGames::Mesh::LoadFromPBMsg ( const MeshMsg & aMeshMsg)

Load mesh data from a protobuf message.

Parameters
aMeshMsgThe protobuf message to load from.

Definition at line 113 of file Mesh.cpp.

◆ Unload()

void AeonGames::Mesh::Unload ( )
finalvirtual

Unload mesh data and release resources.

Implements AeonGames::Resource.

Definition at line 151 of file Mesh.cpp.


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