Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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__
src
cmd
collide2
OPC_VolumeCollider.h
Generated on Fri May 29 2015 23:07:13 for Vegastrike 0.5.1 rc1 by
1.8.4