esp::assets::GenericMeshData class

Mesh data storage and loading for gltf format assets. See ResourceManager::loadMeshes.

Base classes

class BaseMesh
Base class for storing mesh asset data including geometry and topology.

Public types

struct RenderingBuffer
Stores render data for the mesh necessary for gltf format.

Constructors, destructors, conversion operators

GenericMeshData(bool needsNormals = true) explicit
Constructor. Sets asset type to be SupportedMeshType::GENERIC_MESH .
~GenericMeshData() defaulted override
Destructor.

Public functions

void uploadBuffersToGPU(bool forceReload = false) override
Compile the renderingBuffer_ if first upload or forceReload is true.
void setMeshData(Magnum::Trade::MeshData&& meshData)
Set mesh data from external source, and sets the collisionMesh_ references. Can be used for meshDatas that are manually synthesized, such as NavMesh.
void importAndSetMeshData(Magnum::Trade::AbstractImporter& importer, int meshID)
Load mesh data from a pre-parsed importer for a specific mesh component ID. Sets the collisionMeshData_ references.
void importAndSetMeshData(Magnum::Trade::AbstractImporter& importer, const std::string& meshName)
Load mesh data from a pre-parsed importer for a specific mesh component name. Sets the collisionMeshData_ references.
auto getRenderingBuffer() -> RenderingBuffer* virtual
Returns a pointer to the compiled render data storage structure.
auto getMagnumGLMesh() -> Magnum::GL::Mesh* override
Returns a pointer to the compiled render mesh data stored in the renderingBuffer_.

Protected variables

std::unique_ptr<RenderingBuffer> renderingBuffer_
Storage structure for compiled render data. We will use a smart pointer here since each item within the structure (e.g., Magnum::GL::Mesh) does NOT have copy constructor. See uploadBuffersToGPU.
bool needsNormals_
Whether this mesh should have smooth normals generated.

Function documentation

void esp::assets::GenericMeshData::uploadBuffersToGPU(bool forceReload = false) override

Compile the renderingBuffer_ if first upload or forceReload is true.

Parameters
forceReload If true, recompiles the renderingBuffer_ (e.g. in the case of data change after initial compilation).

void esp::assets::GenericMeshData::setMeshData(Magnum::Trade::MeshData&& meshData)

Set mesh data from external source, and sets the collisionMesh_ references. Can be used for meshDatas that are manually synthesized, such as NavMesh.

Parameters
meshData the meshData to be assigned.

void esp::assets::GenericMeshData::importAndSetMeshData(Magnum::Trade::AbstractImporter& importer, int meshID)

Load mesh data from a pre-parsed importer for a specific mesh component ID. Sets the collisionMeshData_ references.

Parameters
importer The importer pre-loaded with asset data from file, or a Primitive Importer.
meshID The local identifier of a specific mesh component of the asset.

void esp::assets::GenericMeshData::importAndSetMeshData(Magnum::Trade::AbstractImporter& importer, const std::string& meshName)

Load mesh data from a pre-parsed importer for a specific mesh component name. Sets the collisionMeshData_ references.

Parameters
importer The importer pre-loaded with asset data from file, or a Primitive Importer.
meshName The string identifier of a specific mesh - i.e. with PrimitiveImporter to denote which Primitive to instantiate.

RenderingBuffer* esp::assets::GenericMeshData::getRenderingBuffer() virtual

Returns a pointer to the compiled render data storage structure.

Returns Pointer to the renderingBuffer_.

Magnum::GL::Mesh* esp::assets::GenericMeshData::getMagnumGLMesh() override

Returns a pointer to the compiled render mesh data stored in the renderingBuffer_.

Returns Pointer to the compiled render mesh data.