group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
DebugCollisionDraw.hpp
Go to the documentation of this file.
1
17
18#pragma once
19
20#include <cstdint>
21#include <glm/vec3.hpp>
22#include <span>
23
24namespace physics::debug
25{
26
44
50struct Contact
51{
52 glm::vec3 point{0.0f};
53 glm::vec3 normal{0.0f};
54 float depth = 0.0f;
56 uint32_t primitiveIndex = 0;
57};
58
61void pushContact(const Contact& c) noexcept;
62
64void pushSweepContact(glm::vec3 point, glm::vec3 normal, ContactSource source, uint32_t primitiveIndex = 0) noexcept;
65
68 glm::vec3 point, glm::vec3 normal, float depth, ContactSource source, uint32_t primitiveIndex = 0) noexcept;
69
72void setEnabled(bool on) noexcept;
73
75[[nodiscard]] bool isEnabled() noexcept;
76
81void beginFrame() noexcept;
82
85[[nodiscard]] std::span<const Contact> contacts() noexcept;
86
87} // namespace physics::debug
Definition DebugCollisionDraw.cpp:11
void pushSweepContact(glm::vec3 point, glm::vec3 normal, ContactSource source, uint32_t primitiveIndex) noexcept
Convenience overload for non-depenetration (sweep) contacts.
Definition DebugCollisionDraw.cpp:79
void beginFrame() noexcept
Drain all thread-local buffers into the front buffer and clear them.
Definition DebugCollisionDraw.cpp:116
ContactSource
Source of a recorded contact, for filter / colour in the overlay.
Definition DebugCollisionDraw.hpp:29
@ TriMeshDepen
Depenetration push from a triangle MTV contribution.
Definition DebugCollisionDraw.hpp:41
@ BrushDepen
Depenetration push out of brush.
Definition DebugCollisionDraw.hpp:38
@ CylinderDepen
Depenetration push out of cylinder.
Definition DebugCollisionDraw.hpp:39
@ BoxSweep
Swept-AABB hit on a static AABB.
Definition DebugCollisionDraw.hpp:31
@ PlaneDepen
Depenetration push out of plane overlap.
Definition DebugCollisionDraw.hpp:36
@ BrushSweep
Swept-AABB hit on a convex brush.
Definition DebugCollisionDraw.hpp:32
@ BoxDepen
Depenetration push out of static AABB.
Definition DebugCollisionDraw.hpp:37
@ SphereDepen
Depenetration push out of sphere.
Definition DebugCollisionDraw.hpp:40
@ PlaneSweep
Swept-AABB hit on an infinite plane.
Definition DebugCollisionDraw.hpp:30
@ TriMeshSweep
Swept-AABB hit on a triangle (mesh).
Definition DebugCollisionDraw.hpp:35
@ SphereSweep
Swept-AABB hit on a sphere.
Definition DebugCollisionDraw.hpp:34
@ Count
Definition DebugCollisionDraw.hpp:42
@ CylinderSweep
Swept-AABB hit on a vertical cylinder.
Definition DebugCollisionDraw.hpp:33
bool isEnabled() noexcept
Query the recording flag. Internal fast-path predicate.
Definition DebugCollisionDraw.cpp:111
void setEnabled(bool on) noexcept
Enable / disable recording.
Definition DebugCollisionDraw.cpp:106
std::span< const Contact > contacts() noexcept
Snapshot of all contacts pushed since the last beginFrame().
Definition DebugCollisionDraw.cpp:132
void pushContact(const Contact &c) noexcept
Push a contact event.
Definition DebugCollisionDraw.cpp:72
void pushDepenContact(glm::vec3 point, glm::vec3 normal, float depth, ContactSource source, uint32_t primitiveIndex) noexcept
Convenience overload for depenetration contacts (with depth).
Definition DebugCollisionDraw.cpp:92
A single recorded contact event.
Definition DebugCollisionDraw.hpp:51
glm::vec3 normal
Unit surface normal pointing into free space.
Definition DebugCollisionDraw.hpp:53
glm::vec3 point
World-space contact point.
Definition DebugCollisionDraw.hpp:52
float depth
Depenetration depth (0 for sweep hits).
Definition DebugCollisionDraw.hpp:54
uint32_t primitiveIndex
Source-primitive index (e.g. triangle id, box id).
Definition DebugCollisionDraw.hpp:56
ContactSource source
Origin classification (for filtering/colouring).
Definition DebugCollisionDraw.hpp:55