My Project: openb3dlib.mod/openb3d/src/collision2.h Source File

My Project

collision2.h
Go to the documentation of this file.
1 #ifndef COLLISION2_H
2 #define COLLISION2_H
3
4 /*
5 * collision2.h
6 * iminib3d
7 *
8 * Created by Simon Harrison.
9 * Copyright Si Design. All rights reserved.
10 *
11 */
12
13 #include "entity.h"
14 #include "surface.h"
15
16 #include <list>
17 #include <iostream>
18 using namespace std;
19
20 const int MAX_TYPES=100;
21
22 class Entity;
23
24 class CollisionPair{
25
26 public:
27
28 static list<CollisionPair*> cp_list;
29 static list<Entity*> ent_lists[MAX_TYPES];
30
31 int src_type;
32 int des_type;
33 int col_method;
34 int response;
35
36 CollisionPair(){
37
38 src_type=0;
39 des_type=0;
40 col_method=0;
41 response=0;
42
43 }
44
45 };
46
47 class CollisionImpact{
48
49 public:
50
51 float x,y,z;
52 float nx,ny,nz;
53 float time;
54 Entity* ent;
55 Surface* surf;
56 int tri;
57
58 CollisionImpact(){
59
60 x=y=z=nx=ny=nz=time=0.0;
61 ent=NULL;
62 surf=NULL;
63 tri=0;
64
65 }
66
67 };
68
69 // collision methods - already defined in collision
70 //const int COLLISION_METHOD_SPHERE=1;
71 //const int COLLISION_METHOD_POLYGON=2;
72 //const int COLLISION_METHOD_BOX=3;
73
74 // collision actions
75 //const int COLLISION_RESPONSE_NONE=0;
76 //const int COLLISION_RESPONSE_STOP=1;
77 //const int COLLISION_RESPONSE_SLIDE=2;
78 //const int COLLISION_RESPONSE_SLIDEXZ=3;
79
80 void UpdateCollisions();
81 void UpdateStaticCollisions();
82 void UpdateDynamicCollisions();
83 void clearCollisions();
84 int PositionEntities(int update_old=true,int add_to_new=false);
85 int QuickCheck(Entity& ent,Entity& ent2);
86
87 #endif
entity.h
UpdateStaticCollisions
void UpdateStaticCollisions()
Definition: collision2.cpp:95
Surface
Definition: surface.h:19
CollisionPair::src_type
int src_type
Definition: collision2.h:31
CollisionPair
Definition: collision2.h:24
CollisionPair::col_method
int col_method
Definition: collision2.h:33
CollisionImpact::surf
Surface * surf
Definition: collision2.h:55
UpdateDynamicCollisions
void UpdateDynamicCollisions()
Definition: collision2.cpp:249
std
CollisionImpact::tri
int tri
Definition: collision2.h:56
UpdateCollisions
void UpdateCollisions()
Definition: collision2.cpp:34
MAX_TYPES
const int MAX_TYPES
Definition: collision2.h:20
Entity
Definition: entity.h:27
QuickCheck
int QuickCheck(Entity &ent, Entity &ent2)
Definition: collision2.cpp:512
CollisionPair::CollisionPair
CollisionPair()
Definition: collision2.h:36
CollisionPair::des_type
int des_type
Definition: collision2.h:32
PositionEntities
int PositionEntities(int update_old=true, int add_to_new=false)
Definition: collision2.cpp:39
CollisionImpact::nz
float nz
Definition: collision2.h:52
CollisionPair::response
int response
Definition: collision2.h:34
CollisionImpact::CollisionImpact
CollisionImpact()
Definition: collision2.h:58
surface.h
CollisionImpact::z
float z
Definition: collision2.h:51
CollisionImpact
Definition: collision2.h:47
CollisionPair::cp_list
static list< CollisionPair * > cp_list
Definition: collision2.h:28
clearCollisions
void clearCollisions()
Definition: collision2.cpp:71
NULL
#define NULL
Definition: tree.cpp:4
CollisionImpact::time
float time
Definition: collision2.h:53
CollisionImpact::ent
Entity * ent
Definition: collision2.h:54