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_Collider.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_COLLIDER_H__
21
#define __OPC_COLLIDER_H__
22
23
enum
CollisionFlag
24
{
25
OPC_FIRST_CONTACT
= (1<<0),
26
OPC_TEMPORAL_COHERENCE
= (1<<1),
27
OPC_CONTACT
= (1<<2),
28
OPC_TEMPORAL_HIT
= (1<<3),
29
OPC_NO_PRIMITIVE_TESTS
= (1<<4),
30
31
OPC_CONTACT_FOUND
=
OPC_FIRST_CONTACT
|
OPC_CONTACT
,
32
OPC_TEMPORAL_CONTACT
=
OPC_TEMPORAL_HIT
|
OPC_CONTACT
,
33
34
OPC_FORCE_DWORD
= 0x7fffffff
35
};
36
37
class
OPCODE_API
Collider
38
{
39
public
:
40
// Constructor / Destructor
41
Collider
();
42
virtual
~
Collider
();
43
44
// Collision report
45
47
51
inline_
BOOL
GetContactStatus()
const
{
return
mFlags &
OPC_CONTACT
; }
53
55
59
inline_
BOOL
FirstContactEnabled()
const
{
return
mFlags &
OPC_FIRST_CONTACT
; }
61
63
67
inline_
BOOL
TemporalCoherenceEnabled()
const
{
return
mFlags &
OPC_TEMPORAL_COHERENCE
; }
69
71
75
inline_
BOOL
ContactFound()
const
{
return
(mFlags&
OPC_CONTACT_FOUND
)==
OPC_CONTACT_FOUND
; }
77
79
83
inline_
BOOL
TemporalHit()
const
{
return
mFlags &
OPC_TEMPORAL_HIT
; }
85
87
91
inline_
BOOL
SkipPrimitiveTests()
const
{
return
mFlags &
OPC_NO_PRIMITIVE_TESTS
; }
93
94
// Settings
95
97
103
inline_
void
SetFirstContact(
bool
flag)
105
{
106
if
(flag) mFlags |=
OPC_FIRST_CONTACT
;
107
else
mFlags &= ~
OPC_FIRST_CONTACT
;
108
}
109
111
117
inline_
void
SetTemporalCoherence(
bool
flag)
119
{
120
if
(flag) mFlags |=
OPC_TEMPORAL_COHERENCE
;
121
else
mFlags &= ~
OPC_TEMPORAL_COHERENCE
;
122
}
123
125
129
inline_
void
SetPrimitiveTests(
bool
flag)
131
{
132
if
(!flag) mFlags |=
OPC_NO_PRIMITIVE_TESTS
;
133
else
mFlags &= ~
OPC_NO_PRIMITIVE_TESTS
;
134
}
135
137
141
virtual
const
char
* ValidateSettings() = 0;
143
144
protected
:
145
udword
mFlags
;
146
const
BaseModel
*
mCurrentModel
;
147
// User mesh interface
148
const
MeshInterface
*
mIMesh
;
149
150
// Internal methods
152
157
inline_
BOOL
Setup(
const
BaseModel
*
model
)
159
{
160
// Keep track of current model
161
mCurrentModel =
model
;
162
if
(!mCurrentModel)
return
FALSE
;
163
164
mIMesh = model->
GetMeshInterface
();
165
return
mIMesh!=
null
;
166
}
167
169
172
virtual
inline_
void
InitQuery() { mFlags &= ~
OPC_TEMPORAL_CONTACT
; }
174
};
175
176
#endif // __OPC_COLLIDER_H__
src
cmd
collide2
OPC_Collider.h
Generated on Fri May 29 2015 23:07:12 for Vegastrike 0.5.1 rc1 by
1.8.4