Permalink
Browse files

Using Chipmunk v6.0.3

  • Loading branch information...
ricardoquesada committed Jan 10, 2012
1 parent 10ebd4b commit 0429fc4a1b89c82d2d008714d35e541f41ebaa5c
Showing with 1,420 additions and 1,363 deletions.
  1. +3 −1 CHANGELOG
  2. +15 −11 external/Chipmunk/include/chipmunk/chipmunk.h
  3. +2 −1 external/Chipmunk/include/chipmunk/chipmunk_ffi.h
  4. +27 −20 external/Chipmunk/include/chipmunk/chipmunk_private.h
  5. +7 −6 external/Chipmunk/include/chipmunk/chipmunk_types.h
  6. +3 −3 external/Chipmunk/include/chipmunk/chipmunk_unsafe.h
  7. +18 −14 external/Chipmunk/include/chipmunk/constraints/cpConstraint.h
  8. +10 −9 external/Chipmunk/include/chipmunk/constraints/cpDampedRotarySpring.h
  9. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpDampedSpring.h
  10. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpGearJoint.h
  11. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpGrooveJoint.h
  12. +10 −10 external/Chipmunk/include/chipmunk/constraints/cpPinJoint.h
  13. +10 −10 external/Chipmunk/include/chipmunk/constraints/cpPivotJoint.h
  14. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpRatchetJoint.h
  15. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpRotaryLimitJoint.h
  16. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpSimpleMotor.h
  17. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpSlideJoint.h
  18. +11 −11 external/Chipmunk/include/chipmunk/constraints/util.h
  19. +14 −10 external/Chipmunk/include/chipmunk/cpArbiter.h
  20. +36 −15 external/Chipmunk/include/chipmunk/cpBB.h
  21. +29 −23 external/Chipmunk/include/chipmunk/cpBody.h
  22. +11 −11 external/Chipmunk/include/chipmunk/cpPolyShape.h
  23. +19 −19 external/Chipmunk/include/chipmunk/cpShape.h
  24. +28 −25 external/Chipmunk/include/chipmunk/cpSpace.h
  25. +27 −27 external/Chipmunk/include/chipmunk/cpSpatialIndex.h
  26. +4 −4 external/Chipmunk/include/chipmunk/cpVect.h
  27. +1 −1 external/Chipmunk/src/CMakeLists.txt
  28. +18 −18 external/Chipmunk/src/chipmunk.c
  29. +8 −8 external/Chipmunk/src/constraints/cpConstraint.c
  30. +9 −9 external/Chipmunk/src/constraints/cpDampedRotarySpring.c
  31. +13 −13 external/Chipmunk/src/constraints/cpDampedSpring.c
  32. +14 −14 external/Chipmunk/src/constraints/cpGearJoint.c
  33. +21 −21 external/Chipmunk/src/constraints/cpGrooveJoint.c
  34. +16 −14 external/Chipmunk/src/constraints/cpPinJoint.c
  35. +15 −15 external/Chipmunk/src/constraints/cpPivotJoint.c
  36. +17 −17 external/Chipmunk/src/constraints/cpRatchetJoint.c
  37. +15 −15 external/Chipmunk/src/constraints/cpRotaryLimitJoint.c
  38. +13 −13 external/Chipmunk/src/constraints/cpSimpleMotor.c
  39. +22 −21 external/Chipmunk/src/constraints/cpSlideJoint.c
  40. +77 −69 external/Chipmunk/src/cpArbiter.c
  41. +16 −16 external/Chipmunk/src/cpArray.c
  42. +6 −6 external/Chipmunk/src/cpBB.c
  43. +119 −110 external/Chipmunk/src/cpBBTree.c
  44. +51 −29 external/Chipmunk/src/cpBody.c
  45. +64 −103 external/Chipmunk/src/cpCollision.c
  46. +47 −47 external/Chipmunk/src/cpHashSet.c
  47. +22 −22 external/Chipmunk/src/cpPolyShape.c
  48. +57 −66 external/Chipmunk/src/cpShape.c
  49. +90 −86 external/Chipmunk/src/cpSpace.c
  50. +54 −52 external/Chipmunk/src/cpSpaceComponent.c
  51. +83 −83 external/Chipmunk/src/cpSpaceHash.c
  52. +28 −28 external/Chipmunk/src/cpSpaceQuery.c
  53. +136 −133 external/Chipmunk/src/cpSpaceStep.c
  54. +2 −2 external/Chipmunk/src/cpSpatialIndex.c
  55. +29 −29 external/Chipmunk/src/cpSweep1D.c
  56. +5 −5 external/Chipmunk/src/cpVect.c
  57. +5 −5 external/Chipmunk/src/prime.h
