esp::assets::GenericSemanticMeshData class

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.

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.

Public static functions

static auto buildSemanticMeshData(const Magnum::Trade::MeshData& meshData, const std::string& semanticFilename, std::vector<Magnum::Vector3ub>& colorMapToUse, bool convertToSRGB, const std::shared_ptr<scene::SemanticScene>& semanticScene = nullptr) -> std::unique_ptr<GenericSemanticMeshData>
Build the GenericSemanticMeshData based on the contents of the passed meshData,.
static auto partitionSemanticMeshData(const std::unique_ptr<GenericSemanticMeshData>& semanticMeshData) -> std::vector<std::unique_ptr<GenericSemanticMeshData>>
Partition the passed GenericSemanticMeshData to facilitate culling.

Constructors, destructors, conversion operators

GenericSemanticMeshData(SupportedMeshType type) explicit
Constructor. Builds semantic mesh data, and sets type to passed SupportedMeshType.
GenericSemanticMeshData() explicit
Constructor. Builds semantic mesh data, and sets type to SupportedMeshType::INSTANCE_MESH.
~GenericSemanticMeshData() defaulted override

Public functions

auto buildCCBasedSemanticObjs(const std::shared_ptr<scene::SemanticScene>& semanticScene) -> std::unordered_map<uint32_t, std::vector<std::shared_ptr<scene::CCSemanticObject>>>
Build a per-color/per-semantic ID map of all bounding boxes for each CC found in the mesh, and the count of verts responsible for each.
void uploadBuffersToGPU(bool forceReload = false) override
Upload the mesh data to GPU memory.
auto getRenderingBuffer() -> RenderingBuffer*
Retrieve a pointer to the rendering buffer for this GenericSemanticMeshData.
auto getMagnumGLMesh() -> Magnum::GL::Mesh* override
Retrieve a pointer to the Magnum GL Mesh behind this GenericSemanticMeshData.
auto getVertexBufferObjectCPU() const -> const std::vector<Mn::Vector3>&
Retrive a reference to this GenericSemanticMeshData 's vertex buffer.
auto getColorBufferObjectCPU() const -> const std::vector<Mn::Color3ub>&
Retrive a reference to this GenericSemanticMeshData 's color buffer.
auto getIndexBufferObjectCPU() const -> const std::vector<uint32_t>&
Retrive a reference to this GenericSemanticMeshData 's index buffer.
auto getObjectIdsBufferObjectCPU() const -> const std::vector<uint16_t>&
Retrive a reference to this GenericSemanticMeshData 's object id buffer.
auto getPartitionIDs() const -> const std::vector<uint16_t>&
Either return separate partition IDs or objectIDs, depending on which were available when mesh was initially configured. These are used to partition mesh for culling.
auto meshCanBePartitioned() const -> bool
This mesh can be partitioned - either object IDs were found in vertices or per-vert region partition values were found from semantic descriptor file.
auto getVertColorSSDReport(const std::string& semanticFilename, const std::vector<Mn::Vector3ub>& colorMapToUse, const std::shared_ptr<scene::SemanticScene>& semanticScene) -> std::vector<std::string>
build a string array holding mapping information for colors found on verts and colors found in semantic scene descriptor aggregated during load.

Protected types

class PerPartitionIdMeshBuilder
This class is intended to provide a concise interface to build the appropriate mesh data.

Protected functions

void updateCollisionMeshData()
update the meshdata positions and indices with the data from the member vectors

Protected variables

std::unordered_map<uint32_t, int> nonSSDVertColorIDs
temporary holding structures to hold any non-SSD vert color IDs, so that the nonSSDObjID for new colors can be incremented appropriately not using set to avoid extra include. Key is color, value is semantic ID assigned for unknown color
std::unordered_map<uint32_t, int> nonSSDVertColorCounts
temporary holding structures to hold any non-SSD vert color counts. Key is color, value is semantic ID assigned for unknown color
std::vector<uint32_t> unMappedObjectIDXs
record of semantic object IDXs with no presence in any verts
bool meshHasPartitionIDXs
Whether or not this mesh can be partitioned - either object IDs were found in vertices or per-vert region partition values were found from semantic descriptor file.
bool meshUsesSSDPartitionIDs
This mesh has separate partition IDs, provided by Semantic Scene Descriptor file. If false, uses the objectIDs for the partitioning, if true means region IDs were provided in semantic scene descriptor.

Function documentation

static std::unique_ptr<GenericSemanticMeshData> esp::assets::GenericSemanticMeshData::buildSemanticMeshData(const Magnum::Trade::MeshData& meshData, const std::string& semanticFilename, std::vector<Magnum::Vector3ub>& colorMapToUse, bool convertToSRGB, const std::shared_ptr<scene::SemanticScene>& semanticScene = nullptr)

Build the GenericSemanticMeshData based on the contents of the passed meshData,.

Parameters
meshData The imported meshData.
semanticFilename Path-less Filename of source mesh.
colorMapToUse out An array holding the semantic colors to use for visualization or matching to semantic IDs.
convertToSRGB Whether the source vertex colors from the meshData should be converted to SRGB
semanticScene The SSD for the semantic mesh being loaded.
Returns reference to the GenericSemanticMeshData.

static std::vector<std::unique_ptr<GenericSemanticMeshData>> esp::assets::GenericSemanticMeshData::partitionSemanticMeshData(const std::unique_ptr<GenericSemanticMeshData>& semanticMeshData)

Partition the passed GenericSemanticMeshData to facilitate culling.

Parameters
semanticMeshData
Returns vector holding one or more GenericSemanticMeshData

std::unordered_map<uint32_t, std::vector<std::shared_ptr<scene::CCSemanticObject>>> esp::assets::GenericSemanticMeshData::buildCCBasedSemanticObjs(const std::shared_ptr<scene::SemanticScene>& semanticScene)

Build a per-color/per-semantic ID map of all bounding boxes for each CC found in the mesh, and the count of verts responsible for each.

Parameters
semanticScene The SSD for the current semantic mesh. Used to query semantic objs. If nullptr, this function returns hex-color-keyed map, otherwise returns SemanticID-keyed map.