group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
TriMeshCollision.hpp File Reference

Triangle-mesh collision with BVH acceleration and seam welding. More...

#include "SweptCollision.hpp"
#include <cstdint>
#include <glm/glm.hpp>
Include dependency graph for TriMeshCollision.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  physics::TriMeshValidationReport
 Map-cooking validation counters for authored collision triangle meshes. More...
struct  physics::TriMeshValidationTotals
 Aggregate validation counters across a whole authored collision set. More...
struct  physics::TriMeshCookStats
 Runtime/cook summary for authored static collision triangle meshes. More...
struct  physics::ClosestPointOnMeshResult
 Result of a closest-point-on-mesh query. More...

Namespaces

namespace  physics
 Pure physics math — no ECS types, no registry.

Enumerations

enum class  physics::TriRegion : uint8_t {
  physics::Face = 0 , physics::Edge0 = 1 , physics::Edge1 = 2 , physics::Edge2 = 3 ,
  physics::Vert0 = 4 , physics::Vert1 = 5 , physics::Vert2 = 6
}
 Voronoi region of a triangle. More...

Functions

void physics::buildTriMeshBVH (WorldTriMesh &mesh)
 Build the BVH for a WorldTriMesh.
void physics::weldTriMesh (WorldTriMesh &mesh, float coplanarTolerance=0.0349065850f)
 Compute face normals + active edge / vertex flags for a triangle mesh.
TriMeshValidationReport physics::validateTriMesh (const WorldTriMesh &mesh, float positionEpsilon=1e-4f)
 Validate authored collision mesh topology before/after cooking.
TriMeshValidationTotals physics::validateTriMeshes (std::span< const WorldTriMesh > meshes, float positionEpsilon=1e-4f)
 Validate every triangle mesh in an authored collision set.
TriMeshCookStats physics::collectTriMeshCookStats (std::span< const WorldTriMesh > meshes)
 Collect aggregate map-cooking diagnostics for already-cooked meshes.
HitResult physics::sweepAABBvsTriMesh (glm::vec3 halfExtents, glm::vec3 start, glm::vec3 end, const WorldTriMesh &mesh)
 Sweep an AABB against a triangle mesh using Voronoi-clipped per-triangle tests.
void physics::depenetrateAABBvsTriMesh (glm::vec3 &pos, glm::vec3 &vel, glm::vec3 halfExtents, const WorldTriMesh &mesh, float pushback=0.03125f)
 Push an AABB out of a triangle mesh using Voronoi-clipped face-normal MTVs.
HitResult physics::sweepCapsuleVsTriMesh (CapsuleShape capsule, glm::vec3 start, glm::vec3 end, const WorldTriMesh &mesh)
 Sweep a capsule against a triangle mesh.
DepenContact physics::deepestCapsuleContactVsTriMesh (CapsuleShape capsule, glm::vec3 pos, glm::vec3 vel, const WorldTriMesh &mesh)
 Single deepest surface contact of a capsule against any triangle in this mesh.
ClosestPointOnMeshResult physics::closestPointOnMesh (glm::vec3 segA, glm::vec3 segB, float maxDist, const WorldTriMesh &mesh)
 Find the closest point on the mesh's surface to a query segment, considering only points within maxDist.
ClosestPointOnMeshResult physics::closestPointOnMesh (CapsuleShape capsule, glm::vec3 center, float maxDist, const WorldTriMesh &mesh)
 Convenience overload — uses the capsule's inner axis as the query segment at the given centre position.
ClosestPointOnMeshResult physics::closestPointOnMeshTriangle (CapsuleShape capsule, glm::vec3 center, float maxDist, const WorldTriMesh &mesh, uint32_t triId)
 Closest point from a capsule axis to one specific cooked triangle.
ClearanceResult physics::clearanceCapsuleVsTriMesh (CapsuleShape capsule, glm::vec3 pos, float maxReach, const WorldTriMesh &mesh)
 Capsule-vs-trimesh clearance.
GroundProbeResult physics::groundProbeCapsuleVsTriMesh (CapsuleShape capsule, glm::vec3 pos, float maxDistance, float minWalkableDot, const WorldTriMesh &mesh)
 Downward ground probe against walkable triangle faces only.

Detailed Description

Triangle-mesh collision with BVH acceleration and seam welding.

Provides a BVH builder + welding pass (called once at load time) and swept-AABB / capsule-surface queries against triangle meshes. The BVH is a flat-array binary tree where each leaf holds up to 4 triangles. Welding data stabilizes seams for AABB/dev paths and exposes adjacency for systems such as wallrun surface tracking.