7 #ifndef CAFU_CLIPSYS_COLLISION_MODEL_STATIC_HPP_INCLUDED
8 #define CAFU_CLIPSYS_COLLISION_MODEL_STATIC_HPP_INCLUDED
10 #include "CollisionModel_base.hpp"
11 #include "Templates/Array.hpp"
12 #include "Templates/Pool.hpp"
15 namespace cf {
struct MapFileEntityT; }
44 bool IsTriangle()
const {
return Vertices[3] == 0xFFFFFFFF; }
89 void CacheHullVerts()
const;
90 void CacheHullEdges()
const;
237 const double MAP_ROUND_EPSILON,
const double MAP_MIN_VERTEX_DIST,
const double BP_MAX_CURVE_ERROR,
const double BP_MAX_CURVE_LENGTH,
const double MIN_NODE_SIZE);
251 unsigned long GetContents(
const Vector3dT& Point,
double BoxRadius,
unsigned long ContMask)
const override;
260 static unsigned long s_CheckCount;
266 void BuildAxialBSPTree(
NodeT* Node,
const BoundingBox3dT& NodeBB,
const double MIN_NODE_SIZE);
277 unsigned long m_Contents;
282 bool m_GenericBrushes;
unsigned long NrOfHullEdges
The number of unique edges (or rather, edge indices).
Definition: CollisionModel_static.hpp:117
PolygonT()
The default constructor.
Definition: CollisionModel_static.cpp:104
ArrayT< const BrushT * > Brushes
The list of brushes in this node (brushes are both for traces and contents tests).
Definition: CollisionModel_static.hpp:207
CollisionModelStaticT(std::istream &InFile, cf::SceneGraph::aux::PoolT &Pool, const ArrayT< TerrainRefT > &Terrains)
Constructor for creating a collision model by loading it from a file.
Definition: CollisionModel_static.cpp:1341
This class represents terrains, offering methods for LoD rendering and collision detection.
Definition: Terrain.hpp:17
unsigned long NrOfHullVerts
The number of unique vertices (or rather, vertex indices).
Definition: CollisionModel_static.hpp:115
BrushT()
The default constructor.
Definition: CollisionModel_static.cpp:324
This class represents a solid object that can be traced through collision worlds, models and shapes...
Definition: TraceSolid.hpp:30
PlaneTypeE
As the nodes of an octree are not subdivided by arbitrary planes, but only by planes that are paralle...
Definition: CollisionModel_static.hpp:144
This class describes a brush (convex polyhedron) within a CollisionModelStaticT collision shape...
Definition: CollisionModel_static.hpp:67
btCollisionShape * GetBulletAdapter() const override
Returns an adapter class for using CollisionModelT instances also as Bullet btCollisionShape instance...
Definition: CollisionModel_static.cpp:2244
unsigned long Contents
The contents of this brush.
Definition: CollisionModel_static.hpp:109
BoundingBox3dT BB
The bounding box of this terrain.
Definition: CollisionModel_static.hpp:131
Definition: MapFile.hpp:145
NodeT * Parent
The parent of this node, NULL if this is the root node.
Definition: CollisionModel_static.hpp:204
BoundingBox3dT GetBB() const
Returns the bounding box of all contents (polygons, brushes, terrains) of this node.
Definition: CollisionModel_static.cpp:852
unsigned long CheckCount
Used in order to avoid processing things twice.
Definition: CollisionModel_static.hpp:110
No plane at all. Used for nodes that are actually leaves.
Definition: CollisionModel_static.hpp:146
MaterialT * Material
The material of this side of the brush.
Definition: CollisionModel_static.hpp:76
Plane3dT Plane
The plane of this side of the brush.
Definition: CollisionModel_static.hpp:73
unsigned long NrOfSides
How many sides the brush has.
Definition: CollisionModel_static.hpp:106
Definition: CollisionModel_static.hpp:33
MaterialT * Material
The material on the surface of this polygon.
Definition: CollisionModel_static.hpp:55
unsigned long * HullVerts
The union of the vertex indices of the sides of this brush (i.e. the unique vertices whose convex hul...
Definition: CollisionModel_static.hpp:114
void TraceConvexSolid(const TraceSolidT &TraceSolid, const Vector3dT &Start, const Vector3dT &Ray, unsigned long ClipMask, TraceResultT &Result) const override
Traces the given TraceSolidT instance from Start along Ray (up to the input value of Result...
Definition: CollisionModel_static.cpp:2172
void SaveToFile(std::ostream &OutFile, SceneGraph::aux::PoolT &Pool) const override
Saves the model to OutFile.
Definition: CollisionModel_static.cpp:2044
This class represents a surface material ("A datastructural representation of a scripts material def...
Definition: Material.hpp:22
~CollisionModelStaticT()
The destructor.
Definition: CollisionModel_static.cpp:2023
unsigned long CheckCount
Used in order to avoid processing things twice.
Definition: CollisionModel_static.hpp:132
void Trace(const Vector3dT &A, const Vector3dT &B, double FracA, double FracB, const TraceParamsT &Params) const
Traces an object along a line segment through the tree that is rooted at this node.
Definition: CollisionModel_static.cpp:1063
unsigned long B
Index of the second vertex of this edge.
Definition: CollisionModel_static.hpp:82
This class provides an adapter for CollisionModelStaticT instances to be used as btConcaveShape insta...
Definition: CollisionModel_static_BulletAdapter.hpp:25
unsigned long Vertices[4]
The indices of the vertices that define the triangle or quad, respectively, referring into the m_Vert...
Definition: CollisionModel_static.hpp:54
unsigned long GetContents() const override
Returns the contents of this collision model.
Definition: CollisionModel_static.cpp:2038
bool IntersectsAllChildren(const BoundingBox3dT &BB) const
Determines whether the given BB intersects (is partly inside) each child of this node.
Definition: CollisionModel_static.cpp:905
This class describes the result of tracing an object (a ray, a bounding-box, or a convex solid) throu...
Definition: TraceResult.hpp:36
This representation of a TraceSolidT is used in the implementation of CollisionModelStaticT as a perf...
Definition: CollisionModel_static.cpp:40
ArrayT< const TerrainRefT * > Terrains
The list of terrains in this node (used for traces, never for contents tests).
Definition: CollisionModel_static.hpp:208
This is the base class for collision models, defining their common interface.
Definition: CollisionModel_base.hpp:29
This class represents a static collision model.
Definition: CollisionModel_static.hpp:25
unsigned long CheckCount
Used in order to avoid processing things twice.
Definition: CollisionModel_static.hpp:56
Definition: CollisionModel_static.cpp:78
const TerrainT * Terrain
The pointer to the actual terrain instance this class is referring to. The instances are kept "outsid...
Definition: CollisionModel_static.hpp:129
NodeT()
The default constructor.
Definition: CollisionModel_static.hpp:155
void Insert(const PolygonT *Poly)
Recursively inserts the given polygon into the (sub-)tree at and below this node. ...
Definition: CollisionModel_static.cpp:1208
Definition: CollisionModel_static.hpp:79
NodeT * Children[2]
The children of this node at each side of the plane (NULL if there is no plane / the node is a leaf)...
Definition: CollisionModel_static.hpp:205
PlaneTypeE PlaneType
The type of the plane that subdivides this node (no plane at all, normal vector along the x-...
Definition: CollisionModel_static.hpp:202
SideT * Sides
The sides of the brush (i.e. the planes whose intersection forms the brush). This points into Parent-...
Definition: CollisionModel_static.hpp:105
EdgeT * HullEdges
The unique edges of this brush (e.g. edge <A, B> is not stored again as edge <B, A>).
Definition: CollisionModel_static.hpp:116
A plane with normal vector (0, 0, 1), parallel to the x- and y-axis.
Definition: CollisionModel_static.hpp:149
unsigned long GetContents() const
Returns the contents (the union of the contents of all polygons, brushes and terrains) of this node...
Definition: CollisionModel_static.cpp:884
double PlaneDist
The distance of the plane to the origin. Corresponds to the Plane3fT::Dist member in a full plane...
Definition: CollisionModel_static.hpp:203
A plane with normal vector (1, 0, 0), parallel to the y- and z-axis.
Definition: CollisionModel_static.hpp:147
BoundingBox3dT GetBoundingBox() const override
Returns the bounding box of this collision model.
Definition: CollisionModel_static.cpp:2032
unsigned long NrOfVertices
The number of vertices (or rather, vertex indices).
Definition: CollisionModel_static.hpp:75
bool DetermineSplitPlane(const BoundingBox3dT &NodeBB, const double MIN_NODE_SIZE)
Determines an axis-aligned split plane for further BSP partitioning of the contents of this node...
Definition: CollisionModel_static.cpp:920
MaterialT * Material
The material on the surface of this terrain.
Definition: CollisionModel_static.hpp:130
unsigned long A
Index of the first vertex of this edge.
Definition: CollisionModel_static.hpp:81
This class manages memory for a pool of objects.
Definition: Pool.hpp:19
Definition: CollisionModel_static.hpp:136
unsigned long * Vertices
The vertex indices of this polygon, in clockwise (CW) order (same as in Polygon3T<T>). Vertices itself points into Parent->m_BrushSideVIs, which in turn gives indices into Parent->m_Vertices.
Definition: CollisionModel_static.hpp:74
Definition: Renderer.hpp:16
ArrayT< const PolygonT * > Polygons
The list of polygons in this node (used for traces, never for contents tests).
Definition: CollisionModel_static.hpp:206
Definition: CollisionModel_static.hpp:71
BoundingBox3dT BB
The bounding box (of the vertices) of this brush.
Definition: CollisionModel_static.hpp:108
void TraceConvexSolid(const InternalTraceSolidT &TraceSolid, const Vector3dT &Start, const Vector3dT &Ray, unsigned long ClipMask, TraceResultT &Result) const
Traces the given convex polyhedron from Start along Ray (up to the input value of Result...
Definition: CollisionModel_static.cpp:424
A plane with normal vector (0, 1, 0), parallel to the x- and z-axis.
Definition: CollisionModel_static.hpp:148
Definition: CollisionModel_static.hpp:121