Foundation
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
ModelViewer Namespace Reference

ModelViewer implementation. More...

Classes

class  App
 Model Viewer Application implementation. More...
 
struct  Camera
 
struct  Grid
 
struct  Instance
 
struct  MeshAllocation
 
struct  MeshLodAllocation
 
struct  MeshLodScratchBuffers
 
struct  MeshMeshlet
 Meshlet structure containing offsets and counts to access meshlet data. More...
 
struct  MeshScratchBuffers
 
struct  MeshVertex
 Full-size vertex structure for static meshes. More...
 
struct  MeshVertexCompact
 Compact 4-byte aligned vertex structure for static meshes. More...
 
class  Scene
 

Typedefs

using MeshIndex = uint32_t
 
using MeshMicroIndex = uint8_t
 
using SceneHandle = uint32_t
 

Functions

static voidmeshoptAlloc (size_t size)
 
static void meshoptFree (void *ptr)
 
template<typename Vertex , typename Index >
void optimizeVertexIndex (Vector< Vertex > &vertices, Vector< Index > &indices)
 
float meshGenerateLod (Vector< MeshIndex > &outIndices, Span< const MeshVertex > vertices, Span< const MeshIndex > indices, const float lodScale)
 Generate a simplified LOD mesh index buffer from the input mesh.
 
void meshBuildMeshlets (Vector< MeshMeshlet > &outMeshlet, Vector< MeshIndex > &outMeshletVertices, Vector< MeshMicroIndex > &outMeshletTriangles, Span< const MeshVertex > vertices, Span< const MeshIndex > indices)
 Build meshlets from a mesh.
 
void meshLoadObjFile (Vector< MeshVertex > &outVertex, Vector< MeshIndex > &outIndex, const Native::Path &path)
 Load a mesh from an OBJ file.
 
void drawGizmoCameraFrustum (mat4 viewProj, mat4 frustumViewProj, ImColor color, float lineThickness)
 
Tuple< ImVec2, ImVec2, ImDrawList * > getGizmoDrawOffsetRegionList ()
 
MeshScratchBuffers sceneMeshDataFromVertexIndex (Span< MeshVertex > vertices, Span< MeshIndex > indices, Allocator *allocator, int numLods=kMaxSceneMeshLodCount, bool buildMeshlets=true)
 

Variables

SceneHandle mesh
 
static DefaultAllocator MeshoptAllocator
 
constexpr uint32_t kMeshletMaxVertices = 64
 
constexpr uint32_t kMeshletMaxTriangles = 96
 
constexpr int kMaxSceneMeshLodCount = 4
 
constexpr uint32_t kSceneInvalid = ~0u
 

Detailed Description

ModelViewer implementation.

Typedef Documentation

◆ MeshIndex

◆ MeshMicroIndex

◆ SceneHandle

Function Documentation

◆ drawGizmoCameraFrustum()

IMGUI_API void ModelViewer::drawGizmoCameraFrustum ( mat4  viewProj,
mat4  frustumViewProj,
ImColor  color,
float  lineThickness 
)

◆ getGizmoDrawOffsetRegionList()

Tuple< ImVec2, ImVec2, ImDrawList * > ModelViewer::getGizmoDrawOffsetRegionList ( )
inline

◆ meshBuildMeshlets()

void ModelViewer::meshBuildMeshlets ( Vector< MeshMeshlet > &  outMeshlet,
Vector< MeshIndex > &  outMeshletVertices,
Vector< MeshMicroIndex > &  outMeshletTriangles,
Span< const MeshVertex vertices,
Span< const MeshIndex indices 
)

Build meshlets from a mesh.

Parameters
outMeshletOutput meshlet array
outMeshletVerticesOutput meshlet vertex indirection array
outMeshletTrianglesOutput meshlet triangle index array (into meshlet vertices)
verticesInput vertex array
indicesInput index array

◆ meshGenerateLod()

float ModelViewer::meshGenerateLod ( Vector< MeshIndex > &  outIndices,
Span< const MeshVertex vertices,
Span< const MeshIndex indices,
const float  lodScale 
)

Generate a simplified LOD mesh index buffer from the input mesh.

Parameters
outIndicesOutput index array for the LOD mesh
verticesInput vertex array
indicesInput source index array.
lodScaleScale factor for the LOD (0.0 - 1.0)
Returns
Error factor of this LOD to the input mesh

◆ meshLoadObjFile()

void ModelViewer::meshLoadObjFile ( Vector< MeshVertex > &  outVertex,
Vector< MeshIndex > &  outIndex,
const Native::Path path 
)

Load a mesh from an OBJ file.

Parameters
outVertexOutput vertex array
outIndexOutput index array
pathPath to the OBJ file

◆ meshoptAlloc()

static void * ModelViewer::meshoptAlloc ( size_t  size)
static

◆ meshoptFree()

static void ModelViewer::meshoptFree ( void ptr)
static

◆ optimizeVertexIndex()

template<typename Vertex , typename Index >
void ModelViewer::optimizeVertexIndex ( Vector< Vertex > &  vertices,
Vector< Index > &  indices 
)

◆ sceneMeshDataFromVertexIndex()

MeshScratchBuffers ModelViewer::sceneMeshDataFromVertexIndex ( Span< MeshVertex vertices,
Span< MeshIndex indices,
Allocator allocator,
int  numLods = kMaxSceneMeshLodCount,
bool  buildMeshlets = true 
)

Variable Documentation

◆ kMaxSceneMeshLodCount

constexpr int ModelViewer::kMaxSceneMeshLodCount = 4
constexpr

◆ kMeshletMaxTriangles

constexpr uint32_t ModelViewer::kMeshletMaxTriangles = 96
constexpr

◆ kMeshletMaxVertices

constexpr uint32_t ModelViewer::kMeshletMaxVertices = 64
constexpr

◆ kSceneInvalid

constexpr uint32_t ModelViewer::kSceneInvalid = ~0u
constexpr

◆ mesh

SceneHandle ModelViewer::mesh

◆ MeshoptAllocator

DefaultAllocator ModelViewer::MeshoptAllocator
static