Public Member Functions | Private Member Functions | List of all members
Model Class Reference

#include <OPC_Model.h>

Inheritance diagram for Model:
Inheritance graph
[legend]

Public Member Functions

 Model ()
 
 override (BaseModel) bool Build(const OPCODECREATE &create)
 
 override (BaseModel) udword GetUsedBytes() const
 
virtual ~Model ()
 
- Public Member Functions inherited from BaseModel
 BaseModel ()
 
virtual bool Build (const OPCODECREATE &create)=0
 
const inline_ MeshInterfaceGetMeshInterface () const
 
inline_ udword GetModelCode () const
 
inline_ udword GetNbNodes () const
 
const inline_ AABBTreeGetSourceTree () const
 
inline_ AABBOptimizedTreeGetTree ()
 
const inline_ AABBOptimizedTreeGetTree () 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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from BaseModel
bool CreateTree (bool no_leaf, bool quantized)
 
void ReleaseBase ()
 
- Protected Attributes inherited from BaseModel
const MeshInterfacemIMesh
 User-defined mesh interface. More...
 
udword mModelCode
 Model code = combination of ModelFlag(s) More...
 
AABBTreemSource
 Original source tree. More...
 
AABBOptimizedTreemTree
 Optimized tree owned by the model. More...
 

Detailed Description

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;
OPCC.IMesh = ...;
OPCC.Rules = ...;
OPCC.NoLeaf = ...;
OPCC.Quantized = ...;
OPCC.KeepOriginal = ...;
bool Status = Sample.Build(OPCC);

3) Create a tree collider and set it up:

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
Author
Pierre Terdiman
Version
1.3
Date
March, 20, 2001

Definition at line 23 of file OPC_Model.h.

Constructor & Destructor Documentation

◆ Model()

Model::Model ( )

Constructor.

Definition at line 102 of file OPC_Model.cpp.

◆ ~Model()

Model::~Model ( )
virtual

Destructor.

Definition at line 114 of file OPC_Model.cpp.

Member Function Documentation

◆ override() [1/2]

Model::override ( BaseModel  ) const &

Builds a collision model.

Parameters
create[in] model creation structure
Returns
true if success

◆ override() [2/2]

Model::override ( BaseModel  ) const

Gets the number of bytes used by the tree.

Returns
amount of bytes used

◆ Release()

void Model::Release ( )
private

Releases the model.

Definition at line 124 of file OPC_Model.cpp.


The documentation for this class was generated from the following files:
Pair
A generic couple structure.
Definition: IcePairs.h:16
Triangle
Definition: IceTriangle.h:30
BaseModel::Build
virtual bool Build(const OPCODECREATE &create)=0
AABBTreeCollider::GetNbBVBVTests
inline_ udword GetNbBVBVTests() const
Definition: OPC_TreeCollider.h:135
AABBTreeCollider::Collide
bool Collide(BVTCache &cache, const Matrix4x4 *world0=null, const Matrix4x4 *world1=null)
Definition: OPC_TreeCollider.cpp:97
udword
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
Collider::SetTemporalCoherence
inline_ void SetTemporalCoherence(bool flag)
Definition: OPC_Collider.h:118
BOOL
int BOOL
Another boolean type.
Definition: IceTypes.h:102
OPCODECREATE
Model creation structure.
Definition: OPC_BaseModel.h:24
AABBTreeCollider::GetNbPrimPrimTests
inline_ udword GetNbPrimPrimTests() const
Definition: OPC_TreeCollider.h:145
BVTCache::Model0
const Model * Model0
Model for first object.
Definition: OPC_TreeCollider.h:60
Model
Definition: OPC_Model.h:23
AABBTreeCollider::SetFullPrimBoxTest
inline_ void SetFullPrimBoxTest(bool flag)
Definition: OPC_TreeCollider.h:123
Collider::SetFirstContact
inline_ void SetFirstContact(bool flag)
Definition: OPC_Collider.h:104
Collider::GetContactStatus
inline_ BOOL GetContactStatus() const
Definition: OPC_Collider.h:52
AABBTreeCollider::SetFullBoxBoxTest
inline_ void SetFullBoxBoxTest(bool flag)
Definition: OPC_TreeCollider.h:114
AABBTreeCollider::GetNbPairs
inline_ udword GetNbPairs() const
Definition: OPC_TreeCollider.h:167
AABBTreeCollider::GetNbBVPrimTests
inline_ udword GetNbBVPrimTests() const
Definition: OPC_TreeCollider.h:155
AABBTreeCollider::GetPairs
const inline_ Pair * GetPairs() const
Definition: OPC_TreeCollider.h:177
AABBTreeCollider
Definition: OPC_TreeCollider.h:70
BVTCache
Definition: OPC_TreeCollider.h:30
BVTCache::Model1
const Model * Model1
Model for second object.
Definition: OPC_TreeCollider.h:61


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:05