group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
physics::WorldTriMesh Struct Reference

A triangle mesh with BVH acceleration for collision queries. More...

#include <SweptCollision.hpp>

Public Attributes

std::vector< glm::vec3 > vertices
 All vertex positions (world space, scaled).
std::vector< uint32_t > indices
 Triangle indices (3 per triangle).
std::vector< BVHNodebvhNodes
 Flat BVH node array.
std::vector< uint32_t > triIndices
 Permutation: BVH leaf ranges → triangle indices.
glm::vec3 boundsMin {0.0f}
 Whole-mesh AABB min.
glm::vec3 boundsMax {0.0f}
 Whole-mesh AABB max.
std::vector< glm::vec3 > faceNormals
 CCW face normal (unit length) per triangle.
std::vector< uint8_t > edgeActive
 Bit i set ⇔ edge i of this triangle is an active (boundary or convex) edge.
std::vector< uint8_t > vertActive
 Bit i set ⇔ vertex i of this triangle is touched by an active edge.
std::vector< uint32_t > edgeNeighbor
 Phase B — edge → neighbour triangle adjacency.
std::vector< uint8_t > triangleMaterials
 One SurfaceType index per triangle (empty = use default).
SurfaceType defaultSurface = SurfaceType::Concrete
 Fallback for triangles without per-face material data.

Detailed Description

A triangle mesh with BVH acceleration for collision queries.

Built once at load time via buildTriMeshBVH(). The BVH is a flat array binary tree; leaves hold up to 4 triangles. triIndices is a permutation array mapping BVH leaf ranges to triangle indices in indices.

Phase 2 welding data (faceNormals, edgeActive, vertActive): produced by weldTriMesh() after buildTriMeshBVH(). Per-triangle edgeActive bits mark genuine boundary edges; vertActive marks corners touched by an active edge. Internal edges (welded coplanar / concave edges shared between adjacent triangles) are cleared for legacy AABB contact clipping. Capsule queries use bounded triangle closest points directly and keep these arrays as adjacency / feature metadata for traversal systems.

Member Data Documentation

◆ boundsMax

glm::vec3 physics::WorldTriMesh::boundsMax {0.0f}

Whole-mesh AABB max.

◆ boundsMin

glm::vec3 physics::WorldTriMesh::boundsMin {0.0f}

Whole-mesh AABB min.

◆ bvhNodes

std::vector<BVHNode> physics::WorldTriMesh::bvhNodes

Flat BVH node array.

◆ defaultSurface

SurfaceType physics::WorldTriMesh::defaultSurface = SurfaceType::Concrete

Fallback for triangles without per-face material data.

◆ edgeActive

std::vector<uint8_t> physics::WorldTriMesh::edgeActive

Bit i set ⇔ edge i of this triangle is an active (boundary or convex) edge.

◆ edgeNeighbor

std::vector<uint32_t> physics::WorldTriMesh::edgeNeighbor

Phase B — edge → neighbour triangle adjacency.

Three entries per triangle, one per edge: edgeNeighbor[3*t + e] is the triangle index of the triangle sharing edge e of triangle t, or UINT32_MAX for boundary edges (no neighbour) and non-manifold edges (more than two incident triangles).

Populated by weldTriMesh() as a side-product of the existing per-edge classification pass. Consumed by:

  • sweepCapsuleVsTriangle for the welded-coplanar contact-normal swap (Phase B), and
  • Phase D wallrun edge traversal, which walks the surface manifold by hopping between neighbouring triangles at edge crossings.

◆ faceNormals

std::vector<glm::vec3> physics::WorldTriMesh::faceNormals

CCW face normal (unit length) per triangle.

◆ indices

std::vector<uint32_t> physics::WorldTriMesh::indices

Triangle indices (3 per triangle).

◆ triangleMaterials

std::vector<uint8_t> physics::WorldTriMesh::triangleMaterials

One SurfaceType index per triangle (empty = use default).

◆ triIndices

std::vector<uint32_t> physics::WorldTriMesh::triIndices

Permutation: BVH leaf ranges → triangle indices.

◆ vertActive

std::vector<uint8_t> physics::WorldTriMesh::vertActive

Bit i set ⇔ vertex i of this triangle is touched by an active edge.

◆ vertices

std::vector<glm::vec3> physics::WorldTriMesh::vertices

All vertex positions (world space, scaled).


The documentation for this struct was generated from the following file: