class
#include <esp/assets/BaseMesh.h>
BaseMesh Base class for storing mesh asset data including geometry and topology.
Also manages transfer of this data to GPU memory. Derived classes implement modifications to support specific mesh formats as enumerated by SupportedMeshType.
Derived classes
- class GenericMeshData
- Mesh data storage and loading for gltf format assets. See ResourceManager::
loadMeshes. - class GenericSemanticMeshData
- Mesh data storage and loading for ply format assets used primarily for Semantic Scene meshes, including manage vertex colors and vertex IDs for semantic visualization and rendering.
Constructors, destructors, conversion operators
- BaseMesh(SupportedMeshType type) explicit
- Constructor defining the SupportedMeshType of this asset and likely identifying the derived type of this object.
- ~BaseMesh() defaulted virtual
- Destructor.
Public functions
- auto setMeshType(SupportedMeshType type) -> bool
- Set the SupportedMeshType, type_
, of this object. - auto getMeshType() -> SupportedMeshType
- Retrieve the SupportedMeshType, type_
, of this object. - void uploadBuffersToGPU(bool) virtual
- Upload the mesh data to GPU memory.
-
auto getMagnumGLMesh() -> Magnum::
GL:: Mesh* virtual - Get a pointer to the compiled rendering buffer for the asset.
-
auto getMagnumGLMesh(int) -> Magnum::
GL:: Mesh* virtual - Get a pointer to the compiled rendering buffer for a particular sub-component of the asset.
-
auto getMeshData() -> Corrade::
Containers:: Optional<Magnum:: Trade:: MeshData>& - Retrieve a reference to the
meshData_
for this mesh;. - auto getCollisionMeshData() -> CollisionMeshData& virtual
- Get a reference to the collisionMeshData_
(non-render geometry and topology) for the asset.
Public variables
-
Magnum::
Range3D BB - Axis aligned bounding box of the mesh.
Protected functions
-
void buildColorMapToUse(Corrade::
Containers:: Array<Magnum:: UnsignedInt>& vertIDs, const Cr::Containers::Array<Mn:: Color3ub>& vertColors, bool useVertexColors, std:: vector<Mn:: Vector3ub>& colorMapToUse) const - Build a colormap to use either from mapping given list of per-vertex object IDs to per-vertex Colors, or through a mapping of a Magnum-provided color map depending on value of
useVertexColors
. -
void convertMeshColors(const Mn::Trade::MeshData& srcMeshData,
bool convertToSRGB,
Cr::Containers::Array<Mn::
Color3ub>& destColors) const - Populate an array of colors of the correct type from colors held in the given
srcMeshData
. Generally used for semantic processing/rendering.
Protected variables
- SupportedMeshType type_
- Identifies the derived type of this object and the format of the asset.
- bool buffersOnGPU_
- Whether or not the mesh data has been transferred to GPU.
-
Corrade::
Containers:: Optional<Magnum:: Trade:: MeshData> meshData_ - Optional storage container for mesh render data.
- CollisionMeshData collisionMeshData_
- Stores references to mesh geometry and topology for use in CPU side physics collision shape generation.
Function documentation
bool esp:: assets:: BaseMesh:: setMeshType(SupportedMeshType type)
Set the SupportedMeshType, type_
Parameters | |
---|---|
type | The desired SupportedMeshType to set. |
Returns | Whether or not the set was successful. |
SupportedMeshType esp:: assets:: BaseMesh:: getMeshType()
Retrieve the SupportedMeshType, type_
Returns | the SupportedMeshType, type_ |
---|
void esp:: assets:: BaseMesh:: uploadBuffersToGPU(bool) virtual
Upload the mesh data to GPU memory.
Virtual with no implementation for BaseMesh.
Magnum:: GL:: Mesh* esp:: assets:: BaseMesh:: getMagnumGLMesh() virtual
Get a pointer to the compiled rendering buffer for the asset.
Returns | A pointer to the compiled rendering buffer for the asset. |
---|
Always nullptr for BaseMesh.
Magnum:: GL:: Mesh* esp:: assets:: BaseMesh:: getMagnumGLMesh(int) virtual
Get a pointer to the compiled rendering buffer for a particular sub-component of the asset.
Returns | A pointer to the compiled rendering buffer for a particular sub-component of the asset. |
---|
Always nullptr for BaseMesh.
CollisionMeshData& esp:: assets:: BaseMesh:: getCollisionMeshData() virtual
Get a reference to the collisionMeshData_
Returns | The CollisionMeshData, collisionMeshData_ |
---|
Usage: (1) physics simulation.
void esp:: assets:: BaseMesh:: buildColorMapToUse(Corrade:: Containers:: Array<Magnum:: UnsignedInt>& vertIDs,
const Cr::Containers::Array<Mn:: Color3ub>& vertColors,
bool useVertexColors,
std:: vector<Mn:: Vector3ub>& colorMapToUse) const protected
Build a colormap to use either from mapping given list of per-vertex object IDs to per-vertex Colors, or through a mapping of a Magnum-provided color map depending on value of useVertexColors
.
Parameters | |
---|---|
vertIDs | Per-vertex ids from mesh |
vertColors | Per-vertex colors from mesh |
useVertexColors | Whether or not to use vertex colors in mesh for color map |
colorMapToUse out | The mapping of semantic ID to color |
void esp:: assets:: BaseMesh:: convertMeshColors(const Mn::Trade::MeshData& srcMeshData,
bool convertToSRGB,
Cr::Containers::Array<Mn:: Color3ub>& destColors) const protected
Populate an array of colors of the correct type from colors held in the given srcMeshData
. Generally used for semantic processing/rendering.
Parameters | |
---|---|
srcMeshData | The meshdata containing the colors we wish to query |
convertToSRGB | Whether the source vertex colors from the srcMeshData should be converted to SRGB |
destColors out | The per-element array of colors to be built. |
Variable documentation
Magnum:: Range3D esp:: assets:: BaseMesh:: BB
Axis aligned bounding box of the mesh.
Computed automatically on mesh load. See ResourceManager::
Corrade:: Containers:: Optional<Magnum:: Trade:: MeshData> esp:: assets:: BaseMesh:: meshData_ protected
Optional storage container for mesh render data.
CollisionMeshData esp:: assets:: BaseMesh:: collisionMeshData_ protected
Stores references to mesh geometry and topology for use in CPU side physics collision shape generation.
Should be updated when mesh data is edited.