|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
Generates LOD hierarchy for meshes using meshoptimizer. More...
#include <ClusterLodGenerator.h>
Classes | |
| struct | LodLevelData |
| Generate a single LOD level by simplifying geometry. More... | |
Static Public Member Functions | |
| static Ecs::LodHierarchyResult | generate (const std::vector< Vertex > &vertices, const std::vector< uint32_t > &indices, const std::vector< meshopt_Meshlet > &baseMeshlets, const std::vector< uint32_t > &baseMeshletVertices, const std::vector< uint8_t > &baseMeshletTriangles, const LodGenerationConfig &config={}) |
| Generate LOD hierarchy from mesh geometry. | |
Static Private Member Functions | |
| static LodLevelData | generateLodLevel (const std::vector< Vertex > &srcVertices, const std::vector< uint32_t > &srcIndices, size_t targetIndexCount, float targetError, size_t maxVerticesPerMeshlet, size_t maxTrianglesPerMeshlet) |
| static glm::vec4 | computeBoundingSphere (const std::vector< Vertex > &vertices, const std::vector< uint32_t > &indices) |
| Compute bounding sphere for a set of vertices. | |
| static glm::vec4 | computeMeshletBoundingSphere (const std::vector< Vertex > &vertices, const meshopt_Meshlet &meshlet, const std::vector< uint32_t > &meshletVertices) |
| Compute bounding sphere for a meshlet. | |
Generates LOD hierarchy for meshes using meshoptimizer.
This generator creates a DAG (Directed Acyclic Graph) of clusters where:
GPU selection uses screen-space error to pick the appropriate LOD level per cluster, with dithered transitions for smooth blending.
Definition at line 45 of file ClusterLodGenerator.h.
|
staticprivate |
Compute bounding sphere for a set of vertices.
Definition at line 17 of file ClusterLodGenerator.cpp.
Referenced by generate().
|
staticprivate |
Compute bounding sphere for a meshlet.
Definition at line 43 of file ClusterLodGenerator.cpp.
Referenced by generate().
|
static |
Generate LOD hierarchy from mesh geometry.
| vertices | Input vertex data |
| indices | Input index data |
| baseMeshlets | Base level meshlets (already generated) |
| baseMeshletVertices | Meshlet vertex indices |
| baseMeshletTriangles | Meshlet triangle indices |
| config | Generation configuration |
Definition at line 183 of file ClusterLodGenerator.cpp.
References Ecs::LodHierarchyResult::baseLevelClusterCount, EngineCore::ClusterLodData::boundsPositionAndRadius, Ecs::LodHierarchyResult::clusters, computeBoundingSphere(), computeMeshletBoundingSphere(), EngineCore::Debug, EngineCore::ClusterGroupData::depth, EngineCore::ClusterLodData::error, EngineCore::ClusterLodGenerator::LodLevelData::error, generateLodLevel(), Ecs::LodHierarchyResult::groups, EngineCore::ClusterLodGenerator::LodLevelData::indices, EngineCore::Info, Ecs::LodHierarchyResult::lodLevelCount, LogLOD, EngineCore::LodGenerationConfig::maxLodLevels, EngineCore::LodGenerationConfig::maxTrianglesPerCluster, Ecs::LodHierarchyResult::meshletData, EngineCore::ClusterLodData::meshletIndex, Ecs::MeshletData::meshlets, EngineCore::ClusterLodGenerator::LodLevelData::meshlets, EngineCore::ClusterLodGenerator::LodLevelData::meshletTriangles, EngineCore::ClusterLodGenerator::LodLevelData::meshletVertices, EngineCore::LodGenerationConfig::minTrianglesForLod, Ecs::PackedTriangle::pack(), EngineCore::ClusterLodData::refinedGroupId, EngineCore::LodGenerationConfig::simplificationRatio, EngineCore::ClusterGroupData::simplifiedBoundsPositionAndRadius, EngineCore::ClusterGroupData::simplifiedError, EngineCore::LodGenerationConfig::targetError, Ecs::UnpackedMeshletData::triangles, Ecs::LodHierarchyResult::unpackedData, Ecs::UnpackedMeshletData::vertices, EngineCore::ClusterLodGenerator::LodLevelData::vertices, and VS_LOG.
|
staticprivate |
Definition at line 72 of file ClusterLodGenerator.cpp.
References EngineCore::ClusterLodGenerator::LodLevelData::error, EngineCore::ClusterLodGenerator::LodLevelData::indices, EngineCore::ClusterLodGenerator::LodLevelData::meshlets, EngineCore::ClusterLodGenerator::LodLevelData::meshletTriangles, EngineCore::ClusterLodGenerator::LodLevelData::meshletVertices, and EngineCore::ClusterLodGenerator::LodLevelData::vertices.
Referenced by generate().