View
@@ -1,4 +1,4 @@
-version 2.0-beta2 8-Jan-2012
+version 2.0-beta2 9-Jan-2012
. [NEW] v1.1 Forward-ported changes:
LabelTTF: word wrap works on Mac (issue #1074)
Node: Added onExitTransitionDidStart (issue #792)
@@ -37,6 +37,8 @@ version 2.0-beta2 8-Jan-2012
. [FIX] Tests: ShaderTest centers shaders (Mac)
. [FIX] Texture2D: Uses CGImageRef instead of UIKit for iOS API
. [FIX] TileMaps: Re-added "cc_vertexz" property
+. [3RD] Chipmunk: Using Chipmunk v6.0.3
+
version 2.0-beta 27-Nov-2011
. [NEW] v1.1 Forward-ported changes:
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -19,9 +19,6 @@
* SOFTWARE.
*/
-/// @defgroup misc Misc
-/// @{
-
#ifndef CHIPMUNK_HEADER
#define CHIPMUNK_HEADER
@@ -57,22 +54,27 @@ void cpMessage(const char *condition, const char *file, int line, int isError, i
#include "chipmunk_types.h"
+
+/// @defgroup misc Misc
+/// @{
-// Allocated size for various Chipmunk buffers
+/// Allocated size for various Chipmunk buffers
#ifndef CP_BUFFER_BYTES
#define CP_BUFFER_BYTES (32*1024)
#endif
-// Chipmunk memory function aliases.
#ifndef cpcalloc
+ /// Chipmunk calloc() alias.
#define cpcalloc calloc
#endif
#ifndef cprealloc
+ /// Chipmunk realloc() alias.
#define cprealloc realloc
#endif
#ifndef cpfree
+ /// Chipmunk free() alias.
#define cpfree free
#endif
@@ -96,14 +98,15 @@ typedef struct cpSpace cpSpace;
#include "cpShape.h"
#include "cpPolyShape.h"
-#include "cpArbiter.h"
+#include "cpArbiter.h"
#include "constraints/cpConstraint.h"
#include "cpSpace.h"
+// Chipmunk 6.0.3
#define CP_VERSION_MAJOR 6
#define CP_VERSION_MINOR 0
-#define CP_VERSION_RELEASE 2
+#define CP_VERSION_RELEASE 3
/// Version string.
extern const char *cpVersionString;
@@ -145,6 +148,8 @@ cpFloat cpMomentForBox(cpFloat m, cpFloat width, cpFloat height);
/// Calculate the moment of inertia for a solid box.
cpFloat cpMomentForBox2(cpFloat m, cpBB box);
+//@}
+
#ifdef __cplusplus
}
@@ -156,4 +161,3 @@ static inline cpVect operator -(const cpVect v){return cpvneg(v);}
#endif
#endif
-//@}
@@ -47,13 +47,15 @@ MAKE_REF(cpflerp);
MAKE_REF(cpflerpconst);
MAKE_REF(cpBBNew);
+MAKE_REF(cpBBNewForCircle);
MAKE_REF(cpBBIntersects);
MAKE_REF(cpBBContainsBB);
MAKE_REF(cpBBContainsVect);
MAKE_REF(cpBBMerge);
MAKE_REF(cpBBExpand);
MAKE_REF(cpBBArea);
MAKE_REF(cpBBMergedArea);
+MAKE_REF(cpBBSegmentQuery);
MAKE_REF(cpBBIntersectsSegment);
MAKE_REF(cpBodyGetMass);
@@ -160,7 +162,6 @@ MAKE_PROPERTIES_REF(cpSpace, Gravity);
MAKE_PROPERTIES_REF(cpSpace, Damping);
MAKE_PROPERTIES_REF(cpSpace, IdleSpeedThreshold);
MAKE_PROPERTIES_REF(cpSpace, SleepTimeThreshold);
-MAKE_PROPERTIES_REF(cpSpace, SleepTimeThreshold);
MAKE_PROPERTIES_REF(cpSpace, CollisionSlop);
MAKE_PROPERTIES_REF(cpSpace, CollisionBias);
MAKE_PROPERTIES_REF(cpSpace, CollisionPersistence);
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -25,7 +25,7 @@
#define CP_HASH_COEF (3344921057ul)
#define CP_HASH_PAIR(A, B) ((cpHashValue)(A)*CP_HASH_COEF ^ (cpHashValue)(B)*CP_HASH_COEF)
-#pragma mark cpArray
+//MARK: cpArray
struct cpArray {
int num, max;
@@ -43,7 +43,7 @@ cpBool cpArrayContains(cpArray *arr, void *ptr);
void cpArrayFreeEach(cpArray *arr, void (freeFunc)(void*));
-#pragma mark Foreach loops
+//MARK: Foreach loops
static inline cpConstraint *
cpConstraintNext(cpConstraint *node, cpBody *body)
@@ -69,7 +69,7 @@ cpArbiterNext(cpArbiter *node, cpBody *body)
#define CP_BODY_FOREACH_COMPONENT(root, var)\
for(cpBody *var = root; var; var = var->node.next)
-#pragma mark cpHashSet
+//MARK: cpHashSet
typedef cpBool (*cpHashSetEqlFunc)(void *ptr, void *elt);
typedef void *(*cpHashSetTransFunc)(void *ptr, void *data);
@@ -90,14 +90,14 @@ void cpHashSetEach(cpHashSet *set, cpHashSetIteratorFunc func, void *data);
typedef cpBool (*cpHashSetFilterFunc)(void *elt, void *data);
void cpHashSetFilter(cpHashSet *set, cpHashSetFilterFunc func, void *data);
-#pragma mark Body Functions
+//MARK: Body Functions
void cpBodyAddShape(cpBody *body, cpShape *shape);
void cpBodyRemoveShape(cpBody *body, cpShape *shape);
void cpBodyRemoveConstraint(cpBody *body, cpConstraint *constraint);
-#pragma mark Shape/Collision Functions
+//MARK: Shape/Collision Functions
cpShape* cpShapeInit(cpShape *shape, const cpShapeClass *klass, cpBody *body);
@@ -114,55 +114,57 @@ cpPolyShapeValueOnAxis(const cpPolyShape *poly, const cpVect n, const cpFloat d)
{
cpVect *verts = poly->tVerts;
cpFloat min = cpvdot(n, verts[0]);
-
+
for(int i=1; i<poly->numVerts; i++){
min = cpfmin(min, cpvdot(n, verts[i]));
}
-
+
return min - d;
}
static inline cpBool
cpPolyShapeContainsVert(const cpPolyShape *poly, const cpVect v)
{
cpPolyShapeAxis *axes = poly->tAxes;
-
+
for(int i=0; i<poly->numVerts; i++){
cpFloat dist = cpvdot(axes[i].n, v) - axes[i].d;
if(dist > 0.0f) return cpFalse;
}
-
+
return cpTrue;
}
static inline cpBool
cpPolyShapeContainsVertPartial(const cpPolyShape *poly, const cpVect v, const cpVect n)
{
cpPolyShapeAxis *axes = poly->tAxes;
-
+
for(int i=0; i<poly->numVerts; i++){
if(cpvdot(axes[i].n, n) < 0.0f) continue;
cpFloat dist = cpvdot(axes[i].n, v) - axes[i].d;
if(dist > 0.0f) return cpFalse;
}
-
+
return cpTrue;
}
-#pragma mark Spatial Index Functions
+//MARK: Spatial Index Functions
cpSpatialIndex *cpSpatialIndexInit(cpSpatialIndex *index, cpSpatialIndexClass *klass, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
-#pragma mark Space Functions
+//MARK: Space Functions
extern cpCollisionHandler cpDefaultCollisionHandler;
void cpSpaceProcessComponents(cpSpace *space, cpFloat dt);
+void cpSpacePushFreshContactBuffer(cpSpace *space);
cpContact *cpContactBufferGetArray(cpSpace *space);
void cpSpacePushContacts(cpSpace *space, int count);
void *cpSpaceGetPostStepData(cpSpace *space, void *obj);
+cpBool cpSpaceArbiterSetFilter(cpArbiter *arb, cpSpace *space);
void cpSpaceFilterArbiters(cpSpace *space, cpBody *body, cpShape *filter);
void cpSpaceActivateBody(cpSpace *space, cpBody *body);
@@ -181,23 +183,28 @@ cpSpaceUncacheArbiter(cpSpace *space, cpArbiter *arb)
{
cpShape *a = arb->a, *b = arb->b;
cpShape *shape_pair[] = {a, b};
- cpHashValue arbHashID = CP_HASH_PAIR((size_t)a, (size_t)b);
+ cpHashValue arbHashID = CP_HASH_PAIR((cpHashValue)a, (cpHashValue)b);
cpHashSetRemove(space->cachedArbiters, arbHashID, shape_pair);
cpArrayDeleteObj(space->arbiters, arb);
}
-#pragma mark Arbiters
+void cpShapeUpdateFunc(cpShape *shape, void *unused);
+void cpSpaceCollideShapes(cpShape *a, cpShape *b, cpSpace *space);
+
+
+
+//MARK: Arbiters
struct cpContact {
cpVect p, n;
cpFloat dist;
-
+
cpVect r1, r2;
cpFloat nMass, tMass, bounce;
cpFloat jnAcc, jtAcc, jBias;
cpFloat bias;
-
+
cpHashValue hash;
};
@@ -1,11 +1,12 @@
+#include <math.h>
#include <stdint.h>
#ifdef __APPLE__
#import "TargetConditionals.h"
#endif
-#if (defined TARGET_OS_IPHONE) && (!defined CP_USE_CGPOINTS)
- #define CP_USE_CGPOINTS
+#if (TARGET_OS_IPHONE == 1) && (!defined CP_USE_CGPOINTS)
+ #define CP_USE_CGPOINTS 1
#endif
#ifdef CP_USE_CGPOINTS
@@ -14,7 +15,7 @@
#elif TARGET_OS_MAC
#import <ApplicationServices/ApplicationServices.h>
#endif
-
+
#if defined(__LP64__) && __LP64__
#define CP_USE_DOUBLES 1
#else
@@ -70,11 +71,11 @@
static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
#define INFINITY (INFINITY_HACK.Value)
#endif
-
+
#ifdef __GNUC__
#define INFINITY (__builtin_inf())
#endif
-
+
#ifndef INFINITY
#define INFINITY (1e1000)
#endif
@@ -136,8 +137,8 @@ static inline cpFloat cpflerpconst(cpFloat f1, cpFloat f2, cpFloat d)
/// Hash value type.
typedef uintptr_t cpHashValue;
+// Oh C, how we love to define our own boolean types to get compiler compatibility
/// Chipmunk's boolean type.
-/// Oh C, how we love to define our own boolean types to get compiler compatibility
#ifdef CP_BOOL_TYPE
typedef CP_BOOL_TYPE cpBool;
#else
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Oops, something went wrong.

0 comments on commit 0429fc4

Please sign in to comment.