group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
MapLoader.hpp
Go to the documentation of this file.
1
17
18#pragma once
19
20#include "SweptCollision.hpp"
21
22#include <string>
23#include <vector>
24
25namespace physics
26{
27
29
36{
37 std::vector<Plane> planes;
38 std::vector<WorldAABB> boxes;
39 std::vector<WorldBrush> brushes;
40 std::vector<WorldCylinder> cylinders;
41 std::vector<WorldSphere> spheres;
42 std::vector<WorldTriMesh> triMeshes;
43
49 [[nodiscard]] WorldGeometry geometry() const
50 {
51 return {.planes = planes,
52 .boxes = boxes,
53 .brushes = brushes,
54 .cylinders = cylinders,
55 .spheres = spheres,
56 .triMeshes = triMeshes};
57 }
58};
59
61
64{
66 float scale = 1.0f;
67
72 std::string collisionCollection = "Collision";
73
78
82 bool addFloorPlane = false;
83
108
130};
131
133
148bool loadMapCollision(const std::string& path, MapCollisionData& out, const MapLoadOptions& opts = {});
149
171 const std::string& path, MapCollisionData& out, glm::vec3 position, float scale, bool decomposeNonConvex = false);
172
173} // namespace physics
Swept AABB and sphere collision queries against world geometry.
Pure physics math — no ECS types, no registry.
Definition MapLoader.cpp:51
bool loadMapCollision(const std::string &path, MapCollisionData &out, const MapLoadOptions &opts)
API.
Definition MapLoader.cpp:1232
bool loadPropCollision(const std::string &path, MapCollisionData &out, glm::vec3 position, float scale, bool decomposeNonConvex)
Load collision for a standalone prop GLB and append to existing collision data.
Definition MapLoader.cpp:1297
Collision data.
Definition MapLoader.hpp:36
std::vector< WorldTriMesh > triMeshes
Definition MapLoader.hpp:42
std::vector< WorldAABB > boxes
Definition MapLoader.hpp:38
std::vector< WorldSphere > spheres
Definition MapLoader.hpp:41
std::vector< WorldBrush > brushes
Definition MapLoader.hpp:39
std::vector< WorldCylinder > cylinders
Definition MapLoader.hpp:40
WorldGeometry geometry() const
Return a non-owning WorldGeometry view into this data.
Definition MapLoader.hpp:49
std::vector< Plane > planes
Definition MapLoader.hpp:37
Load options.
Definition MapLoader.hpp:64
bool guessShapesProcessed
In separated mode (allMeshesAreCollision = false), should the loader auto-detect/guess each collision...
Definition MapLoader.hpp:107
bool allMeshesAreCollision
When true, every mesh in the file is treated as both visual and collision geometry.
Definition MapLoader.hpp:77
std::string collisionCollection
Name of the Blender collection (= Assimp parent node) whose children are collision geometry.
Definition MapLoader.hpp:72
float scale
Uniform scale applied to every vertex position (e.g. 39.37 for m → in).
Definition MapLoader.hpp:66
bool addFloorPlane
When true, an infinite floor plane is added at the lowest Y coordinate found across all collision geo...
Definition MapLoader.hpp:82
bool decomposeNonConvex
In separated mode with shape-guessing on, when a collision mesh is non-convex (so it can't be a singl...
Definition MapLoader.hpp:129
All world collision geometry for one tick.
Definition SweptCollision.hpp:100