vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
support.h
1#pragma once
2
3#include <cstdint>
4
5#include <glm/glm.hpp>
6
7#include "system/physics/collision/narrowphase.h"
8
9namespace Vkm::Engine {
10
18 enum class Kind : uint8_t {
22 };
23
24 Kind kind = Kind::Box;
25
26 glm::vec3 center = {0.0f, 0.0f, 0.0f};
27 glm::vec3 axes[3] = {{1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}};
28 glm::vec3 halfExtents = {0.5f, 0.5f, 0.5f};
29
30 glm::vec3 a = {0.0f, 0.0f, 0.0f};
31 glm::vec3 b = {0.0f, 0.0f, 0.0f};
32 float radius = 0.0f;
33
34 const glm::vec3* points = nullptr;
35 uint32_t count = 0;
36};
37
44SupportShape supportOf(const BoxShape& box);
45
52SupportShape supportOf(const CapsuleShape& capsule);
53
63SupportShape supportOfPoints(const glm::vec3* points, uint32_t count);
64
72glm::vec3 support(const SupportShape& shape, const glm::vec3& direction);
73
74} // namespace Vkm::Engine
An oriented box in world space: centre, three unit axes, half extents.
Definition narrowphase.h:17
A capsule in world space: a segment swept by a radius.
Definition narrowphase.h:29
A convex shape reduced to the one question GJK asks: its furthest point along a direction.
Definition support.h:17
Kind
Definition support.h:18
@ Box
Reads centre + axes + halfExtents.
Definition support.h:19
@ Capsule
Reads a + b + radius; a == b is a sphere.
Definition support.h:20
@ Points
Reads points + count, already in world space.
Definition support.h:21