vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SP_CommonDefs.h
Go to the documentation of this file.
1 #ifndef SP_COMMONDEFS
2 #define SP_COMMONDEFS
3 
4 #include <helpers/DynamicArray.h>
5 
6 namespace vrecko {
7 
8 
9 //#define DEBUG_COLLISIONS
10 
11 
12 #ifdef VRECKO_LIBRARY
13  #define COLL_VRECKO_EXPORT __declspec(dllexport)
14 #else
15  #define COLL_VRECKO_EXPORT __declspec(dllimport)
16 #endif /* VRECKO_LIBRARY */
17 
18 
19 class SP_SceneInterface;
20 class SP_ObjectInterface;
21 
22 
23 
25 #define PARTITIONING_INTERFACE_DEFAULT -1
26 
27 
28 
29 // Flags for COLLISION_POINT_INFO::dwFlags
30 
31 
34 #define COLPOINT_FLAGS_INVALID 0x00000001
35 
38 #define COLPOINT_FLAGS_INTERSECTION_LINE 0x00000002
39 
41 #define COLPOINT_FLAGS_NEG_DIST_PRESENT 0x00000004
42 
45 #define COLPOINT_FLAGS_NORMALIZED 0x00000008
46 
47 // MASK and SHIFT of the number of point pairs that this one represents.
48 // You can use COLPOINT_FLAGS_REPRESENTANTS__GET to retrieve it.
49 #define COLPOINT_FLAGS_REPRESENTANTS__MASK 0x00000FF0
50 #define COLPOINT_FLAGS_REPRESENTANTS__SHIFT 4
51 #define COLPOINT_FLAGS_REPRESENTANTS__GET(x) ((x && COLPOINT_FLAGS_REPRESENTANTS__MASK) >> COLPOINT_FLAGS_REPRESENTANTS__SHIFT)
52 
53 
55 public:
56  unsigned long dwFlags;
57 
60  osg::Vec3 points[2];
61 
62 
65 
66 
67 #ifdef DEBUG_COLLISIONS
68  unsigned long faceIndices[2];
69 #endif
70 };
71 typedef std::vector<CollisionPointInfo> COLLISION_POINTS_VECTOR;
72 
73 
75 public:
76  CollisionInfo() { eoID[0] = 0; eoID[1] = 0; points = NULL; }
77 
78  ~CollisionInfo() { if (points) delete points; }
79  unsigned long eoID[2];
81 };
83 
84 
86 #define COLLISION_FLAGS_RAYCASTING 0x00000001
87 
89 #define COLLISION_FLAGS_NOCONTACTS 0x00000002
90 
93 #define COLLISION_FLAGS_SINGLECONTACT 0x00000004
94 
98 #define COLLISION_FLAGS_ONLYSCENETESTS 0x00000008
99 
103 #define COLLISION_FLAGS_ALLOW_INTERSECTIONS 0x00000010
104 
106 #define COLLISION_FLAGS_ONLY_INTERSECTIONS 0x00000020
107 
112 #define COLLISION_FLAGS_RUN_IN_BACKGROUND 0x00000040
113 
117 #define COLLISION_FLAGS_USE_MTMATRIXTRANSFORM 0x00000080
118 
123 #define COLLISION_FLAGS_ALLOW_NEGATIVE_DISTANCES 0x00000100
124 
131 #define COLLISION_FLAGS_NO_CALCULATIONS 0x00000200
132 
135 #define COLLISION_FLAGS_PREFER_NO_CALCULATIONS 0x00000400
136 
138 #define COLLISION_FLAGS_NO_OLD_COLLISION_DELETION 0x00000800
139 
141 #define COLLISION_FLAGS_NO_OLD_COLLISION_DELETION 0x00000800
142  // Do not delete the old collision pairs in COLLISIONS_INFO_VECTOR
143 #define COLLISION_FLAGSMASK_COMPARISON_FLAGS (COLLISION_FLAGS_RAYCASTING | COLLISION_FLAGS_ONLYSCENETESTS | COLLISION_FLAGS_ALLOW_INTERSECTIONS | COLLISION_FLAGS_ONLY_INTERSECTIONS | COLLISION_FLAGS_ALLOW_NEGATIVE_DISTANCES)
144 
145 
148 public:
149  CollisionParams__ver1() : dwFlags(0),
150  preferredSceneInterface(PARTITIONING_INTERFACE_DEFAULT),
151  preferredObjectInterface(PARTITIONING_INTERFACE_DEFAULT),
152  maxCollisionDistance(0.0f),
153  debugGlobalUpdatesCounter(0),
154  bgThreadAffinityMask(0xFFFFFFFF),
155  objIntPtr(NULL)
156  { dwStructureVersion = 1; }
157 
158  virtual bool isSame(const CollisionParams__ver1 * other) const;
159 
160  unsigned long dwStructureVersion;
161 
164 
167  unsigned long dwFlags;
168 
174 
177  osg::Vec3 rayStart, rayEnd;
178 
181 
186  unsigned int bgThreadAffinityMask;
187 
189 
192 };
193 
195 
196 
197 }
198 
199 
200 #endif