Berserk
Public Member Functions | List of all members
Mesh Class Referencefinal

Contains vertex array-based geometry. More...

#include <Mesh.hpp>

Inheritance diagram for Mesh:
Inheritance graph
[legend]
Collaboration diagram for Mesh:
Collaboration graph
[legend]

Public Member Functions

BRK_API Mesh (MeshFormat format, uint32 verticesCount, const Ref< Data > &vertexData, const Ref< Data > &attributeData, const Ref< Data > &skinningData)
 Creates mesh from raw vertex data. More...
 
BRK_API Mesh (MeshFormat format, uint32 verticesCount, const MeshArrays &meshArrays)
 Creates mesh from arrays of attributes. More...
 
BRK_API ~Mesh () override=default
 
BRK_API void SetName (StringName name)
 
BRK_API void SetAabb (const Aabbf &aabb)
 
BRK_API void AddMaterial (Ref< Material > material)
 
BRK_API void AddSubMesh (const StringName &name, RHIPrimitivesType primitivesType, const Aabbf &aabb, uint32 baseVertex, RHIIndexType indexType, uint32 indicesCount, const Ref< Data > &indexData)
 Add new indexed sub-mesh to the mesh. More...
 
BRK_API void SetSubMeshMaterial (const StringName &name, uint32 index)
 Set sub-mesh material. More...
 
BRK_API Ref< const SubMeshFindSubMesh (const StringName &name) const
 
BRK_API const StringNameGetName () const
 
BRK_API const MeshFormatGetFormat () const
 
BRK_API const AabbfGetAabb () const
 
BRK_API const std::vector< Ref< Material > > & GetMaterials () const
 
BRK_API const std::vector< Ref< SubMesh > > & GetSubMeshes () const
 
BRK_API const std::unordered_map< StringName, uint32 > & GetSubMeshLookUp () const
 
BRK_API uint32 GetVerticesCount () const
 
BRK_API const Ref< RHIVertexBuffer > & GetVertexData () const
 
BRK_API const Ref< RHIVertexBuffer > & GetAttributeData () const
 
BRK_API const Ref< RHIVertexBuffer > & GetSkinningData () const
 
BRK_API const Ref< RHIVertexDeclaration > & GetDeclaration () const
 
BRK_API bool HasVertexData () const
 
BRK_API bool HasAttributeData () const
 
BRK_API bool HasSkinningData () const
 
- Public Member Functions inherited from RefCnt
virtual ~RefCnt ()
 
bool IsUnique () const
 
std::int32_t GetRefs () const
 
std::int32_t AddRef () const
 
std::int32_t RelRef () const
 

Additional Inherited Members

- Protected Member Functions inherited from RefCnt
virtual void Destroy () const
 

Detailed Description

Contains vertex array-based geometry.

Mesh is a type of rendering resource that contains vertex array-based geometry, divided into a set of sub-meshes. Each sub-mesh has separate list of index data, can use separate material and primitives type for rendering.

See also
Material
MeshFormat
MeshFormats
MeshAttribute

Constructor & Destructor Documentation

◆ Mesh() [1/2]

BRK_NS_BEGIN Mesh::Mesh ( MeshFormat  format,
uint32  verticesCount,
const Ref< Data > &  vertexData,
const Ref< Data > &  attributeData,
const Ref< Data > &  skinningData 
)

Creates mesh from raw vertex data.

Parameters
formatFormat of the vertex data
verticesCountNumber of vertices in the mesh
vertexDataPacked vertex data
attributeDataPacked attribute data
skinningDataPacked skinning data

◆ Mesh() [2/2]

Mesh::Mesh ( MeshFormat  format,
uint32  verticesCount,
const MeshArrays meshArrays 
)

Creates mesh from arrays of attributes.

Automatically packs data accordingly to mesh format.

Parameters
formatFormat of the vertex data
verticesCountNumber of vertices in the mesh
meshArraysStructure with pointers to attributes

◆ ~Mesh()

BRK_API Mesh::~Mesh ( )
overridedefault

Member Function Documentation

◆ AddMaterial()

void Mesh::AddMaterial ( Ref< Material material)

Adds new material to the mesh

◆ AddSubMesh()

void Mesh::AddSubMesh ( const StringName name,
RHIPrimitivesType  primitivesType,
const Aabbf aabb,
uint32  baseVertex,
RHIIndexType  indexType,
uint32  indicesCount,
const Ref< Data > &  indexData 
)

Add new indexed sub-mesh to the mesh.

Parameters
nameUnique name of the sub-mesh
primitivesTypeType of sub-mesh primitives
aabbBounding box of sub-mesh
baseVertexbase vertex index
indexTypeType of indices
indicesCountNumber of indices
indexDataIndex data

◆ FindSubMesh()

Ref< const SubMesh > Mesh::FindSubMesh ( const StringName name) const
Returns
Sub-mesh found by name; null if not found

◆ GetAabb()

BRK_API const Aabbf& Mesh::GetAabb ( ) const
inline
Returns
Bounding box of mesh

◆ GetAttributeData()

BRK_API const Ref<RHIVertexBuffer>& Mesh::GetAttributeData ( ) const
inline

color,uv's data of the mesh

◆ GetDeclaration()

BRK_API const Ref<RHIVertexDeclaration>& Mesh::GetDeclaration ( ) const
inline

Vertex declaration for rendering with full data

◆ GetFormat()

BRK_API const MeshFormat& Mesh::GetFormat ( ) const
inline
Returns
Format of the mesh

◆ GetMaterials()

BRK_API const std::vector<Ref<Material> >& Mesh::GetMaterials ( ) const
inline
Returns
List of materials used by the mesh

◆ GetName()

BRK_API const StringName& Mesh::GetName ( ) const
inline
Returns
Name of the mesh

◆ GetSkinningData()

BRK_API const Ref<RHIVertexBuffer>& Mesh::GetSkinningData ( ) const
inline

bones, weights data of the mesh

◆ GetSubMeshes()

BRK_API const std::vector<Ref<SubMesh> >& Mesh::GetSubMeshes ( ) const
inline
Returns
List of sub-meshes

◆ GetSubMeshLookUp()

BRK_API const std::unordered_map<StringName, uint32>& Mesh::GetSubMeshLookUp ( ) const
inline
Returns
Name to id resoling

◆ GetVertexData()

BRK_API const Ref<RHIVertexBuffer>& Mesh::GetVertexData ( ) const
inline

pos,norm,tan data of the mesh

◆ GetVerticesCount()

BRK_API uint32 Mesh::GetVerticesCount ( ) const
inline

Number of vertices in the mesh

◆ HasAttributeData()

BRK_API bool Mesh::HasAttributeData ( ) const
inline

◆ HasSkinningData()

BRK_API bool Mesh::HasSkinningData ( ) const
inline

◆ HasVertexData()

BRK_API bool Mesh::HasVertexData ( ) const
inline

◆ SetAabb()

void Mesh::SetAabb ( const Aabbf aabb)

Set mesh bounding box

◆ SetName()

void Mesh::SetName ( StringName  name)

Set name of the mesh

◆ SetSubMeshMaterial()

void Mesh::SetSubMeshMaterial ( const StringName name,
uint32  index 
)

Set sub-mesh material.

Parameters
nameName of the sub-mesh
indexIndex of the material in the mesh materials list

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