mirror of
https://github.com/tribes2/engine.git
synced 2026-01-20 03:34:48 +00:00
67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
//-----------------------------------------------------------------------------
|
|
// V12 Engine
|
|
//
|
|
// Copyright (c) 2001 GarageGames.Com
|
|
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#ifndef _COLLISION_H_
|
|
#define _COLLISION_H_
|
|
|
|
#ifndef _DATACHUNKER_H_
|
|
#include "Core/dataChunker.h"
|
|
#endif
|
|
#ifndef _MPLANE_H_
|
|
#include "Math/mPlane.h"
|
|
#endif
|
|
|
|
class SceneObject;
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
struct Collision
|
|
{
|
|
SceneObject* object;
|
|
Point3F point;
|
|
VectorF normal;
|
|
U32 material;
|
|
// Face and Face dot are currently only set by the extrudedPolyList
|
|
// clipper. Values are otherwise undefined.
|
|
U32 face; // Which face was hit
|
|
F32 faceDot; // -Dot of face with poly normal
|
|
F32 distance;
|
|
};
|
|
|
|
struct CollisionList
|
|
{
|
|
enum {
|
|
MaxCollisions = 64
|
|
};
|
|
int count;
|
|
Collision collision[MaxCollisions];
|
|
F32 t;
|
|
// MaxHeight is currently only set by the extrudedPolyList
|
|
// clipper. It represents the maximum vertex z value of
|
|
// the returned collision surfaces.
|
|
F32 maxHeight;
|
|
};
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
// BSP Collision tree
|
|
// Solid nodes are represented by structures with NULL frontNode and
|
|
// backNoide pointers. The material field is only valid on a solid node.
|
|
// There is no structure for empty nodes, frontNode or backNode
|
|
// should be set to NULL to represent empty half-spaces.
|
|
|
|
struct BSPNode
|
|
{
|
|
U32 material;
|
|
PlaneF plane;
|
|
BSPNode *frontNode, *backNode;
|
|
};
|
|
|
|
typedef Chunker<BSPNode> BSPTree;
|
|
|
|
#endif
|