hrplib
hrpCollision
Opcode
OPC_VolumeCollider.h
Go to the documentation of this file.
1
/*
3
* OPCODE - Optimized Collision Detection
4
* Copyright (C) 2001 Pierre Terdiman
5
* Homepage: http://www.codercorner.com/Opcode.htm
6
*/
8
10
16
19
// Include Guard
20
#ifndef __OPC_VOLUMECOLLIDER_H__
21
#define __OPC_VOLUMECOLLIDER_H__
22
23
struct
OPCODE_API
VolumeCache
24
{
25
VolumeCache
() :
Model
(
null
) {}
26
~VolumeCache
() {}
27
28
Container
TouchedPrimitives
;
29
const
BaseModel
*
Model
;
30
};
31
32
class
OPCODE_API
VolumeCollider
:
public
Collider
33
{
34
public
:
35
// Constructor / Destructor
36
VolumeCollider
();
37
virtual
~
VolumeCollider
() = 0;
38
39
// Collision report
40
42
48
inline_
udword
GetNbTouchedPrimitives()
const
{
return
mTouchedPrimitives ? mTouchedPrimitives->GetNbEntries() : 0; }
50
52
58
inline_
const
udword
* GetTouchedPrimitives()
const
{
return
mTouchedPrimitives ? mTouchedPrimitives->GetEntries() :
null
; }
60
61
// Stats
62
64
69
inline_
udword
GetNbVolumeBVTests()
const
{
return
mNbVolumeBVTests; }
71
73
78
inline_
udword
GetNbVolumePrimTests()
const
{
return
mNbVolumePrimTests; }
80
81
// Settings
82
84
88
override
(
Collider
)
const
char
*
ValidateSettings
();
90
91
protected
:
92
// Touched primitives
93
Container
*
mTouchedPrimitives
;
94
95
// Dequantization coeffs
96
Point
mCenterCoeff
;
97
Point
mExtentsCoeff
;
98
// Stats
99
udword
mNbVolumeBVTests
;
100
udword
mNbVolumePrimTests
;
101
// Internal methods
102
void
_Dump(
const
AABBCollisionNode
* node);
103
void
_Dump(
const
AABBNoLeafNode
* node);
104
void
_Dump(
const
AABBQuantizedNode
* node);
105
void
_Dump(
const
AABBQuantizedNoLeafNode
* node);
106
108
111
override
(
Collider
)
inline_
void
InitQuery
()
113
{
114
// Reset stats & contact status
115
mNbVolumeBVTests = 0;
116
mNbVolumePrimTests = 0;
117
Collider::InitQuery
();
118
}
119
120
inline_
BOOL
IsCacheValid
(
VolumeCache
& cache)
121
{
122
// We're going to do a volume-vs-model query.
123
if
(cache.
Model
!=mCurrentModel)
124
{
125
// Cached list was for another model so we can't keep it
126
// Keep track of new owner and reset cache
127
cache.
Model
=
mCurrentModel
;
128
return
FALSE
;
129
}
130
else
131
{
132
// Same models, no problem
133
return
TRUE
;
134
}
135
}
136
};
137
138
#endif // __OPC_VOLUMECOLLIDER_H__
VolumeCache::Model
const BaseModel * Model
Owner.
Definition:
OPC_VolumeCollider.h:29
VolumeCollider
Definition:
OPC_VolumeCollider.h:32
VolumeCollider::mNbVolumeBVTests
udword mNbVolumeBVTests
Number of Volume-BV tests.
Definition:
OPC_VolumeCollider.h:99
Container
Definition:
IceContainer.h:25
Collider::InitQuery
virtual inline_ void InitQuery()
Definition:
OPC_Collider.h:173
udword
unsigned int udword
sizeof(udword) must be 4
Definition:
IceTypes.h:65
BOOL
int BOOL
Another boolean type.
Definition:
IceTypes.h:102
VolumeCollider::mTouchedPrimitives
Container * mTouchedPrimitives
List of touched primitives.
Definition:
OPC_VolumeCollider.h:93
Collider::ValidateSettings
virtual const char * ValidateSettings()=0
VolumeCache::~VolumeCache
~VolumeCache()
Definition:
OPC_VolumeCollider.h:26
Collider::Collider
Collider()
Definition:
OPC_Collider.cpp:40
Collider::mCurrentModel
const BaseModel * mCurrentModel
Current model for collision query (owner of touched faces)
Definition:
OPC_Collider.h:146
AABBCollisionNode
Definition:
OPC_OptimizedTree.h:76
BaseModel
Definition:
OPC_BaseModel.h:50
AABBNoLeafNode
Definition:
OPC_OptimizedTree.h:116
VolumeCollider::mNbVolumePrimTests
udword mNbVolumePrimTests
Number of Volume-Primitive tests.
Definition:
OPC_VolumeCollider.h:100
VolumeCollider::mCenterCoeff
Point mCenterCoeff
Definition:
OPC_VolumeCollider.h:96
VolumeCollider::IsCacheValid
inline_ BOOL IsCacheValid(VolumeCache &cache)
Definition:
OPC_VolumeCollider.h:120
Collider
Definition:
OPC_Collider.h:37
VolumeCache
Definition:
OPC_VolumeCollider.h:23
AABBQuantizedNoLeafNode
Definition:
OPC_OptimizedTree.h:121
VolumeCollider::mExtentsCoeff
Point mExtentsCoeff
Definition:
OPC_VolumeCollider.h:97
VolumeCache::VolumeCache
VolumeCache()
Definition:
OPC_VolumeCollider.h:25
TRUE
#define TRUE
Definition:
OPC_IceHook.h:13
Model
Definition:
OPC_Model.h:23
FALSE
#define FALSE
Definition:
OPC_IceHook.h:9
OPCODE_API
#define OPCODE_API
Definition:
Opcode.h:68
Point
Definition:
IcePoint.h:25
AABBQuantizedNode
Definition:
OPC_OptimizedTree.h:100
VolumeCache::TouchedPrimitives
Container TouchedPrimitives
Indices of touched primitives.
Definition:
OPC_VolumeCollider.h:28
inline_
#define inline_
Definition:
IcePreprocessor.h:103
null
#define null
our own NULL pointer
Definition:
IceTypes.h:57
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:04