annotate trunk/chipmunkd/cpSpace.d @ 23:4ceef5833c8c

updated to chipmunk 5.3.3
author Extrawurst
date Fri, 10 Dec 2010 02:10:27 +0100
parents df4ebc8add66
children 4541ca17975b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
1
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
2 // written in the D programming language
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
3
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
4 module chipmunkd.cpSpace;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
5
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
6 import chipmunkd.chipmunk;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
7
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
8 // Number of frames that contact information should persist.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
9 //extern cpTimestamp cp_contact_persistence;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
10
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
11 // User collision handler function types.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
12 alias cpBool function(cpArbiter *arb, cpSpace *space, void *data)cpCollisionBeginFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
13 alias cpBool function(cpArbiter *arb, cpSpace *space, void *data)cpCollisionPreSolveFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
14 alias void function(cpArbiter *arb, cpSpace *space, void *data)cpCollisionPostSolveFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
15 alias void function(cpArbiter *arb, cpSpace *space, void *data)cpCollisionSeparateFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
16
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
17 // Structure for holding collision pair function information.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
18 // Used internally.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
19 struct cpCollisionHandler {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
20 cpCollisionType a;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
21 cpCollisionType b;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
22 cpCollisionBeginFunc begin;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
23 cpCollisionPreSolveFunc preSolve;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
24 cpCollisionPostSolveFunc postSolve;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
25 cpCollisionSeparateFunc separate;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
26 void *data;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
27 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
28
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
29 struct cpContactBufferHeader {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
30 cpTimestamp stamp;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
31 cpContactBufferHeader *next;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
32 uint numContacts;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
33 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
34
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
35 struct cpSpace{
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
36 // *** User definable fields
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
37
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
38 // Number of iterations to use in the impulse solver to solve contacts.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
39 int iterations;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
40
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
41 // Number of iterations to use in the impulse solver to solve elastic collisions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
42 int elasticIterations;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
43
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
44 // Default gravity to supply when integrating rigid body motions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
45 cpVect gravity;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
46
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
47 // Default damping to supply when integrating rigid body motions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
48 cpFloat damping;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
49
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
50 // Speed threshold for a body to be considered idle.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
51 // The default value of 0 means to let the space guess a good threshold based on gravity.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
52 cpFloat idleSpeedThreshold;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
53
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
54 // Time a group of bodies must remain idle in order to fall asleep
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
55 // The default value of INFINITY disables the sleeping algorithm.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
56 cpFloat sleepTimeThreshold;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
57
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
58 // *** Internally Used Fields
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
59
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
60 // When the space is locked, you should not add or remove objects;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
61 cpBool locked;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
62
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
63 // Time stamp. Is incremented on every call to cpSpaceStep().
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
64 cpTimestamp stamp;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
65
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
66 // The static and active shape spatial hashes.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
67 cpSpaceHash* staticShapes;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
68 cpSpaceHash* activeShapes;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
69
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
70 // List of bodies in the system.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
71 cpArray *bodies;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
72
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
73 // List of groups of sleeping bodies.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
74 cpArray *sleepingComponents;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
75
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
76 // List of active arbiters for the impulse solver.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
77 cpArray* arbiters, pooledArbiters;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
78
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
79 // Linked list ring of contact buffers.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
80 // Head is the newest buffer, and each buffer points to a newer buffer.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
81 // Head wraps around and points to the oldest (tail) buffer.
23
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
82 cpContactBufferHeader* contactBuffersHead;
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
83 deprecated cpContactBufferHeader* _contactBuffersTail_Deprecated;
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
84
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
85 // List of buffers to be free()ed when destroying the space.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
86 cpArray *allocatedBuffers;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
87
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
88 // Persistant contact set.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
89 cpHashSet *contactSet;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
90
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
91 // List of constraints in the system.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
92 cpArray *constraints;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
93
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
94 // Set of collisionpair functions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
95 cpHashSet *collFuncSet;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
96 // Default collision handler.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
97 cpCollisionHandler defaultHandler;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
98
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
99 cpHashSet *postStepCallbacks;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
100
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
101 cpBody staticBody;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
102 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
103
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
104 //// Basic allocation/destruction functions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
105 //cpSpace* cpSpaceAlloc(void);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
106 //cpSpace* cpSpaceInit(cpSpace *space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
107 //cpSpace* cpSpaceNew(void);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
108 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
109 //void cpSpaceDestroy(cpSpace *space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
110 //void cpSpaceFree(cpSpace *space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
111 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
112 //// Convenience function. Frees all referenced entities. (bodies, shapes and constraints)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
113 //void cpSpaceFreeChildren(cpSpace *space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
114 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
115 //// Collision handler management functions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
116 //void cpSpaceSetDefaultCollisionHandler(
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
117 // cpSpace *space,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
118 // cpCollisionBeginFunc begin,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
119 // cpCollisionPreSolveFunc preSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
120 // cpCollisionPostSolveFunc postSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
121 // cpCollisionSeparateFunc separate,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
122 // void *data
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
123 //);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
124 //void cpSpaceAddCollisionHandler(
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
125 // cpSpace *space,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
126 // cpCollisionType a, cpCollisionType b,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
127 // cpCollisionBeginFunc begin,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
128 // cpCollisionPreSolveFunc preSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
129 // cpCollisionPostSolveFunc postSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
130 // cpCollisionSeparateFunc separate,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
131 // void *data
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
132 //);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
133 //void cpSpaceRemoveCollisionHandler(cpSpace *space, cpCollisionType a, cpCollisionType b);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
134 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
135 //// Add and remove entities from the system.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
136 //cpShape *cpSpaceAddShape(cpSpace *space, cpShape *shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
137 //cpShape *cpSpaceAddStaticShape(cpSpace *space, cpShape *shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
138 //cpBody *cpSpaceAddBody(cpSpace *space, cpBody *body);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
139 //cpConstraint *cpSpaceAddConstraint(cpSpace *space, cpConstraint *constraint);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
140 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
141 //void cpSpaceRemoveShape(cpSpace *space, cpShape *shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
142 //void cpSpaceRemoveStaticShape(cpSpace *space, cpShape *shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
143 //void cpSpaceRemoveBody(cpSpace *space, cpBody *body);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
144 //void cpSpaceRemoveConstraint(cpSpace *space, cpConstraint *constraint);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
145 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
146 //// Post Step function definition
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
147 alias void function(cpSpace *space, void *obj, void *data) cpPostStepFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
148 //// Register a post step function to be called after cpSpaceStep() has finished.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
149 //// obj is used a key, you can only register one callback per unique value for obj
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
150 //void cpSpaceAddPostStepCallback(cpSpace *space, cpPostStepFunc func, void *obj, void *data);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
151 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
152 //// Point query callback function
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
153 alias void function(cpShape *shape, void *data) cpSpacePointQueryFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
154 //void cpSpacePointQuery(cpSpace *space, cpVect point, cpLayers layers, cpGroup group, cpSpacePointQueryFunc func, void *data);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
155 //cpShape *cpSpacePointQueryFirst(cpSpace *space, cpVect point, cpLayers layers, cpGroup group);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
156 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
157 //// Segment query callback function
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
158 alias void function(cpShape *shape, cpFloat t, cpVect n, void *data)cpSpaceSegmentQueryFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
159 //void cpSpaceSegmentQuery(cpSpace *space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSpaceSegmentQueryFunc func, void *data);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
160 //cpShape *cpSpaceSegmentQueryFirst(cpSpace *space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo *out);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
161 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
162 //// BB query callback function
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
163 alias void function(cpShape *shape, void *data)cpSpaceBBQueryFunc;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
164 //void cpSpaceBBQuery(cpSpace *space, cpBB bb, cpLayers layers, cpGroup group, cpSpaceBBQueryFunc func, void *data);
23
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
165
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
166 // Shape query callback function
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
167 alias void function(cpShape *shape, cpContactPointSet *points, void *data)cpSpaceShapeQueryFunc;
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
168 //cpBool cpSpaceShapeQuery(cpSpace *space, cpShape *shape, cpSpaceShapeQueryFunc func, void *data);
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
169
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
170
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
171 //void cpSpaceActivateShapesTouchingShape(cpSpace *space, cpShape *shape);
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
172
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
173 //// Iterator function for iterating the bodies in a space.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
174 alias void function(cpBody *_body, void *data)cpSpaceBodyIterator;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
175 //void cpSpaceEachBody(cpSpace *space, cpSpaceBodyIterator func, void *data);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
176 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
177 //// Spatial hash management functions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
178 //void cpSpaceResizeStaticHash(cpSpace *space, cpFloat dim, int count);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
179 //void cpSpaceResizeActiveHash(cpSpace *space, cpFloat dim, int count);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
180 //void cpSpaceRehashStatic(cpSpace *space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
181 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
182 //void cpSpaceRehashShape(cpSpace *space, cpShape *shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
183 //
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
184 //// Update the space.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
185 //void cpSpaceStep(cpSpace *space, cpFloat dt);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
186
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
187
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
188 cpTimestamp cp_contact_persistence = 3;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
189
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
190 // Equal function for contactSet.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
191 static cpBool
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
192 contactSetEql(cpShape **shapes, cpArbiter *arb)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
193 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
194 cpShape *a = shapes[0];
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
195 cpShape *b = shapes[1];
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
196
23
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
197 return ((a == arb.a && b == arb.b) || (b == arb.a && a == arb.b));
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
198 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
199
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
200 // Transformation function for contactSet.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
201 static void *
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
202 contactSetTrans(cpShape **shapes, cpSpace *space)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
203 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
204 if(space.pooledArbiters.num == 0){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
205 // arbiter pool is exhausted, make more
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
206 int count = CP_BUFFER_BYTES/cpArbiter.sizeof;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
207 assert(count, "Buffer size too small.");
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
208
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
209 cpArbiter *buffer = cast(cpArbiter *)cpmalloc(CP_BUFFER_BYTES);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
210 cpArrayPush(space.allocatedBuffers, buffer);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
211
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
212 for(int i=0; i<count; i++) cpArrayPush(space.pooledArbiters, buffer + i);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
213 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
214
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
215 return cpArbiterInit(cast(cpArbiter *) cpArrayPop(space.pooledArbiters), shapes[0], shapes[1]);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
216 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
217
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
218 // Equals function for collFuncSet.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
219 static cpBool
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
220 collFuncSetEql(cpCollisionHandler *check, cpCollisionHandler *pair)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
221 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
222 return ((check.a == pair.a && check.b == pair.b) || (check.b == pair.a && check.a == pair.b));
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
223 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
224
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
225 // Transformation function for collFuncSet.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
226 static void *
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
227 collFuncSetTrans(cpCollisionHandler *handler, void *unused)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
228 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
229 cpCollisionHandler *copy = cast(cpCollisionHandler *)cpmalloc(cpCollisionHandler.sizeof);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
230 (*copy) = (*handler);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
231
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
232 return copy;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
233 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
234
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
235 // Default collision functions.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
236 static cpBool alwaysCollide(cpArbiter *arb, cpSpace *space, void *data){return 1;}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
237 static void nothing(cpArbiter *arb, cpSpace *space, void *data){}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
238
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
239 // BBfunc callback for the spatial hash.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
240 static cpBB shapeBBFunc(cpShape *shape){return shape.bb;}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
241
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
242 // Iterator functions for destructors.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
243 static void freeWrap(void *ptr, void *unused){ cpfree(ptr);}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
244 static void shapeFreeWrap(cpShape *ptr, void *unused){ cpShapeFree(ptr);}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
245 static void bodyFreeWrap(cpBody *ptr, void *unused){ cpBodyFree(ptr);}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
246 static void constraintFreeWrap(cpConstraint *ptr, void *unused){cpConstraintFree(ptr);}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
247
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
248 cpSpace *
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
249 cpSpaceAlloc()
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
250 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
251 return cast(cpSpace *)cpcalloc(1, cpSpace.sizeof);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
252 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
253
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
254 enum DEFAULT_DIM_SIZE = 100.0f;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
255 enum DEFAULT_COUNT = 1000;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
256 enum DEFAULT_ITERATIONS = 10;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
257 enum DEFAULT_ELASTIC_ITERATIONS = 0;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
258
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
259 cpCollisionHandler defaultHandler = {0, 0, &alwaysCollide, &alwaysCollide, &nothing, &nothing, null};
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
260
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
261 cpSpace*
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
262 cpSpaceInit(cpSpace *space)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
263 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
264 space.iterations = DEFAULT_ITERATIONS;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
265 space.elasticIterations = DEFAULT_ELASTIC_ITERATIONS;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
266 // space.sleepTicks = 300;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
267
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
268 space.gravity = cpvzero;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
269 space.damping = 1.0f;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
270
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
271 space.locked = 0;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
272 space.stamp = 0;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
273
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
274 space.staticShapes = cpSpaceHashNew(DEFAULT_DIM_SIZE, DEFAULT_COUNT, cast(cpSpaceHashBBFunc)&shapeBBFunc);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
275 space.activeShapes = cpSpaceHashNew(DEFAULT_DIM_SIZE, DEFAULT_COUNT, cast(cpSpaceHashBBFunc)&shapeBBFunc);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
276
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
277 space.allocatedBuffers = cpArrayNew(0);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
278
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
279 space.bodies = cpArrayNew(0);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
280 space.sleepingComponents = cpArrayNew(0);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
281 space.sleepTimeThreshold = INFINITY;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
282 space.idleSpeedThreshold = 0.0f;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
283
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
284 space.arbiters = cpArrayNew(0);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
285 space.pooledArbiters = cpArrayNew(0);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
286
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
287 space.contactBuffersHead = null;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
288 space.contactSet = cpHashSetNew(0, cast(cpHashSetEqlFunc)&contactSetEql, cast(cpHashSetTransFunc)&contactSetTrans);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
289
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
290 space.constraints = cpArrayNew(0);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
291
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
292 space.defaultHandler = defaultHandler;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
293 space.collFuncSet = cpHashSetNew(0, cast(cpHashSetEqlFunc)&collFuncSetEql, cast(cpHashSetTransFunc)&collFuncSetTrans);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
294 space.collFuncSet.default_value = &space.defaultHandler;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
295
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
296 space.postStepCallbacks = null;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
297
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
298 cpBodyInit(&space.staticBody, INFINITY, INFINITY);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
299 space.staticBody.space = space;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
300
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
301 return space;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
302 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
303
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
304 cpSpace*
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
305 cpSpaceNew()
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
306 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
307 return cpSpaceInit(cpSpaceAlloc());
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
308 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
309
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
310 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
311 cpSpaceDestroy(cpSpace *space)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
312 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
313 cpSpaceHashFree(space.staticShapes);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
314 cpSpaceHashFree(space.activeShapes);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
315
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
316 cpArrayFree(space.bodies);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
317 cpArrayFree(space.sleepingComponents);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
318
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
319 cpArrayFree(space.constraints);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
320
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
321 cpHashSetFree(space.contactSet);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
322
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
323 cpArrayFree(space.arbiters);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
324 cpArrayFree(space.pooledArbiters);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
325
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
326 if(space.allocatedBuffers){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
327 cpArrayEach(space.allocatedBuffers, &freeWrap, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
328 cpArrayFree(space.allocatedBuffers);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
329 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
330
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
331 if(space.postStepCallbacks){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
332 cpHashSetEach(space.postStepCallbacks, &freeWrap, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
333 cpHashSetFree(space.postStepCallbacks);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
334 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
335
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
336 if(space.collFuncSet){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
337 cpHashSetEach(space.collFuncSet, &freeWrap, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
338 cpHashSetFree(space.collFuncSet);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
339 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
340 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
341
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
342 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
343 cpSpaceFree(cpSpace *space)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
344 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
345 if(space){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
346 cpSpaceDestroy(space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
347 cpfree(space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
348 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
349 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
350
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
351 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
352 cpSpaceFreeChildren(cpSpace *space)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
353 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
354 cpArray *components = space.sleepingComponents;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
355 while(components.num) cpBodyActivate(cast(cpBody *)components.arr[0]);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
356
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
357 cpSpaceHashEach(space.staticShapes, cast(cpSpaceHashIterator)&shapeFreeWrap, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
358 cpSpaceHashEach(space.activeShapes, cast(cpSpaceHashIterator)&shapeFreeWrap, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
359 cpArrayEach(space.bodies, cast(cpArrayIter)&bodyFreeWrap, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
360 cpArrayEach(space.constraints, cast(cpArrayIter)&constraintFreeWrap, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
361 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
362
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
363 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
364 cpSpaceAddCollisionHandler(
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
365 cpSpace *space,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
366 cpCollisionType a, cpCollisionType b,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
367 cpCollisionBeginFunc begin,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
368 cpCollisionPreSolveFunc preSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
369 cpCollisionPostSolveFunc postSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
370 cpCollisionSeparateFunc separate,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
371 void *data
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
372 ){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
373 // Remove any old function so the new one will get added.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
374 cpSpaceRemoveCollisionHandler(space, a, b);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
375
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
376 cpCollisionHandler handler = {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
377 a, b,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
378 begin ? begin : &alwaysCollide,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
379 preSolve ? preSolve : &alwaysCollide,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
380 postSolve ? postSolve : &nothing,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
381 separate ? separate : &nothing,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
382 data
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
383 };
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
384
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
385 cpHashSetInsert(space.collFuncSet, CP_HASH_PAIR(a, b), &handler, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
386 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
387
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
388 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
389 cpSpaceRemoveCollisionHandler(cpSpace *space, cpCollisionType a, cpCollisionType b)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
390 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
391 struct tmp{cpCollisionType a, b;} tmp ids = {a, b};
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
392 cpCollisionHandler *old_handler = cast(cpCollisionHandler *) cpHashSetRemove(space.collFuncSet, CP_HASH_PAIR(a, b), &ids);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
393 cpfree(old_handler);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
394 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
395
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
396 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
397 cpSpaceSetDefaultCollisionHandler(
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
398 cpSpace *space,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
399 cpCollisionBeginFunc begin,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
400 cpCollisionPreSolveFunc preSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
401 cpCollisionPostSolveFunc postSolve,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
402 cpCollisionSeparateFunc separate,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
403 void *data
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
404 ){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
405 cpCollisionHandler handler = {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
406 0, 0,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
407 begin ? begin : &alwaysCollide,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
408 preSolve ? preSolve : &alwaysCollide,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
409 postSolve ? postSolve : &nothing,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
410 separate ? separate : &nothing,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
411 data
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
412 };
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
413
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
414 space.defaultHandler = handler;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
415 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
416
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
417 //#pragma mark Body, Shape, and Joint Management
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
418
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
419 void cpAssertSpaceUnlocked(cpSpace* _space){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
420 assert(!_space.locked,
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
421 "This addition/removal cannot be done safely during a call to cpSpaceStep(). "
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
422 "Put these calls into a Post Step Callback."
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
423 );}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
424
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
425 static void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
426 cpBodyAddShape(cpBody *_body, cpShape *shape)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
427 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
428 shape.next = shape._body.shapesList;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
429 shape._body.shapesList = shape;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
430 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
431
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
432 static void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
433 cpBodyRemoveShape(cpBody *_body, cpShape *shape)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
434 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
435 cpShape **prev_ptr = &_body.shapesList;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
436 cpShape *node = _body.shapesList;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
437
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
438 while(node && node != shape){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
439 prev_ptr = &node.next;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
440 node = node.next;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
441 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
442
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
443 assert(node, "Attempted to remove a shape from a body it was never attached to.");
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
444 (*prev_ptr) = node.next;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
445 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
446
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
447 cpShape *
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
448 cpSpaceAddShape(cpSpace *space, cpShape *shape)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
449 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
450 cpBody *_body = shape._body;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
451 if(!_body || _body == &space.staticBody) return cpSpaceAddStaticShape(space, shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
452
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
453 assert(!cpHashSetFind(space.activeShapes.handleSet, shape.hashid, shape),
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
454 "Cannot add the same shape more than once.");
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
455 cpAssertSpaceUnlocked(space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
456
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
457 cpBodyActivate(_body);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
458 cpBodyAddShape(_body, shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
459
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
460 cpShapeCacheBB(shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
461 cpSpaceHashInsert(space.activeShapes, shape, shape.hashid, shape.bb);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
462
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
463 return shape;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
464 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
465
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
466 cpShape *
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
467 cpSpaceAddStaticShape(cpSpace *space, cpShape *shape)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
468 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
469 assert(!cpHashSetFind(space.staticShapes.handleSet, shape.hashid, shape),
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
470 "Cannot add the same static shape more than once.");
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
471 cpAssertSpaceUnlocked(space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
472
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
473 if(!shape._body) shape._body = &space.staticBody;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
474
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
475 cpShapeCacheBB(shape);
23
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
476 cpSpaceActivateShapesTouchingShape(space, shape);
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
477 cpSpaceHashInsert(space.staticShapes, shape, shape.hashid, shape.bb);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
478
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
479 return shape;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
480 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
481
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
482 cpBody *
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
483 cpSpaceAddBody(cpSpace *space, cpBody *_body)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
484 {
23
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
485 mixin(cpAssertWarn!("!cpBodyIsStatic(_body)", "Static bodies cannot be added to a space as they are not meant to be simulated.",__FILE__,__LINE__));
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
486 assert(!_body.space, "Cannot add a body to a more than one space or to the same space twice.");
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
487 // cpAssertSpaceUnlocked(space); This should be safe as long as it's not from an integration callback
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
488
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
489 cpArrayPush(space.bodies, _body);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
490 _body.space = space;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
491
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
492 return _body;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
493 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
494
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
495 cpConstraint *
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
496 cpSpaceAddConstraint(cpSpace *space, cpConstraint *constraint)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
497 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
498 assert(!cpArrayContains(space.constraints, constraint), "Cannot add the same constraint more than once.");
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
499 // cpAssertSpaceUnlocked(space); This should be safe as long as its not from a constraint callback.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
500
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
501 if(!constraint.a) constraint.a = &space.staticBody;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
502 if(!constraint.b) constraint.b = &space.staticBody;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
503
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
504 cpBodyActivate(constraint.a);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
505 cpBodyActivate(constraint.b);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
506 cpArrayPush(space.constraints, constraint);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
507
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
508 return constraint;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
509 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
510
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
511 struct removalContext {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
512 cpSpace *space;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
513 cpShape *shape;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
514 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
515
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
516 // Hashset filter func to throw away old arbiters.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
517 static cpBool
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
518 contactSetFilterRemovedShape(cpArbiter *arb, removalContext *context)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
519 {
23
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
520 if(context.shape == arb.a || context.shape == arb.b){
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
521 if(arb.state != cpArbiterState.cpArbiterStateCached){
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
522 arb.handler.separate(arb, context.space, arb.handler.data);
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
523 }
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
524
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
525 cpArrayPush(context.space.pooledArbiters, arb);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
526 return cpFalse;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
527 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
528
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
529 return cpTrue;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
530 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
531
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
532 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
533 cpSpaceRemoveShape(cpSpace *space, cpShape *shape)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
534 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
535 cpBody *_body = shape._body;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
536 if(cpBodyIsStatic(_body)){
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
537 cpSpaceRemoveStaticShape(space, shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
538 return;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
539 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
540
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
541 cpBodyActivate(_body);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
542
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
543 cpAssertSpaceUnlocked(space);
13
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
544 mixin(cpAssertWarn!("cpHashSetFind(space.activeShapes.handleSet, shape.hashid, shape) !is null",
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
545 "Cannot remove a shape that was never added to the space. (Removed twice maybe?)",__FILE__,__LINE__));
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
546
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
547 cpBodyRemoveShape(_body, shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
548
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
549 removalContext context = {space, shape};
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
550 cpHashSetFilter(space.contactSet, cast(cpHashSetFilterFunc)&contactSetFilterRemovedShape, &context);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
551 cpSpaceHashRemove(space.activeShapes, shape, shape.hashid);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
552 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
553
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
554 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
555 cpSpaceRemoveStaticShape(cpSpace *space, cpShape *shape)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
556 {
13
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
557 mixin(cpAssertWarn!("cpHashSetFind(space.staticShapes.handleSet, shape.hashid, shape) !is null",
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
558 "Cannot remove a static or sleeping shape that was never added to the space. (Removed twice maybe?)",__FILE__,__LINE__));
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
559 cpAssertSpaceUnlocked(space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
560
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
561 removalContext context = {space, shape};
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
562 cpHashSetFilter(space.contactSet, cast(cpHashSetFilterFunc)&contactSetFilterRemovedShape, &context);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
563 cpSpaceHashRemove(space.staticShapes, shape, shape.hashid);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
564
23
4ceef5833c8c updated to chipmunk 5.3.3
Extrawurst
parents: 15
diff changeset
565 cpSpaceActivateShapesTouchingShape(space, shape);
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
566 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
567
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
568 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
569 cpSpaceRemoveBody(cpSpace *space, cpBody *_body)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
570 {
13
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
571 mixin(cpAssertWarn!("_body.space == space",
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
572 "Cannot remove a body that was never added to the space. (Removed twice maybe?)"));
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
573 cpAssertSpaceUnlocked(space);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
574
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
575 cpBodyActivate(_body);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
576 cpArrayDeleteObj(space.bodies, _body);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
577 _body.space = null;
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
578 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
579
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
580 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
581 cpSpaceRemoveConstraint(cpSpace *space, cpConstraint *constraint)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
582 {
13
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
583 mixin(cpAssertWarn!("cpArrayContains(space.constraints, constraint)",
c03a41d47b60 - finished all constraints properties
Extrawurst
parents: 4
diff changeset
584 "Cannot remove a constraint that was never added to the space. (Removed twice maybe?)",__FILE__,__LINE__));
4
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
585 // cpAssertSpaceUnlocked(space); Should be safe as long as its not from a constraint callback.
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
586
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
587 cpBodyActivate(constraint.a);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
588 cpBodyActivate(constraint.b);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
589 cpArrayDeleteObj(space.constraints, constraint);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
590 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
591
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
592 //#pragma mark Spatial Hash Management
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
593
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
594 static void updateBBCache(cpShape *shape, void *unused){cpShapeCacheBB(shape);}
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
595
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
596 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
597 cpSpaceResizeStaticHash(cpSpace *space, cpFloat dim, int count)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
598 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
599 cpSpaceHashResize(space.staticShapes, dim, count);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
600 cpSpaceHashRehash(space.staticShapes);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
601 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
602
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
603 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
604 cpSpaceResizeActiveHash(cpSpace *space, cpFloat dim, int count)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
605 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
606 cpSpaceHashResize(space.activeShapes, dim, count);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
607 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
608
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
609 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
610 cpSpaceRehashStatic(cpSpace *space)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
611 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
612 cpSpaceHashEach(space.staticShapes, cast(cpSpaceHashIterator)&updateBBCache, null);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
613 cpSpaceHashRehash(space.staticShapes);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
614 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
615
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
616 void
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
617 cpSpaceRehashShape(cpSpace *space, cpShape *shape)
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
618 {
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
619 cpShapeCacheBB(shape);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
620
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
621 // attempt to rehash the shape in both hashes
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
622 cpSpaceHashRehashObject(space.activeShapes, shape, shape.hashid);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
623 cpSpaceHashRehashObject(space.staticShapes, shape, shape.hashid);
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
624 }
7ebbd4d05553 initial commit
Extrawurst
parents:
diff changeset
625