Convex

Engine/source/collision/convex.h

More...

Linked list management

linkAfter(Convex * next)

Insert this Convex after the provided convex.

Remove this Convex from the linked list.

Next item in linked list of Convexes.

Previous item in linked list of Convexes.

Private Attributes

Private Static Attributes

Protected Attributes

Objects we're testing against.

Object this Convex is built around.

Other convex testing against us.

Type of Convex this is.

Objects within our bounds.

Public Functions

Constructor.

Destructor.

Adds the provided Convex to the list of objects within the bounds of this Convex.

Clear out the working collision list of objects.

Runs through the linked list of Convex objects and removes the ones with no references.

findClosestState(const MatrixF & mat, const Point3F & scale, const F32 dontCareDist)

Finds the closest.

Returns the bounding box for the object this is built around in world space.

Returns the object space bounding box for the object this is built around transformed and scaled.

bool

This is used by the GJK collision in Vehicle.

Returns the object this Convex is built from.

Builds a collision poly list out of this convex.

Returns the scale of the object this is built around.

Returns the list of objects this object is testing against.

Returns the transform of the object this is built around.

Returns the type of this Convex.

Returns the list of objects currently inside the bounds of this Convex.

Deletes all convex objects in the list.

Registers another Convex by linking it after this one.

Render this convex for debugging purposes.

Render convex(s) for debugging purposes.

Returns the farthest point, along a vector, still bound by the convex.

updateStateList(const MatrixF & mat, const Point3F & scale, const Point3F * displacement)

Updates the CollisionStateList (mList) with new collision states and removing ones no longer under consideration.

Updates the working collision list of objects which are currently colliding with (inside the bounds of) this Convex.

Detailed Description

Linked list management

linkAfter(Convex * next)

Insert this Convex after the provided convex.

Parameters:

next

unlink()

Remove this Convex from the linked list.

Convex * mNext 

Next item in linked list of Convexes.

Convex * mPrev 

Previous item in linked list of Convexes.

Private Attributes

U32 mTag 

Private Static Attributes

U32 sTag 

Protected Attributes

CollisionStateList mList 

Objects we're testing against.

SceneObject * mObject 

Object this Convex is built around.

CollisionWorkingList mReference 

Other convex testing against us.

ConvexType mType 

Type of Convex this is.

CollisionWorkingList mWorking 

Objects within our bounds.

Public Functions

Convex()

Constructor.

~Convex()

Destructor.

addToWorkingList(Convex * ptr)

Adds the provided Convex to the list of objects within the bounds of this Convex.

Parameters:

ptr

Convex to add to the working list of this object

clearWorkingList()

Clear out the working collision list of objects.

collectGarbage()

Runs through the linked list of Convex objects and removes the ones with no references.

findClosestState(const MatrixF & mat, const Point3F & scale, const F32 dontCareDist)

Finds the closest.

getBoundingBox()

Returns the bounding box for the object this is built around in world space.

Reimplemented by: MeshRoadConvex, ForestConvex, ShapeBaseConvex, TSStaticPolysoupConvex, TerrainConvex

getBoundingBox(const MatrixF & mat, const Point3F & scale)

Returns the object space bounding box for the object this is built around transformed and scaled.

Parameters:

mat

Matrix to transform the object-space box by

scale

Scaling factor to scale the bounding box by

Reimplemented by: MeshRoadConvex, ForestConvex, ShapeBaseConvex, TSStaticPolysoupConvex, TerrainConvex

getCollisionInfo(const MatrixF & mat, const Point3F & scale, CollisionList * cList, F32 tol)

getFeatures(const MatrixF & mat, const VectorF & n, ConvexFeature * cf)

This is used by the GJK collision in Vehicle.

The Convex class should add verts, edges, and faces to the passed ConvexFeature that face towards the passed normal vector. Verts added in this way should also be transformed by the passed matrix. Parameters:

mat

Transform which should be applied to verts added to the ConvexFeature

n

Normal vector

cf

ConvexFeature to add data to.

Reimplemented by: BoxConvex, MeshRoadConvex, ForestConvex, ConvexShapeCollisionConvex, ShapeBaseConvex, TSStaticPolysoupConvex, TerrainConvex

getObject()

Returns the object this Convex is built from.

getPolyList(AbstractPolyList * list)

Builds a collision poly list out of this convex.

Parameters:

list

(Out) Poly list built

Reimplemented by: BoxConvex, MeshRoadConvex, ForestConvex, ConvexShapeCollisionConvex, ShapeBaseConvex, TSStaticPolysoupConvex, TerrainConvex

getScale()

Returns the scale of the object this is built around.

getStateList()

Returns the list of objects this object is testing against.

getTransform()

Returns the transform of the object this is built around.

Reimplemented by: OrthoBoxConvex, MeshRoadConvex, ForestConvex, ShapeBaseConvex

getType()

Returns the type of this Convex.

getWorkingList()

Returns the list of objects currently inside the bounds of this Convex.

nukeList()

Deletes all convex objects in the list.

registerObject(Convex * convex)

Registers another Convex by linking it after this one.

render()

Render this convex for debugging purposes.

renderWorkingList()

Render convex(s) for debugging purposes.

support(const VectorF & v)

Returns the farthest point, along a vector, still bound by the convex.

Parameters:

v

Vector

Reimplemented by: BoxConvex, ForestConvex, ShapeBaseConvex, TSStaticPolysoupConvex, TerrainConvex, MeshRoadConvex, ConvexShapeCollisionConvex

updateStateList(const MatrixF & mat, const Point3F & scale, const Point3F * displacement)

Updates the CollisionStateList (mList) with new collision states and removing ones no longer under consideration.

Parameters:

mat

Used as the matrix to create a bounding box for updating the list

scale

Used to scale the bounding box

displacement

Bounding box displacement (optional)

updateWorkingList(const Box3F & box, const U32 colMask)

Updates the working collision list of objects which are currently colliding with (inside the bounds of) this Convex.

Parameters:

box

Used as the bounding box.

colMask

Mask of objects to check against.