#include <OPC_Model.h>
Public Member Functions | |
Model () | |
override (BaseModel) bool Build(const OPCODECREATE &create) | |
override (BaseModel) udword GetUsedBytes() const | |
virtual | ~Model () |
Private Member Functions | |
void | Release () |
The main collision wrapper, for all trees. Supported trees are:
Usage:
1) Create a static mesh interface using callbacks or pointers. (see OPC_MeshInterface.cpp). Keep it around in your app, since a pointer to this interface is saved internally and used until you release the collision structures.
2) Build a Model using a creation structure:
Model Sample; OPCODECREATE OPCC; OPCC.IMesh = ...; OPCC.Rules = ...; OPCC.NoLeaf = ...; OPCC.Quantized = ...; OPCC.KeepOriginal = ...; bool Status = Sample.Build(OPCC);
3) Create a tree collider and set it up:
AABBTreeCollider TC; TC.SetFirstContact(...); TC.SetFullBoxBoxTest(...); TC.SetFullPrimBoxTest(...); TC.SetTemporalCoherence(...);
4) Perform a collision query
// Setup cache static BVTCache ColCache; ColCache.Model0 = &Model0; ColCache.Model1 = &Model1; // Collision query bool IsOk = TC.Collide(ColCache, World0, World1); // Get collision status => if true, objects overlap BOOL Status = TC.GetContactStatus(); // Number of colliding pairs and list of pairs udword NbPairs = TC.GetNbPairs(); const Pair* p = TC.GetPairs()
5) Stats
Model0.GetUsedBytes() = number of bytes used for this collision tree TC.GetNbBVBVTests() = number of BV-BV overlap tests performed during last query TC.GetNbPrimPrimTests() = number of Triangle-Triangle overlap tests performed during last query TC.GetNbBVPrimTests() = number of Triangle-BV overlap tests performed during last query
Definition at line 23 of file OPC_Model.h.
Model::Model | ( | ) |
virtual Model::~Model | ( | ) | [virtual] |
Model::override | ( | BaseModel | ) | const |
Builds a collision model.
create | [in] model creation structure |
Model::override | ( | BaseModel | ) | const |
Gets the number of bytes used by the tree.
void Model::Release | ( | ) | [private] |