Permalink
Browse files

Added Chipmunk v5.3.2

Chipmunk template's updated
  • Loading branch information...
1 parent 299c5a3 commit c2a449b166bd47d31700cc8def9ff1cad8aa157b @ricardoquesada ricardoquesada committed Oct 10, 2010
View
@@ -1,3 +1,6 @@
+version 0.99.5-rc0 - XX-XXX-2010
+. [3RD] Chipmunk: Using version 5.3.2
+
version 0.99.5-beta3 23-Sep-2010
. [NEW] RetinaDisplay supported automatically:
Director: winSize returns size in Points. Use winSizeInPixels for pixels
@@ -2198,6 +2198,9 @@
E0B0E71111F8CF9F00414246 /* texture1024x1024.png in Resources */ = {isa = PBXBuildFile; fileRef = E0B0E70D11F8CF9F00414246 /* texture1024x1024.png */; };
E0B0E71211F8CF9F00414246 /* texture2048x2048.png in Resources */ = {isa = PBXBuildFile; fileRef = E0B0E70E11F8CF9F00414246 /* texture2048x2048.png */; };
E0B0E71311F8CF9F00414246 /* texture4096x4096.png in Resources */ = {isa = PBXBuildFile; fileRef = E0B0E70F11F8CF9F00414246 /* texture4096x4096.png */; };
+ E0B1E8021261F9E300ACD961 /* cpSpaceComponent.c in Sources */ = {isa = PBXBuildFile; fileRef = E0B1E7FF1261F9E300ACD961 /* cpSpaceComponent.c */; };
+ E0B1E8031261F9E300ACD961 /* cpSpaceQuery.c in Sources */ = {isa = PBXBuildFile; fileRef = E0B1E8001261F9E300ACD961 /* cpSpaceQuery.c */; };
+ E0B1E8041261F9E300ACD961 /* cpSpaceStep.c in Sources */ = {isa = PBXBuildFile; fileRef = E0B1E8011261F9E300ACD961 /* cpSpaceStep.c */; };
E0C3655B11F0AE9B001C08F9 /* CCSpriteBatchNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E0C3655911F0AE9B001C08F9 /* CCSpriteBatchNode.h */; };
E0C3655C11F0AE9B001C08F9 /* CCSpriteBatchNode.m in Sources */ = {isa = PBXBuildFile; fileRef = E0C3655A11F0AE9B001C08F9 /* CCSpriteBatchNode.m */; };
E0C54DCA11F9CF2700B9E4CB /* ccUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = E0C54DC811F9CF2700B9E4CB /* ccUtils.c */; };
@@ -4088,6 +4091,9 @@
E0B0E70D11F8CF9F00414246 /* texture1024x1024.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = texture1024x1024.png; sourceTree = "<group>"; };
E0B0E70E11F8CF9F00414246 /* texture2048x2048.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = texture2048x2048.png; sourceTree = "<group>"; };
E0B0E70F11F8CF9F00414246 /* texture4096x4096.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = texture4096x4096.png; sourceTree = "<group>"; };
+ E0B1E7FF1261F9E300ACD961 /* cpSpaceComponent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpaceComponent.c; sourceTree = "<group>"; };
+ E0B1E8001261F9E300ACD961 /* cpSpaceQuery.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpaceQuery.c; sourceTree = "<group>"; };
+ E0B1E8011261F9E300ACD961 /* cpSpaceStep.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpaceStep.c; sourceTree = "<group>"; };
E0C3655911F0AE9B001C08F9 /* CCSpriteBatchNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSpriteBatchNode.h; sourceTree = "<group>"; };
E0C3655A11F0AE9B001C08F9 /* CCSpriteBatchNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCSpriteBatchNode.m; sourceTree = "<group>"; };
E0C54DC811F9CF2700B9E4CB /* ccUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccUtils.c; sourceTree = "<group>"; };
@@ -6608,6 +6614,9 @@
50E5F2D1110690C600E3FCF5 /* cpShape.c */,
50E5F2D2110690C600E3FCF5 /* cpSpace.c */,
50E5F2D3110690C600E3FCF5 /* cpSpaceHash.c */,
+ E0B1E7FF1261F9E300ACD961 /* cpSpaceComponent.c */,
+ E0B1E8001261F9E300ACD961 /* cpSpaceQuery.c */,
+ E0B1E8011261F9E300ACD961 /* cpSpaceStep.c */,
50E5F2D4110690C600E3FCF5 /* cpVect.c */,
50E5F2D5110690C600E3FCF5 /* prime.h */,
);
@@ -10729,6 +10738,9 @@
50E5F305110690C600E3FCF5 /* cpSpace.c in Sources */,
50E5F306110690C600E3FCF5 /* cpSpaceHash.c in Sources */,
50E5F307110690C600E3FCF5 /* cpVect.c in Sources */,
+ E0B1E8021261F9E300ACD961 /* cpSpaceComponent.c in Sources */,
+ E0B1E8031261F9E300ACD961 /* cpSpaceQuery.c in Sources */,
+ E0B1E8041261F9E300ACD961 /* cpSpaceStep.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -92,17 +92,26 @@ void cpMessage(const char *message, const char *condition, const char *file, int
extern const char *cpVersionString;
void cpInitChipmunk(void);
-// Calculate the moment of inertia for a circle, r1 and r2 are the inner and outer diameters.
-// (A solid circle has an inner diameter of 0)
+/**
+ Calculate the moment of inertia for a circle.
+ r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.
+*/
cpFloat cpMomentForCircle(cpFloat m, cpFloat r1, cpFloat r2, cpVect offset);
-// Calculate the moment of inertia for a line segment. (beveling radius not supported)
+/**
+ Calculate the moment of inertia for a line segment.
+ Beveling radius is not supported.
+*/
cpFloat cpMomentForSegment(cpFloat m, cpVect a, cpVect b);
-// Calculate the moment of inertia for a solid polygon shape.
+/**
+ Calculate the moment of inertia for a solid polygon shape.
+*/
cpFloat cpMomentForPoly(cpFloat m, int numVerts, cpVect *verts, cpVect offset);
-// Calculate the moment of inertia for a solid box.
+/**
+ Calculate the moment of inertia for a solid box.
+*/
cpFloat cpMomentForBox(cpFloat m, cpFloat width, cpFloat height);
#ifdef __cplusplus
@@ -12,6 +12,7 @@
#endif
MAKE_REF(cpv); // makes a variable named _cpv that contains the function pointer for cpv()
+MAKE_REF(cpveql);
MAKE_REF(cpvadd);
MAKE_REF(cpvneg);
MAKE_REF(cpvsub);
@@ -30,8 +31,8 @@ MAKE_REF(cpvnormalize_safe);
MAKE_REF(cpvclamp);
MAKE_REF(cpvlerpconst);
MAKE_REF(cpvdist);
-MAKE_REF(cpvnear);
MAKE_REF(cpvdistsq);
+MAKE_REF(cpvnear);
MAKE_REF(cpBBNew);
MAKE_REF(cpBBintersects);
@@ -43,8 +44,16 @@ MAKE_REF(cpBBexpand);
MAKE_REF(cpBodyWorld2Local);
MAKE_REF(cpBodyLocal2World);
MAKE_REF(cpBodyApplyImpulse);
+MAKE_REF(cpBodyIsSleeping);
+MAKE_REF(cpBodyIsRogue);
+MAKE_REF(cpBodyKineticEnergy);
MAKE_REF(cpArbiterIsFirstContact);
MAKE_REF(cpArbiterGetShapes);
MAKE_REF(cpArbiterGetNormal);
MAKE_REF(cpArbiterGetPoint);
+
+MAKE_REF(cpConstraintGetImpulse);
+
+MAKE_REF(cpSegmentQueryHitPoint);
+MAKE_REF(cpSegmentQueryHitDist);
@@ -63,13 +63,19 @@ cpConstraintActivateBodies(cpConstraint *constraint)
cpBody *b = constraint->b; if(b) cpBodyActivate(b);
}
+static inline cpFloat
+cpConstraintGetImpulse(cpConstraint *constraint)
+{
+ return constraint->klass->getImpulse(constraint);
+}
+
#define cpConstraintCheckCast(constraint, struct) \
cpAssert(constraint->klass == struct##GetClass(), "Constraint is not a "#struct);
#define CP_DefineConstraintGetter(struct, type, member, name) \
static inline type \
-struct##Get##name(cpConstraint *constraint){ \
+struct##Get##name(const cpConstraint *constraint){ \
cpConstraintCheckCast(constraint, struct); \
return ((struct *)constraint)->member; \
} \
@@ -78,6 +84,7 @@ struct##Get##name(cpConstraint *constraint){ \
static inline void \
struct##Set##name(cpConstraint *constraint, type value){ \
cpConstraintCheckCast(constraint, struct); \
+ cpConstraintActivateBodies(constraint); \
((struct *)constraint)->member = value; \
} \
@@ -40,5 +40,9 @@ cpGrooveJoint *cpGrooveJointAlloc(void);
cpGrooveJoint *cpGrooveJointInit(cpGrooveJoint *joint, cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
cpConstraint *cpGrooveJointNew(cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
-// TODO setters for the groove.
+
+CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_a, GrooveA);
+void cpGrooveJointSetGrooveA(cpConstraint *constraint, cpVect value);
+CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_b, GrooveB);
+void cpGrooveJointSetGrooveB(cpConstraint *constraint, cpVect value);
CP_DefineConstraintProperty(cpGrooveJoint, cpVect, anchr2, Anchr2);
@@ -110,7 +110,7 @@ void cpArbiterIgnore(cpArbiter *arb);
static inline void
-cpArbiterGetShapes(cpArbiter *arb, cpShape **a, cpShape **b)
+cpArbiterGetShapes(const cpArbiter *arb, cpShape **a, cpShape **b)
{
if(arb->swappedColl){
(*a) = arb->private_b, (*b) = arb->private_a;
@@ -121,7 +121,7 @@ cpArbiterGetShapes(cpArbiter *arb, cpShape **a, cpShape **b)
#define CP_ARBITER_GET_SHAPES(arb, a, b) cpShape *a, *b; cpArbiterGetShapes(arb, &a, &b);
static inline void
-cpArbiterGetBodies(cpArbiter *arb, cpBody **a, cpBody **b)
+cpArbiterGetBodies(const cpArbiter *arb, cpBody **a, cpBody **b)
{
CP_ARBITER_GET_SHAPES(arb, shape_a, shape_b);
(*a) = shape_a->body;
@@ -130,20 +130,20 @@ cpArbiterGetBodies(cpArbiter *arb, cpBody **a, cpBody **b)
#define CP_ARBITER_GET_BODIES(arb, a, b) cpBody *a, *b; cpArbiterGetBodies(arb, &a, &b);
static inline cpBool
-cpArbiterIsFirstContact(cpArbiter *arb)
+cpArbiterIsFirstContact(const cpArbiter *arb)
{
return arb->state == cpArbiterStateFirstColl;
}
static inline cpVect
-cpArbiterGetNormal(cpArbiter *arb, int i)
+cpArbiterGetNormal(const cpArbiter *arb, int i)
{
cpVect n = arb->contacts[i].n;
return arb->swappedColl ? cpvneg(n) : n;
}
static inline cpVect
-cpArbiterGetPoint(cpArbiter *arb, int i)
+cpArbiterGetPoint(const cpArbiter *arb, int i)
{
return arb->contacts[i].p;
}
@@ -71,16 +71,16 @@ typedef struct cpBody{
// Used for fast vector rotation using cpvrotate().
cpVect rot;
- // *** Other Fields
-
- // Maximum velocities this body can move at after integrating velocity
- cpFloat v_limit, w_limit;
-
// *** User Definable Fields
// User defined data pointer.
cpDataPointer data;
+ // *** Other Fields
+
+ // Maximum velocities this body can move at after integrating velocity
+ cpFloat v_limit, w_limit;
+
// *** Internally Used Fields
// Velocity bias values used when solving penetrations and correcting constraints.
@@ -106,32 +106,35 @@ cpBody *cpBodyNew(cpFloat m, cpFloat i);
void cpBodyDestroy(cpBody *body);
void cpBodyFree(cpBody *body);
-// Wake up a sleeping or idle body.
+// Wake up a sleeping or idle body. (defined in cpSpace.c)
void cpBodyActivate(cpBody *body);
+// Force a body to sleep;
+void cpBodySleep(cpBody *body);
+//void cpBodySleepGroup(cpBody *body, ...);
+
static inline cpBool
-cpBodyIsSleeping(cpBody *body)
+cpBodyIsSleeping(const cpBody *body)
{
return (body->node.next != ((cpBody*)0));
}
-// defined in cpSpace.h after the cpSpace type has been defined
-static inline cpBool
-cpBodyIsStatic(cpBody *body);
+cpBool cpBodyIsStatic(const cpBody *body);
static inline cpBool
-cpBodyIsRogue(cpBody *body)
+cpBodyIsRogue(const cpBody *body)
{
return (body->space == ((struct cpSpace*)0));
}
#define CP_DefineBodyGetter(type, member, name) \
-static inline type cpBodyGet##name(cpBody *body){return body->member;}
+static inline type cpBodyGet##name(const cpBody *body){return body->member;}
#define CP_DefineBodySetter(type, member, name) \
static inline void \
-cpBodySet##name(cpBody *body, type value){ \
+cpBodySet##name(cpBody *body, const type value){ \
+ cpBodyActivate(body); \
body->member = value; \
} \
@@ -169,21 +172,21 @@ void cpBodyUpdatePosition(cpBody *body, cpFloat dt);
// Convert body local to world coordinates
static inline cpVect
-cpBodyLocal2World(cpBody *body, cpVect v)
+cpBodyLocal2World(const cpBody *body, const cpVect v)
{
return cpvadd(body->p, cpvrotate(v, body->rot));
}
// Convert world to body local coordinates
static inline cpVect
-cpBodyWorld2Local(cpBody *body, cpVect v)
+cpBodyWorld2Local(const cpBody *body, const cpVect v)
{
return cpvunrotate(cpvsub(v, body->p), body->rot);
}
// Apply an impulse (in world coordinates) to the body at a point relative to the center of gravity (also in world coordinates).
static inline void
-cpBodyApplyImpulse(cpBody *body, cpVect j, cpVect r)
+cpBodyApplyImpulse(cpBody *body, const cpVect j, const cpVect r)
{
body->v = cpvadd(body->v, cpvmult(j, body->m_inv));
body->w += body->i_inv*cpvcross(r, j);
@@ -192,10 +195,10 @@ cpBodyApplyImpulse(cpBody *body, cpVect j, cpVect r)
// Zero the forces on a body.
void cpBodyResetForces(cpBody *body);
// Apply a force (in world coordinates) to a body at a point relative to the center of gravity (also in world coordinates).
-void cpBodyApplyForce(cpBody *body, cpVect f, cpVect r);
+void cpBodyApplyForce(cpBody *body, const cpVect f, const cpVect r);
static inline cpFloat
-cpBodyKineticEnergy(cpBody *body)
+cpBodyKineticEnergy(const cpBody *body)
{
// Need to do some fudging to avoid NaNs
cpFloat vsq = cpvdot(body->v, body->v);
@@ -23,4 +23,4 @@
// Returns the number of contact points added to arr
// which should be at least CP_MAX_CONTACTS_PER_ARBITER in length.
// This function is very lonely in this header :(
-int cpCollideShapes(cpShape *a, cpShape *b, cpContact *arr);
+int cpCollideShapes(const cpShape *a, const cpShape *b, cpContact *arr);
@@ -73,7 +73,7 @@ cpPolyShapeValueOnAxis(const cpPolyShape *poly, const cpVect n, const cpFloat d)
// Returns true if the polygon contains the vertex.
static inline cpBool
-cpPolyShapeContainsVert(cpPolyShape *poly, cpVect v)
+cpPolyShapeContainsVert(const cpPolyShape *poly, const cpVect v)
{
cpPolyShapeAxis *axes = poly->tAxes;
@@ -88,7 +88,7 @@ cpPolyShapeContainsVert(cpPolyShape *poly, cpVect v)
// Same as cpPolyShapeContainsVert() but ignores faces pointing away from the normal.
static inline cpBool
-cpPolyShapeContainsVertPartial(cpPolyShape *poly, cpVect v, cpVect n)
+cpPolyShapeContainsVertPartial(const cpPolyShape *poly, const cpVect v, const cpVect n)
{
cpPolyShapeAxis *axes = poly->tAxes;
@@ -165,13 +165,13 @@ void cpSegmentQueryInfoPrint(cpSegmentQueryInfo *info);
cpBool cpShapeSegmentQuery(cpShape *shape, cpVect a, cpVect b, cpSegmentQueryInfo *info);
static inline cpVect
-cpSegmentQueryHitPoint(cpVect start, cpVect end, cpSegmentQueryInfo info)
+cpSegmentQueryHitPoint(const cpVect start, const cpVect end, const cpSegmentQueryInfo info)
{
return cpvlerp(start, end, info.t);
}
static inline cpFloat
-cpSegmentQueryHitDist(cpVect start, cpVect end, cpSegmentQueryInfo info)
+cpSegmentQueryHitDist(const cpVect start, const cpVect end, const cpSegmentQueryInfo info)
{
return cpvdist(start, end)*info.t;
}
@@ -94,9 +94,9 @@ typedef struct cpSpace{
cpArray *arbiters, *pooledArbiters;
// Linked list ring of contact buffers.
- // Head is the current buffer. Tail is the oldest buffer.
- // The list points in the direction of tail->head.
- cpContactBufferHeader *contactBuffersHead, *contactBuffersTail;
+ // Head is the newest buffer, and each buffer points to a newer buffer.
+ // Head wraps around and points to the oldest (tail) buffer.
+ cpContactBufferHeader *contactBuffersHead, *_contactBuffersTail;
// List of buffers to be free()ed when destroying the space.
cpArray *allocatedBuffers;
@@ -128,14 +128,6 @@ void cpSpaceFree(cpSpace *space);
// Convenience function. Frees all referenced entities. (bodies, shapes and constraints)
void cpSpaceFreeChildren(cpSpace *space);
-// Needed to be defined after the cpSpace type was closed
-static inline cpBool
-cpBodyIsStatic(cpBody *body)
-{
- cpSpace *space = body->space;
- return (space != ((cpSpace*)0) && body == &space->staticBody);
-}
-
// Collision handler management functions.
void cpSpaceSetDefaultCollisionHandler(
cpSpace *space,
@@ -180,7 +172,7 @@ cpShape *cpSpacePointQueryFirst(cpSpace *space, cpVect point, cpLayers layers, c
// Segment query callback function
typedef void (*cpSpaceSegmentQueryFunc)(cpShape *shape, cpFloat t, cpVect n, void *data);
-cpBool cpSpaceSegmentQuery(cpSpace *space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSpaceSegmentQueryFunc func, void *data);
+void cpSpaceSegmentQuery(cpSpace *space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSpaceSegmentQueryFunc func, void *data);
cpShape *cpSpaceSegmentQueryFirst(cpSpace *space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo *out);
// BB query callback function
@@ -197,5 +189,7 @@ void cpSpaceResizeStaticHash(cpSpace *space, cpFloat dim, int count);
void cpSpaceResizeActiveHash(cpSpace *space, cpFloat dim, int count);
void cpSpaceRehashStatic(cpSpace *space);
+void cpSpaceRehashShape(cpSpace *space, cpShape *shape);
+
// Update the space.
void cpSpaceStep(cpSpace *space, cpFloat dt);
@@ -77,7 +77,7 @@ void cpSpaceHashFree(cpSpaceHash *hash);
void cpSpaceHashResize(cpSpaceHash *hash, cpFloat celldim, int numcells);
// Add an object to the hash.
-void cpSpaceHashInsert(cpSpaceHash *hash, void *obj, cpHashValue id, cpBB bb);
+void cpSpaceHashInsert(cpSpaceHash *hash, void *obj, cpHashValue id, cpBB _deprecated_ignored);
// Remove an object from the hash.
void cpSpaceHashRemove(cpSpaceHash *hash, void *obj, cpHashValue id);
Oops, something went wrong.

0 comments on commit c2a449b

Please sign in to comment.