#include <OPC_HybridModel.h>
Public Member Functions | |
const inline_ udword * | GetIndices () const |
const inline_ LeafTriangles * | GetLeafTriangles () const |
HybridModel () | |
override (BaseModel) bool Build(const OPCODECREATE &create) | |
override (BaseModel) bool Refit() | |
override (BaseModel) udword GetUsedBytes() const | |
virtual | ~HybridModel () |
Public Member Functions inherited from BaseModel | |
BaseModel () | |
virtual bool | Build (const OPCODECREATE &create)=0 |
const inline_ MeshInterface * | GetMeshInterface () const |
inline_ udword | GetModelCode () const |
inline_ udword | GetNbNodes () const |
const inline_ AABBTree * | GetSourceTree () const |
inline_ AABBOptimizedTree * | GetTree () |
const inline_ AABBOptimizedTree * | GetTree () const |
virtual udword | GetUsedBytes () const =0 |
inline_ BOOL | HasLeafNodes () const |
inline_ BOOL | HasSingleNode () const |
inline_ BOOL | IsQuantized () const |
virtual bool | Refit () |
inline_ void | SetMeshInterface (const MeshInterface *imesh) |
virtual | ~BaseModel () |
Private Member Functions | |
void | Release () |
Private Attributes | |
udword * | mIndices |
Array of primitive indices. More... | |
udword | mNbLeaves |
Number of leaf nodes in the model. More... | |
udword | mNbPrimitives |
Number of primitives in the model. More... | |
LeafTriangles * | mTriangles |
Array of mNbLeaves leaf descriptors. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from BaseModel | |
bool | CreateTree (bool no_leaf, bool quantized) |
void | ReleaseBase () |
Protected Attributes inherited from BaseModel | |
const MeshInterface * | mIMesh |
User-defined mesh interface. More... | |
udword | mModelCode |
Model code = combination of ModelFlag(s) More... | |
AABBTree * | mSource |
Original source tree. More... | |
AABBOptimizedTree * | mTree |
Optimized tree owned by the model. More... | |
An hybrid collision model.
The problem :
Opcode really shines for mesh-mesh collision, especially when meshes are deeply overlapping (it typically outperforms RAPID in those cases).
Unfortunately this is not the typical scenario in games.
For close-proximity cases, especially for volume-mesh queries, it's relatively easy to run faster than Opcode, that suffers from a relatively high setup time.
In particular, Opcode's "vanilla" trees in those cases -can- run faster. They can also use -less- memory than the optimized ones, when you let the system stop at ~10 triangles / leaf for example (i.e. when you don't use "complete" trees). However, those trees tend to fragment memory quite a lot, increasing cache misses : since they're not "complete", we can't predict the final number of nodes and we have to allocate nodes on-the-fly. For the same reasons we can't use Opcode's "optimized" trees here, since they rely on a known layout to perform the "optimization".
Hybrid trees :
Hybrid trees try to combine best of both worlds :
All of that is wrapped in this "hybrid model" that contains the minimal data required for this to work. It's a mix between old "vanilla" trees, and old "optimized" trees.
Extra advantages:
Information to take home:
Definition at line 46 of file OPC_HybridModel.h.
HybridModel::HybridModel | ( | ) |
Constructor.
Definition at line 94 of file OPC_HybridModel.cpp.
|
virtual |
Destructor.
Definition at line 107 of file OPC_HybridModel.cpp.
|
inline |
HybridModel::override | ( | BaseModel | ) | const & |
Builds a collision model.
create | [in] model creation structure |
HybridModel::override | ( | BaseModel | ) |
Refits the collision model. This can be used to handle dynamic meshes. Usage is:
HybridModel::override | ( | BaseModel | ) | const |
Gets the number of bytes used by the tree.
|
private |
Releases everything.
Definition at line 117 of file OPC_HybridModel.cpp.
|
private |
Array of primitive indices.
Definition at line 100 of file OPC_HybridModel.h.
|
private |
Number of leaf nodes in the model.
Definition at line 97 of file OPC_HybridModel.h.
|
private |
Number of primitives in the model.
Definition at line 99 of file OPC_HybridModel.h.
|
private |
Array of mNbLeaves leaf descriptors.
Definition at line 98 of file OPC_HybridModel.h.