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_SweepAndPrune.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_SWEEPANDPRUNE_H__
21
#define __OPC_SWEEPANDPRUNE_H__
22
24
31
typedef
BOOL
(*
PairCallback
) (
udword
id0,
udword
id1,
void
* user_data);
33
34
class
SAP_Element;
35
class
SAP_EndPoint;
36
class
SAP_Box;
37
38
class
OPCODE_API
SAP_PairData
39
{
40
public
:
41
SAP_PairData
();
42
~
SAP_PairData
();
43
44
bool
Init(
udword
nb_objects);
45
46
void
AddPair(
udword
id1,
udword
id2);
47
void
RemovePair(
udword
id1,
udword
id2);
48
49
void
DumpPairs(
Pairs
& pairs)
const
;
50
void
DumpPairs(
PairCallback
callback,
void
* user_data)
const
;
51
private
:
52
udword
mNbElements;
53
udword
mNbUsedElements;
54
SAP_Element* mElementPool;
55
SAP_Element* mFirstFree;
56
57
udword
mNbObjects;
58
SAP_Element** mArray;
59
// Internal methods
60
SAP_Element* GetFreeElem(
udword
id
, SAP_Element*
next
,
udword
* remap=
null
);
61
inline_
void
FreeElem(SAP_Element* elem);
62
void
Release();
63
};
64
65
class
OPCODE_API
SweepAndPrune
66
{
67
public
:
68
SweepAndPrune
();
69
~
SweepAndPrune
();
70
71
bool
Init(
udword
nb_objects,
const
AABB
** boxes);
72
bool
UpdateObject(
udword
i
,
const
AABB
& box);
73
74
void
GetPairs(
Pairs
& pairs)
const
;
75
void
GetPairs(
PairCallback
callback,
void
* user_data)
const
;
76
private
:
77
SAP_PairData
mPairs;
78
79
udword
mNbObjects;
80
SAP_Box* mBoxes;
81
SAP_EndPoint* mList[3];
82
// Internal methods
83
bool
CheckListsIntegrity();
84
};
85
86
#endif //__OPC_SWEEPANDPRUNE_H__
src
cmd
collide2
OPC_SweepAndPrune.h
Generated on Fri May 29 2015 23:07:13 for Vegastrike 0.5.1 rc1 by
1.8.4