Created
June 17, 2015 23:16
-
-
Save kripken/3956475146c5998cc3d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 56b78d937b91aa597193be1c5a0d681d2df0e5e7 Mon Sep 17 00:00:00 2001 | |
From: Alessandro Pignotti <a.pignotti@sssup.it> | |
Date: Tue, 16 Jun 2015 16:55:33 +0200 | |
Subject: [PATCH] Add Cheerp support to test runner | |
--- | |
cheerptrampoline.cpp | 43 +++++ | |
tests/box2d/Benchmark.cpp | 26 ++- | |
.../box2d/Box2D/Collision/Shapes/b2ChainShape.cpp | 11 +- | |
.../box2d/Box2D/Collision/Shapes/b2CircleShape.cpp | 3 +- | |
tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.cpp | 17 +- | |
tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.h | 2 +- | |
.../Box2D/Collision/Shapes/b2PolygonShape.cpp | 3 +- | |
tests/box2d/Box2D/Collision/b2CollideCircle.cpp | 10 +- | |
tests/box2d/Box2D/Collision/b2CollideEdge.cpp | 12 +- | |
tests/box2d/Box2D/Collision/b2Collision.cpp | 4 +- | |
tests/box2d/Box2D/Collision/b2Collision.h | 17 +- | |
tests/box2d/Box2D/Collision/b2Distance.cpp | 86 ++++----- | |
tests/box2d/Box2D/Common/b2BlockAllocator.cpp | 3 + | |
tests/box2d/Box2D/Common/b2BlockAllocator.h | 4 + | |
tests/box2d/Box2D/Common/b2Settings.h | 7 + | |
tests/box2d/Box2D/Common/b2StackAllocator.cpp | 2 + | |
tests/box2d/Box2D/Common/b2StackAllocator.h | 4 + | |
.../Dynamics/Contacts/b2ChainAndCircleContact.cpp | 6 +- | |
.../Dynamics/Contacts/b2ChainAndPolygonContact.cpp | 6 +- | |
.../Box2D/Dynamics/Contacts/b2CircleContact.cpp | 6 +- | |
tests/box2d/Box2D/Dynamics/Contacts/b2Contact.cpp | 2 +- | |
.../Box2D/Dynamics/Contacts/b2ContactSolver.cpp | 8 +- | |
.../Dynamics/Contacts/b2EdgeAndCircleContact.cpp | 6 +- | |
.../Dynamics/Contacts/b2EdgeAndPolygonContact.cpp | 6 +- | |
.../Contacts/b2PolygonAndCircleContact.cpp | 6 +- | |
.../Box2D/Dynamics/Contacts/b2PolygonContact.cpp | 6 +- | |
tests/box2d/Box2D/Dynamics/Joints/b2Joint.cpp | 51 +++-- | |
tests/box2d/Box2D/Dynamics/b2Body.cpp | 17 +- | |
tests/box2d/Box2D/Dynamics/b2ContactManager.cpp | 5 +- | |
tests/box2d/Box2D/Dynamics/b2ContactManager.h | 1 - | |
tests/box2d/Box2D/Dynamics/b2Fixture.cpp | 16 +- | |
tests/box2d/Box2D/Dynamics/b2Island.cpp | 20 +- | |
tests/box2d/Box2D/Dynamics/b2World.cpp | 29 ++- | |
tests/box2d/Box2D/Dynamics/b2World.h | 2 + | |
tests/box2d/Makefile | 3 + | |
tests/bullet/CMakeLists.txt | 2 +- | |
tests/bullet/Demos/Benchmarks/BenchmarkDemo.cpp | 10 + | |
tests/bullet/Demos/Benchmarks/BenchmarkDemo.h | 3 +- | |
tests/bullet/Demos/Benchmarks/main.cpp | 7 + | |
tests/bullet/Demos/HelloWorld/BenchmarkDemo.h | 2 + | |
tests/bullet/Demos/HelloWorld/HelloWorld.cpp | 4 + | |
.../BroadphaseCollision/btAxisSweep3.h | 22 +-- | |
.../BroadphaseCollision/btBroadphaseProxy.h | 2 +- | |
.../BulletCollision/BroadphaseCollision/btDbvt.cpp | 18 +- | |
.../BulletCollision/BroadphaseCollision/btDbvt.h | 4 +- | |
.../BroadphaseCollision/btDbvtBroadphase.cpp | 9 +- | |
.../BroadphaseCollision/btMultiSapBroadphase.cpp | 12 +- | |
.../BroadphaseCollision/btOverlappingPairCache.cpp | 10 +- | |
.../BroadphaseCollision/btQuantizedBvh.cpp | 6 +- | |
.../BroadphaseCollision/btQuantizedBvh.h | 4 + | |
.../BroadphaseCollision/btSimpleBroadphase.cpp | 8 +- | |
.../BroadphaseCollision/btSimpleBroadphase.h | 1 - | |
.../CollisionDispatch/btBoxBoxCollisionAlgorithm.h | 3 +- | |
.../CollisionDispatch/btCollisionDispatcher.cpp | 10 +- | |
.../btCompoundCollisionAlgorithm.h | 6 +- | |
.../btConvex2dConvex2dAlgorithm.h | 3 +- | |
.../btConvexConcaveCollisionAlgorithm.cpp | 3 +- | |
.../btConvexConcaveCollisionAlgorithm.h | 6 +- | |
.../CollisionDispatch/btConvexConvexAlgorithm.h | 3 +- | |
.../btConvexPlaneCollisionAlgorithm.h | 5 +- | |
.../btDefaultCollisionConfiguration.cpp | 124 ++++-------- | |
.../CollisionDispatch/btEmptyCollisionAlgorithm.h | 3 +- | |
.../CollisionDispatch/btGhostObject.cpp | 2 +- | |
.../btSphereSphereCollisionAlgorithm.h | 3 +- | |
.../btSphereTriangleCollisionAlgorithm.h | 4 +- | |
.../CollisionShapes/btBvhTriangleMeshShape.cpp | 9 +- | |
.../CollisionShapes/btBvhTriangleMeshShape.h | 3 +- | |
.../CollisionShapes/btCompoundShape.cpp | 8 +- | |
.../CollisionShapes/btHeightfieldTerrainShape.cpp | 7 +- | |
.../CollisionShapes/btHeightfieldTerrainShape.h | 3 +- | |
.../CollisionShapes/btOptimizedBvh.cpp | 2 + | |
.../CollisionShapes/btOptimizedBvh.h | 3 +- | |
.../CollisionShapes/btPolyhedralConvexShape.cpp | 3 +- | |
.../Gimpact/btGImpactCollisionAlgorithm.h | 3 +- | |
.../Gimpact/btGenericPoolAllocator.cpp | 3 +- | |
.../bullet/src/BulletCollision/Gimpact/gim_math.h | 5 +- | |
.../src/BulletCollision/Gimpact/gim_memory.cpp | 4 +- | |
.../src/BulletCollision/Gimpact/gim_memory.h | 19 +- | |
.../ConstraintSolver/btConeTwistConstraint.cpp | 128 ++++++------- | |
.../ConstraintSolver/btGeneric6DofConstraint.cpp | 81 ++++---- | |
.../ConstraintSolver/btHingeConstraint.cpp | 207 ++++++++++----------- | |
.../ConstraintSolver/btPoint2PointConstraint.cpp | 26 +-- | |
.../btSequentialImpulseConstraintSolver.cpp | 38 +++- | |
.../ConstraintSolver/btSliderConstraint.cpp | 4 +- | |
.../ConstraintSolver/btSolverConstraint.h | 19 +- | |
.../ConstraintSolver/btTypedConstraint.h | 10 +- | |
.../src/BulletDynamics/Dynamics/Bullet-C-API.cpp | 43 ++--- | |
.../Dynamics/btDiscreteDynamicsWorld.cpp | 15 +- | |
.../Dynamics/btSimpleDynamicsWorld.cpp | 6 +- | |
tests/bullet/src/LinearMath/btAlignedAllocator.cpp | 8 + | |
tests/bullet/src/LinearMath/btAlignedAllocator.h | 12 +- | |
tests/bullet/src/LinearMath/btAlignedObjectArray.h | 4 +- | |
tests/bullet/src/LinearMath/btConvexHull.cpp | 3 +- | |
.../bullet/src/LinearMath/btConvexHullComputer.cpp | 10 +- | |
tests/bullet/src/LinearMath/btHashMap.h | 2 +- | |
tests/bullet/src/LinearMath/btMatrix3x3.h | 14 +- | |
tests/bullet/src/LinearMath/btQuickprof.cpp | 24 ++- | |
tests/bullet/src/LinearMath/btScalar.h | 8 +- | |
tests/bullet/src/LinearMath/btSerializer.cpp | 196 +++++++++---------- | |
tests/bullet/src/LinearMath/btSerializer.h | 4 +- | |
tests/bullet/src/LinearMath/btVector3.h | 32 ++-- | |
tests/test_benchmark.py | 69 +++++-- | |
102 files changed, 944 insertions(+), 840 deletions(-) | |
create mode 100644 cheerptrampoline.cpp | |
diff --git a/cheerptrampoline.cpp b/cheerptrampoline.cpp | |
new file mode 100644 | |
index 0000000..014ca4a | |
--- /dev/null | |
+++ b/cheerptrampoline.cpp | |
@@ -0,0 +1,43 @@ | |
+#include <cheerp/clientlib.h> | |
+ | |
+namespace client | |
+{ | |
+ class Module | |
+ { | |
+ public: | |
+ Array* get_preRun(); | |
+ Array* get_postRun(); | |
+ }; | |
+ extern Module* Module; | |
+} | |
+ | |
+extern int main(int argc, const char* argv[]); | |
+ | |
+const char* volatile arg = "4"; | |
+ | |
+#define EMBENCHEN 0 | |
+ | |
+void webMain() | |
+{ | |
+ const char* args[2]; | |
+ args[0]="benchmark"; | |
+ args[1]=arg; | |
+ const char** a=&args[0]; | |
+#if EMBENCHEN | |
+ if(client::Module->get_preRun()) | |
+ { | |
+ client::Array& preRun=*client::Module->get_preRun(); | |
+ for(int i=0;i<preRun.get_length();i++) | |
+ reinterpret_cast<void(*)()>(preRun[i])(); | |
+ } | |
+#endif | |
+ main(2, a); | |
+#if EMBENCHEN | |
+ if(client::Module->get_postRun()) | |
+ { | |
+ client::Array& postRun=*client::Module->get_postRun(); | |
+ for(int i=0;i<postRun.get_length();i++) | |
+ reinterpret_cast<void(*)()>(postRun[i])(); | |
+ } | |
+#endif | |
+} | |
diff --git a/tests/box2d/Benchmark.cpp b/tests/box2d/Benchmark.cpp | |
index 6c9b3c5..d50ec1a 100644 | |
--- a/tests/box2d/Benchmark.cpp | |
+++ b/tests/box2d/Benchmark.cpp | |
@@ -28,6 +28,10 @@ typedef struct { | |
#ifdef __EMSCRIPTEN__ | |
#include <emscripten.h> | |
#endif | |
+#ifdef __CHEERP__ | |
+#include <cheerp/clientlib.h> | |
+#endif | |
+ | |
#include "Box2D/Box2D.h" | |
@@ -58,7 +62,8 @@ result_t measure(clock_t *times) { | |
b2World *world; | |
clock_t *times, minn = CLOCKS_PER_SEC * 1000 * 100, maxx = -1; | |
-b2Body* topBody; | |
+b2Body** bodies = NULL; | |
+int32 bodyCount = 0; | |
int32 frameCounter = 0; | |
int responsive_main_loop; | |
@@ -108,6 +113,8 @@ int main(int argc, char **argv) { | |
b2Vec2 deltaX(0.5625f, 1); | |
b2Vec2 deltaY(1.125f, 0.0f); | |
+ bodies = new b2Body*[e_count*e_count]; | |
+ memset(bodies,0,sizeof(sizeof(b2Body*)*e_count*e_count)); | |
for (int32 i = 0; i < e_count; ++i) { | |
y = x; | |
@@ -117,9 +124,8 @@ int main(int argc, char **argv) { | |
bd.position = y; | |
b2Body* body = world->CreateBody(&bd); | |
body->CreateFixture(&shape, 5.0f); | |
- | |
- topBody = body; | |
- | |
+ bodies[bodyCount] = body; | |
+ bodyCount++; | |
y += deltaY; | |
} | |
@@ -150,16 +156,24 @@ int main(int argc, char **argv) { | |
void iter() { | |
if (frameCounter < FRAMES) { | |
+#ifndef __CHEERP__ | |
clock_t start = clock(); | |
+#else | |
+ double start = client::Date::now() * CLOCKS_PER_SEC / 1000; | |
+#endif | |
world->Step(1.0f/60.0f, 3, 3); | |
+#ifndef __CHEERP__ | |
clock_t end = clock(); | |
+#else | |
+ double end = client::Date::now() * CLOCKS_PER_SEC / 1000; | |
+#endif | |
clock_t curr = end - start; | |
times[frameCounter] = curr; | |
if (curr < minn) minn = curr; | |
if (curr > maxx) maxx = curr; | |
#if DEBUG | |
- printf("%f :: ", topBody->GetPosition().y); | |
- printf("%f\n", (float32)(end - start) / CLOCKS_PER_SEC * 1000); | |
+ for(int32 i=0;i<bodyCount;i++) | |
+ printf("%f\n%f\n", bodies[i]->GetPosition().x, bodies[i]->GetPosition().y); | |
#endif | |
frameCounter++; | |
return; | |
diff --git a/tests/box2d/Box2D/Collision/Shapes/b2ChainShape.cpp b/tests/box2d/Box2D/Collision/Shapes/b2ChainShape.cpp | |
index f7bbe06..e6df069 100644 | |
--- a/tests/box2d/Box2D/Collision/Shapes/b2ChainShape.cpp | |
+++ b/tests/box2d/Box2D/Collision/Shapes/b2ChainShape.cpp | |
@@ -68,8 +68,7 @@ void b2ChainShape::SetNextVertex(const b2Vec2& nextVertex) | |
b2Shape* b2ChainShape::Clone(b2BlockAllocator* allocator) const | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2ChainShape)); | |
- b2ChainShape* clone = new (mem) b2ChainShape; | |
+ b2ChainShape* clone = new b2ChainShape; | |
clone->CreateChain(m_vertices, m_count); | |
clone->m_prevVertex = m_prevVertex; | |
clone->m_nextVertex = m_nextVertex; | |
@@ -90,8 +89,8 @@ void b2ChainShape::GetChildEdge(b2EdgeShape* edge, int32 index) const | |
edge->m_type = b2Shape::e_edge; | |
edge->m_radius = m_radius; | |
- edge->m_vertex1 = m_vertices[index + 0]; | |
- edge->m_vertex2 = m_vertices[index + 1]; | |
+ edge->m_vertex[0] = m_vertices[index + 0]; | |
+ edge->m_vertex[1] = m_vertices[index + 1]; | |
if (index > 0) | |
{ | |
@@ -137,8 +136,8 @@ bool b2ChainShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, | |
i2 = 0; | |
} | |
- edgeShape.m_vertex1 = m_vertices[i1]; | |
- edgeShape.m_vertex2 = m_vertices[i2]; | |
+ edgeShape.m_vertex[0] = m_vertices[i1]; | |
+ edgeShape.m_vertex[1] = m_vertices[i2]; | |
return edgeShape.RayCast(output, input, xf, 0); | |
} | |
diff --git a/tests/box2d/Box2D/Collision/Shapes/b2CircleShape.cpp b/tests/box2d/Box2D/Collision/Shapes/b2CircleShape.cpp | |
index c03d662..6e7ffa0 100644 | |
--- a/tests/box2d/Box2D/Collision/Shapes/b2CircleShape.cpp | |
+++ b/tests/box2d/Box2D/Collision/Shapes/b2CircleShape.cpp | |
@@ -22,8 +22,7 @@ using namespace std; | |
b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2CircleShape)); | |
- b2CircleShape* clone = new (mem) b2CircleShape; | |
+ b2CircleShape* clone = new b2CircleShape; | |
*clone = *this; | |
return clone; | |
} | |
diff --git a/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.cpp b/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.cpp | |
index e204160..8bfb83d 100644 | |
--- a/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.cpp | |
+++ b/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.cpp | |
@@ -22,16 +22,15 @@ using namespace std; | |
void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2) | |
{ | |
- m_vertex1 = v1; | |
- m_vertex2 = v2; | |
+ m_vertex[0] = v1; | |
+ m_vertex[1] = v2; | |
m_hasVertex0 = false; | |
m_hasVertex3 = false; | |
} | |
b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2EdgeShape)); | |
- b2EdgeShape* clone = new (mem) b2EdgeShape; | |
+ b2EdgeShape* clone = new b2EdgeShape; | |
*clone = *this; | |
return clone; | |
} | |
@@ -62,8 +61,8 @@ bool b2EdgeShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, | |
b2Vec2 p2 = b2MulT(xf.q, input.p2 - xf.p); | |
b2Vec2 d = p2 - p1; | |
- b2Vec2 v1 = m_vertex1; | |
- b2Vec2 v2 = m_vertex2; | |
+ b2Vec2 v1 = m_vertex[0]; | |
+ b2Vec2 v2 = m_vertex[1]; | |
b2Vec2 e = v2 - v1; | |
b2Vec2 normal(e.y, -e.x); | |
normal.Normalize(); | |
@@ -118,8 +117,8 @@ void b2EdgeShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIn | |
{ | |
B2_NOT_USED(childIndex); | |
- b2Vec2 v1 = b2Mul(xf, m_vertex1); | |
- b2Vec2 v2 = b2Mul(xf, m_vertex2); | |
+ b2Vec2 v1 = b2Mul(xf, m_vertex[0]); | |
+ b2Vec2 v2 = b2Mul(xf, m_vertex[1]); | |
b2Vec2 lower = b2Min(v1, v2); | |
b2Vec2 upper = b2Max(v1, v2); | |
@@ -134,6 +133,6 @@ void b2EdgeShape::ComputeMass(b2MassData* massData, float32 density) const | |
B2_NOT_USED(density); | |
massData->mass = 0.0f; | |
- massData->center = 0.5f * (m_vertex1 + m_vertex2); | |
+ massData->center = 0.5f * (m_vertex[0] + m_vertex[1]); | |
massData->I = 0.0f; | |
} | |
diff --git a/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.h b/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.h | |
index 99f822b..bfb40ee 100644 | |
--- a/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.h | |
+++ b/tests/box2d/Box2D/Collision/Shapes/b2EdgeShape.h | |
@@ -52,7 +52,7 @@ public: | |
void ComputeMass(b2MassData* massData, float32 density) const; | |
/// These are the edge vertices | |
- b2Vec2 m_vertex1, m_vertex2; | |
+ b2Vec2 m_vertex[2]; | |
/// Optional adjacent vertices. These are used for smooth collision. | |
b2Vec2 m_vertex0, m_vertex3; | |
diff --git a/tests/box2d/Box2D/Collision/Shapes/b2PolygonShape.cpp b/tests/box2d/Box2D/Collision/Shapes/b2PolygonShape.cpp | |
index 8be8133..c8fde20 100644 | |
--- a/tests/box2d/Box2D/Collision/Shapes/b2PolygonShape.cpp | |
+++ b/tests/box2d/Box2D/Collision/Shapes/b2PolygonShape.cpp | |
@@ -21,8 +21,7 @@ | |
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2PolygonShape)); | |
- b2PolygonShape* clone = new (mem) b2PolygonShape; | |
+ b2PolygonShape* clone = new b2PolygonShape; | |
*clone = *this; | |
return clone; | |
} | |
diff --git a/tests/box2d/Box2D/Collision/b2CollideCircle.cpp b/tests/box2d/Box2D/Collision/b2CollideCircle.cpp | |
index 0ad58f0..7982c1c 100644 | |
--- a/tests/box2d/Box2D/Collision/b2CollideCircle.cpp | |
+++ b/tests/box2d/Box2D/Collision/b2CollideCircle.cpp | |
@@ -45,7 +45,7 @@ void b2CollideCircles( | |
manifold->pointCount = 1; | |
manifold->points[0].localPoint = circleB->m_p; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
} | |
void b2CollidePolygonAndCircle( | |
@@ -98,7 +98,7 @@ void b2CollidePolygonAndCircle( | |
manifold->localNormal = normals[normalIndex]; | |
manifold->localPoint = 0.5f * (v1 + v2); | |
manifold->points[0].localPoint = circleB->m_p; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
return; | |
} | |
@@ -118,7 +118,7 @@ void b2CollidePolygonAndCircle( | |
manifold->localNormal.Normalize(); | |
manifold->localPoint = v1; | |
manifold->points[0].localPoint = circleB->m_p; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
} | |
else if (u2 <= 0.0f) | |
{ | |
@@ -133,7 +133,7 @@ void b2CollidePolygonAndCircle( | |
manifold->localNormal.Normalize(); | |
manifold->localPoint = v2; | |
manifold->points[0].localPoint = circleB->m_p; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
} | |
else | |
{ | |
@@ -149,6 +149,6 @@ void b2CollidePolygonAndCircle( | |
manifold->localNormal = normals[vertIndex1]; | |
manifold->localPoint = faceCenter; | |
manifold->points[0].localPoint = circleB->m_p; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
} | |
} | |
diff --git a/tests/box2d/Box2D/Collision/b2CollideEdge.cpp b/tests/box2d/Box2D/Collision/b2CollideEdge.cpp | |
index 2819671..0bfcbb2 100644 | |
--- a/tests/box2d/Box2D/Collision/b2CollideEdge.cpp | |
+++ b/tests/box2d/Box2D/Collision/b2CollideEdge.cpp | |
@@ -33,7 +33,7 @@ void b2CollideEdgeAndCircle(b2Manifold* manifold, | |
// Compute circle in frame of edge | |
b2Vec2 Q = b2MulT(xfA, b2Mul(xfB, circleB->m_p)); | |
- b2Vec2 A = edgeA->m_vertex1, B = edgeA->m_vertex2; | |
+ b2Vec2 A = edgeA->m_vertex[0], B = edgeA->m_vertex[1]; | |
b2Vec2 e = B - A; | |
// Barycentric coordinates | |
@@ -78,7 +78,7 @@ void b2CollideEdgeAndCircle(b2Manifold* manifold, | |
manifold->type = b2Manifold::e_circles; | |
manifold->localNormal.SetZero(); | |
manifold->localPoint = P; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
manifold->points[0].id.cf = cf; | |
manifold->points[0].localPoint = circleB->m_p; | |
return; | |
@@ -116,7 +116,7 @@ void b2CollideEdgeAndCircle(b2Manifold* manifold, | |
manifold->type = b2Manifold::e_circles; | |
manifold->localNormal.SetZero(); | |
manifold->localPoint = P; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
manifold->points[0].id.cf = cf; | |
manifold->points[0].localPoint = circleB->m_p; | |
return; | |
@@ -146,7 +146,7 @@ void b2CollideEdgeAndCircle(b2Manifold* manifold, | |
manifold->type = b2Manifold::e_faceA; | |
manifold->localNormal = n; | |
manifold->localPoint = A; | |
- manifold->points[0].id.key = 0; | |
+ manifold->points[0].id.clearKey(); | |
manifold->points[0].id.cf = cf; | |
manifold->points[0].localPoint = circleB->m_p; | |
} | |
@@ -235,8 +235,8 @@ void b2EPCollider::Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const | |
m_centroidB = b2Mul(m_xf, polygonB->m_centroid); | |
m_v0 = edgeA->m_vertex0; | |
- m_v1 = edgeA->m_vertex1; | |
- m_v2 = edgeA->m_vertex2; | |
+ m_v1 = edgeA->m_vertex[0]; | |
+ m_v2 = edgeA->m_vertex[1]; | |
m_v3 = edgeA->m_vertex3; | |
bool hasVertex0 = edgeA->m_hasVertex0; | |
diff --git a/tests/box2d/Box2D/Collision/b2Collision.cpp b/tests/box2d/Box2D/Collision/b2Collision.cpp | |
index 4b092f0..cda713e 100644 | |
--- a/tests/box2d/Box2D/Collision/b2Collision.cpp | |
+++ b/tests/box2d/Box2D/Collision/b2Collision.cpp | |
@@ -100,7 +100,7 @@ void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState st | |
for (int32 j = 0; j < manifold2->pointCount; ++j) | |
{ | |
- if (manifold2->points[j].id.key == id.key) | |
+ if (manifold2->points[j].id == id) | |
{ | |
state1[i] = b2_persistState; | |
break; | |
@@ -117,7 +117,7 @@ void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState st | |
for (int32 j = 0; j < manifold1->pointCount; ++j) | |
{ | |
- if (manifold1->points[j].id.key == id.key) | |
+ if (manifold1->points[j].id == id) | |
{ | |
state2[i] = b2_persistState; | |
break; | |
diff --git a/tests/box2d/Box2D/Collision/b2Collision.h b/tests/box2d/Box2D/Collision/b2Collision.h | |
index 71bf15b..75c8ebf 100644 | |
--- a/tests/box2d/Box2D/Collision/b2Collision.h | |
+++ b/tests/box2d/Box2D/Collision/b2Collision.h | |
@@ -52,10 +52,23 @@ struct b2ContactFeature | |
}; | |
/// Contact ids to facilitate warm starting. | |
-union b2ContactID | |
+struct b2ContactID | |
{ | |
b2ContactFeature cf; | |
- uint32 key; ///< Used to quickly compare contact ids. | |
+ void clearKey() | |
+ { | |
+ cf.indexA = 0; | |
+ cf.indexB = 0; | |
+ cf.typeA = 0; | |
+ cf.typeB = 0; | |
+ } | |
+ bool operator==(const b2ContactID& rhs) const | |
+ { | |
+ return cf.indexA == rhs.cf.indexA && | |
+ cf.indexB == rhs.cf.indexB && | |
+ cf.typeA == rhs.cf.typeA && | |
+ cf.typeB == rhs.cf.typeB; | |
+ } | |
}; | |
/// A manifold point is a contact point belonging to a contact | |
diff --git a/tests/box2d/Box2D/Collision/b2Distance.cpp b/tests/box2d/Box2D/Collision/b2Distance.cpp | |
index 1010c8c..c54c9fd 100644 | |
--- a/tests/box2d/Box2D/Collision/b2Distance.cpp | |
+++ b/tests/box2d/Box2D/Collision/b2Distance.cpp | |
@@ -71,7 +71,7 @@ void b2DistanceProxy::Set(const b2Shape* shape, int32 index) | |
case b2Shape::e_edge: | |
{ | |
const b2EdgeShape* edge = (b2EdgeShape*)shape; | |
- m_vertices = &edge->m_vertex1; | |
+ m_vertices = edge->m_vertex; | |
m_count = 2; | |
m_radius = edge->m_radius; | |
} | |
@@ -103,7 +103,7 @@ struct b2Simplex | |
// Copy data from cache. | |
m_count = cache->count; | |
- b2SimplexVertex* vertices = &m_v1; | |
+ b2SimplexVertex* vertices = &m_v[0]; | |
for (int32 i = 0; i < m_count; ++i) | |
{ | |
b2SimplexVertex* v = vertices + i; | |
@@ -149,7 +149,7 @@ struct b2Simplex | |
{ | |
cache->metric = GetMetric(); | |
cache->count = uint16(m_count); | |
- const b2SimplexVertex* vertices = &m_v1; | |
+ const b2SimplexVertex* vertices = &m_v[0]; | |
for (int32 i = 0; i < m_count; ++i) | |
{ | |
cache->indexA[i] = uint8(vertices[i].indexA); | |
@@ -162,12 +162,12 @@ struct b2Simplex | |
switch (m_count) | |
{ | |
case 1: | |
- return -m_v1.w; | |
+ return -m_v[0].w; | |
case 2: | |
{ | |
- b2Vec2 e12 = m_v2.w - m_v1.w; | |
- float32 sgn = b2Cross(e12, -m_v1.w); | |
+ b2Vec2 e12 = m_v[1].w - m_v[0].w; | |
+ float32 sgn = b2Cross(e12, -m_v[0].w); | |
if (sgn > 0.0f) | |
{ | |
// Origin is left of e12. | |
@@ -195,10 +195,10 @@ struct b2Simplex | |
return b2Vec2_zero; | |
case 1: | |
- return m_v1.w; | |
+ return m_v[0].w; | |
case 2: | |
- return m_v1.a * m_v1.w + m_v2.a * m_v2.w; | |
+ return m_v[0].a * m_v[0].w + m_v[1].a * m_v[1].w; | |
case 3: | |
return b2Vec2_zero; | |
@@ -218,17 +218,17 @@ struct b2Simplex | |
break; | |
case 1: | |
- *pA = m_v1.wA; | |
- *pB = m_v1.wB; | |
+ *pA = m_v[0].wA; | |
+ *pB = m_v[0].wB; | |
break; | |
case 2: | |
- *pA = m_v1.a * m_v1.wA + m_v2.a * m_v2.wA; | |
- *pB = m_v1.a * m_v1.wB + m_v2.a * m_v2.wB; | |
+ *pA = m_v[0].a * m_v[0].wA + m_v[1].a * m_v[1].wA; | |
+ *pB = m_v[0].a * m_v[0].wB + m_v[1].a * m_v[1].wB; | |
break; | |
case 3: | |
- *pA = m_v1.a * m_v1.wA + m_v2.a * m_v2.wA + m_v3.a * m_v3.wA; | |
+ *pA = m_v[0].a * m_v[0].wA + m_v[1].a * m_v[1].wA + m_v[2].a * m_v[2].wA; | |
*pB = *pA; | |
break; | |
@@ -250,10 +250,10 @@ struct b2Simplex | |
return 0.0f; | |
case 2: | |
- return b2Distance(m_v1.w, m_v2.w); | |
+ return b2Distance(m_v[0].w, m_v[1].w); | |
case 3: | |
- return b2Cross(m_v2.w - m_v1.w, m_v3.w - m_v1.w); | |
+ return b2Cross(m_v[1].w - m_v[0].w, m_v[2].w - m_v[0].w); | |
default: | |
b2Assert(false); | |
@@ -264,7 +264,7 @@ struct b2Simplex | |
void Solve2(); | |
void Solve3(); | |
- b2SimplexVertex m_v1, m_v2, m_v3; | |
+ b2SimplexVertex m_v[3]; | |
int32 m_count; | |
}; | |
@@ -294,8 +294,8 @@ struct b2Simplex | |
// a2 = d12_2 / d12 | |
void b2Simplex::Solve2() | |
{ | |
- b2Vec2 w1 = m_v1.w; | |
- b2Vec2 w2 = m_v2.w; | |
+ b2Vec2 w1 = m_v[0].w; | |
+ b2Vec2 w2 = m_v[1].w; | |
b2Vec2 e12 = w2 - w1; | |
// w1 region | |
@@ -303,7 +303,7 @@ void b2Simplex::Solve2() | |
if (d12_2 <= 0.0f) | |
{ | |
// a2 <= 0, so we clamp it to 0 | |
- m_v1.a = 1.0f; | |
+ m_v[0].a = 1.0f; | |
m_count = 1; | |
return; | |
} | |
@@ -313,16 +313,16 @@ void b2Simplex::Solve2() | |
if (d12_1 <= 0.0f) | |
{ | |
// a1 <= 0, so we clamp it to 0 | |
- m_v2.a = 1.0f; | |
+ m_v[1].a = 1.0f; | |
m_count = 1; | |
- m_v1 = m_v2; | |
+ m_v[0] = m_v[1]; | |
return; | |
} | |
// Must be in e12 region. | |
float32 inv_d12 = 1.0f / (d12_1 + d12_2); | |
- m_v1.a = d12_1 * inv_d12; | |
- m_v2.a = d12_2 * inv_d12; | |
+ m_v[0].a = d12_1 * inv_d12; | |
+ m_v[1].a = d12_2 * inv_d12; | |
m_count = 2; | |
} | |
@@ -333,9 +333,9 @@ void b2Simplex::Solve2() | |
// - inside the triangle | |
void b2Simplex::Solve3() | |
{ | |
- b2Vec2 w1 = m_v1.w; | |
- b2Vec2 w2 = m_v2.w; | |
- b2Vec2 w3 = m_v3.w; | |
+ b2Vec2 w1 = m_v[0].w; | |
+ b2Vec2 w2 = m_v[1].w; | |
+ b2Vec2 w3 = m_v[2].w; | |
// Edge12 | |
// [1 1 ][a1] = [1] | |
@@ -377,7 +377,7 @@ void b2Simplex::Solve3() | |
// w1 region | |
if (d12_2 <= 0.0f && d13_2 <= 0.0f) | |
{ | |
- m_v1.a = 1.0f; | |
+ m_v[0].a = 1.0f; | |
m_count = 1; | |
return; | |
} | |
@@ -386,8 +386,8 @@ void b2Simplex::Solve3() | |
if (d12_1 > 0.0f && d12_2 > 0.0f && d123_3 <= 0.0f) | |
{ | |
float32 inv_d12 = 1.0f / (d12_1 + d12_2); | |
- m_v1.a = d12_1 * inv_d12; | |
- m_v2.a = d12_2 * inv_d12; | |
+ m_v[0].a = d12_1 * inv_d12; | |
+ m_v[1].a = d12_2 * inv_d12; | |
m_count = 2; | |
return; | |
} | |
@@ -396,28 +396,28 @@ void b2Simplex::Solve3() | |
if (d13_1 > 0.0f && d13_2 > 0.0f && d123_2 <= 0.0f) | |
{ | |
float32 inv_d13 = 1.0f / (d13_1 + d13_2); | |
- m_v1.a = d13_1 * inv_d13; | |
- m_v3.a = d13_2 * inv_d13; | |
+ m_v[0].a = d13_1 * inv_d13; | |
+ m_v[2].a = d13_2 * inv_d13; | |
m_count = 2; | |
- m_v2 = m_v3; | |
+ m_v[1] = m_v[2]; | |
return; | |
} | |
// w2 region | |
if (d12_1 <= 0.0f && d23_2 <= 0.0f) | |
{ | |
- m_v2.a = 1.0f; | |
+ m_v[1].a = 1.0f; | |
m_count = 1; | |
- m_v1 = m_v2; | |
+ m_v[0] = m_v[1]; | |
return; | |
} | |
// w3 region | |
if (d13_1 <= 0.0f && d23_1 <= 0.0f) | |
{ | |
- m_v3.a = 1.0f; | |
+ m_v[2].a = 1.0f; | |
m_count = 1; | |
- m_v1 = m_v3; | |
+ m_v[0] = m_v[2]; | |
return; | |
} | |
@@ -425,18 +425,18 @@ void b2Simplex::Solve3() | |
if (d23_1 > 0.0f && d23_2 > 0.0f && d123_1 <= 0.0f) | |
{ | |
float32 inv_d23 = 1.0f / (d23_1 + d23_2); | |
- m_v2.a = d23_1 * inv_d23; | |
- m_v3.a = d23_2 * inv_d23; | |
+ m_v[1].a = d23_1 * inv_d23; | |
+ m_v[2].a = d23_2 * inv_d23; | |
m_count = 2; | |
- m_v1 = m_v3; | |
+ m_v[0] = m_v[2]; | |
return; | |
} | |
// Must be in triangle123 | |
float32 inv_d123 = 1.0f / (d123_1 + d123_2 + d123_3); | |
- m_v1.a = d123_1 * inv_d123; | |
- m_v2.a = d123_2 * inv_d123; | |
- m_v3.a = d123_3 * inv_d123; | |
+ m_v[0].a = d123_1 * inv_d123; | |
+ m_v[1].a = d123_2 * inv_d123; | |
+ m_v[2].a = d123_3 * inv_d123; | |
m_count = 3; | |
} | |
@@ -457,7 +457,7 @@ void b2Distance(b2DistanceOutput* output, | |
simplex.ReadCache(cache, proxyA, transformA, proxyB, transformB); | |
// Get simplex vertices as an array. | |
- b2SimplexVertex* vertices = &simplex.m_v1; | |
+ b2SimplexVertex* vertices = &simplex.m_v[0]; | |
const int32 k_maxIters = 20; | |
// These store the vertices of the last simplex so that we | |
diff --git a/tests/box2d/Box2D/Common/b2BlockAllocator.cpp b/tests/box2d/Box2D/Common/b2BlockAllocator.cpp | |
index f5060da..9f74517 100644 | |
--- a/tests/box2d/Box2D/Common/b2BlockAllocator.cpp | |
+++ b/tests/box2d/Box2D/Common/b2BlockAllocator.cpp | |
@@ -23,6 +23,7 @@ | |
#include <memory> | |
using namespace std; | |
+#ifndef __CHEERP__ | |
int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] = | |
{ | |
16, // 0 | |
@@ -215,3 +216,5 @@ void b2BlockAllocator::Clear() | |
memset(m_freeLists, 0, sizeof(m_freeLists)); | |
} | |
+ | |
+#endif | |
diff --git a/tests/box2d/Box2D/Common/b2BlockAllocator.h b/tests/box2d/Box2D/Common/b2BlockAllocator.h | |
index 8ba29a5..b85bc9a 100644 | |
--- a/tests/box2d/Box2D/Common/b2BlockAllocator.h | |
+++ b/tests/box2d/Box2D/Common/b2BlockAllocator.h | |
@@ -29,6 +29,7 @@ const int32 b2_chunkArrayIncrement = 128; | |
struct b2Block; | |
struct b2Chunk; | |
+#ifndef __CHEERP__ | |
/// This is a small object allocator used for allocating small | |
/// objects that persist for more than one time step. | |
/// See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp | |
@@ -58,5 +59,8 @@ private: | |
static uint8 s_blockSizeLookup[b2_maxBlockSize + 1]; | |
static bool s_blockSizeLookupInitialized; | |
}; | |
+#else | |
+class b2BlockAllocator; | |
+#endif | |
#endif | |
diff --git a/tests/box2d/Box2D/Common/b2Settings.h b/tests/box2d/Box2D/Common/b2Settings.h | |
index 391b6f8..1a22054 100644 | |
--- a/tests/box2d/Box2D/Common/b2Settings.h | |
+++ b/tests/box2d/Box2D/Common/b2Settings.h | |
@@ -27,6 +27,8 @@ | |
#include <cmath> | |
#endif | |
+#include <stdlib.h> | |
+ | |
#define B2_NOT_USED(x) ((void)(x)) | |
#define b2Assert(A) assert(A) | |
@@ -131,11 +133,16 @@ typedef double float64; | |
// Memory Allocation | |
+#ifndef __CHEERP__ | |
/// Implement this function to use your own memory allocator. | |
void* b2Alloc(int32 size); | |
/// If you implement b2Alloc, you should also implement this function. | |
void b2Free(void* mem); | |
+#else | |
+#define b2Alloc malloc | |
+#define b2Free free | |
+#endif | |
/// Logging function. | |
void b2Log(const char* string, ...); | |
diff --git a/tests/box2d/Box2D/Common/b2StackAllocator.cpp b/tests/box2d/Box2D/Common/b2StackAllocator.cpp | |
index 4a86283..661a0b2 100644 | |
--- a/tests/box2d/Box2D/Common/b2StackAllocator.cpp | |
+++ b/tests/box2d/Box2D/Common/b2StackAllocator.cpp | |
@@ -19,6 +19,7 @@ | |
#include <Box2D/Common/b2StackAllocator.h> | |
#include <Box2D/Common/b2Math.h> | |
+#ifndef __CHEERP__ | |
b2StackAllocator::b2StackAllocator() | |
{ | |
m_index = 0; | |
@@ -81,3 +82,4 @@ int32 b2StackAllocator::GetMaxAllocation() const | |
{ | |
return m_maxAllocation; | |
} | |
+#endif | |
diff --git a/tests/box2d/Box2D/Common/b2StackAllocator.h b/tests/box2d/Box2D/Common/b2StackAllocator.h | |
index 796c51d..e0a9c5b 100644 | |
--- a/tests/box2d/Box2D/Common/b2StackAllocator.h | |
+++ b/tests/box2d/Box2D/Common/b2StackAllocator.h | |
@@ -31,6 +31,7 @@ struct b2StackEntry | |
bool usedMalloc; | |
}; | |
+#ifndef __CHEERP__ | |
// This is a stack allocator used for fast per step allocations. | |
// You must nest allocate/free pairs. The code will assert | |
// if you try to interleave multiple allocate/free pairs. | |
@@ -56,5 +57,8 @@ private: | |
b2StackEntry m_entries[b2_maxStackEntries]; | |
int32 m_entryCount; | |
}; | |
+#else | |
+class b2StackAllocator; | |
+#endif | |
#endif | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp | |
index 3886dfd..edf940d 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp | |
@@ -23,18 +23,18 @@ | |
#include <Box2D/Collision/Shapes/b2EdgeShape.h> | |
#include <new> | |
+#include <stdlib.h> | |
using namespace std; | |
b2Contact* b2ChainAndCircleContact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator) | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2ChainAndCircleContact)); | |
- return new (mem) b2ChainAndCircleContact(fixtureA, indexA, fixtureB, indexB); | |
+ return new b2ChainAndCircleContact(fixtureA, indexA, fixtureB, indexB); | |
} | |
void b2ChainAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) | |
{ | |
((b2ChainAndCircleContact*)contact)->~b2ChainAndCircleContact(); | |
- allocator->Free(contact, sizeof(b2ChainAndCircleContact)); | |
+ free(contact); | |
} | |
b2ChainAndCircleContact::b2ChainAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB) | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp | |
index 02bcaaf..b8f5e35 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp | |
@@ -23,18 +23,18 @@ | |
#include <Box2D/Collision/Shapes/b2EdgeShape.h> | |
#include <new> | |
+#include <stdlib.h> | |
using namespace std; | |
b2Contact* b2ChainAndPolygonContact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator) | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2ChainAndPolygonContact)); | |
- return new (mem) b2ChainAndPolygonContact(fixtureA, indexA, fixtureB, indexB); | |
+ return new b2ChainAndPolygonContact(fixtureA, indexA, fixtureB, indexB); | |
} | |
void b2ChainAndPolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) | |
{ | |
((b2ChainAndPolygonContact*)contact)->~b2ChainAndPolygonContact(); | |
- allocator->Free(contact, sizeof(b2ChainAndPolygonContact)); | |
+ free(contact); | |
} | |
b2ChainAndPolygonContact::b2ChainAndPolygonContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB) | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2CircleContact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2CircleContact.cpp | |
index 584ef2f..2ef9316 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2CircleContact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2CircleContact.cpp | |
@@ -24,18 +24,18 @@ | |
#include <Box2D/Collision/b2TimeOfImpact.h> | |
#include <new> | |
+#include <stdlib.h> | |
using namespace std; | |
b2Contact* b2CircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2CircleContact)); | |
- return new (mem) b2CircleContact(fixtureA, fixtureB); | |
+ return new b2CircleContact(fixtureA, fixtureB); | |
} | |
void b2CircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) | |
{ | |
((b2CircleContact*)contact)->~b2CircleContact(); | |
- allocator->Free(contact, sizeof(b2CircleContact)); | |
+ free(contact); | |
} | |
b2CircleContact::b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB) | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2Contact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2Contact.cpp | |
index 557af7f..337b11d 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2Contact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2Contact.cpp | |
@@ -198,7 +198,7 @@ void b2Contact::Update(b2ContactListener* listener) | |
{ | |
b2ManifoldPoint* mp1 = oldManifold.points + j; | |
- if (mp1->id.key == id2.key) | |
+ if (mp1->id == id2) | |
{ | |
mp2->normalImpulse = mp1->normalImpulse; | |
mp2->tangentImpulse = mp1->tangentImpulse; | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2ContactSolver.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2ContactSolver.cpp | |
index c990d7f..3cc16c8 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2ContactSolver.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2ContactSolver.cpp | |
@@ -46,8 +46,8 @@ b2ContactSolver::b2ContactSolver(b2ContactSolverDef* def) | |
m_step = def->step; | |
m_allocator = def->allocator; | |
m_count = def->count; | |
- m_positionConstraints = (b2ContactPositionConstraint*)m_allocator->Allocate(m_count * sizeof(b2ContactPositionConstraint)); | |
- m_velocityConstraints = (b2ContactVelocityConstraint*)m_allocator->Allocate(m_count * sizeof(b2ContactVelocityConstraint)); | |
+ m_positionConstraints = (b2ContactPositionConstraint*)malloc(m_count * sizeof(b2ContactPositionConstraint)); | |
+ m_velocityConstraints = (b2ContactVelocityConstraint*)malloc(m_count * sizeof(b2ContactVelocityConstraint)); | |
m_positions = def->positions; | |
m_velocities = def->velocities; | |
m_contacts = def->contacts; | |
@@ -129,8 +129,8 @@ b2ContactSolver::b2ContactSolver(b2ContactSolverDef* def) | |
b2ContactSolver::~b2ContactSolver() | |
{ | |
- m_allocator->Free(m_velocityConstraints); | |
- m_allocator->Free(m_positionConstraints); | |
+ free(m_velocityConstraints); | |
+ free(m_positionConstraints); | |
} | |
// Initialize position dependent portions of the velocity constraints. | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp | |
index 0433650..5722cff 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp | |
@@ -21,18 +21,18 @@ | |
#include <Box2D/Dynamics/b2Fixture.h> | |
#include <new> | |
+#include <stdlib.h> | |
using namespace std; | |
b2Contact* b2EdgeAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2EdgeAndCircleContact)); | |
- return new (mem) b2EdgeAndCircleContact(fixtureA, fixtureB); | |
+ return new b2EdgeAndCircleContact(fixtureA, fixtureB); | |
} | |
void b2EdgeAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) | |
{ | |
((b2EdgeAndCircleContact*)contact)->~b2EdgeAndCircleContact(); | |
- allocator->Free(contact, sizeof(b2EdgeAndCircleContact)); | |
+ free(contact); | |
} | |
b2EdgeAndCircleContact::b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB) | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp | |
index 8bac536..69efbf9 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp | |
@@ -21,18 +21,18 @@ | |
#include <Box2D/Dynamics/b2Fixture.h> | |
#include <new> | |
+#include <stdlib.h> | |
using namespace std; | |
b2Contact* b2EdgeAndPolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2EdgeAndPolygonContact)); | |
- return new (mem) b2EdgeAndPolygonContact(fixtureA, fixtureB); | |
+ return new b2EdgeAndPolygonContact(fixtureA, fixtureB); | |
} | |
void b2EdgeAndPolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) | |
{ | |
((b2EdgeAndPolygonContact*)contact)->~b2EdgeAndPolygonContact(); | |
- allocator->Free(contact, sizeof(b2EdgeAndPolygonContact)); | |
+ free(contact); | |
} | |
b2EdgeAndPolygonContact::b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB) | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp | |
index 880f83e..a0e332a 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp | |
@@ -21,18 +21,18 @@ | |
#include <Box2D/Dynamics/b2Fixture.h> | |
#include <new> | |
+#include <stdlib.h> | |
using namespace std; | |
b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2PolygonAndCircleContact)); | |
- return new (mem) b2PolygonAndCircleContact(fixtureA, fixtureB); | |
+ return new b2PolygonAndCircleContact(fixtureA, fixtureB); | |
} | |
void b2PolygonAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) | |
{ | |
((b2PolygonAndCircleContact*)contact)->~b2PolygonAndCircleContact(); | |
- allocator->Free(contact, sizeof(b2PolygonAndCircleContact)); | |
+ free(contact); | |
} | |
b2PolygonAndCircleContact::b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB) | |
diff --git a/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonContact.cpp b/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonContact.cpp | |
index 52e1be8..0468ac3 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonContact.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Contacts/b2PolygonContact.cpp | |
@@ -24,18 +24,18 @@ | |
#include <Box2D/Dynamics/b2WorldCallbacks.h> | |
#include <new> | |
+#include <stdlib.h> | |
using namespace std; | |
b2Contact* b2PolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator) | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2PolygonContact)); | |
- return new (mem) b2PolygonContact(fixtureA, fixtureB); | |
+ return new b2PolygonContact(fixtureA, fixtureB); | |
} | |
void b2PolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) | |
{ | |
((b2PolygonContact*)contact)->~b2PolygonContact(); | |
- allocator->Free(contact, sizeof(b2PolygonContact)); | |
+ free(contact); | |
} | |
b2PolygonContact::b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB) | |
diff --git a/tests/box2d/Box2D/Dynamics/Joints/b2Joint.cpp b/tests/box2d/Box2D/Dynamics/Joints/b2Joint.cpp | |
index 85322f7..defc98b 100644 | |
--- a/tests/box2d/Box2D/Dynamics/Joints/b2Joint.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/Joints/b2Joint.cpp | |
@@ -32,6 +32,7 @@ | |
#include <Box2D/Common/b2BlockAllocator.h> | |
#include <new> | |
+#include <stdlib.h> | |
b2Joint* b2Joint::Create(const b2JointDef* def, b2BlockAllocator* allocator) | |
{ | |
@@ -41,71 +42,61 @@ b2Joint* b2Joint::Create(const b2JointDef* def, b2BlockAllocator* allocator) | |
{ | |
case e_distanceJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2DistanceJoint)); | |
- joint = new (mem) b2DistanceJoint((b2DistanceJointDef*)def); | |
+ joint = new b2DistanceJoint((b2DistanceJointDef*)def); | |
} | |
break; | |
case e_mouseJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2MouseJoint)); | |
- joint = new (mem) b2MouseJoint((b2MouseJointDef*)def); | |
+ joint = new b2MouseJoint((b2MouseJointDef*)def); | |
} | |
break; | |
case e_prismaticJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2PrismaticJoint)); | |
- joint = new (mem) b2PrismaticJoint((b2PrismaticJointDef*)def); | |
+ joint = new b2PrismaticJoint((b2PrismaticJointDef*)def); | |
} | |
break; | |
case e_revoluteJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2RevoluteJoint)); | |
- joint = new (mem) b2RevoluteJoint((b2RevoluteJointDef*)def); | |
+ joint = new b2RevoluteJoint((b2RevoluteJointDef*)def); | |
} | |
break; | |
case e_pulleyJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2PulleyJoint)); | |
- joint = new (mem) b2PulleyJoint((b2PulleyJointDef*)def); | |
+ joint = new b2PulleyJoint((b2PulleyJointDef*)def); | |
} | |
break; | |
case e_gearJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2GearJoint)); | |
- joint = new (mem) b2GearJoint((b2GearJointDef*)def); | |
+ joint = new b2GearJoint((b2GearJointDef*)def); | |
} | |
break; | |
case e_wheelJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2WheelJoint)); | |
- joint = new (mem) b2WheelJoint((b2WheelJointDef*)def); | |
+ joint = new b2WheelJoint((b2WheelJointDef*)def); | |
} | |
break; | |
case e_weldJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2WeldJoint)); | |
- joint = new (mem) b2WeldJoint((b2WeldJointDef*)def); | |
+ joint = new b2WeldJoint((b2WeldJointDef*)def); | |
} | |
break; | |
case e_frictionJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2FrictionJoint)); | |
- joint = new (mem) b2FrictionJoint((b2FrictionJointDef*)def); | |
+ joint = new b2FrictionJoint((b2FrictionJointDef*)def); | |
} | |
break; | |
case e_ropeJoint: | |
{ | |
- void* mem = allocator->Allocate(sizeof(b2RopeJoint)); | |
- joint = new (mem) b2RopeJoint((b2RopeJointDef*)def); | |
+ joint = new b2RopeJoint((b2RopeJointDef*)def); | |
} | |
break; | |
@@ -123,43 +114,43 @@ void b2Joint::Destroy(b2Joint* joint, b2BlockAllocator* allocator) | |
switch (joint->m_type) | |
{ | |
case e_distanceJoint: | |
- allocator->Free(joint, sizeof(b2DistanceJoint)); | |
+ free(joint); | |
break; | |
case e_mouseJoint: | |
- allocator->Free(joint, sizeof(b2MouseJoint)); | |
+ free(joint); | |
break; | |
case e_prismaticJoint: | |
- allocator->Free(joint, sizeof(b2PrismaticJoint)); | |
+ free(joint); | |
break; | |
case e_revoluteJoint: | |
- allocator->Free(joint, sizeof(b2RevoluteJoint)); | |
+ free(joint); | |
break; | |
case e_pulleyJoint: | |
- allocator->Free(joint, sizeof(b2PulleyJoint)); | |
+ free(joint); | |
break; | |
case e_gearJoint: | |
- allocator->Free(joint, sizeof(b2GearJoint)); | |
+ free(joint); | |
break; | |
case e_wheelJoint: | |
- allocator->Free(joint, sizeof(b2WheelJoint)); | |
+ free(joint); | |
break; | |
case e_weldJoint: | |
- allocator->Free(joint, sizeof(b2WeldJoint)); | |
+ free(joint); | |
break; | |
case e_frictionJoint: | |
- allocator->Free(joint, sizeof(b2FrictionJoint)); | |
+ free(joint); | |
break; | |
case e_ropeJoint: | |
- allocator->Free(joint, sizeof(b2RopeJoint)); | |
+ free(joint); | |
break; | |
default: | |
diff --git a/tests/box2d/Box2D/Dynamics/b2Body.cpp b/tests/box2d/Box2D/Dynamics/b2Body.cpp | |
index b50bf45..fde3882 100644 | |
--- a/tests/box2d/Box2D/Dynamics/b2Body.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/b2Body.cpp | |
@@ -22,6 +22,8 @@ | |
#include <Box2D/Dynamics/Contacts/b2Contact.h> | |
#include <Box2D/Dynamics/Joints/b2Joint.h> | |
+#include <stdlib.h> | |
+ | |
b2Body::b2Body(const b2BodyDef* bd, b2World* world) | |
{ | |
b2Assert(bd->position.IsValid()); | |
@@ -156,11 +158,8 @@ b2Fixture* b2Body::CreateFixture(const b2FixtureDef* def) | |
return NULL; | |
} | |
- b2BlockAllocator* allocator = &m_world->m_blockAllocator; | |
- | |
- void* memory = allocator->Allocate(sizeof(b2Fixture)); | |
- b2Fixture* fixture = new (memory) b2Fixture; | |
- fixture->Create(allocator, this, def); | |
+ b2Fixture* fixture = new b2Fixture; | |
+ fixture->Create(NULL, this, def); | |
if (m_flags & e_activeFlag) | |
{ | |
@@ -243,19 +242,17 @@ void b2Body::DestroyFixture(b2Fixture* fixture) | |
} | |
} | |
- b2BlockAllocator* allocator = &m_world->m_blockAllocator; | |
- | |
if (m_flags & e_activeFlag) | |
{ | |
b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase; | |
fixture->DestroyProxies(broadPhase); | |
} | |
- fixture->Destroy(allocator); | |
+ fixture->Destroy(NULL); | |
fixture->m_body = NULL; | |
fixture->m_next = NULL; | |
fixture->~b2Fixture(); | |
- allocator->Free(fixture, sizeof(b2Fixture)); | |
+ free(fixture); | |
--m_fixtureCount; | |
@@ -511,4 +508,4 @@ void b2Body::Dump() | |
b2Log(" }\n"); | |
} | |
b2Log("}\n"); | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/tests/box2d/Box2D/Dynamics/b2ContactManager.cpp b/tests/box2d/Box2D/Dynamics/b2ContactManager.cpp | |
index 5ac12b3..8075488 100644 | |
--- a/tests/box2d/Box2D/Dynamics/b2ContactManager.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/b2ContactManager.cpp | |
@@ -31,7 +31,6 @@ b2ContactManager::b2ContactManager() | |
m_contactCount = 0; | |
m_contactFilter = &b2_defaultFilter; | |
m_contactListener = &b2_defaultListener; | |
- m_allocator = NULL; | |
} | |
void b2ContactManager::Destroy(b2Contact* c) | |
@@ -95,7 +94,7 @@ void b2ContactManager::Destroy(b2Contact* c) | |
} | |
// Call the factory. | |
- b2Contact::Destroy(c, m_allocator); | |
+ b2Contact::Destroy(c, NULL); | |
--m_contactCount; | |
} | |
@@ -236,7 +235,7 @@ void b2ContactManager::AddPair(void* proxyUserDataA, void* proxyUserDataB) | |
} | |
// Call the factory. | |
- b2Contact* c = b2Contact::Create(fixtureA, indexA, fixtureB, indexB, m_allocator); | |
+ b2Contact* c = b2Contact::Create(fixtureA, indexA, fixtureB, indexB, NULL); | |
if (c == NULL) | |
{ | |
return; | |
diff --git a/tests/box2d/Box2D/Dynamics/b2ContactManager.h b/tests/box2d/Box2D/Dynamics/b2ContactManager.h | |
index dc1f77f..eb257d5 100644 | |
--- a/tests/box2d/Box2D/Dynamics/b2ContactManager.h | |
+++ b/tests/box2d/Box2D/Dynamics/b2ContactManager.h | |
@@ -46,7 +46,6 @@ public: | |
int32 m_contactCount; | |
b2ContactFilter* m_contactFilter; | |
b2ContactListener* m_contactListener; | |
- b2BlockAllocator* m_allocator; | |
}; | |
#endif | |
diff --git a/tests/box2d/Box2D/Dynamics/b2Fixture.cpp b/tests/box2d/Box2D/Dynamics/b2Fixture.cpp | |
index 77537b2..59781cb 100644 | |
--- a/tests/box2d/Box2D/Dynamics/b2Fixture.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/b2Fixture.cpp | |
@@ -55,7 +55,7 @@ void b2Fixture::Create(b2BlockAllocator* allocator, b2Body* body, const b2Fixtur | |
// Reserve proxy space | |
int32 childCount = m_shape->GetChildCount(); | |
- m_proxies = (b2FixtureProxy*)allocator->Allocate(childCount * sizeof(b2FixtureProxy)); | |
+ m_proxies = (b2FixtureProxy*)malloc(childCount * sizeof(b2FixtureProxy)); | |
for (int32 i = 0; i < childCount; ++i) | |
{ | |
m_proxies[i].fixture = NULL; | |
@@ -73,7 +73,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator) | |
// Free the proxy array. | |
int32 childCount = m_shape->GetChildCount(); | |
- allocator->Free(m_proxies, childCount * sizeof(b2FixtureProxy)); | |
+ free(m_proxies); | |
m_proxies = NULL; | |
// Free the child shape. | |
@@ -83,7 +83,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator) | |
{ | |
b2CircleShape* s = (b2CircleShape*)m_shape; | |
s->~b2CircleShape(); | |
- allocator->Free(s, sizeof(b2CircleShape)); | |
+ free(s); | |
} | |
break; | |
@@ -91,7 +91,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator) | |
{ | |
b2EdgeShape* s = (b2EdgeShape*)m_shape; | |
s->~b2EdgeShape(); | |
- allocator->Free(s, sizeof(b2EdgeShape)); | |
+ free(s); | |
} | |
break; | |
@@ -99,7 +99,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator) | |
{ | |
b2PolygonShape* s = (b2PolygonShape*)m_shape; | |
s->~b2PolygonShape(); | |
- allocator->Free(s, sizeof(b2PolygonShape)); | |
+ free(s); | |
} | |
break; | |
@@ -107,7 +107,7 @@ void b2Fixture::Destroy(b2BlockAllocator* allocator) | |
{ | |
b2ChainShape* s = (b2ChainShape*)m_shape; | |
s->~b2ChainShape(); | |
- allocator->Free(s, sizeof(b2ChainShape)); | |
+ free(s); | |
} | |
break; | |
@@ -254,8 +254,8 @@ void b2Fixture::Dump(int32 bodyIndex) | |
b2Log(" b2EdgeShape shape;\n"); | |
b2Log(" shape.m_radius = %.15lef;\n", s->m_radius); | |
b2Log(" shape.m_vertex0.Set(%.15lef, %.15lef);\n", s->m_vertex0.x, s->m_vertex0.y); | |
- b2Log(" shape.m_vertex1.Set(%.15lef, %.15lef);\n", s->m_vertex1.x, s->m_vertex1.y); | |
- b2Log(" shape.m_vertex2.Set(%.15lef, %.15lef);\n", s->m_vertex2.x, s->m_vertex2.y); | |
+ b2Log(" shape.m_vertex1.Set(%.15lef, %.15lef);\n", s->m_vertex[0].x, s->m_vertex[0].y); | |
+ b2Log(" shape.m_vertex2.Set(%.15lef, %.15lef);\n", s->m_vertex[1].x, s->m_vertex[1].y); | |
b2Log(" shape.m_vertex3.Set(%.15lef, %.15lef);\n", s->m_vertex3.x, s->m_vertex3.y); | |
b2Log(" shape.m_hasVertex0 = bool(%d);\n", s->m_hasVertex0); | |
b2Log(" shape.m_hasVertex3 = bool(%d);\n", s->m_hasVertex3); | |
diff --git a/tests/box2d/Box2D/Dynamics/b2Island.cpp b/tests/box2d/Box2D/Dynamics/b2Island.cpp | |
index 0e2129c..848aa98 100644 | |
--- a/tests/box2d/Box2D/Dynamics/b2Island.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/b2Island.cpp | |
@@ -162,22 +162,22 @@ b2Island::b2Island( | |
m_allocator = allocator; | |
m_listener = listener; | |
- m_bodies = (b2Body**)m_allocator->Allocate(bodyCapacity * sizeof(b2Body*)); | |
- m_contacts = (b2Contact**)m_allocator->Allocate(contactCapacity * sizeof(b2Contact*)); | |
- m_joints = (b2Joint**)m_allocator->Allocate(jointCapacity * sizeof(b2Joint*)); | |
+ m_bodies = (b2Body**)malloc(bodyCapacity * sizeof(b2Body*)); | |
+ m_contacts = (b2Contact**)malloc(contactCapacity * sizeof(b2Contact*)); | |
+ m_joints = (b2Joint**)malloc(jointCapacity * sizeof(b2Joint*)); | |
- m_velocities = (b2Velocity*)m_allocator->Allocate(m_bodyCapacity * sizeof(b2Velocity)); | |
- m_positions = (b2Position*)m_allocator->Allocate(m_bodyCapacity * sizeof(b2Position)); | |
+ m_velocities = (b2Velocity*)malloc(m_bodyCapacity * sizeof(b2Velocity)); | |
+ m_positions = (b2Position*)malloc(m_bodyCapacity * sizeof(b2Position)); | |
} | |
b2Island::~b2Island() | |
{ | |
// Warning: the order should reverse the constructor order. | |
- m_allocator->Free(m_positions); | |
- m_allocator->Free(m_velocities); | |
- m_allocator->Free(m_joints); | |
- m_allocator->Free(m_contacts); | |
- m_allocator->Free(m_bodies); | |
+ free(m_positions); | |
+ free(m_velocities); | |
+ free(m_joints); | |
+ free(m_contacts); | |
+ free(m_bodies); | |
} | |
void b2Island::Solve(b2Profile* profile, const b2TimeStep& step, const b2Vec2& gravity, bool allowSleep) | |
diff --git a/tests/box2d/Box2D/Dynamics/b2World.cpp b/tests/box2d/Box2D/Dynamics/b2World.cpp | |
index baacded..7c7dc31 100644 | |
--- a/tests/box2d/Box2D/Dynamics/b2World.cpp | |
+++ b/tests/box2d/Box2D/Dynamics/b2World.cpp | |
@@ -58,8 +58,6 @@ b2World::b2World(const b2Vec2& gravity) | |
m_inv_dt0 = 0.0f; | |
- m_contactManager.m_allocator = &m_blockAllocator; | |
- | |
memset(&m_profile, 0, sizeof(b2Profile)); | |
} | |
@@ -76,7 +74,7 @@ b2World::~b2World() | |
{ | |
b2Fixture* fNext = f->m_next; | |
f->m_proxyCount = 0; | |
- f->Destroy(&m_blockAllocator); | |
+ f->Destroy(NULL); | |
f = fNext; | |
} | |
@@ -112,8 +110,7 @@ b2Body* b2World::CreateBody(const b2BodyDef* def) | |
return NULL; | |
} | |
- void* mem = m_blockAllocator.Allocate(sizeof(b2Body)); | |
- b2Body* b = new (mem) b2Body(def, this); | |
+ b2Body* b = new b2Body(def, this); | |
// Add to world doubly linked list. | |
b->m_prev = NULL; | |
@@ -178,9 +175,9 @@ void b2World::DestroyBody(b2Body* b) | |
} | |
f0->DestroyProxies(&m_contactManager.m_broadPhase); | |
- f0->Destroy(&m_blockAllocator); | |
+ f0->Destroy(NULL); | |
f0->~b2Fixture(); | |
- m_blockAllocator.Free(f0, sizeof(b2Fixture)); | |
+ free(f0); | |
b->m_fixtureList = f; | |
b->m_fixtureCount -= 1; | |
@@ -206,7 +203,7 @@ void b2World::DestroyBody(b2Body* b) | |
--m_bodyCount; | |
b->~b2Body(); | |
- m_blockAllocator.Free(b, sizeof(b2Body)); | |
+ free(b); | |
} | |
b2Joint* b2World::CreateJoint(const b2JointDef* def) | |
@@ -217,7 +214,7 @@ b2Joint* b2World::CreateJoint(const b2JointDef* def) | |
return NULL; | |
} | |
- b2Joint* j = b2Joint::Create(def, &m_blockAllocator); | |
+ b2Joint* j = b2Joint::Create(def, NULL); | |
// Connect to the world list. | |
j->m_prev = NULL; | |
@@ -341,7 +338,7 @@ void b2World::DestroyJoint(b2Joint* j) | |
j->m_edgeB.prev = NULL; | |
j->m_edgeB.next = NULL; | |
- b2Joint::Destroy(j, &m_blockAllocator); | |
+ b2Joint::Destroy(j, NULL); | |
b2Assert(m_jointCount > 0); | |
--m_jointCount; | |
@@ -393,7 +390,7 @@ void b2World::Solve(const b2TimeStep& step) | |
b2Island island(m_bodyCount, | |
m_contactManager.m_contactCount, | |
m_jointCount, | |
- &m_stackAllocator, | |
+ NULL, | |
m_contactManager.m_contactListener); | |
// Clear all the island flags. | |
@@ -412,7 +409,7 @@ void b2World::Solve(const b2TimeStep& step) | |
// Build and simulate all awake islands. | |
int32 stackSize = m_bodyCount; | |
- b2Body** stack = (b2Body**)m_stackAllocator.Allocate(stackSize * sizeof(b2Body*)); | |
+ b2Body** stack = (b2Body**)malloc(stackSize * sizeof(b2Body*)); | |
for (b2Body* seed = m_bodyList; seed; seed = seed->m_next) | |
{ | |
if (seed->m_flags & b2Body::e_islandFlag) | |
@@ -545,7 +542,7 @@ void b2World::Solve(const b2TimeStep& step) | |
} | |
} | |
- m_stackAllocator.Free(stack); | |
+ free(stack); | |
{ | |
b2Timer timer; | |
@@ -576,7 +573,7 @@ void b2World::Solve(const b2TimeStep& step) | |
// Find TOI contacts and solve them. | |
void b2World::SolveTOI(const b2TimeStep& step) | |
{ | |
- b2Island island(2 * b2_maxTOIContacts, b2_maxTOIContacts, 0, &m_stackAllocator, m_contactManager.m_contactListener); | |
+ b2Island island(2 * b2_maxTOIContacts, b2_maxTOIContacts, 0, NULL, m_contactManager.m_contactListener); | |
if (m_stepComplete) | |
{ | |
@@ -1047,8 +1044,8 @@ void b2World::DrawShape(b2Fixture* fixture, const b2Transform& xf, const b2Color | |
case b2Shape::e_edge: | |
{ | |
b2EdgeShape* edge = (b2EdgeShape*)fixture->GetShape(); | |
- b2Vec2 v1 = b2Mul(xf, edge->m_vertex1); | |
- b2Vec2 v2 = b2Mul(xf, edge->m_vertex2); | |
+ b2Vec2 v1 = b2Mul(xf, edge->m_vertex[0]); | |
+ b2Vec2 v2 = b2Mul(xf, edge->m_vertex[1]); | |
m_debugDraw->DrawSegment(v1, v2, color); | |
} | |
break; | |
diff --git a/tests/box2d/Box2D/Dynamics/b2World.h b/tests/box2d/Box2D/Dynamics/b2World.h | |
index eba7572..9f1b7b7 100644 | |
--- a/tests/box2d/Box2D/Dynamics/b2World.h | |
+++ b/tests/box2d/Box2D/Dynamics/b2World.h | |
@@ -225,8 +225,10 @@ private: | |
void DrawJoint(b2Joint* joint); | |
void DrawShape(b2Fixture* shape, const b2Transform& xf, const b2Color& color); | |
+#ifndef __CHEERP__ | |
b2BlockAllocator m_blockAllocator; | |
b2StackAllocator m_stackAllocator; | |
+#endif | |
int32 m_flags; | |
diff --git a/tests/box2d/Makefile b/tests/box2d/Makefile | |
index d37adaa..b4c361f 100644 | |
--- a/tests/box2d/Makefile | |
+++ b/tests/box2d/Makefile | |
@@ -56,6 +56,9 @@ all: box2d.a | |
box2d.a: $(OBJECTS) | |
$(AR) rvs $@ $(OBJECTS) | |
+box2d.bc: $(OBJECTS) | |
+ $(LLVMLINK) $(OBJECTS) -o $@ | |
+ | |
clean: | |
rm box2d.a | |
diff --git a/tests/bullet/CMakeLists.txt b/tests/bullet/CMakeLists.txt | |
index 55299a0..d52a029 100644 | |
--- a/tests/bullet/CMakeLists.txt | |
+++ b/tests/bullet/CMakeLists.txt | |
@@ -20,7 +20,7 @@ ENDIF (NOT CMAKE_BUILD_TYPE) | |
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") | |
#MESSAGE("CMAKE_CXX_FLAGS_DEBUG="+${CMAKE_CXX_FLAGS_DEBUG}) | |
-OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF) | |
+OPTION(USE_DOUBLE_PRECISION "Use double precision" ON) | |
OPTION(USE_GRAPHICAL_BENCHMARK "Use Graphical Benchmark" ON) | |
OPTION(USE_MULTITHREADED_BENCHMARK "Use Multithreaded Benchmark" OFF) | |
diff --git a/tests/bullet/Demos/Benchmarks/BenchmarkDemo.cpp b/tests/bullet/Demos/Benchmarks/BenchmarkDemo.cpp | |
index 8a4eaea..e74add6 100644 | |
--- a/tests/bullet/Demos/Benchmarks/BenchmarkDemo.cpp | |
+++ b/tests/bullet/Demos/Benchmarks/BenchmarkDemo.cpp | |
@@ -413,6 +413,7 @@ void BenchmarkDemo::initPhysics() | |
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform); | |
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia); | |
btRigidBody* body = new btRigidBody(rbInfo); | |
+ m_rigidBodies.push_back(body); | |
//add the body to the dynamics world | |
m_dynamicsWorld->addRigidBody(body); | |
@@ -996,6 +997,14 @@ void BenchmarkDemo::createTest4() | |
} | |
} | |
+void BenchmarkDemo::dump() | |
+{ | |
+ for(int j=0;j<m_rigidBodies.size();j++) | |
+ { | |
+ const btTransform& trans=m_rigidBodies[j]->getWorldTransform(); | |
+ printf("%.2f\n%.2f\n%.2f\n",float(trans.getOrigin().getX()),float(trans.getOrigin().getY()),float(trans.getOrigin().getZ())); | |
+ } | |
+} | |
/////////////////////////////////////////////////////////////////////////////// | |
// LargeMesh | |
@@ -1322,6 +1331,7 @@ btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform | |
body->setWorldTransform(startTransform); | |
body->setContactProcessingThreshold(m_defaultContactProcessingThreshold); | |
m_dynamicsWorld->addRigidBody(body); | |
+ m_rigidBodies.push_back(body); | |
return body; | |
} | |
diff --git a/tests/bullet/Demos/Benchmarks/BenchmarkDemo.h b/tests/bullet/Demos/Benchmarks/BenchmarkDemo.h | |
index b9f1052..5cb8b7f 100644 | |
--- a/tests/bullet/Demos/Benchmarks/BenchmarkDemo.h | |
+++ b/tests/bullet/Demos/Benchmarks/BenchmarkDemo.h | |
@@ -41,6 +41,7 @@ protected: | |
btDynamicsWorld* m_dynamicsWorld; | |
btScalar m_defaultContactProcessingThreshold; | |
+ btAlignedObjectArray<btRigidBody*> m_rigidBodies; | |
public: | |
DemoApplication() | |
@@ -135,7 +136,7 @@ class BenchmarkDemo : public PlatformDemoApplication | |
virtual void displayCallback(); | |
- | |
+ void dump(); | |
}; | |
diff --git a/tests/bullet/Demos/Benchmarks/main.cpp b/tests/bullet/Demos/Benchmarks/main.cpp | |
index 5526a31..afee725 100644 | |
--- a/tests/bullet/Demos/Benchmarks/main.cpp | |
+++ b/tests/bullet/Demos/Benchmarks/main.cpp | |
@@ -25,6 +25,7 @@ subject to the following restrictions: | |
#define benchmarkDemo benchmarkDemo2 | |
#endif //USE_GRAPHICAL_BENCHMARK | |
+#define DEBUG 0 | |
#define NUM_DEMOS 7 | |
@@ -68,6 +69,9 @@ int main(int argc, char **argv) { | |
for (d=0;d<NUM_DEMOS;d++) | |
{ | |
+#if DEBUG | |
+ printf("Begin test %s\n",demoNames[d]); | |
+#endif | |
demoArray[d]->initPhysics(); | |
@@ -75,10 +79,13 @@ int main(int argc, char **argv) { | |
{ | |
demoArray[d]->clientMoveAndDisplay(); | |
float frameTime = CProfileManager::Get_Time_Since_Reset(); | |
+#if DEBUG | |
if ((i % 25)==0) | |
{ | |
//printf("BenchmarkDemo: %s, Frame %d, Duration (ms): %f\n",demoNames[d],i,frameTime); | |
+ demoArray[d]->dump(); | |
} | |
+#endif | |
totalTime[d] += frameTime; | |
//if (i==NUM_TESTS-1) | |
// CProfileManager::dumpAll(); | |
diff --git a/tests/bullet/Demos/HelloWorld/BenchmarkDemo.h b/tests/bullet/Demos/HelloWorld/BenchmarkDemo.h | |
index b9f1052..7f24266 100644 | |
--- a/tests/bullet/Demos/HelloWorld/BenchmarkDemo.h | |
+++ b/tests/bullet/Demos/HelloWorld/BenchmarkDemo.h | |
@@ -41,6 +41,7 @@ protected: | |
btDynamicsWorld* m_dynamicsWorld; | |
btScalar m_defaultContactProcessingThreshold; | |
+ btAlignedObjectArray<btRigidBody*> m_rigidBodies; | |
public: | |
DemoApplication() | |
@@ -135,6 +136,7 @@ class BenchmarkDemo : public PlatformDemoApplication | |
virtual void displayCallback(); | |
+ void dump(); | |
diff --git a/tests/bullet/Demos/HelloWorld/HelloWorld.cpp b/tests/bullet/Demos/HelloWorld/HelloWorld.cpp | |
index f16cd94..5875e82 100644 | |
--- a/tests/bullet/Demos/HelloWorld/HelloWorld.cpp | |
+++ b/tests/bullet/Demos/HelloWorld/HelloWorld.cpp | |
@@ -19,7 +19,11 @@ subject to the following restrictions: | |
/// This is a Hello World program for running a basic Bullet physics simulation | |
+#ifdef __CHEERP__ | |
+void webMain() | |
+#else | |
int main(int argc, char** argv) | |
+#endif | |
{ | |
int i; | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h b/tests/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h | |
index 4f4d94b..eebf929 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h | |
@@ -83,7 +83,6 @@ protected: | |
BP_FP_INT_TYPE m_firstFreeHandle; // free handles list | |
Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries) | |
- void* m_pEdgesRawPtr[3]; | |
btOverlappingPairCache* m_pairCache; | |
@@ -362,15 +361,14 @@ m_raycastAccelerator(0) | |
if (!m_pairCache) | |
{ | |
- void* ptr = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16); | |
- m_pairCache = new(ptr) btHashedOverlappingPairCache(); | |
+ m_pairCache = new btHashedOverlappingPairCache(); | |
m_ownsPairCache = true; | |
} | |
if (!disableRaycastAccelerator) | |
{ | |
- m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache),16)) btNullPairCache(); | |
- m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache); | |
+ m_nullPairCache = new btNullPairCache(); | |
+ m_raycastAccelerator = new btDbvtBroadphase(m_nullPairCache);//m_pairCache); | |
m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs | |
} | |
@@ -404,8 +402,7 @@ m_raycastAccelerator(0) | |
// allocate edge buffers | |
for (int i = 0; i < 3; i++) | |
{ | |
- m_pEdgesRawPtr[i] = btAlignedAlloc(sizeof(Edge)*maxHandles*2,16); | |
- m_pEdges[i] = new(m_pEdgesRawPtr[i]) Edge[maxHandles * 2]; | |
+ m_pEdges[i] = new Edge[maxHandles * 2]; | |
} | |
} | |
//removed overlap management | |
@@ -436,22 +433,19 @@ btAxisSweep3Internal<BP_FP_INT_TYPE>::~btAxisSweep3Internal() | |
{ | |
if (m_raycastAccelerator) | |
{ | |
- m_nullPairCache->~btOverlappingPairCache(); | |
- btAlignedFree(m_nullPairCache); | |
- m_raycastAccelerator->~btDbvtBroadphase(); | |
- btAlignedFree (m_raycastAccelerator); | |
+ delete m_nullPairCache; | |
+ delete m_raycastAccelerator; | |
} | |
for (int i = 2; i >= 0; i--) | |
{ | |
- btAlignedFree(m_pEdgesRawPtr[i]); | |
+ delete[] m_pEdges[i]; | |
} | |
delete [] m_pHandles; | |
if (m_ownsPairCache) | |
{ | |
- m_pairCache->~btOverlappingPairCache(); | |
- btAlignedFree(m_pairCache); | |
+ delete m_pairCache; | |
} | |
} | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h b/tests/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h | |
index 32e8f03..ab052cc 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h | |
@@ -227,7 +227,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR(); | |
btBroadphaseProxy* m_pProxy1; | |
mutable btCollisionAlgorithm* m_algorithm; | |
- union { void* m_internalInfo1; int m_internalTmpValue;};//don't use this data, it will be removed in future version. | |
+ void* m_internalInfo1; int m_internalTmpValue;//don't use this data, it will be removed in future version. | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp b/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp | |
index 95443af..4c2eb81 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp | |
@@ -37,12 +37,12 @@ static DBVT_INLINE int indexof(const btDbvtNode* node) | |
static DBVT_INLINE btDbvtVolume merge( const btDbvtVolume& a, | |
const btDbvtVolume& b) | |
{ | |
-#if (DBVT_MERGE_IMPL==DBVT_IMPL_SSE) | |
+/*#if (DBVT_MERGE_IMPL==DBVT_IMPL_SSE) | |
ATTRIBUTE_ALIGNED16(char locals[sizeof(btDbvtAabbMm)]); | |
btDbvtVolume& res=*(btDbvtVolume*)locals; | |
-#else | |
+#else*/ | |
btDbvtVolume res; | |
-#endif | |
+//#endif | |
Merge(a,b,res); | |
return(res); | |
} | |
@@ -69,7 +69,7 @@ static void getmaxdepth(const btDbvtNode* node,int depth,int& maxdepth) | |
static DBVT_INLINE void deletenode( btDbvt* pdbvt, | |
btDbvtNode* node) | |
{ | |
- btAlignedFree(pdbvt->m_free); | |
+ delete pdbvt->m_free; | |
pdbvt->m_free=node; | |
} | |
@@ -95,7 +95,7 @@ static DBVT_INLINE btDbvtNode* createnode( btDbvt* pdbvt, | |
if(pdbvt->m_free) | |
{ node=pdbvt->m_free;pdbvt->m_free=0; } | |
else | |
- { node=new(btAlignedAlloc(sizeof(btDbvtNode),16)) btDbvtNode(); } | |
+ { node=new btDbvtNode(); } | |
node->parent = parent; | |
node->data = data; | |
node->childs[1] = 0; | |
@@ -248,13 +248,7 @@ static void split( const tNodeArray& leaves, | |
// | |
static btDbvtVolume bounds( const tNodeArray& leaves) | |
{ | |
-#if DBVT_MERGE_IMPL==DBVT_IMPL_SSE | |
- ATTRIBUTE_ALIGNED16(char locals[sizeof(btDbvtVolume)]); | |
- btDbvtVolume& volume=*(btDbvtVolume*)locals; | |
- volume=leaves[0]->volume; | |
-#else | |
btDbvtVolume volume=leaves[0]->volume; | |
-#endif | |
for(int i=1,ni=leaves.size();i<ni;++i) | |
{ | |
Merge(volume,leaves[i]->volume,volume); | |
@@ -426,7 +420,7 @@ void btDbvt::clear() | |
{ | |
if(m_root) | |
recursedeletenode(this,m_root); | |
- btAlignedFree(m_free); | |
+ delete m_free; | |
m_free=0; | |
m_lkhd = -1; | |
m_stkStack.clear(); | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h b/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h | |
index 2bb8ef5..9ea3798 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h | |
@@ -92,7 +92,7 @@ subject to the following restrictions: | |
#endif | |
#if DBVT_USE_MEMMOVE | |
-#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__) | |
+#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__) && !defined(__CHEERP__) | |
#include <memory.h> | |
#endif | |
#include <string.h> | |
@@ -176,7 +176,7 @@ struct btDbvtNode | |
btDbvtNode* parent; | |
DBVT_INLINE bool isleaf() const { return(childs[1]==0); } | |
DBVT_INLINE bool isinternal() const { return(!isleaf()); } | |
- union | |
+ struct | |
{ | |
btDbvtNode* childs[2]; | |
void* data; | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp | |
index 75cfac6..0dffa20 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp | |
@@ -134,7 +134,7 @@ btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache) | |
m_updates_call = 0; | |
m_updates_done = 0; | |
m_updates_ratio = 0; | |
- m_paircache = paircache? paircache : new(btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache(); | |
+ m_paircache = paircache? paircache : new btHashedOverlappingPairCache(); | |
m_gid = 0; | |
m_pid = 0; | |
m_cid = 0; | |
@@ -151,10 +151,7 @@ btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache) | |
btDbvtBroadphase::~btDbvtBroadphase() | |
{ | |
if(m_releasepaircache) | |
- { | |
- m_paircache->~btOverlappingPairCache(); | |
- btAlignedFree(m_paircache); | |
- } | |
+ delete m_paircache; | |
} | |
// | |
@@ -167,7 +164,7 @@ btBroadphaseProxy* btDbvtBroadphase::createProxy( const btVector3& aabbMin, | |
btDispatcher* /*dispatcher*/, | |
void* /*multiSapProxy*/) | |
{ | |
- btDbvtProxy* proxy=new(btAlignedAlloc(sizeof(btDbvtProxy),16)) btDbvtProxy( aabbMin,aabbMax,userPtr, | |
+ btDbvtProxy* proxy=new btDbvtProxy( aabbMin,aabbMax,userPtr, | |
collisionFilterGroup, | |
collisionFilterMask); | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp b/tests/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp | |
index 6712f52..3a407b2 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp | |
@@ -46,8 +46,7 @@ m_invalidPair(0) | |
if (!m_overlappingPairs) | |
{ | |
m_ownsPairCache = true; | |
- void* mem = btAlignedAlloc(sizeof(btSortedOverlappingPairCache),16); | |
- m_overlappingPairs = new (mem)btSortedOverlappingPairCache(); | |
+ m_overlappingPairs = new btSortedOverlappingPairCache(); | |
} | |
struct btMultiSapOverlapFilterCallback : public btOverlapFilterCallback | |
@@ -67,8 +66,7 @@ m_invalidPair(0) | |
} | |
}; | |
- void* mem = btAlignedAlloc(sizeof(btMultiSapOverlapFilterCallback),16); | |
- m_filterCallback = new (mem)btMultiSapOverlapFilterCallback(); | |
+ m_filterCallback = new btMultiSapOverlapFilterCallback(); | |
m_overlappingPairs->setOverlapFilterCallback(m_filterCallback); | |
// mem = btAlignedAlloc(sizeof(btSimpleBroadphase),16); | |
@@ -108,8 +106,7 @@ btBroadphaseProxy* btMultiSapBroadphase::createProxy( const btVector3& aabbMin, | |
{ | |
//void* ignoreMe -> we could think of recursive multi-sap, if someone is interested | |
- void* mem = btAlignedAlloc(sizeof(btMultiSapProxy),16); | |
- btMultiSapProxy* proxy = new (mem)btMultiSapProxy(aabbMin, aabbMax,shapeType,userPtr, collisionFilterGroup,collisionFilterMask); | |
+ btMultiSapProxy* proxy = new btMultiSapProxy(aabbMin, aabbMax,shapeType,userPtr, collisionFilterGroup,collisionFilterMask); | |
m_multiSapProxies.push_back(proxy); | |
///this should deal with inserting/removal into child broadphases | |
@@ -127,8 +124,7 @@ void btMultiSapBroadphase::destroyProxy(btBroadphaseProxy* /*proxy*/,btDispatche | |
void btMultiSapBroadphase::addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btBridgeProxy),16); | |
- btBridgeProxy* bridgeProxyRef = new(mem) btBridgeProxy; | |
+ btBridgeProxy* bridgeProxyRef = new btBridgeProxy; | |
bridgeProxyRef->m_childProxy = childProxy; | |
bridgeProxyRef->m_childBroadphase = childBroadphase; | |
parentMultiSapProxy->m_bridgeProxies.push_back(bridgeProxyRef); | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp b/tests/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp | |
index 041bbe0..4893eb5 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp | |
@@ -56,8 +56,7 @@ void btHashedOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,b | |
if (pair.m_algorithm) | |
{ | |
{ | |
- pair.m_algorithm->~btCollisionAlgorithm(); | |
- dispatcher->freeCollisionAlgorithm(pair.m_algorithm); | |
+ delete pair.m_algorithm; | |
pair.m_algorithm=0; | |
} | |
} | |
@@ -240,7 +239,7 @@ btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProx | |
}*/ | |
int count = m_overlappingPairArray.size(); | |
int oldCapacity = m_overlappingPairArray.capacity(); | |
- void* mem = &m_overlappingPairArray.expandNonInitializing(); | |
+ btBroadphasePair* mem = &m_overlappingPairArray.expandNonInitializing(); | |
//this is where we add an actual pair, so also call the 'ghost' | |
if (m_ghostPairCallback) | |
@@ -467,7 +466,7 @@ btBroadphasePair* btSortedOverlappingPairCache::addOverlappingPair(btBroadphaseP | |
if (!needsBroadphaseCollision(proxy0,proxy1)) | |
return 0; | |
- void* mem = &m_overlappingPairArray.expandNonInitializing(); | |
+ btBroadphasePair* mem = &m_overlappingPairArray.expandNonInitializing(); | |
btBroadphasePair* pair = new (mem) btBroadphasePair(*proxy0,*proxy1); | |
gOverlappingPairs++; | |
@@ -557,8 +556,7 @@ void btSortedOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,b | |
if (pair.m_algorithm) | |
{ | |
{ | |
- pair.m_algorithm->~btCollisionAlgorithm(); | |
- dispatcher->freeCollisionAlgorithm(pair.m_algorithm); | |
+ delete pair.m_algorithm; | |
pair.m_algorithm=0; | |
gRemovePairs--; | |
} | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp b/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp | |
index c911435..c88178e 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp | |
@@ -824,7 +824,7 @@ static const unsigned BVH_ALIGNMENT_MASK = BVH_ALIGNMENT-1; | |
static const unsigned BVH_ALIGNMENT_BLOCKS = 2; | |
#endif | |
- | |
+#if 0 | |
unsigned int btQuantizedBvh::getAlignmentSerializationPadding() | |
{ | |
// I changed this to 0 since the extra padding is not needed or used. | |
@@ -1133,6 +1133,7 @@ btQuantizedBvh *btQuantizedBvh::deSerializeInPlace(void *i_alignedDataBuffer, un | |
return bvh; | |
} | |
+#endif | |
// Constructor that prevents btVector3's default constructor from being called | |
btQuantizedBvh::btQuantizedBvh(btQuantizedBvh &self, bool /* ownsMemory */) : | |
@@ -1144,6 +1145,7 @@ m_bulletVersion(BT_BULLET_VERSION) | |
} | |
+#if 0 | |
void btQuantizedBvh::deSerializeFloat(struct btQuantizedBvhFloatData& quantizedBvhFloatData) | |
{ | |
m_bvhAabbMax.deSerializeFloat(quantizedBvhFloatData.m_bvhAabbMax); | |
@@ -1368,7 +1370,7 @@ const char* btQuantizedBvh::serialize(void* dataBuffer, btSerializer* serializer | |
} | |
return btQuantizedBvhDataName; | |
} | |
- | |
+#endif | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h b/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h | |
index bedb100..29adbdd 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h | |
@@ -461,6 +461,7 @@ public: | |
/////Calculate space needed to store BVH for serialization | |
unsigned calculateSerializeBufferSize() const; | |
+#if 0 | |
/// Data buffer MUST be 16 byte aligned | |
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const; | |
@@ -479,6 +480,7 @@ public: | |
virtual void deSerializeFloat(struct btQuantizedBvhFloatData& quantizedBvhFloatData); | |
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData& quantizedBvhDoubleData); | |
+#endif | |
//////////////////////////////////////////////////////////////////// | |
@@ -569,10 +571,12 @@ struct btQuantizedBvhDoubleData | |
}; | |
+#if 0 | |
SIMD_FORCE_INLINE int btQuantizedBvh::calculateSerializeBufferSizeNew() const | |
{ | |
return sizeof(btQuantizedBvhData); | |
} | |
+#endif | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp b/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp | |
index 752fcd0..7654313 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp | |
@@ -46,14 +46,12 @@ btSimpleBroadphase::btSimpleBroadphase(int maxProxies, btOverlappingPairCache* o | |
if (!overlappingPairCache) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16); | |
- m_pairCache = new (mem)btHashedOverlappingPairCache(); | |
+ m_pairCache = new btHashedOverlappingPairCache(); | |
m_ownsPairCache = true; | |
} | |
// allocate handles buffer and put all handles on free list | |
- m_pHandlesRawPtr = btAlignedAlloc(sizeof(btSimpleBroadphaseProxy)*maxProxies,16); | |
- m_pHandles = new(m_pHandlesRawPtr) btSimpleBroadphaseProxy[maxProxies]; | |
+ m_pHandles = new btSimpleBroadphaseProxy[maxProxies]; | |
m_maxHandles = maxProxies; | |
m_numHandles = 0; | |
m_firstFreeHandle = 0; | |
@@ -74,7 +72,7 @@ btSimpleBroadphase::btSimpleBroadphase(int maxProxies, btOverlappingPairCache* o | |
btSimpleBroadphase::~btSimpleBroadphase() | |
{ | |
- btAlignedFree(m_pHandlesRawPtr); | |
+ delete[] m_pHandles; | |
if (m_ownsPairCache) | |
{ | |
diff --git a/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h b/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h | |
index 7cb3c40..c052ca2 100644 | |
--- a/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h | |
+++ b/tests/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h | |
@@ -57,7 +57,6 @@ protected: | |
btSimpleBroadphaseProxy* m_pHandles; // handles pool | |
- void* m_pHandlesRawPtr; | |
int m_firstFreeHandle; // free handles list | |
int allocHandle() | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h | |
index f0bbae6..8613d77 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h | |
@@ -55,8 +55,7 @@ public: | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
int bbsize = sizeof(btBoxBoxCollisionAlgorithm); | |
- void* ptr = ci.m_dispatcher1->allocateCollisionAlgorithm(bbsize); | |
- return new(ptr) btBoxBoxCollisionAlgorithm(0,ci,body0,body1); | |
+ return new btBoxBoxCollisionAlgorithm(0,ci,body0,body1); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp b/tests/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp | |
index 29674f3..b2b0583 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp | |
@@ -85,7 +85,7 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1) | |
btScalar contactProcessingThreshold = btMin(body0->getContactProcessingThreshold(),body1->getContactProcessingThreshold()); | |
- void* mem = 0; | |
+ /*void* mem = 0; | |
if (m_persistentManifoldPoolAllocator->getFreeCount()) | |
{ | |
@@ -102,8 +102,8 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1) | |
//make sure to increase the m_defaultMaxPersistentManifoldPoolSize in the btDefaultCollisionConstructionInfo/btDefaultCollisionConfiguration | |
return 0; | |
} | |
- } | |
- btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0,contactBreakingThreshold,contactProcessingThreshold); | |
+ }*/ | |
+ btPersistentManifold* manifold = new btPersistentManifold (body0,body1,0,contactBreakingThreshold,contactProcessingThreshold); | |
manifold->m_index1a = m_manifoldsPtr.size(); | |
m_manifoldsPtr.push_back(manifold); | |
@@ -131,10 +131,10 @@ void btCollisionDispatcher::releaseManifold(btPersistentManifold* manifold) | |
m_manifoldsPtr.pop_back(); | |
manifold->~btPersistentManifold(); | |
- if (m_persistentManifoldPoolAllocator->validPtr(manifold)) | |
+ /*if (m_persistentManifoldPoolAllocator->validPtr(manifold)) | |
{ | |
m_persistentManifoldPoolAllocator->freeMemory(manifold); | |
- } else | |
+ } else*/ | |
{ | |
btAlignedFree(manifold); | |
} | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h | |
index 4045749..575f597 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h | |
@@ -67,8 +67,7 @@ public: | |
{ | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm)); | |
- return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,false); | |
+ return new btCompoundCollisionAlgorithm(ci,body0,body1,false); | |
} | |
}; | |
@@ -76,8 +75,7 @@ public: | |
{ | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm)); | |
- return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,true); | |
+ return new btCompoundCollisionAlgorithm(ci,body0,body1,true); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h | |
index 53d13b8..fab0f35 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h | |
@@ -84,8 +84,7 @@ public: | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvex2dConvex2dAlgorithm)); | |
- return new(mem) btConvex2dConvex2dAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
+ return new btConvex2dConvex2dAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp | |
index d2b2c22..58e6039 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp | |
@@ -123,8 +123,7 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i | |
} | |
colAlgo->processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut); | |
- colAlgo->~btCollisionAlgorithm(); | |
- ci.m_dispatcher1->freeCollisionAlgorithm(colAlgo); | |
+ delete colAlgo; | |
ob->internalSetTemporaryCollisionShape( tmpShape); | |
} | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h | |
index f718d1d..d0a105c 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h | |
@@ -97,8 +97,7 @@ public: | |
{ | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConcaveCollisionAlgorithm)); | |
- return new(mem) btConvexConcaveCollisionAlgorithm(ci,body0,body1,false); | |
+ return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,false); | |
} | |
}; | |
@@ -106,8 +105,7 @@ public: | |
{ | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConcaveCollisionAlgorithm)); | |
- return new(mem) btConvexConcaveCollisionAlgorithm(ci,body0,body1,true); | |
+ return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,true); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h | |
index 4380b80..bed73f6 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h | |
@@ -98,8 +98,7 @@ public: | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConvexAlgorithm)); | |
- return new(mem) btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
+ return new btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h | |
index a3d59f4..89e5e02 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h | |
@@ -67,13 +67,12 @@ public: | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexPlaneCollisionAlgorithm)); | |
if (!m_swapped) | |
{ | |
- return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,false,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
+ return new btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,false,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
} else | |
{ | |
- return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,true,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
+ return new btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,true,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold); | |
} | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp b/tests/bullet/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp | |
index c27d8ce..cf71e48 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp | |
@@ -32,8 +32,8 @@ subject to the following restrictions: | |
-#include "LinearMath/btStackAlloc.h" | |
#include "LinearMath/btPoolAllocator.h" | |
+#include "LinearMath/btStackAlloc.h" | |
@@ -43,57 +43,40 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault | |
//btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(btStackAlloc* stackAlloc,btPoolAllocator* persistentManifoldPool,btPoolAllocator* collisionAlgorithmPool) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btVoronoiSimplexSolver),16); | |
- m_simplexSolver = new (mem)btVoronoiSimplexSolver(); | |
+ m_simplexSolver = new btVoronoiSimplexSolver(); | |
if (constructionInfo.m_useEpaPenetrationAlgorithm) | |
{ | |
- mem = btAlignedAlloc(sizeof(btGjkEpaPenetrationDepthSolver),16); | |
- m_pdSolver = new (mem)btGjkEpaPenetrationDepthSolver; | |
+ m_pdSolver = new btGjkEpaPenetrationDepthSolver; | |
}else | |
{ | |
- mem = btAlignedAlloc(sizeof(btMinkowskiPenetrationDepthSolver),16); | |
- m_pdSolver = new (mem)btMinkowskiPenetrationDepthSolver; | |
+ m_pdSolver = new btMinkowskiPenetrationDepthSolver; | |
} | |
//default CreationFunctions, filling the m_doubleDispatch table | |
- mem = btAlignedAlloc(sizeof(btConvexConvexAlgorithm::CreateFunc),16); | |
- m_convexConvexCreateFunc = new(mem) btConvexConvexAlgorithm::CreateFunc(m_simplexSolver,m_pdSolver); | |
- mem = btAlignedAlloc(sizeof(btConvexConcaveCollisionAlgorithm::CreateFunc),16); | |
- m_convexConcaveCreateFunc = new (mem)btConvexConcaveCollisionAlgorithm::CreateFunc; | |
- mem = btAlignedAlloc(sizeof(btConvexConcaveCollisionAlgorithm::CreateFunc),16); | |
- m_swappedConvexConcaveCreateFunc = new (mem)btConvexConcaveCollisionAlgorithm::SwappedCreateFunc; | |
- mem = btAlignedAlloc(sizeof(btCompoundCollisionAlgorithm::CreateFunc),16); | |
- m_compoundCreateFunc = new (mem)btCompoundCollisionAlgorithm::CreateFunc; | |
- mem = btAlignedAlloc(sizeof(btCompoundCollisionAlgorithm::SwappedCreateFunc),16); | |
- m_swappedCompoundCreateFunc = new (mem)btCompoundCollisionAlgorithm::SwappedCreateFunc; | |
- mem = btAlignedAlloc(sizeof(btEmptyAlgorithm::CreateFunc),16); | |
- m_emptyCreateFunc = new(mem) btEmptyAlgorithm::CreateFunc; | |
+ m_convexConvexCreateFunc = new btConvexConvexAlgorithm::CreateFunc(m_simplexSolver,m_pdSolver); | |
+ m_convexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm::CreateFunc; | |
+ m_swappedConvexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm::SwappedCreateFunc; | |
+ m_compoundCreateFunc = new btCompoundCollisionAlgorithm::CreateFunc; | |
+ m_swappedCompoundCreateFunc = new btCompoundCollisionAlgorithm::SwappedCreateFunc; | |
+ m_emptyCreateFunc = new btEmptyAlgorithm::CreateFunc; | |
- mem = btAlignedAlloc(sizeof(btSphereSphereCollisionAlgorithm::CreateFunc),16); | |
- m_sphereSphereCF = new(mem) btSphereSphereCollisionAlgorithm::CreateFunc; | |
+ m_sphereSphereCF = new btSphereSphereCollisionAlgorithm::CreateFunc; | |
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM | |
- mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16); | |
- m_sphereBoxCF = new(mem) btSphereBoxCollisionAlgorithm::CreateFunc; | |
- mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16); | |
- m_boxSphereCF = new (mem)btSphereBoxCollisionAlgorithm::CreateFunc; | |
+ m_sphereBoxCF = new btSphereBoxCollisionAlgorithm::CreateFunc; | |
+ m_boxSphereCF = new btSphereBoxCollisionAlgorithm::CreateFunc; | |
m_boxSphereCF->m_swapped = true; | |
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM | |
- mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc),16); | |
- m_sphereTriangleCF = new (mem)btSphereTriangleCollisionAlgorithm::CreateFunc; | |
- mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc),16); | |
- m_triangleSphereCF = new (mem)btSphereTriangleCollisionAlgorithm::CreateFunc; | |
+ m_sphereTriangleCF = new btSphereTriangleCollisionAlgorithm::CreateFunc; | |
+ m_triangleSphereCF = new btSphereTriangleCollisionAlgorithm::CreateFunc; | |
m_triangleSphereCF->m_swapped = true; | |
- mem = btAlignedAlloc(sizeof(btBoxBoxCollisionAlgorithm::CreateFunc),16); | |
- m_boxBoxCF = new(mem)btBoxBoxCollisionAlgorithm::CreateFunc; | |
+ m_boxBoxCF = new btBoxBoxCollisionAlgorithm::CreateFunc; | |
//convex versus plane | |
- mem = btAlignedAlloc (sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc),16); | |
- m_convexPlaneCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc; | |
- mem = btAlignedAlloc (sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc),16); | |
- m_planeConvexCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc; | |
+ m_convexPlaneCF = new btConvexPlaneCollisionAlgorithm::CreateFunc; | |
+ m_planeConvexCF = new btConvexPlaneCollisionAlgorithm::CreateFunc; | |
m_planeConvexCF->m_swapped = true; | |
///calculate maximum element size, big enough to fit any collision algorithm in the memory pool | |
@@ -112,9 +95,8 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault | |
this->m_stackAlloc = constructionInfo.m_stackAlloc; | |
} else | |
{ | |
- m_ownsStackAllocator = true; | |
- void* mem = btAlignedAlloc(sizeof(btStackAlloc),16); | |
- m_stackAlloc = new(mem)btStackAlloc(constructionInfo.m_defaultStackAllocatorSize); | |
+ m_ownsStackAllocator = false; | |
+ m_stackAlloc = NULL; | |
} | |
if (constructionInfo.m_persistentManifoldPool) | |
@@ -124,8 +106,7 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault | |
} else | |
{ | |
m_ownsPersistentManifoldPool = true; | |
- void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16); | |
- m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold),constructionInfo.m_defaultMaxPersistentManifoldPoolSize); | |
+ m_persistentManifoldPool = NULL; | |
} | |
if (constructionInfo.m_collisionAlgorithmPool) | |
@@ -135,8 +116,7 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault | |
} else | |
{ | |
m_ownsCollisionAlgorithmPool = true; | |
- void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16); | |
- m_collisionAlgorithmPool = new(mem) btPoolAllocator(collisionAlgorithmMaxElementSize,constructionInfo.m_defaultMaxCollisionAlgorithmPoolSize); | |
+ m_collisionAlgorithmPool = NULL; | |
} | |
@@ -147,67 +127,45 @@ btDefaultCollisionConfiguration::~btDefaultCollisionConfiguration() | |
if (m_ownsStackAllocator) | |
{ | |
m_stackAlloc->destroy(); | |
- m_stackAlloc->~btStackAlloc(); | |
- btAlignedFree(m_stackAlloc); | |
+ delete m_stackAlloc; | |
} | |
if (m_ownsCollisionAlgorithmPool) | |
{ | |
- m_collisionAlgorithmPool->~btPoolAllocator(); | |
- btAlignedFree(m_collisionAlgorithmPool); | |
+ delete m_collisionAlgorithmPool; | |
} | |
if (m_ownsPersistentManifoldPool) | |
{ | |
- m_persistentManifoldPool->~btPoolAllocator(); | |
- btAlignedFree(m_persistentManifoldPool); | |
+ delete m_persistentManifoldPool; | |
} | |
- m_convexConvexCreateFunc->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_convexConvexCreateFunc); | |
+ delete m_convexConvexCreateFunc; | |
- m_convexConcaveCreateFunc->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_convexConcaveCreateFunc); | |
- m_swappedConvexConcaveCreateFunc->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_swappedConvexConcaveCreateFunc); | |
+ delete m_convexConcaveCreateFunc; | |
+ delete m_swappedConvexConcaveCreateFunc; | |
- m_compoundCreateFunc->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_compoundCreateFunc); | |
+ delete m_compoundCreateFunc; | |
- m_swappedCompoundCreateFunc->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_swappedCompoundCreateFunc); | |
+ delete m_swappedCompoundCreateFunc; | |
- m_emptyCreateFunc->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_emptyCreateFunc); | |
+ delete m_emptyCreateFunc; | |
- m_sphereSphereCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_sphereSphereCF); | |
+ delete m_sphereSphereCF; | |
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM | |
- m_sphereBoxCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_sphereBoxCF); | |
- m_boxSphereCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_boxSphereCF); | |
+ delete m_sphereBoxCF; | |
+ delete m_boxSphereCF; | |
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM | |
- m_sphereTriangleCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_sphereTriangleCF); | |
- m_triangleSphereCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_triangleSphereCF); | |
- m_boxBoxCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_boxBoxCF); | |
+ delete m_sphereTriangleCF; | |
+ delete m_triangleSphereCF; | |
+ delete m_boxBoxCF; | |
- m_convexPlaneCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_convexPlaneCF); | |
- m_planeConvexCF->~btCollisionAlgorithmCreateFunc(); | |
- btAlignedFree( m_planeConvexCF); | |
- | |
- m_simplexSolver->~btVoronoiSimplexSolver(); | |
- btAlignedFree(m_simplexSolver); | |
- | |
- m_pdSolver->~btConvexPenetrationDepthSolver(); | |
- | |
- btAlignedFree(m_pdSolver); | |
+ delete m_convexPlaneCF; | |
+ delete m_planeConvexCF; | |
+ delete m_simplexSolver; | |
+ delete m_pdSolver; | |
} | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h | |
index f03c9dc..8035fb1 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h | |
@@ -44,8 +44,7 @@ public: | |
{ | |
(void)body0; | |
(void)body1; | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btEmptyAlgorithm)); | |
- return new(mem) btEmptyAlgorithm(ci); | |
+ return new btEmptyAlgorithm(ci); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btGhostObject.cpp b/tests/bullet/src/BulletCollision/CollisionDispatch/btGhostObject.cpp | |
index 86141fa..15ebfa8 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btGhostObject.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btGhostObject.cpp | |
@@ -58,7 +58,7 @@ void btGhostObject::removeOverlappingObjectInternal(btBroadphaseProxy* otherProx | |
btPairCachingGhostObject::btPairCachingGhostObject() | |
{ | |
- m_hashPairCache = new (btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache(); | |
+ m_hashPairCache = new btHashedOverlappingPairCache(); | |
} | |
btPairCachingGhostObject::~btPairCachingGhostObject() | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h | |
index e55acf2..896ce50 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h | |
@@ -55,8 +55,7 @@ public: | |
{ | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btSphereSphereCollisionAlgorithm)); | |
- return new(mem) btSphereSphereCollisionAlgorithm(0,ci,body0,body1); | |
+ return new btSphereSphereCollisionAlgorithm(0,ci,body0,body1); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h | |
index 7c6c4d8..7edd917 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h | |
@@ -57,9 +57,7 @@ public: | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btSphereTriangleCollisionAlgorithm)); | |
- | |
- return new(mem) btSphereTriangleCollisionAlgorithm(ci.m_manifold,ci,body0,body1,m_swapped); | |
+ return new btSphereTriangleCollisionAlgorithm(ci.m_manifold,ci,body0,body1,m_swapped); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp b/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp | |
index ace4cfa..0944237 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp | |
@@ -54,8 +54,7 @@ m_ownsBvh(false) | |
if (buildBvh) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btOptimizedBvh),16); | |
- m_bvh = new (mem) btOptimizedBvh(); | |
+ m_bvh = new btOptimizedBvh(); | |
m_bvh->build(meshInterface,m_useQuantizedAabbCompression,bvhAabbMin,bvhAabbMax); | |
m_ownsBvh = true; | |
@@ -345,8 +344,7 @@ void btBvhTriangleMeshShape::buildOptimizedBvh() | |
btAlignedFree(m_bvh); | |
} | |
///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work | |
- void* mem = btAlignedAlloc(sizeof(btOptimizedBvh),16); | |
- m_bvh = new(mem) btOptimizedBvh(); | |
+ m_bvh = new btOptimizedBvh(); | |
//rebuild the bvh... | |
m_bvh->build(m_meshInterface,m_useQuantizedAabbCompression,m_localAabbMin,m_localAabbMax); | |
m_ownsBvh = true; | |
@@ -368,6 +366,7 @@ void btBvhTriangleMeshShape::setOptimizedBvh(btOptimizedBvh* bvh, const btVect | |
+#if 0 | |
///fills the dataBuffer and returns the struct name (and 0 on failure) | |
const char* btBvhTriangleMeshShape::serialize(void* dataBuffer, btSerializer* serializer) const | |
{ | |
@@ -461,6 +460,6 @@ void btBvhTriangleMeshShape::serializeSingleTriangleInfoMap(btSerializer* serial | |
} | |
} | |
- | |
+#endif | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h b/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h | |
index d1c2162..513d7aa 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h | |
@@ -101,13 +101,14 @@ public: | |
virtual int calculateSerializeBufferSize() const; | |
+#if 0 | |
///fills the dataBuffer and returns the struct name (and 0 on failure) | |
virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; | |
virtual void serializeSingleBvh(btSerializer* serializer) const; | |
virtual void serializeSingleTriangleInfoMap(btSerializer* serializer) const; | |
- | |
+#endif | |
}; | |
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btCompoundShape.cpp b/tests/bullet/src/BulletCollision/CollisionShapes/btCompoundShape.cpp | |
index 4eb860c..a1d2ed4 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btCompoundShape.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btCompoundShape.cpp | |
@@ -30,9 +30,7 @@ m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)) | |
if (enableDynamicAabbTree) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btDbvt),16); | |
- m_dynamicAabbTree = new(mem) btDbvt(); | |
- btAssert(mem==m_dynamicAabbTree); | |
+ m_dynamicAabbTree = new btDbvt(); | |
} | |
} | |
@@ -299,9 +297,7 @@ void btCompoundShape::createAabbTreeFromChildren() | |
{ | |
if ( !m_dynamicAabbTree ) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btDbvt),16); | |
- m_dynamicAabbTree = new(mem) btDbvt(); | |
- btAssert(mem==m_dynamicAabbTree); | |
+ m_dynamicAabbTree = new btDbvt(); | |
for ( int index = 0; index < m_children.size(); index++ ) | |
{ | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp b/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp | |
index 3a1e6f4..4ad20b7 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp | |
@@ -78,7 +78,12 @@ PHY_ScalarType hdt, bool flipQuadEdges | |
m_width = (btScalar) (heightStickWidth - 1); | |
m_length = (btScalar) (heightStickLength - 1); | |
m_heightScale = heightScale; | |
- m_heightfieldDataUnknown = heightfieldData; | |
+ if(hdt==PHY_UCHAR) | |
+ m_heightfieldDataUnsignedChar = (unsigned char*)heightfieldData; | |
+ else if(hdt==PHY_FLOAT) | |
+ m_heightfieldDataFloat = (btScalar*)heightfieldData; | |
+ else if(hdt==PHY_SHORT) | |
+ m_heightfieldDataShort = (short*)heightfieldData; | |
m_heightDataType = hdt; | |
m_flipQuadEdges = flipQuadEdges; | |
m_useDiamondSubdivision = false; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h b/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h | |
index 710c29e..87bc014 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h | |
@@ -83,12 +83,11 @@ protected: | |
btScalar m_width; | |
btScalar m_length; | |
btScalar m_heightScale; | |
- union | |
+ struct | |
{ | |
unsigned char* m_heightfieldDataUnsignedChar; | |
short* m_heightfieldDataShort; | |
btScalar* m_heightfieldDataFloat; | |
- void* m_heightfieldDataUnknown; | |
}; | |
PHY_ScalarType m_heightDataType; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp b/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp | |
index 981b8a2..c8b9460 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp | |
@@ -381,6 +381,7 @@ void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface,int f | |
} | |
+#if 0 | |
///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place' | |
btOptimizedBvh* btOptimizedBvh::deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian) | |
{ | |
@@ -389,3 +390,4 @@ btOptimizedBvh* btOptimizedBvh::deSerializeInPlace(void *i_alignedDataBuffer, un | |
//we don't add additional data so just do a static upcast | |
return static_cast<btOptimizedBvh*>(bvh); | |
} | |
+#endif | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.h b/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.h | |
index 715961f..cf7aec0 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.h | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.h | |
@@ -46,6 +46,7 @@ public: | |
void updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode,int index); | |
+#if 0 | |
/// Data buffer MUST be 16 byte aligned | |
virtual bool serializeInPlace(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const | |
{ | |
@@ -55,7 +56,7 @@ public: | |
///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place' | |
static btOptimizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian); | |
- | |
+#endif | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/tests/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp | |
index e84767e..04ca261 100644 | |
--- a/tests/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp | |
+++ b/tests/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp | |
@@ -37,8 +37,7 @@ bool btPolyhedralConvexShape::initializePolyhedralFeatures() | |
if (m_polyhedron) | |
btAlignedFree(m_polyhedron); | |
- void* mem = btAlignedAlloc(sizeof(btConvexPolyhedron),16); | |
- m_polyhedron = new (mem) btConvexPolyhedron; | |
+ m_polyhedron = new btConvexPolyhedron; | |
btAlignedObjectArray<btVector3> tmpVertices; | |
for (int i=0;i<getNumVertices();i++) | |
diff --git a/tests/bullet/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h b/tests/bullet/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h | |
index 6b6e07c..0f44e6f 100644 | |
--- a/tests/bullet/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h | |
+++ b/tests/bullet/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h | |
@@ -215,8 +215,7 @@ public: | |
{ | |
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1) | |
{ | |
- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btGImpactCollisionAlgorithm)); | |
- return new(mem) btGImpactCollisionAlgorithm(ci,body0,body1); | |
+ return new btGImpactCollisionAlgorithm(ci,body0,body1); | |
} | |
}; | |
diff --git a/tests/bullet/src/BulletCollision/Gimpact/btGenericPoolAllocator.cpp b/tests/bullet/src/BulletCollision/Gimpact/btGenericPoolAllocator.cpp | |
index 5d07d1a..61ffbc1 100644 | |
--- a/tests/bullet/src/BulletCollision/Gimpact/btGenericPoolAllocator.cpp | |
+++ b/tests/bullet/src/BulletCollision/Gimpact/btGenericPoolAllocator.cpp | |
@@ -262,7 +262,7 @@ public: | |
// global allocator | |
GIM_STANDARD_ALLOCATOR g_main_allocator; | |
- | |
+#ifndef __CHEERP__ | |
void * btPoolAlloc(size_t size) | |
{ | |
return g_main_allocator.allocate(size); | |
@@ -281,3 +281,4 @@ void btPoolFree(void *ptr) | |
{ | |
g_main_allocator.freeMemory(ptr); | |
} | |
+#endif | |
diff --git a/tests/bullet/src/BulletCollision/Gimpact/gim_math.h b/tests/bullet/src/BulletCollision/Gimpact/gim_math.h | |
index 939079e..f9146bd 100644 | |
--- a/tests/bullet/src/BulletCollision/Gimpact/gim_math.h | |
+++ b/tests/bullet/src/BulletCollision/Gimpact/gim_math.h | |
@@ -124,10 +124,7 @@ enum GIM_SCALAR_TYPES | |
}\ | |
else\ | |
{\ | |
- GREAL _x = va * 0.5f;\ | |
- GUINT _y = 0x5f3759df - ( GIM_IR(va) >> 1);\ | |
- isva = GIM_FR(_y);\ | |
- isva = isva * ( 1.5f - ( _x * isva * isva ) );\ | |
+ isva = 1.0f/sqrtf(va); \ | |
}\ | |
}\ | |
diff --git a/tests/bullet/src/BulletCollision/Gimpact/gim_memory.cpp b/tests/bullet/src/BulletCollision/Gimpact/gim_memory.cpp | |
index 1636eb7..959fafd 100644 | |
--- a/tests/bullet/src/BulletCollision/Gimpact/gim_memory.cpp | |
+++ b/tests/bullet/src/BulletCollision/Gimpact/gim_memory.cpp | |
@@ -82,7 +82,7 @@ gim_free_function *gim_get_free_handler () | |
return g_freefn; | |
} | |
- | |
+#ifndef __CHEERP__ | |
void * gim_alloc(size_t size) | |
{ | |
void * ptr; | |
@@ -132,4 +132,4 @@ void gim_free(void *ptr) | |
#endif | |
} | |
} | |
- | |
+#endif | |
diff --git a/tests/bullet/src/BulletCollision/Gimpact/gim_memory.h b/tests/bullet/src/BulletCollision/Gimpact/gim_memory.h | |
index e203888..a5e537b 100644 | |
--- a/tests/bullet/src/BulletCollision/Gimpact/gim_memory.h | |
+++ b/tests/bullet/src/BulletCollision/Gimpact/gim_memory.h | |
@@ -126,7 +126,7 @@ void gim_free(void *ptr); | |
//! SIMD INTEGER SIZE | |
#define SIMD_T_SIZE sizeof(SIMD_T) | |
- | |
+#ifndef __CHEERP__ | |
inline void gim_simd_memcpy(void * dst, const void * src, size_t copysize) | |
{ | |
#ifdef GIM_SIMD_MEMORY | |
@@ -155,6 +155,7 @@ inline void gim_simd_memcpy(void * dst, const void * src, size_t copysize) | |
memcpy(dst,src,copysize); | |
#endif | |
} | |
+#endif | |
@@ -170,10 +171,14 @@ inline void gim_swap_elements(T* _array,size_t _i,size_t _j) | |
template<class T> | |
inline void gim_swap_elements_memcpy(T* _array,size_t _i,size_t _j) | |
{ | |
+#ifdef __CHEERP__ | |
+ T _e_tmp_ [[noinit]]; | |
+#else | |
char _e_tmp_[sizeof(T)]; | |
- gim_simd_memcpy(_e_tmp_,&_array[_i],sizeof(T)); | |
- gim_simd_memcpy(&_array[_i],&_array[_j],sizeof(T)); | |
- gim_simd_memcpy(&_array[_j],_e_tmp_,sizeof(T)); | |
+#endif | |
+ memcpy(_e_tmp_,&_array[_i],sizeof(T)); | |
+ memcpy(&_array[_i],&_array[_j],sizeof(T)); | |
+ memcpy(&_array[_j],_e_tmp_,sizeof(T)); | |
} | |
template <int SIZE> | |
@@ -182,9 +187,9 @@ inline void gim_swap_elements_ptr(char * _array,size_t _i,size_t _j) | |
char _e_tmp_[SIZE]; | |
_i*=SIZE; | |
_j*=SIZE; | |
- gim_simd_memcpy(_e_tmp_,_array+_i,SIZE); | |
- gim_simd_memcpy(_array+_i,_array+_j,SIZE); | |
- gim_simd_memcpy(_array+_j,_e_tmp_,SIZE); | |
+ memcpy(_e_tmp_,_array+_i,SIZE); | |
+ memcpy(_array+_i,_array+_j,SIZE); | |
+ memcpy(_array+_j,_e_tmp_,SIZE); | |
} | |
#endif // GIM_MEMORY_H_INCLUDED | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp b/tests/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp | |
index bc371e4..0e4c2d7 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp | |
@@ -125,22 +125,22 @@ void btConeTwistConstraint::getInfo2NonVirtual (btConstraintInfo2* info,const bt | |
btAssert(!m_useSolveConstraintObsolete); | |
// set jacobian | |
- info->m_J1linearAxis[0] = 1; | |
- info->m_J1linearAxis[info->rowskip+1] = 1; | |
- info->m_J1linearAxis[2*info->rowskip+2] = 1; | |
+ (*info->m_J1linearAxis[0])[0] = 1; | |
+ (*info->m_J1linearAxis[1])[1] = 1; | |
+ (*info->m_J1linearAxis[2])[2] = 1; | |
btVector3 a1 = transA.getBasis() * m_rbAFrame.getOrigin(); | |
{ | |
- btVector3* angular0 = (btVector3*)(info->m_J1angularAxis); | |
- btVector3* angular1 = (btVector3*)(info->m_J1angularAxis+info->rowskip); | |
- btVector3* angular2 = (btVector3*)(info->m_J1angularAxis+2*info->rowskip); | |
+ btVector3* angular0(info->m_J1angularAxis[0]); | |
+ btVector3* angular1(info->m_J1angularAxis[1]); | |
+ btVector3* angular2(info->m_J1angularAxis[2]); | |
btVector3 a1neg = -a1; | |
a1neg.getSkewSymmetricMatrix(angular0,angular1,angular2); | |
} | |
btVector3 a2 = transB.getBasis() * m_rbBFrame.getOrigin(); | |
{ | |
- btVector3* angular0 = (btVector3*)(info->m_J2angularAxis); | |
- btVector3* angular1 = (btVector3*)(info->m_J2angularAxis+info->rowskip); | |
- btVector3* angular2 = (btVector3*)(info->m_J2angularAxis+2*info->rowskip); | |
+ btVector3* angular0(info->m_J2angularAxis[0]); | |
+ btVector3* angular1(info->m_J2angularAxis[1]); | |
+ btVector3* angular2(info->m_J2angularAxis[2]); | |
a2.getSkewSymmetricMatrix(angular0,angular1,angular2); | |
} | |
// set right hand side | |
@@ -149,108 +149,108 @@ void btConeTwistConstraint::getInfo2NonVirtual (btConstraintInfo2* info,const bt | |
int j; | |
for (j=0; j<3; j++) | |
{ | |
- info->m_constraintError[j*info->rowskip] = k * (a2[j] + transB.getOrigin()[j] - a1[j] - transA.getOrigin()[j]); | |
- info->m_lowerLimit[j*info->rowskip] = -SIMD_INFINITY; | |
- info->m_upperLimit[j*info->rowskip] = SIMD_INFINITY; | |
+ *info->m_constraintError[j] = k * (a2[j] + transB.getOrigin()[j] - a1[j] - transA.getOrigin()[j]); | |
+ *info->m_lowerLimit[j] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[j] = SIMD_INFINITY; | |
if(m_flags & BT_CONETWIST_FLAGS_LIN_CFM) | |
{ | |
- info->cfm[j*info->rowskip] = m_linCFM; | |
+ *info->cfm[j] = m_linCFM; | |
} | |
} | |
int row = 3; | |
- int srow = row * info->rowskip; | |
+ int srow = row; | |
btVector3 ax1; | |
// angular limits | |
if(m_solveSwingLimit) | |
{ | |
- btScalar *J1 = info->m_J1angularAxis; | |
- btScalar *J2 = info->m_J2angularAxis; | |
+ btVector3 **J1 = info->m_J1angularAxis; | |
+ btVector3 **J2 = info->m_J2angularAxis; | |
if((m_swingSpan1 < m_fixThresh) && (m_swingSpan2 < m_fixThresh)) | |
{ | |
btTransform trA = transA*m_rbAFrame; | |
btVector3 p = trA.getBasis().getColumn(1); | |
btVector3 q = trA.getBasis().getColumn(2); | |
- int srow1 = srow + info->rowskip; | |
- J1[srow+0] = p[0]; | |
- J1[srow+1] = p[1]; | |
- J1[srow+2] = p[2]; | |
- J1[srow1+0] = q[0]; | |
- J1[srow1+1] = q[1]; | |
- J1[srow1+2] = q[2]; | |
- J2[srow+0] = -p[0]; | |
- J2[srow+1] = -p[1]; | |
- J2[srow+2] = -p[2]; | |
- J2[srow1+0] = -q[0]; | |
- J2[srow1+1] = -q[1]; | |
- J2[srow1+2] = -q[2]; | |
+ int srow1 = srow + 1; | |
+ (*J1[srow])[0] = p[0]; | |
+ (*J1[srow])[1] = p[1]; | |
+ (*J1[srow])[2] = p[2]; | |
+ (*J1[srow1])[0] = q[0]; | |
+ (*J1[srow1])[1] = q[1]; | |
+ (*J1[srow1])[2] = q[2]; | |
+ (*J2[srow])[0] = -p[0]; | |
+ (*J2[srow])[1] = -p[1]; | |
+ (*J2[srow])[2] = -p[2]; | |
+ (*J2[srow1])[0] = -q[0]; | |
+ (*J2[srow1])[1] = -q[1]; | |
+ (*J2[srow1])[2] = -q[2]; | |
btScalar fact = info->fps * m_relaxationFactor; | |
- info->m_constraintError[srow] = fact * m_swingAxis.dot(p); | |
- info->m_constraintError[srow1] = fact * m_swingAxis.dot(q); | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
- info->m_lowerLimit[srow1] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow1] = SIMD_INFINITY; | |
- srow = srow1 + info->rowskip; | |
+ *info->m_constraintError[srow] = fact * m_swingAxis.dot(p); | |
+ *info->m_constraintError[srow1] = fact * m_swingAxis.dot(q); | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow1] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow1] = SIMD_INFINITY; | |
+ srow = srow1 + 1; | |
} | |
else | |
{ | |
ax1 = m_swingAxis * m_relaxationFactor * m_relaxationFactor; | |
- J1[srow+0] = ax1[0]; | |
- J1[srow+1] = ax1[1]; | |
- J1[srow+2] = ax1[2]; | |
- J2[srow+0] = -ax1[0]; | |
- J2[srow+1] = -ax1[1]; | |
- J2[srow+2] = -ax1[2]; | |
+ (*J1[srow])[0] = ax1[0]; | |
+ (*J1[srow])[1] = ax1[1]; | |
+ (*J1[srow])[2] = ax1[2]; | |
+ (*J2[srow])[0] = -ax1[0]; | |
+ (*J2[srow])[1] = -ax1[1]; | |
+ (*J2[srow])[2] = -ax1[2]; | |
btScalar k = info->fps * m_biasFactor; | |
- info->m_constraintError[srow] = k * m_swingCorrection; | |
+ *info->m_constraintError[srow] = k * m_swingCorrection; | |
if(m_flags & BT_CONETWIST_FLAGS_ANG_CFM) | |
{ | |
- info->cfm[srow] = m_angCFM; | |
+ *info->cfm[srow] = m_angCFM; | |
} | |
// m_swingCorrection is always positive or 0 | |
- info->m_lowerLimit[srow] = 0; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
- srow += info->rowskip; | |
+ *info->m_lowerLimit[srow] = 0; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ srow += 1; | |
} | |
} | |
if(m_solveTwistLimit) | |
{ | |
ax1 = m_twistAxis * m_relaxationFactor * m_relaxationFactor; | |
- btScalar *J1 = info->m_J1angularAxis; | |
- btScalar *J2 = info->m_J2angularAxis; | |
- J1[srow+0] = ax1[0]; | |
- J1[srow+1] = ax1[1]; | |
- J1[srow+2] = ax1[2]; | |
- J2[srow+0] = -ax1[0]; | |
- J2[srow+1] = -ax1[1]; | |
- J2[srow+2] = -ax1[2]; | |
+ btVector3 **J1 = info->m_J1angularAxis; | |
+ btVector3 **J2 = info->m_J2angularAxis; | |
+ (*J1[srow])[0] = ax1[0]; | |
+ (*J1[srow])[1] = ax1[1]; | |
+ (*J1[srow])[2] = ax1[2]; | |
+ (*J2[srow])[0] = -ax1[0]; | |
+ (*J2[srow])[1] = -ax1[1]; | |
+ (*J2[srow])[2] = -ax1[2]; | |
btScalar k = info->fps * m_biasFactor; | |
- info->m_constraintError[srow] = k * m_twistCorrection; | |
+ *info->m_constraintError[srow] = k * m_twistCorrection; | |
if(m_flags & BT_CONETWIST_FLAGS_ANG_CFM) | |
{ | |
- info->cfm[srow] = m_angCFM; | |
+ *info->cfm[srow] = m_angCFM; | |
} | |
if(m_twistSpan > 0.0f) | |
{ | |
if(m_twistCorrection > 0.0f) | |
{ | |
- info->m_lowerLimit[srow] = 0; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = 0; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
else | |
{ | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = 0; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = 0; | |
} | |
} | |
else | |
{ | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
- srow += info->rowskip; | |
+ srow += 1; | |
} | |
} | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp b/tests/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp | |
index 7c5e4f6..92035a5 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp | |
@@ -647,8 +647,8 @@ int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info, int row, c | |
limot.m_targetVelocity = m_linearLimits.m_targetVelocity[i]; | |
btVector3 axis = m_calculatedTransformA.getBasis().getColumn(i); | |
int flags = m_flags >> (i * BT_6DOF_FLAGS_AXIS_SHIFT); | |
- limot.m_normalCFM = (flags & BT_6DOF_FLAGS_CFM_NORM) ? m_linearLimits.m_normalCFM[i] : info->cfm[0]; | |
- limot.m_stopCFM = (flags & BT_6DOF_FLAGS_CFM_STOP) ? m_linearLimits.m_stopCFM[i] : info->cfm[0]; | |
+ limot.m_normalCFM = (flags & BT_6DOF_FLAGS_CFM_NORM) ? m_linearLimits.m_normalCFM[i] : *info->cfm[0]; | |
+ limot.m_stopCFM = (flags & BT_6DOF_FLAGS_CFM_STOP) ? m_linearLimits.m_stopCFM[i] : *info->cfm[0]; | |
limot.m_stopERP = (flags & BT_6DOF_FLAGS_ERP_STOP) ? m_linearLimits.m_stopERP[i] : info->erp; | |
if(m_useOffsetForConstraintFrame) | |
{ | |
@@ -671,7 +671,6 @@ int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info, int row, c | |
} | |
- | |
int btGeneric6DofConstraint::setAngularLimits(btConstraintInfo2 *info, int row_offset, const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB) | |
{ | |
btGeneric6DofConstraint * d6constraint = this; | |
@@ -685,11 +684,11 @@ int btGeneric6DofConstraint::setAngularLimits(btConstraintInfo2 *info, int row_o | |
int flags = m_flags >> ((i + 3) * BT_6DOF_FLAGS_AXIS_SHIFT); | |
if(!(flags & BT_6DOF_FLAGS_CFM_NORM)) | |
{ | |
- m_angularLimits[i].m_normalCFM = info->cfm[0]; | |
+ m_angularLimits[i].m_normalCFM = *info->cfm[0]; | |
} | |
if(!(flags & BT_6DOF_FLAGS_CFM_STOP)) | |
{ | |
- m_angularLimits[i].m_stopCFM = info->cfm[0]; | |
+ m_angularLimits[i].m_stopCFM = *info->cfm[0]; | |
} | |
if(!(flags & BT_6DOF_FLAGS_ERP_STOP)) | |
{ | |
@@ -781,21 +780,21 @@ int btGeneric6DofConstraint::get_limit_motor_info2( | |
const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB, | |
btConstraintInfo2 *info, int row, btVector3& ax1, int rotational,int rotAllowed) | |
{ | |
- int srow = row * info->rowskip; | |
+ int srow = row; | |
int powered = limot->m_enableMotor; | |
int limit = limot->m_currentLimit; | |
if (powered || limit) | |
{ // if the joint is powered, or has joint limits, add in the extra row | |
- btScalar *J1 = rotational ? info->m_J1angularAxis : info->m_J1linearAxis; | |
- btScalar *J2 = rotational ? info->m_J2angularAxis : 0; | |
- J1[srow+0] = ax1[0]; | |
- J1[srow+1] = ax1[1]; | |
- J1[srow+2] = ax1[2]; | |
+ btVector3 **J1 = rotational ? info->m_J1angularAxis : info->m_J1linearAxis; | |
+ btVector3 **J2 = rotational ? info->m_J2angularAxis : 0; | |
+ (*J1[srow])[0] = ax1[0]; | |
+ (*J1[srow])[1] = ax1[1]; | |
+ (*J1[srow])[2] = ax1[2]; | |
if(rotational) | |
{ | |
- J2[srow+0] = -ax1[0]; | |
- J2[srow+1] = -ax1[1]; | |
- J2[srow+2] = -ax1[2]; | |
+ (*J2[srow])[0] = -ax1[0]; | |
+ (*J2[srow])[1] = -ax1[1]; | |
+ (*J2[srow])[2] = -ax1[2]; | |
} | |
if((!rotational)) | |
{ | |
@@ -827,31 +826,31 @@ int btGeneric6DofConstraint::get_limit_motor_info2( | |
tmpB *= m_factB; | |
} | |
int i; | |
- for (i=0; i<3; i++) info->m_J1angularAxis[srow+i] = tmpA[i]; | |
- for (i=0; i<3; i++) info->m_J2angularAxis[srow+i] = -tmpB[i]; | |
+ for (i=0; i<3; i++) ((*info->m_J1angularAxis)[srow])[i] = tmpA[i]; | |
+ for (i=0; i<3; i++) ((*info->m_J2angularAxis)[srow])[i] = -tmpB[i]; | |
} else | |
{ | |
btVector3 ltd; // Linear Torque Decoupling vector | |
btVector3 c = m_calculatedTransformB.getOrigin() - transA.getOrigin(); | |
ltd = c.cross(ax1); | |
- info->m_J1angularAxis[srow+0] = ltd[0]; | |
- info->m_J1angularAxis[srow+1] = ltd[1]; | |
- info->m_J1angularAxis[srow+2] = ltd[2]; | |
+ ((*info->m_J1angularAxis)[srow])[0] = ltd[0]; | |
+ ((*info->m_J1angularAxis)[srow])[1] = ltd[1]; | |
+ ((*info->m_J1angularAxis)[srow])[2] = ltd[2]; | |
c = m_calculatedTransformB.getOrigin() - transB.getOrigin(); | |
ltd = -c.cross(ax1); | |
- info->m_J2angularAxis[srow+0] = ltd[0]; | |
- info->m_J2angularAxis[srow+1] = ltd[1]; | |
- info->m_J2angularAxis[srow+2] = ltd[2]; | |
+ ((*info->m_J2angularAxis)[srow])[0] = ltd[0]; | |
+ ((*info->m_J2angularAxis)[srow])[1] = ltd[1]; | |
+ ((*info->m_J2angularAxis)[srow])[2] = ltd[2]; | |
} | |
} | |
// if we're limited low and high simultaneously, the joint motor is | |
// ineffective | |
if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = 0; | |
- info->m_constraintError[srow] = btScalar(0.f); | |
+ *info->m_constraintError[srow] = btScalar(0.f); | |
if (powered) | |
{ | |
- info->cfm[srow] = limot->m_normalCFM; | |
+ *info->cfm[srow] = limot->m_normalCFM; | |
if(!limit) | |
{ | |
btScalar tag_vel = rotational ? limot->m_targetVelocity : -limot->m_targetVelocity; | |
@@ -861,9 +860,9 @@ int btGeneric6DofConstraint::get_limit_motor_info2( | |
limot->m_hiLimit, | |
tag_vel, | |
info->fps * limot->m_stopERP); | |
- info->m_constraintError[srow] += mot_fact * limot->m_targetVelocity; | |
- info->m_lowerLimit[srow] = -limot->m_maxMotorForce; | |
- info->m_upperLimit[srow] = limot->m_maxMotorForce; | |
+ *info->m_constraintError[srow] += mot_fact * limot->m_targetVelocity; | |
+ *info->m_lowerLimit[srow] = -limot->m_maxMotorForce; | |
+ *info->m_upperLimit[srow] = limot->m_maxMotorForce; | |
} | |
} | |
if(limit) | |
@@ -871,29 +870,29 @@ int btGeneric6DofConstraint::get_limit_motor_info2( | |
btScalar k = info->fps * limot->m_stopERP; | |
if(!rotational) | |
{ | |
- info->m_constraintError[srow] += k * limot->m_currentLimitError; | |
+ *info->m_constraintError[srow] += k * limot->m_currentLimitError; | |
} | |
else | |
{ | |
- info->m_constraintError[srow] += -k * limot->m_currentLimitError; | |
+ *info->m_constraintError[srow] += -k * limot->m_currentLimitError; | |
} | |
- info->cfm[srow] = limot->m_stopCFM; | |
+ *info->cfm[srow] = limot->m_stopCFM; | |
if (limot->m_loLimit == limot->m_hiLimit) | |
{ // limited low and high simultaneously | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
else | |
{ | |
if (limit == 1) | |
{ | |
- info->m_lowerLimit[srow] = 0; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = 0; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
else | |
{ | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = 0; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = 0; | |
} | |
// deal with bounce | |
if (limot->m_bounce > 0) | |
@@ -921,8 +920,8 @@ int btGeneric6DofConstraint::get_limit_motor_info2( | |
if (vel < 0) | |
{ | |
btScalar newc = -limot->m_bounce* vel; | |
- if (newc > info->m_constraintError[srow]) | |
- info->m_constraintError[srow] = newc; | |
+ if (newc > *info->m_constraintError[srow]) | |
+ *info->m_constraintError[srow] = newc; | |
} | |
} | |
else | |
@@ -930,8 +929,8 @@ int btGeneric6DofConstraint::get_limit_motor_info2( | |
if (vel > 0) | |
{ | |
btScalar newc = -limot->m_bounce * vel; | |
- if (newc < info->m_constraintError[srow]) | |
- info->m_constraintError[srow] = newc; | |
+ if (newc < *info->m_constraintError[srow]) | |
+ *info->m_constraintError[srow] = newc; | |
} | |
} | |
} | |
@@ -1067,4 +1066,4 @@ void btGeneric6DofConstraint::setAxis(const btVector3& axis1,const btVector3& ax | |
m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW; | |
calculateTransforms(); | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp b/tests/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp | |
index 144beef..1eee637 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp | |
@@ -346,9 +346,8 @@ void btHingeConstraint::getInfo2NonVirtual (btConstraintInfo2* info,const btTran | |
void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransform& transA,const btTransform& transB,const btVector3& angVelA,const btVector3& angVelB) | |
{ | |
- | |
btAssert(!m_useSolveConstraintObsolete); | |
- int i, skip = info->rowskip; | |
+ int i, skip = 1; | |
// transforms in world space | |
btTransform trA = transA*m_rbAFrame; | |
btTransform trB = transB*m_rbBFrame; | |
@@ -380,9 +379,9 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
if (!m_angularOnly) | |
{ | |
- info->m_J1linearAxis[0] = 1; | |
- info->m_J1linearAxis[skip + 1] = 1; | |
- info->m_J1linearAxis[2 * skip + 2] = 1; | |
+ (*info->m_J1linearAxis[0])[0] = 1; | |
+ (*info->m_J1linearAxis[skip])[1]= 1; | |
+ (*info->m_J1linearAxis[2 * skip])[2] = 1; | |
} | |
@@ -409,7 +408,7 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
{ | |
for(i = 0; i < 3; i++) | |
{ | |
- info->m_constraintError[i * skip] = k * (pivotBInW[i] - pivotAInW[i]); | |
+ *info->m_constraintError[i * skip] = k * (pivotBInW[i] - pivotAInW[i]); | |
} | |
} | |
// make rotations around X and Y equal | |
@@ -426,22 +425,22 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
btVector3 p = trA.getBasis().getColumn(0); | |
btVector3 q = trA.getBasis().getColumn(1); | |
// set the two hinge angular rows | |
- int s3 = 3 * info->rowskip; | |
- int s4 = 4 * info->rowskip; | |
- | |
- info->m_J1angularAxis[s3 + 0] = p[0]; | |
- info->m_J1angularAxis[s3 + 1] = p[1]; | |
- info->m_J1angularAxis[s3 + 2] = p[2]; | |
- info->m_J1angularAxis[s4 + 0] = q[0]; | |
- info->m_J1angularAxis[s4 + 1] = q[1]; | |
- info->m_J1angularAxis[s4 + 2] = q[2]; | |
- | |
- info->m_J2angularAxis[s3 + 0] = -p[0]; | |
- info->m_J2angularAxis[s3 + 1] = -p[1]; | |
- info->m_J2angularAxis[s3 + 2] = -p[2]; | |
- info->m_J2angularAxis[s4 + 0] = -q[0]; | |
- info->m_J2angularAxis[s4 + 1] = -q[1]; | |
- info->m_J2angularAxis[s4 + 2] = -q[2]; | |
+ int s3 = 3; | |
+ int s4 = 4; | |
+ | |
+ (*info->m_J1angularAxis[s3])[0] = p[0]; | |
+ (*info->m_J1angularAxis[s3])[1] = p[1]; | |
+ (*info->m_J1angularAxis[s3])[2] = p[2]; | |
+ (*info->m_J1angularAxis[s4])[0] = q[0]; | |
+ (*info->m_J1angularAxis[s4])[1] = q[1]; | |
+ (*info->m_J1angularAxis[s4])[2] = q[2]; | |
+ | |
+ (*info->m_J2angularAxis[s3])[0] = -p[0]; | |
+ (*info->m_J2angularAxis[s3])[1] = -p[1]; | |
+ (*info->m_J2angularAxis[s3])[2] = -p[2]; | |
+ (*info->m_J2angularAxis[s4])[0] = -q[0]; | |
+ (*info->m_J2angularAxis[s4])[1] = -q[1]; | |
+ (*info->m_J2angularAxis[s4])[2] = -q[2]; | |
// compute the right hand side of the constraint equation. set relative | |
// body velocities along p and q to bring the hinge back into alignment. | |
// if ax1,ax2 are the unit length hinge axes as computed from body1 and | |
@@ -459,8 +458,8 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
// velocity to p and q to find the right hand side. | |
btVector3 ax2 = trB.getBasis().getColumn(2); | |
btVector3 u = ax1.cross(ax2); | |
- info->m_constraintError[s3] = k * u.dot(p); | |
- info->m_constraintError[s4] = k * u.dot(q); | |
+ *info->m_constraintError[s3] = k * u.dot(p); | |
+ *info->m_constraintError[s4] = k * u.dot(q); | |
// check angular limits | |
int nrow = 4; // last filled row | |
int srow; | |
@@ -485,14 +484,14 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
if(limit || powered) | |
{ | |
nrow++; | |
- srow = nrow * info->rowskip; | |
- info->m_J1angularAxis[srow+0] = ax1[0]; | |
- info->m_J1angularAxis[srow+1] = ax1[1]; | |
- info->m_J1angularAxis[srow+2] = ax1[2]; | |
+ srow = nrow; | |
+ (*info->m_J1angularAxis[srow])[0] = ax1[0]; | |
+ (*info->m_J1angularAxis[srow])[1] = ax1[1]; | |
+ (*info->m_J1angularAxis[srow])[2] = ax1[2]; | |
- info->m_J2angularAxis[srow+0] = -ax1[0]; | |
- info->m_J2angularAxis[srow+1] = -ax1[1]; | |
- info->m_J2angularAxis[srow+2] = -ax1[2]; | |
+ (*info->m_J2angularAxis[srow])[0] = -ax1[0]; | |
+ (*info->m_J2angularAxis[srow])[1] = -ax1[1]; | |
+ (*info->m_J2angularAxis[srow])[2] = -ax1[2]; | |
btScalar lostop = getLowerLimit(); | |
btScalar histop = getUpperLimit(); | |
@@ -500,42 +499,42 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
{ // the joint motor is ineffective | |
powered = 0; | |
} | |
- info->m_constraintError[srow] = btScalar(0.0f); | |
+ *info->m_constraintError[srow] = btScalar(0.0f); | |
btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : info->erp; | |
if(powered) | |
{ | |
if(m_flags & BT_HINGE_FLAGS_CFM_NORM) | |
{ | |
- info->cfm[srow] = m_normalCFM; | |
+ *info->cfm[srow] = m_normalCFM; | |
} | |
btScalar mot_fact = getMotorFactor(m_hingeAngle, lostop, histop, m_motorTargetVelocity, info->fps * currERP); | |
- info->m_constraintError[srow] += mot_fact * m_motorTargetVelocity * m_referenceSign; | |
- info->m_lowerLimit[srow] = - m_maxMotorImpulse; | |
- info->m_upperLimit[srow] = m_maxMotorImpulse; | |
+ *info->m_constraintError[srow] += mot_fact * m_motorTargetVelocity * m_referenceSign; | |
+ *info->m_lowerLimit[srow] = - m_maxMotorImpulse; | |
+ *info->m_upperLimit[srow] = m_maxMotorImpulse; | |
} | |
if(limit) | |
{ | |
k = info->fps * currERP; | |
- info->m_constraintError[srow] += k * limit_err; | |
+ *info->m_constraintError[srow] += k * limit_err; | |
if(m_flags & BT_HINGE_FLAGS_CFM_STOP) | |
{ | |
- info->cfm[srow] = m_stopCFM; | |
+ *info->cfm[srow] = m_stopCFM; | |
} | |
if(lostop == histop) | |
{ | |
// limited low and high simultaneously | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
else if(limit == 1) | |
{ // low limit | |
- info->m_lowerLimit[srow] = 0; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = 0; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
else | |
{ // high limit | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = 0; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = 0; | |
} | |
// bounce (we'll use slider parameter abs(1.0 - m_dampingLimAng) for that) | |
#ifdef _BT_USE_CENTER_LIMIT_ | |
@@ -554,9 +553,9 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
if(vel < 0) | |
{ | |
btScalar newc = -bounce * vel; | |
- if(newc > info->m_constraintError[srow]) | |
+ if(newc > *info->m_constraintError[srow]) | |
{ | |
- info->m_constraintError[srow] = newc; | |
+ *info->m_constraintError[srow] = newc; | |
} | |
} | |
} | |
@@ -565,17 +564,17 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf | |
if(vel > 0) | |
{ | |
btScalar newc = -bounce * vel; | |
- if(newc < info->m_constraintError[srow]) | |
+ if(newc < *info->m_constraintError[srow]) | |
{ | |
- info->m_constraintError[srow] = newc; | |
+ *info->m_constraintError[srow] = newc; | |
} | |
} | |
} | |
} | |
#ifdef _BT_USE_CENTER_LIMIT_ | |
- info->m_constraintError[srow] *= m_limit.getBiasFactor(); | |
+ *info->m_constraintError[srow] *= m_limit.getBiasFactor(); | |
#else | |
- info->m_constraintError[srow] *= m_biasFactor; | |
+ *info->m_constraintError[srow] *= m_biasFactor; | |
#endif | |
} // if(limit) | |
} // if angular limit or powered | |
@@ -696,7 +695,7 @@ void btHingeConstraint::setMotorTarget(btScalar targetAngle, btScalar dt) | |
void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info, const btTransform& transA,const btTransform& transB,const btVector3& angVelA,const btVector3& angVelB) | |
{ | |
btAssert(!m_useSolveConstraintObsolete); | |
- int i, s = info->rowskip; | |
+ int i, s = 1; | |
// transforms in world space | |
btTransform trA = transA*m_rbAFrame; | |
btTransform trB = transB*m_rbBFrame; | |
@@ -766,8 +765,8 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
// fill three rows | |
tmpA = relA.cross(p); | |
tmpB = relB.cross(p); | |
- for (i=0; i<3; i++) info->m_J1angularAxis[s0+i] = tmpA[i]; | |
- for (i=0; i<3; i++) info->m_J2angularAxis[s0+i] = -tmpB[i]; | |
+ for (i=0; i<3; i++) (*info->m_J1angularAxis[s0])[i] = tmpA[i]; | |
+ for (i=0; i<3; i++) (*info->m_J2angularAxis[s0])[i] = -tmpB[i]; | |
tmpA = relA.cross(q); | |
tmpB = relB.cross(q); | |
if(hasStaticBody && getSolveLimit()) | |
@@ -776,8 +775,8 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
tmpB *= factB; | |
tmpA *= factA; | |
} | |
- for (i=0; i<3; i++) info->m_J1angularAxis[s1+i] = tmpA[i]; | |
- for (i=0; i<3; i++) info->m_J2angularAxis[s1+i] = -tmpB[i]; | |
+ for (i=0; i<3; i++) (*info->m_J1angularAxis[s1])[i] = tmpA[i]; | |
+ for (i=0; i<3; i++) (*info->m_J2angularAxis[s1])[i] = -tmpB[i]; | |
tmpA = relA.cross(ax1); | |
tmpB = relB.cross(ax1); | |
if(hasStaticBody) | |
@@ -786,25 +785,25 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
tmpB *= factB; | |
tmpA *= factA; | |
} | |
- for (i=0; i<3; i++) info->m_J1angularAxis[s2+i] = tmpA[i]; | |
- for (i=0; i<3; i++) info->m_J2angularAxis[s2+i] = -tmpB[i]; | |
+ for (i=0; i<3; i++) (*info->m_J1angularAxis[s2])[i] = tmpA[i]; | |
+ for (i=0; i<3; i++) (*info->m_J2angularAxis[s2])[i] = -tmpB[i]; | |
btScalar k = info->fps * info->erp; | |
if (!m_angularOnly) | |
{ | |
- for (i=0; i<3; i++) info->m_J1linearAxis[s0+i] = p[i]; | |
- for (i=0; i<3; i++) info->m_J1linearAxis[s1+i] = q[i]; | |
- for (i=0; i<3; i++) info->m_J1linearAxis[s2+i] = ax1[i]; | |
+ for (i=0; i<3; i++) (*info->m_J1linearAxis[s0])[i] = p[i]; | |
+ for (i=0; i<3; i++) (*info->m_J1linearAxis[s1])[i] = q[i]; | |
+ for (i=0; i<3; i++) (*info->m_J1linearAxis[s2])[i] = ax1[i]; | |
// compute three elements of right hand side | |
btScalar rhs = k * p.dot(ofs); | |
- info->m_constraintError[s0] = rhs; | |
+ *info->m_constraintError[s0] = rhs; | |
rhs = k * q.dot(ofs); | |
- info->m_constraintError[s1] = rhs; | |
+ *info->m_constraintError[s1] = rhs; | |
rhs = k * ax1.dot(ofs); | |
- info->m_constraintError[s2] = rhs; | |
+ *info->m_constraintError[s2] = rhs; | |
} | |
// the hinge axis should be the only unconstrained | |
// rotational axis, the angular velocity of the two bodies perpendicular to | |
@@ -815,19 +814,19 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
// are the angular velocity vectors of the two bodies. | |
int s3 = 3 * s; | |
int s4 = 4 * s; | |
- info->m_J1angularAxis[s3 + 0] = p[0]; | |
- info->m_J1angularAxis[s3 + 1] = p[1]; | |
- info->m_J1angularAxis[s3 + 2] = p[2]; | |
- info->m_J1angularAxis[s4 + 0] = q[0]; | |
- info->m_J1angularAxis[s4 + 1] = q[1]; | |
- info->m_J1angularAxis[s4 + 2] = q[2]; | |
- | |
- info->m_J2angularAxis[s3 + 0] = -p[0]; | |
- info->m_J2angularAxis[s3 + 1] = -p[1]; | |
- info->m_J2angularAxis[s3 + 2] = -p[2]; | |
- info->m_J2angularAxis[s4 + 0] = -q[0]; | |
- info->m_J2angularAxis[s4 + 1] = -q[1]; | |
- info->m_J2angularAxis[s4 + 2] = -q[2]; | |
+ (*info->m_J1angularAxis[s3])[0] = p[0]; | |
+ (*info->m_J1angularAxis[s3])[1] = p[1]; | |
+ (*info->m_J1angularAxis[s3])[2] = p[2]; | |
+ (*info->m_J1angularAxis[s4])[0] = q[0]; | |
+ (*info->m_J1angularAxis[s4])[1] = q[1]; | |
+ (*info->m_J1angularAxis[s4])[2] = q[2]; | |
+ | |
+ (*info->m_J2angularAxis[s3])[0] = -p[0]; | |
+ (*info->m_J2angularAxis[s3])[1] = -p[1]; | |
+ (*info->m_J2angularAxis[s3])[2] = -p[2]; | |
+ (*info->m_J2angularAxis[s4])[0] = -q[0]; | |
+ (*info->m_J2angularAxis[s4])[1] = -q[1]; | |
+ (*info->m_J2angularAxis[s4])[2] = -q[2]; | |
// compute the right hand side of the constraint equation. set relative | |
// body velocities along p and q to bring the hinge back into alignment. | |
// if ax1A,ax1B are the unit length hinge axes as computed from bodyA and | |
@@ -845,8 +844,8 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
// velocity to p and q to find the right hand side. | |
k = info->fps * info->erp; | |
btVector3 u = ax1A.cross(ax1B); | |
- info->m_constraintError[s3] = k * u.dot(p); | |
- info->m_constraintError[s4] = k * u.dot(q); | |
+ *info->m_constraintError[s3] = k * u.dot(p); | |
+ *info->m_constraintError[s4] = k * u.dot(q); | |
#endif | |
// check angular limits | |
nrow = 4; // last filled row | |
@@ -872,14 +871,14 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
if(limit || powered) | |
{ | |
nrow++; | |
- srow = nrow * info->rowskip; | |
- info->m_J1angularAxis[srow+0] = ax1[0]; | |
- info->m_J1angularAxis[srow+1] = ax1[1]; | |
- info->m_J1angularAxis[srow+2] = ax1[2]; | |
+ srow = nrow; | |
+ (*info->m_J1angularAxis[srow])[0] = ax1[0]; | |
+ (*info->m_J1angularAxis[srow])[1] = ax1[1]; | |
+ (*info->m_J1angularAxis[srow])[2] = ax1[2]; | |
- info->m_J2angularAxis[srow+0] = -ax1[0]; | |
- info->m_J2angularAxis[srow+1] = -ax1[1]; | |
- info->m_J2angularAxis[srow+2] = -ax1[2]; | |
+ (*info->m_J2angularAxis[srow])[0] = -ax1[0]; | |
+ (*info->m_J2angularAxis[srow])[1] = -ax1[1]; | |
+ (*info->m_J2angularAxis[srow])[2] = -ax1[2]; | |
btScalar lostop = getLowerLimit(); | |
btScalar histop = getUpperLimit(); | |
@@ -887,42 +886,42 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
{ // the joint motor is ineffective | |
powered = 0; | |
} | |
- info->m_constraintError[srow] = btScalar(0.0f); | |
+ *info->m_constraintError[srow] = btScalar(0.0f); | |
btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : info->erp; | |
if(powered) | |
{ | |
if(m_flags & BT_HINGE_FLAGS_CFM_NORM) | |
{ | |
- info->cfm[srow] = m_normalCFM; | |
+ *info->cfm[srow] = m_normalCFM; | |
} | |
btScalar mot_fact = getMotorFactor(m_hingeAngle, lostop, histop, m_motorTargetVelocity, info->fps * currERP); | |
- info->m_constraintError[srow] += mot_fact * m_motorTargetVelocity * m_referenceSign; | |
- info->m_lowerLimit[srow] = - m_maxMotorImpulse; | |
- info->m_upperLimit[srow] = m_maxMotorImpulse; | |
+ *info->m_constraintError[srow] += mot_fact * m_motorTargetVelocity * m_referenceSign; | |
+ *info->m_lowerLimit[srow] = - m_maxMotorImpulse; | |
+ *info->m_upperLimit[srow] = m_maxMotorImpulse; | |
} | |
if(limit) | |
{ | |
k = info->fps * currERP; | |
- info->m_constraintError[srow] += k * limit_err; | |
+ *info->m_constraintError[srow] += k * limit_err; | |
if(m_flags & BT_HINGE_FLAGS_CFM_STOP) | |
{ | |
- info->cfm[srow] = m_stopCFM; | |
+ *info->cfm[srow] = m_stopCFM; | |
} | |
if(lostop == histop) | |
{ | |
// limited low and high simultaneously | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
else if(limit == 1) | |
{ // low limit | |
- info->m_lowerLimit[srow] = 0; | |
- info->m_upperLimit[srow] = SIMD_INFINITY; | |
+ *info->m_lowerLimit[srow] = 0; | |
+ *info->m_upperLimit[srow] = SIMD_INFINITY; | |
} | |
else | |
{ // high limit | |
- info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
- info->m_upperLimit[srow] = 0; | |
+ *info->m_lowerLimit[srow] = -SIMD_INFINITY; | |
+ *info->m_upperLimit[srow] = 0; | |
} | |
// bounce (we'll use slider parameter abs(1.0 - m_dampingLimAng) for that) | |
#ifdef _BT_USE_CENTER_LIMIT_ | |
@@ -941,9 +940,9 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
if(vel < 0) | |
{ | |
btScalar newc = -bounce * vel; | |
- if(newc > info->m_constraintError[srow]) | |
+ if(newc > *info->m_constraintError[srow]) | |
{ | |
- info->m_constraintError[srow] = newc; | |
+ *info->m_constraintError[srow] = newc; | |
} | |
} | |
} | |
@@ -952,17 +951,17 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info | |
if(vel > 0) | |
{ | |
btScalar newc = -bounce * vel; | |
- if(newc < info->m_constraintError[srow]) | |
+ if(newc < *info->m_constraintError[srow]) | |
{ | |
- info->m_constraintError[srow] = newc; | |
+ *info->m_constraintError[srow] = newc; | |
} | |
} | |
} | |
} | |
#ifdef _BT_USE_CENTER_LIMIT_ | |
- info->m_constraintError[srow] *= m_limit.getBiasFactor(); | |
+ *info->m_constraintError[srow] *= m_limit.getBiasFactor(); | |
#else | |
- info->m_constraintError[srow] *= m_biasFactor; | |
+ *info->m_constraintError[srow] *= m_biasFactor; | |
#endif | |
} // if(limit) | |
} // if angular limit or powered | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp b/tests/bullet/src/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp | |
index 7e0d93b..25289d4 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp | |
@@ -103,15 +103,15 @@ void btPoint2PointConstraint::getInfo2NonVirtual (btConstraintInfo2* info, const | |
// anchor points in global coordinates with respect to body PORs. | |
// set jacobian | |
- info->m_J1linearAxis[0] = 1; | |
- info->m_J1linearAxis[info->rowskip+1] = 1; | |
- info->m_J1linearAxis[2*info->rowskip+2] = 1; | |
+ (*info->m_J1linearAxis[0])[0] = 1; | |
+ (*info->m_J1linearAxis[1])[1] = 1; | |
+ (*info->m_J1linearAxis[2])[2] = 1; | |
btVector3 a1 = body0_trans.getBasis()*getPivotInA(); | |
{ | |
- btVector3* angular0 = (btVector3*)(info->m_J1angularAxis); | |
- btVector3* angular1 = (btVector3*)(info->m_J1angularAxis+info->rowskip); | |
- btVector3* angular2 = (btVector3*)(info->m_J1angularAxis+2*info->rowskip); | |
+ btVector3* angular0 = info->m_J1angularAxis[0]; | |
+ btVector3* angular1 = info->m_J1angularAxis[1]; | |
+ btVector3* angular2 = info->m_J1angularAxis[2]; | |
btVector3 a1neg = -a1; | |
a1neg.getSkewSymmetricMatrix(angular0,angular1,angular2); | |
} | |
@@ -125,9 +125,9 @@ void btPoint2PointConstraint::getInfo2NonVirtual (btConstraintInfo2* info, const | |
{ | |
btVector3 a2n = -a2; | |
- btVector3* angular0 = (btVector3*)(info->m_J2angularAxis); | |
- btVector3* angular1 = (btVector3*)(info->m_J2angularAxis+info->rowskip); | |
- btVector3* angular2 = (btVector3*)(info->m_J2angularAxis+2*info->rowskip); | |
+ btVector3* angular0 = info->m_J2angularAxis[0]; | |
+ btVector3* angular1 = info->m_J2angularAxis[1]; | |
+ btVector3* angular2 = info->m_J2angularAxis[2]; | |
a2.getSkewSymmetricMatrix(angular0,angular1,angular2); | |
} | |
@@ -139,14 +139,14 @@ void btPoint2PointConstraint::getInfo2NonVirtual (btConstraintInfo2* info, const | |
int j; | |
for (j=0; j<3; j++) | |
{ | |
- info->m_constraintError[j*info->rowskip] = k * (a2[j] + body1_trans.getOrigin()[j] - a1[j] - body0_trans.getOrigin()[j]); | |
+ *info->m_constraintError[j] = k * (a2[j] + body1_trans.getOrigin()[j] - a1[j] - body0_trans.getOrigin()[j]); | |
//printf("info->m_constraintError[%d]=%f\n",j,info->m_constraintError[j]); | |
} | |
if(m_flags & BT_P2P_FLAGS_CFM) | |
{ | |
for (j=0; j<3; j++) | |
{ | |
- info->cfm[j*info->rowskip] = m_cfm; | |
+ *info->cfm[j] = m_cfm; | |
} | |
} | |
@@ -155,8 +155,8 @@ void btPoint2PointConstraint::getInfo2NonVirtual (btConstraintInfo2* info, const | |
{ | |
if (m_setting.m_impulseClamp > 0) | |
{ | |
- info->m_lowerLimit[j*info->rowskip] = -impulseClamp; | |
- info->m_upperLimit[j*info->rowskip] = impulseClamp; | |
+ *info->m_lowerLimit[j] = -impulseClamp; | |
+ *info->m_upperLimit[j] = impulseClamp; | |
} | |
} | |
info->m_damping = m_setting.m_damping; | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp b/tests/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp | |
index c05e22f..9d16f74 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp | |
@@ -838,6 +838,13 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol | |
int j; | |
+ btVector3** contactNormalArray = new btVector3*[info1.m_numConstraintRows]; | |
+ btVector3** relpos1CrossNormalArray = new btVector3*[info1.m_numConstraintRows]; | |
+ btVector3** relpos2CrossNormalArray = new btVector3*[info1.m_numConstraintRows]; | |
+ btScalar** rhsArray = new btScalar*[info1.m_numConstraintRows]; | |
+ btScalar** cfmArray = new btScalar*[info1.m_numConstraintRows]; | |
+ btScalar** lowerLimitArray = new btScalar*[info1.m_numConstraintRows]; | |
+ btScalar** upperLimitArray = new btScalar*[info1.m_numConstraintRows]; | |
for ( j=0;j<info1.m_numConstraintRows;j++) | |
{ | |
memset(¤tConstraintRow[j],0,sizeof(btSolverConstraint)); | |
@@ -847,6 +854,13 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol | |
currentConstraintRow[j].m_appliedPushImpulse = 0.f; | |
currentConstraintRow[j].m_solverBodyA = &rbA; | |
currentConstraintRow[j].m_solverBodyB = &rbB; | |
+ contactNormalArray[j] = ¤tConstraintRow[j].m_contactNormal; | |
+ relpos1CrossNormalArray[j] = ¤tConstraintRow[j].m_relpos1CrossNormal; | |
+ relpos2CrossNormalArray[j] = ¤tConstraintRow[j].m_relpos2CrossNormal; | |
+ rhsArray[j] = ¤tConstraintRow[j].m_rhs; | |
+ cfmArray[j] = ¤tConstraintRow[j].m_cfm; | |
+ lowerLimitArray[j] = ¤tConstraintRow[j].m_lowerLimit; | |
+ upperLimitArray[j] = ¤tConstraintRow[j].m_upperLimit; | |
} | |
rbA.internalGetDeltaLinearVelocity().setValue(0.f,0.f,0.f); | |
@@ -859,19 +873,16 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol | |
btTypedConstraint::btConstraintInfo2 info2; | |
info2.fps = 1.f/infoGlobal.m_timeStep; | |
info2.erp = infoGlobal.m_erp; | |
- info2.m_J1linearAxis = currentConstraintRow->m_contactNormal; | |
- info2.m_J1angularAxis = currentConstraintRow->m_relpos1CrossNormal; | |
+ info2.m_J1linearAxis = contactNormalArray; | |
+ info2.m_J1angularAxis = relpos1CrossNormalArray; | |
info2.m_J2linearAxis = 0; | |
- info2.m_J2angularAxis = currentConstraintRow->m_relpos2CrossNormal; | |
- info2.rowskip = sizeof(btSolverConstraint)/sizeof(btScalar);//check this | |
- ///the size of btSolverConstraint needs be a multiple of btScalar | |
- btAssert(info2.rowskip*sizeof(btScalar)== sizeof(btSolverConstraint)); | |
- info2.m_constraintError = ¤tConstraintRow->m_rhs; | |
+ info2.m_J2angularAxis = relpos2CrossNormalArray; | |
+ info2.m_constraintError = rhsArray; | |
currentConstraintRow->m_cfm = infoGlobal.m_globalCfm; | |
info2.m_damping = infoGlobal.m_damping; | |
- info2.cfm = ¤tConstraintRow->m_cfm; | |
- info2.m_lowerLimit = ¤tConstraintRow->m_lowerLimit; | |
- info2.m_upperLimit = ¤tConstraintRow->m_upperLimit; | |
+ info2.cfm = cfmArray; | |
+ info2.m_lowerLimit = lowerLimitArray; | |
+ info2.m_upperLimit = upperLimitArray; | |
info2.m_numIterations = infoGlobal.m_numIterations; | |
constraints[i]->getInfo2(&info2); | |
@@ -936,6 +947,13 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol | |
} | |
} | |
+ delete[] contactNormalArray; | |
+ delete[] relpos1CrossNormalArray; | |
+ delete[] relpos2CrossNormalArray; | |
+ delete[] rhsArray; | |
+ delete[] cfmArray; | |
+ delete[] lowerLimitArray; | |
+ delete[] upperLimitArray; | |
} | |
currentRow+=m_tmpConstraintSizesPool[i].m_numConstraintRows; | |
} | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp b/tests/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp | |
index b69f46d..e79b1d4 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp | |
@@ -267,7 +267,7 @@ btVector3 btSliderConstraint::getAncorInB(void) | |
void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTransform& transA,const btTransform& transB, const btVector3& linVelA,const btVector3& linVelB, btScalar rbAinvMass,btScalar rbBinvMass ) | |
{ | |
- const btTransform& trA = getCalculatedTransformA(); | |
+ /*const btTransform& trA = getCalculatedTransformA(); | |
const btTransform& trB = getCalculatedTransformB(); | |
btAssert(!m_useSolveConstraintObsolete); | |
@@ -694,7 +694,7 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra | |
} | |
info->m_constraintError[srow] *= getSoftnessLimAng(); | |
} // if(limit) | |
- } // if angular limit or powered | |
+ } // if angular limit or powered*/ | |
} | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btSolverConstraint.h b/tests/bullet/src/BulletDynamics/ConstraintSolver/btSolverConstraint.h | |
index 79e45a4..294f318 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btSolverConstraint.h | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btSolverConstraint.h | |
@@ -45,29 +45,20 @@ ATTRIBUTE_ALIGNED64 (struct) btSolverConstraint | |
btScalar m_friction; | |
btScalar m_jacDiagABInv; | |
- union | |
- { | |
- int m_numConsecutiveRowsPerKernel; | |
- btScalar m_unusedPadding0; | |
- }; | |
- | |
- union | |
- { | |
- int m_frictionIndex; | |
- btScalar m_unusedPadding1; | |
- }; | |
- union | |
+ int m_numConsecutiveRowsPerKernel; | |
+ int m_frictionIndex; | |
+ struct | |
{ | |
btRigidBody* m_solverBodyA; | |
int m_companionIdA; | |
}; | |
- union | |
+ struct | |
{ | |
btRigidBody* m_solverBodyB; | |
int m_companionIdB; | |
}; | |
- union | |
+ struct | |
{ | |
void* m_originalContactPoint; | |
btScalar m_unusedPadding4; | |
diff --git a/tests/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h b/tests/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h | |
index 20df8e5..4a83c60 100644 | |
--- a/tests/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h | |
+++ b/tests/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.h | |
@@ -56,7 +56,7 @@ class btTypedConstraint : public btTypedObject | |
{ | |
int m_userConstraintType; | |
- union | |
+ struct | |
{ | |
int m_userConstraintId; | |
void* m_userConstraintPtr; | |
@@ -105,18 +105,18 @@ public: | |
// n*3 jacobian sub matrices, stored by rows. these matrices will have | |
// been initialized to 0 on entry. if the second body is zero then the | |
// J2xx pointers may be 0. | |
- btScalar *m_J1linearAxis,*m_J1angularAxis,*m_J2linearAxis,*m_J2angularAxis; | |
+ btVector3 **m_J1linearAxis,**m_J1angularAxis,**m_J2linearAxis,**m_J2angularAxis; | |
// elements to jump from one row to the next in J's | |
- int rowskip; | |
+ //int rowskip; | |
// right hand sides of the equation J*v = c + cfm * lambda. cfm is the | |
// "constraint force mixing" vector. c is set to zero on entry, cfm is | |
// set to a constant value (typically very small or zero) value on entry. | |
- btScalar *m_constraintError,*cfm; | |
+ btScalar **m_constraintError,**cfm; | |
// lo and hi limits for variables (set to -/+ infinity on entry). | |
- btScalar *m_lowerLimit,*m_upperLimit; | |
+ btScalar **m_lowerLimit,**m_upperLimit; | |
// findex vector for variables. see the LCP solver interface for a | |
// description of what this does. this is set to -1 on entry. | |
diff --git a/tests/bullet/src/BulletDynamics/Dynamics/Bullet-C-API.cpp b/tests/bullet/src/BulletDynamics/Dynamics/Bullet-C-API.cpp | |
index bd8e274..3134890 100644 | |
--- a/tests/bullet/src/BulletDynamics/Dynamics/Bullet-C-API.cpp | |
+++ b/tests/bullet/src/BulletDynamics/Dynamics/Bullet-C-API.cpp | |
@@ -73,8 +73,7 @@ struct btPhysicsSdk | |
plPhysicsSdkHandle plNewBulletSdk() | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btPhysicsSdk),16); | |
- return (plPhysicsSdkHandle)new (mem)btPhysicsSdk; | |
+ return (plPhysicsSdkHandle)new btPhysicsSdk; | |
} | |
void plDeletePhysicsSdk(plPhysicsSdkHandle physicsSdk) | |
@@ -88,17 +87,12 @@ void plDeletePhysicsSdk(plPhysicsSdkHandle physicsSdk) | |
plDynamicsWorldHandle plCreateDynamicsWorld(plPhysicsSdkHandle physicsSdkHandle) | |
{ | |
btPhysicsSdk* physicsSdk = reinterpret_cast<btPhysicsSdk*>(physicsSdkHandle); | |
- void* mem = btAlignedAlloc(sizeof(btDefaultCollisionConfiguration),16); | |
- btDefaultCollisionConfiguration* collisionConfiguration = new (mem)btDefaultCollisionConfiguration(); | |
- mem = btAlignedAlloc(sizeof(btCollisionDispatcher),16); | |
- btDispatcher* dispatcher = new (mem)btCollisionDispatcher(collisionConfiguration); | |
- mem = btAlignedAlloc(sizeof(btAxisSweep3),16); | |
- btBroadphaseInterface* pairCache = new (mem)btAxisSweep3(physicsSdk->m_worldAabbMin,physicsSdk->m_worldAabbMax); | |
- mem = btAlignedAlloc(sizeof(btSequentialImpulseConstraintSolver),16); | |
- btConstraintSolver* constraintSolver = new(mem) btSequentialImpulseConstraintSolver(); | |
- | |
- mem = btAlignedAlloc(sizeof(btDiscreteDynamicsWorld),16); | |
- return (plDynamicsWorldHandle) new (mem)btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration); | |
+ btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration(); | |
+ btDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration); | |
+ btBroadphaseInterface* pairCache = new btAxisSweep3(physicsSdk->m_worldAabbMin,physicsSdk->m_worldAabbMax); | |
+ btConstraintSolver* constraintSolver = new btSequentialImpulseConstraintSolver(); | |
+ | |
+ return (plDynamicsWorldHandle) new btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration); | |
} | |
void plDeleteDynamicsWorld(plDynamicsWorldHandle world) | |
{ | |
@@ -149,7 +143,7 @@ plRigidBodyHandle plCreateRigidBody( void* user_data, float mass, plCollisionSh | |
} | |
void* mem = btAlignedAlloc(sizeof(btRigidBody),16); | |
btRigidBody::btRigidBodyConstructionInfo rbci(mass, 0,shape,localInertia); | |
- btRigidBody* body = new (mem)btRigidBody(rbci); | |
+ btRigidBody* body = new btRigidBody(rbci); | |
body->setWorldTransform(trans); | |
body->setUserPointer(user_data); | |
return (plRigidBodyHandle) body; | |
@@ -167,15 +161,13 @@ void plDeleteRigidBody(plRigidBodyHandle cbody) | |
plCollisionShapeHandle plNewSphereShape(plReal radius) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btSphereShape),16); | |
- return (plCollisionShapeHandle) new (mem)btSphereShape(radius); | |
+ return (plCollisionShapeHandle) new btSphereShape(radius); | |
} | |
plCollisionShapeHandle plNewBoxShape(plReal x, plReal y, plReal z) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btBoxShape),16); | |
- return (plCollisionShapeHandle) new (mem)btBoxShape(btVector3(x,y,z)); | |
+ return (plCollisionShapeHandle) new btBoxShape(btVector3(x,y,z)); | |
} | |
plCollisionShapeHandle plNewCapsuleShape(plReal radius, plReal height) | |
@@ -185,26 +177,22 @@ plCollisionShapeHandle plNewCapsuleShape(plReal radius, plReal height) | |
const int numSpheres = 2; | |
btVector3 positions[numSpheres] = {btVector3(0,height,0),btVector3(0,-height,0)}; | |
btScalar radi[numSpheres] = {radius,radius}; | |
- void* mem = btAlignedAlloc(sizeof(btMultiSphereShape),16); | |
- return (plCollisionShapeHandle) new (mem)btMultiSphereShape(positions,radi,numSpheres); | |
+ return (plCollisionShapeHandle) new btMultiSphereShape(positions,radi,numSpheres); | |
} | |
plCollisionShapeHandle plNewConeShape(plReal radius, plReal height) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btConeShape),16); | |
- return (plCollisionShapeHandle) new (mem)btConeShape(radius,height); | |
+ return (plCollisionShapeHandle) new btConeShape(radius,height); | |
} | |
plCollisionShapeHandle plNewCylinderShape(plReal radius, plReal height) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btCylinderShape),16); | |
- return (plCollisionShapeHandle) new (mem)btCylinderShape(btVector3(radius,height,radius)); | |
+ return (plCollisionShapeHandle) new btCylinderShape(btVector3(radius,height,radius)); | |
} | |
/* Convex Meshes */ | |
plCollisionShapeHandle plNewConvexHullShape() | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btConvexHullShape),16); | |
- return (plCollisionShapeHandle) new (mem)btConvexHullShape(); | |
+ return (plCollisionShapeHandle) new btConvexHullShape(); | |
} | |
@@ -216,8 +204,7 @@ plMeshInterfaceHandle plNewMeshInterface() | |
plCollisionShapeHandle plNewCompoundShape() | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btCompoundShape),16); | |
- return (plCollisionShapeHandle) new (mem)btCompoundShape(); | |
+ return (plCollisionShapeHandle) new btCompoundShape(); | |
} | |
void plAddChildShape(plCollisionShapeHandle compoundShapeHandle,plCollisionShapeHandle childShapeHandle, plVector3 childPos,plQuaternion childOrn) | |
diff --git a/tests/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp b/tests/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp | |
index b08dcf0..345e89a 100644 | |
--- a/tests/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp | |
+++ b/tests/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp | |
@@ -67,8 +67,7 @@ m_profileTimings(0) | |
{ | |
if (!m_constraintSolver) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btSequentialImpulseConstraintSolver),16); | |
- m_constraintSolver = new (mem) btSequentialImpulseConstraintSolver; | |
+ m_constraintSolver = new btSequentialImpulseConstraintSolver; | |
m_ownsConstraintSolver = true; | |
} else | |
{ | |
@@ -76,8 +75,7 @@ m_profileTimings(0) | |
} | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btSimulationIslandManager),16); | |
- m_islandManager = new (mem) btSimulationIslandManager(); | |
+ m_islandManager = new btSimulationIslandManager(); | |
} | |
m_ownsIslandManager = true; | |
@@ -89,14 +87,11 @@ btDiscreteDynamicsWorld::~btDiscreteDynamicsWorld() | |
//only delete it when we created it | |
if (m_ownsIslandManager) | |
{ | |
- m_islandManager->~btSimulationIslandManager(); | |
- btAlignedFree( m_islandManager); | |
+ delete m_islandManager; | |
} | |
if (m_ownsConstraintSolver) | |
{ | |
- | |
- m_constraintSolver->~btConstraintSolver(); | |
- btAlignedFree(m_constraintSolver); | |
+ delete m_constraintSolver; | |
} | |
} | |
@@ -1280,7 +1275,7 @@ void btDiscreteDynamicsWorld::setConstraintSolver(btConstraintSolver* solver) | |
{ | |
if (m_ownsConstraintSolver) | |
{ | |
- btAlignedFree( m_constraintSolver); | |
+ delete m_constraintSolver; | |
} | |
m_ownsConstraintSolver = false; | |
m_constraintSolver = solver; | |
diff --git a/tests/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp b/tests/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp | |
index 5fc2f3c..2a1e846 100644 | |
--- a/tests/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp | |
+++ b/tests/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp | |
@@ -49,7 +49,7 @@ m_gravity(0,0,-10) | |
btSimpleDynamicsWorld::~btSimpleDynamicsWorld() | |
{ | |
if (m_ownsConstraintSolver) | |
- btAlignedFree( m_constraintSolver); | |
+ delete m_constraintSolver; | |
} | |
int btSimpleDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btScalar fixedTimeStep) | |
@@ -267,9 +267,7 @@ void btSimpleDynamicsWorld::synchronizeMotionStates() | |
void btSimpleDynamicsWorld::setConstraintSolver(btConstraintSolver* solver) | |
{ | |
if (m_ownsConstraintSolver) | |
- { | |
- btAlignedFree(m_constraintSolver); | |
- } | |
+ delete m_constraintSolver; | |
m_ownsConstraintSolver = false; | |
m_constraintSolver = solver; | |
} | |
diff --git a/tests/bullet/src/LinearMath/btAlignedAllocator.cpp b/tests/bullet/src/LinearMath/btAlignedAllocator.cpp | |
index 189b759..78cd6e5 100644 | |
--- a/tests/bullet/src/LinearMath/btAlignedAllocator.cpp | |
+++ b/tests/bullet/src/LinearMath/btAlignedAllocator.cpp | |
@@ -19,17 +19,23 @@ int gNumAlignedAllocs = 0; | |
int gNumAlignedFree = 0; | |
int gTotalBytesAlignedAllocs = 0;//detect memory leaks | |
+#ifndef __CHEERP__ | |
static void *btAllocDefault(size_t size) | |
{ | |
return malloc(size); | |
} | |
+#endif | |
static void btFreeDefault(void *ptr) | |
{ | |
free(ptr); | |
} | |
+#ifndef __CHEERP__ | |
static btAllocFunc *sAllocFunc = btAllocDefault; | |
+#else | |
+static btAllocFunc *sAllocFunc = NULL; | |
+#endif | |
static btFreeFunc *sFreeFunc = btFreeDefault; | |
@@ -90,6 +96,7 @@ static inline void btAlignedFreeDefault(void *ptr) | |
static btAlignedAllocFunc *sAlignedAllocFunc = btAlignedAllocDefault; | |
static btAlignedFreeFunc *sAlignedFreeFunc = btAlignedFreeDefault; | |
+#ifndef __CHEERP__ | |
void btAlignedAllocSetCustomAligned(btAlignedAllocFunc *allocFunc, btAlignedFreeFunc *freeFunc) | |
{ | |
sAlignedAllocFunc = allocFunc ? allocFunc : btAlignedAllocDefault; | |
@@ -101,6 +108,7 @@ void btAlignedAllocSetCustom(btAllocFunc *allocFunc, btFreeFunc *freeFunc) | |
sAllocFunc = allocFunc ? allocFunc : btAllocDefault; | |
sFreeFunc = freeFunc ? freeFunc : btFreeDefault; | |
} | |
+#endif | |
#ifdef BT_DEBUG_MEMORY_ALLOCATIONS | |
//this generic allocator provides the total allocated number of bytes | |
diff --git a/tests/bullet/src/LinearMath/btAlignedAllocator.h b/tests/bullet/src/LinearMath/btAlignedAllocator.h | |
index f168f3c..e6a510b 100644 | |
--- a/tests/bullet/src/LinearMath/btAlignedAllocator.h | |
+++ b/tests/bullet/src/LinearMath/btAlignedAllocator.h | |
@@ -83,11 +83,19 @@ public: | |
const_pointer address ( const_reference ref ) const { return &ref; } | |
pointer allocate ( size_type n , const_pointer * hint = 0 ) { | |
(void)hint; | |
- return reinterpret_cast< pointer >(btAlignedAlloc( sizeof(value_type) * n , Alignment )); | |
+#ifdef __CHEERP__ | |
+ return new value_type[n] [[noinit]]; | |
+#else | |
+ return (value_type*)malloc(sizeof(value_type)*n); | |
+#endif | |
} | |
void construct ( pointer ptr , const value_type & value ) { new (ptr) value_type( value ); } | |
void deallocate( pointer ptr ) { | |
- btAlignedFree( reinterpret_cast< void * >( ptr ) ); | |
+#ifdef __CHEERP__ | |
+ delete[] ptr; | |
+#else | |
+ free(ptr); | |
+#endif | |
} | |
void destroy ( pointer ptr ) { ptr->~value_type(); } | |
diff --git a/tests/bullet/src/LinearMath/btAlignedObjectArray.h b/tests/bullet/src/LinearMath/btAlignedObjectArray.h | |
index 955bb12..fde4c24 100644 | |
--- a/tests/bullet/src/LinearMath/btAlignedObjectArray.h | |
+++ b/tests/bullet/src/LinearMath/btAlignedObjectArray.h | |
@@ -86,7 +86,7 @@ class btAlignedObjectArray | |
} | |
} | |
- SIMD_FORCE_INLINE void* allocate(int size) | |
+ SIMD_FORCE_INLINE T* allocate(int size) | |
{ | |
if (size) | |
return m_allocator.allocate(size); | |
@@ -450,7 +450,7 @@ class btAlignedObjectArray | |
} | |
//PCK: whole function | |
- void initializeFromBuffer(void *buffer, int size, int capacity) | |
+ void initializeFromBuffer(T *buffer, int size, int capacity) | |
{ | |
clear(); | |
m_ownsMemory = false; | |
diff --git a/tests/bullet/src/LinearMath/btConvexHull.cpp b/tests/bullet/src/LinearMath/btConvexHull.cpp | |
index 532d76d..2fc9bef 100644 | |
--- a/tests/bullet/src/LinearMath/btConvexHull.cpp | |
+++ b/tests/bullet/src/LinearMath/btConvexHull.cpp | |
@@ -429,8 +429,7 @@ void HullLibrary::checkit(btHullTriangle *t) | |
btHullTriangle* HullLibrary::allocateTriangle(int a,int b,int c) | |
{ | |
- void* mem = btAlignedAlloc(sizeof(btHullTriangle),16); | |
- btHullTriangle* tr = new (mem)btHullTriangle(a,b,c); | |
+ btHullTriangle* tr = new btHullTriangle(a,b,c); | |
tr->id = m_tris.size(); | |
m_tris.push_back(tr); | |
diff --git a/tests/bullet/src/LinearMath/btConvexHullComputer.cpp b/tests/bullet/src/LinearMath/btConvexHullComputer.cpp | |
index 10316b4..ff38e55 100644 | |
--- a/tests/bullet/src/LinearMath/btConvexHullComputer.cpp | |
+++ b/tests/bullet/src/LinearMath/btConvexHullComputer.cpp | |
@@ -18,6 +18,10 @@ subject to the following restrictions: | |
#include "btAlignedObjectArray.h" | |
#include "btMinMax.h" | |
#include "btVector3.h" | |
+#ifdef __CHEERP__ | |
+#define CHEERP_EMULATE_INT64 | |
+#include <cheerp/int64utils.h> | |
+#endif | |
#ifdef __GNUC__ | |
#include <stdint.h> | |
@@ -155,7 +159,7 @@ class btConvexHullInternal | |
{ | |
} | |
- Int128(int64_t value): low(value), high((value >= 0) ? 0 : (uint64_t) -1LL) | |
+ Int128(int64_t value): low(value), high((value >= 0) ? (uint64_t)0 : (uint64_t) -1LL) | |
{ | |
} | |
@@ -232,7 +236,7 @@ class btConvexHullInternal | |
btScalar toScalar() const | |
{ | |
- return ((int64_t) high >= 0) ? btScalar(high) * (btScalar(0x100000000LL) * btScalar(0x100000000LL)) + btScalar(low) | |
+ return ((int64_t) high >= 0) ? btScalar(high) * (btScalar(0x10000L) * btScalar(0x10000L) * btScalar(0x10000L) * btScalar(0x10000L)) + btScalar(low) | |
: -(-*this).toScalar(); | |
} | |
@@ -739,7 +743,7 @@ class btConvexHullInternal | |
} | |
else | |
{ | |
- p = new(btAlignedAlloc(sizeof(PoolArray<T>), 16)) PoolArray<T>(arraySize); | |
+ p = new PoolArray<T>(arraySize); | |
p->next = arrays; | |
arrays = p; | |
} | |
diff --git a/tests/bullet/src/LinearMath/btHashMap.h b/tests/bullet/src/LinearMath/btHashMap.h | |
index ce07db3..ad38122 100644 | |
--- a/tests/bullet/src/LinearMath/btHashMap.h | |
+++ b/tests/bullet/src/LinearMath/btHashMap.h | |
@@ -112,7 +112,7 @@ public: | |
class btHashPtr | |
{ | |
- union | |
+ struct | |
{ | |
const void* m_pointer; | |
int m_hashValues[2]; | |
diff --git a/tests/bullet/src/LinearMath/btMatrix3x3.h b/tests/bullet/src/LinearMath/btMatrix3x3.h | |
index d0234a0..5baff3e 100644 | |
--- a/tests/bullet/src/LinearMath/btMatrix3x3.h | |
+++ b/tests/bullet/src/LinearMath/btMatrix3x3.h | |
@@ -49,9 +49,9 @@ public: | |
} | |
*/ | |
/** @brief Constructor with row major formatting */ | |
- btMatrix3x3(const btScalar& xx, const btScalar& xy, const btScalar& xz, | |
- const btScalar& yx, const btScalar& yy, const btScalar& yz, | |
- const btScalar& zx, const btScalar& zy, const btScalar& zz) | |
+ btMatrix3x3(const btScalar xx, const btScalar xy, const btScalar xz, | |
+ const btScalar yx, const btScalar yy, const btScalar yz, | |
+ const btScalar zx, const btScalar zy, const btScalar zz) | |
{ | |
setValue(xx, xy, xz, | |
yx, yy, yz, | |
@@ -139,9 +139,9 @@ public: | |
* @param zx Bottom Left | |
* @param zy Bottom Middle | |
* @param zz Bottom Right*/ | |
- void setValue(const btScalar& xx, const btScalar& xy, const btScalar& xz, | |
- const btScalar& yx, const btScalar& yy, const btScalar& yz, | |
- const btScalar& zx, const btScalar& zy, const btScalar& zz) | |
+ void setValue(const btScalar xx, const btScalar xy, const btScalar xz, | |
+ const btScalar yx, const btScalar yy, const btScalar yz, | |
+ const btScalar zx, const btScalar zy, const btScalar zz) | |
{ | |
m_el[0].setValue(xx,xy,xz); | |
m_el[1].setValue(yx,yy,yz); | |
@@ -170,7 +170,7 @@ public: | |
* @param pitch Pitch about X axis | |
* @param roll Roll about Z axis | |
*/ | |
- void setEulerYPR(const btScalar& yaw, const btScalar& pitch, const btScalar& roll) | |
+ void setEulerYPR(const btScalar yaw, const btScalar pitch, const btScalar roll) | |
{ | |
setEulerZYX(roll, pitch, yaw); | |
} | |
diff --git a/tests/bullet/src/LinearMath/btQuickprof.cpp b/tests/bullet/src/LinearMath/btQuickprof.cpp | |
index 1453406..cfd5c3a 100644 | |
--- a/tests/bullet/src/LinearMath/btQuickprof.cpp | |
+++ b/tests/bullet/src/LinearMath/btQuickprof.cpp | |
@@ -52,6 +52,10 @@ static btClock gProfileClock; | |
#include <sys/time.h> | |
#endif //_WIN32 | |
+#ifdef __CHEERP__ | |
+#include <cheerp/clientlib.h> | |
+#endif | |
+ | |
#define mymin(a,b) (a > b ? a : b) | |
struct btClockData | |
@@ -66,8 +70,12 @@ struct btClockData | |
#ifdef __CELLOS_LV2__ | |
uint64_t mStartTime; | |
#else | |
+#ifdef __CHEERP__ | |
+ double mStartTime; | |
+#else | |
struct timeval mStartTime; | |
#endif | |
+#endif | |
#endif //__CELLOS_LV2__ | |
}; | |
@@ -116,9 +124,13 @@ void btClock::reset() | |
SYS_TIMEBASE_GET( newTime ); | |
m_data->mStartTime = newTime; | |
#else | |
+#ifdef __CHEERP__ | |
+ m_data->mStartTime=client::Date::now(); | |
+#else | |
gettimeofday(&m_data->mStartTime, 0); | |
#endif | |
#endif | |
+#endif | |
} | |
/// Returns the time in ms since the last call to reset or since | |
@@ -168,11 +180,15 @@ unsigned long int btClock::getTimeMilliseconds() | |
return (unsigned long int)((double(newTime-m_data->mStartTime)) / dFreq); | |
#else | |
- | |
+#ifdef __CHEERP__ | |
+ double currentTime=client::Date::now(); | |
+ return currentTime-m_data->mStartTime; | |
+#else | |
struct timeval currentTime; | |
gettimeofday(¤tTime, 0); | |
return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000 + | |
(currentTime.tv_usec - m_data->mStartTime.tv_usec) / 1000; | |
+#endif | |
#endif //__CELLOS_LV2__ | |
#endif | |
} | |
@@ -226,11 +242,15 @@ unsigned long int btClock::getTimeMicroseconds() | |
return (unsigned long int)((double(newTime-m_data->mStartTime)) / dFreq); | |
#else | |
- | |
+#ifdef __CHEERP__ | |
+ double currentTime=client::Date::now(); | |
+ return (currentTime-m_data->mStartTime) * 1000; | |
+#else | |
struct timeval currentTime; | |
gettimeofday(¤tTime, 0); | |
return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000000 + | |
(currentTime.tv_usec - m_data->mStartTime.tv_usec); | |
+#endif | |
#endif//__CELLOS_LV2__ | |
#endif | |
} | |
diff --git a/tests/bullet/src/LinearMath/btScalar.h b/tests/bullet/src/LinearMath/btScalar.h | |
index d36af1e..1258a3b 100644 | |
--- a/tests/bullet/src/LinearMath/btScalar.h | |
+++ b/tests/bullet/src/LinearMath/btScalar.h | |
@@ -143,7 +143,7 @@ inline int btGetVersion() | |
#else | |
//non-windows systems | |
-#if (defined (__APPLE__) && defined (__i386__) && (!defined (BT_USE_DOUBLE_PRECISION))) | |
+#if (defined (__APPLE__) && defined (__i386__) && (!defined (BT_USE_DOUBLE_PRECISION)) && !defined (__CHEERP__)) | |
#define BT_USE_SSE | |
#include <emmintrin.h> | |
@@ -212,6 +212,9 @@ typedef float btScalar; | |
+#ifdef __CHEERP__ | |
+#define BT_DECLARE_ALIGNED_ALLOCATOR() | |
+#else | |
#define BT_DECLARE_ALIGNED_ALLOCATOR() \ | |
SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ | |
SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); } \ | |
@@ -220,7 +223,8 @@ typedef float btScalar; | |
SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ | |
SIMD_FORCE_INLINE void operator delete[](void* ptr) { btAlignedFree(ptr); } \ | |
SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; } \ | |
- SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \ | |
+ SIMD_FORCE_INLINE void operator delete[](void*, void*) { } | |
+#endif | |
diff --git a/tests/bullet/src/LinearMath/btSerializer.cpp b/tests/bullet/src/LinearMath/btSerializer.cpp | |
index c6d387e..11dc8b7 100644 | |
--- a/tests/bullet/src/LinearMath/btSerializer.cpp | |
+++ b/tests/bullet/src/LinearMath/btSerializer.cpp | |
@@ -305,12 +305,12 @@ unsigned char sBulletDNAstr[]= { | |
97,116,97,0,98,116,83,111,102,116,66,111,100,121,70,108,111,97,116,68, | |
97,116,97,0,84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0, | |
4,0,4,0,8,0,0,0,12,0,36,0,8,0,16,0,32,0,48,0, | |
-96,0,64,0,-128,0,20,0,48,0,80,0,16,0,84,0,-124,0,12,0, | |
+96,0,64,0,(unsigned char)-128,0,20,0,48,0,80,0,16,0,84,0,(unsigned char)-124,0,12,0, | |
52,0,52,0,20,0,64,0,4,0,4,0,8,0,4,0,32,0,28,0, | |
60,0,56,0,76,0,76,0,24,0,60,0,60,0,16,0,64,0,68,0, | |
--56,1,-8,0,-32,1,-104,3,8,0,44,0,0,0,76,0,108,0,84,1, | |
--44,0,-52,0,-12,0,84,1,-60,0,16,0,100,0,20,0,36,0,100,0, | |
-92,0,104,0,-64,0,92,1,104,0,-92,1,83,84,82,67,61,0,0,0, | |
+(unsigned char)-56,1,(unsigned char)-8,0,(unsigned char)-32,1,(unsigned char)-104,3,8,0,44,0,0,0,76,0,108,0,84,1, | |
+(unsigned char)-44,0,(unsigned char)-52,0,(unsigned char)-12,0,84,1,(unsigned char)-60,0,16,0,100,0,20,0,36,0,100,0, | |
+92,0,104,0,(unsigned char)-64,0,92,1,104,0,(unsigned char)-92,1,83,84,82,67,61,0,0,0, | |
10,0,3,0,4,0,0,0,4,0,1,0,9,0,2,0,11,0,3,0, | |
10,0,3,0,10,0,4,0,10,0,5,0,12,0,2,0,9,0,6,0, | |
9,0,7,0,13,0,1,0,7,0,8,0,14,0,1,0,8,0,8,0, | |
@@ -359,51 +359,51 @@ unsigned char sBulletDNAstr[]= { | |
7,0,114,0,4,0,115,0,4,0,116,0,4,0,117,0,4,0,118,0, | |
4,0,119,0,4,0,120,0,4,0,121,0,48,0,21,0,47,0,122,0, | |
15,0,123,0,13,0,124,0,13,0,125,0,13,0,126,0,13,0,127,0, | |
-13,0,-128,0,13,0,-127,0,13,0,-126,0,13,0,-125,0,13,0,-124,0, | |
-7,0,-123,0,7,0,-122,0,7,0,-121,0,7,0,-120,0,7,0,-119,0, | |
-7,0,-118,0,7,0,-117,0,7,0,-116,0,7,0,-115,0,4,0,-114,0, | |
+13,0,(unsigned char)-128,0,13,0,(unsigned char)-127,0,13,0,(unsigned char)-126,0,13,0,(unsigned char)-125,0,13,0,(unsigned char)-124,0, | |
+7,0,(unsigned char)-123,0,7,0,(unsigned char)-122,0,7,0,(unsigned char)-121,0,7,0,(unsigned char)-120,0,7,0,(unsigned char)-119,0, | |
+7,0,(unsigned char)-118,0,7,0,(unsigned char)-117,0,7,0,(unsigned char)-116,0,7,0,(unsigned char)-115,0,4,0,(unsigned char)-114,0, | |
49,0,22,0,46,0,122,0,16,0,123,0,14,0,124,0,14,0,125,0, | |
-14,0,126,0,14,0,127,0,14,0,-128,0,14,0,-127,0,14,0,-126,0, | |
-14,0,-125,0,14,0,-124,0,8,0,-123,0,8,0,-122,0,8,0,-121,0, | |
-8,0,-120,0,8,0,-119,0,8,0,-118,0,8,0,-117,0,8,0,-116,0, | |
-8,0,-115,0,4,0,-114,0,0,0,37,0,50,0,2,0,4,0,-113,0, | |
-4,0,-112,0,51,0,11,0,52,0,-111,0,52,0,-110,0,0,0,35,0, | |
-4,0,-109,0,4,0,-108,0,4,0,-107,0,4,0,-106,0,7,0,-105,0, | |
-7,0,-104,0,4,0,-103,0,0,0,-102,0,53,0,3,0,51,0,-101,0, | |
-13,0,-100,0,13,0,-99,0,54,0,3,0,51,0,-101,0,14,0,-100,0, | |
-14,0,-99,0,55,0,13,0,51,0,-101,0,18,0,-98,0,18,0,-97,0, | |
-4,0,-96,0,4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0, | |
-7,0,-91,0,7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0, | |
-56,0,13,0,51,0,-101,0,17,0,-98,0,17,0,-97,0,4,0,-96,0, | |
-4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0, | |
-7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,57,0,11,0, | |
-51,0,-101,0,17,0,-98,0,17,0,-97,0,7,0,-86,0,7,0,-85,0, | |
-7,0,-84,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,7,0,-83,0, | |
-0,0,21,0,58,0,9,0,51,0,-101,0,17,0,-98,0,17,0,-97,0, | |
-13,0,-82,0,13,0,-81,0,13,0,-80,0,13,0,-79,0,4,0,-78,0, | |
-4,0,-77,0,59,0,5,0,58,0,-76,0,4,0,-75,0,7,0,-74,0, | |
-7,0,-73,0,7,0,-72,0,60,0,9,0,51,0,-101,0,17,0,-98,0, | |
-17,0,-97,0,7,0,-82,0,7,0,-81,0,7,0,-80,0,7,0,-79,0, | |
-4,0,-78,0,4,0,-77,0,61,0,4,0,7,0,-71,0,7,0,-70,0, | |
-7,0,-69,0,4,0,78,0,62,0,10,0,61,0,-68,0,13,0,-67,0, | |
-13,0,-66,0,13,0,-65,0,13,0,-64,0,13,0,-63,0,7,0,-123,0, | |
-7,0,-62,0,4,0,-61,0,4,0,53,0,63,0,4,0,61,0,-68,0, | |
-4,0,-60,0,7,0,-59,0,4,0,-58,0,64,0,4,0,13,0,-63,0, | |
-61,0,-68,0,4,0,-57,0,7,0,-56,0,65,0,7,0,13,0,-55,0, | |
-61,0,-68,0,4,0,-54,0,7,0,-53,0,7,0,-52,0,7,0,-51,0, | |
-4,0,53,0,66,0,6,0,15,0,-50,0,13,0,-52,0,13,0,-49,0, | |
-52,0,-48,0,4,0,-47,0,7,0,-51,0,67,0,26,0,4,0,-46,0, | |
-7,0,-45,0,7,0,-83,0,7,0,-44,0,7,0,-43,0,7,0,-42,0, | |
-7,0,-41,0,7,0,-40,0,7,0,-39,0,7,0,-38,0,7,0,-37,0, | |
-7,0,-36,0,7,0,-35,0,7,0,-34,0,7,0,-33,0,7,0,-32,0, | |
-7,0,-31,0,7,0,-30,0,7,0,-29,0,7,0,-28,0,7,0,-27,0, | |
-4,0,-26,0,4,0,-25,0,4,0,-24,0,4,0,-23,0,4,0,116,0, | |
-68,0,12,0,15,0,-22,0,15,0,-21,0,15,0,-20,0,13,0,-19,0, | |
-13,0,-18,0,7,0,-17,0,4,0,-16,0,4,0,-15,0,4,0,-14,0, | |
-4,0,-13,0,7,0,-53,0,4,0,53,0,69,0,27,0,17,0,-12,0, | |
-15,0,-11,0,15,0,-10,0,13,0,-19,0,13,0,-9,0,13,0,-8,0, | |
-13,0,-7,0,13,0,-6,0,13,0,-5,0,4,0,-4,0,7,0,-3,0, | |
-4,0,-2,0,4,0,-1,0,4,0,0,1,7,0,1,1,7,0,2,1, | |
+14,0,126,0,14,0,127,0,14,0,(unsigned char)-128,0,14,0,(unsigned char)-127,0,14,0,(unsigned char)-126,0, | |
+14,0,(unsigned char)-125,0,14,0,(unsigned char)-124,0,8,0,(unsigned char)-123,0,8,0,(unsigned char)-122,0,8,0,(unsigned char)-121,0, | |
+8,0,(unsigned char)-120,0,8,0,(unsigned char)-119,0,8,0,(unsigned char)-118,0,8,0,(unsigned char)-117,0,8,0,(unsigned char)-116,0, | |
+8,0,(unsigned char)-115,0,4,0,(unsigned char)-114,0,0,0,37,0,50,0,2,0,4,0,(unsigned char)-113,0, | |
+4,0,(unsigned char)-112,0,51,0,11,0,52,0,(unsigned char)-111,0,52,0,(unsigned char)-110,0,0,0,35,0, | |
+4,0,(unsigned char)-109,0,4,0,(unsigned char)-108,0,4,0,(unsigned char)-107,0,4,0,(unsigned char)-106,0,7,0,(unsigned char)-105,0, | |
+7,0,(unsigned char)-104,0,4,0,(unsigned char)-103,0,0,0,(unsigned char)-102,0,53,0,3,0,51,0,(unsigned char)-101,0, | |
+13,0,(unsigned char)-100,0,13,0,(unsigned char)-99,0,54,0,3,0,51,0,(unsigned char)-101,0,14,0,(unsigned char)-100,0, | |
+14,0,(unsigned char)-99,0,55,0,13,0,51,0,(unsigned char)-101,0,18,0,(unsigned char)-98,0,18,0,(unsigned char)-97,0, | |
+4,0,(unsigned char)-96,0,4,0,(unsigned char)-95,0,4,0,(unsigned char)-94,0,7,0,(unsigned char)-93,0,7,0,(unsigned char)-92,0, | |
+7,0,(unsigned char)-91,0,7,0,(unsigned char)-90,0,7,0,(unsigned char)-89,0,7,0,(unsigned char)-88,0,7,0,(unsigned char)-87,0, | |
+56,0,13,0,51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0,17,0,(unsigned char)-97,0,4,0,(unsigned char)-96,0, | |
+4,0,(unsigned char)-95,0,4,0,(unsigned char)-94,0,7,0,(unsigned char)-93,0,7,0,(unsigned char)-92,0,7,0,(unsigned char)-91,0, | |
+7,0,(unsigned char)-90,0,7,0,(unsigned char)-89,0,7,0,(unsigned char)-88,0,7,0,(unsigned char)-87,0,57,0,11,0, | |
+51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0,17,0,(unsigned char)-97,0,7,0,(unsigned char)-86,0,7,0,(unsigned char)-85,0, | |
+7,0,(unsigned char)-84,0,7,0,(unsigned char)-89,0,7,0,(unsigned char)-88,0,7,0,(unsigned char)-87,0,7,0,(unsigned char)-83,0, | |
+0,0,21,0,58,0,9,0,51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0,17,0,(unsigned char)-97,0, | |
+13,0,(unsigned char)-82,0,13,0,(unsigned char)-81,0,13,0,(unsigned char)-80,0,13,0,(unsigned char)-79,0,4,0,(unsigned char)-78,0, | |
+4,0,(unsigned char)-77,0,59,0,5,0,58,0,(unsigned char)-76,0,4,0,(unsigned char)-75,0,7,0,(unsigned char)-74,0, | |
+7,0,(unsigned char)-73,0,7,0,(unsigned char)-72,0,60,0,9,0,51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0, | |
+17,0,(unsigned char)-97,0,7,0,(unsigned char)-82,0,7,0,(unsigned char)-81,0,7,0,(unsigned char)-80,0,7,0,(unsigned char)-79,0, | |
+4,0,(unsigned char)-78,0,4,0,(unsigned char)-77,0,61,0,4,0,7,0,(unsigned char)-71,0,7,0,(unsigned char)-70,0, | |
+7,0,(unsigned char)-69,0,4,0,78,0,62,0,10,0,61,0,(unsigned char)-68,0,13,0,(unsigned char)-67,0, | |
+13,0,(unsigned char)-66,0,13,0,(unsigned char)-65,0,13,0,(unsigned char)-64,0,13,0,(unsigned char)-63,0,7,0,(unsigned char)-123,0, | |
+7,0,(unsigned char)-62,0,4,0,(unsigned char)-61,0,4,0,53,0,63,0,4,0,61,0,(unsigned char)-68,0, | |
+4,0,(unsigned char)-60,0,7,0,(unsigned char)-59,0,4,0,(unsigned char)-58,0,64,0,4,0,13,0,(unsigned char)-63,0, | |
+61,0,(unsigned char)-68,0,4,0,(unsigned char)-57,0,7,0,(unsigned char)-56,0,65,0,7,0,13,0,(unsigned char)-55,0, | |
+61,0,(unsigned char)-68,0,4,0,(unsigned char)-54,0,7,0,(unsigned char)-53,0,7,0,(unsigned char)-52,0,7,0,(unsigned char)-51,0, | |
+4,0,53,0,66,0,6,0,15,0,(unsigned char)-50,0,13,0,(unsigned char)-52,0,13,0,(unsigned char)-49,0, | |
+52,0,(unsigned char)-48,0,4,0,(unsigned char)-47,0,7,0,(unsigned char)-51,0,67,0,26,0,4,0,(unsigned char)-46,0, | |
+7,0,(unsigned char)-45,0,7,0,(unsigned char)-83,0,7,0,(unsigned char)-44,0,7,0,(unsigned char)-43,0,7,0,(unsigned char)-42,0, | |
+7,0,(unsigned char)-41,0,7,0,(unsigned char)-40,0,7,0,(unsigned char)-39,0,7,0,(unsigned char)-38,0,7,0,(unsigned char)-37,0, | |
+7,0,(unsigned char)-36,0,7,0,(unsigned char)-35,0,7,0,(unsigned char)-34,0,7,0,(unsigned char)-33,0,7,0,(unsigned char)-32,0, | |
+7,0,(unsigned char)-31,0,7,0,(unsigned char)-30,0,7,0,(unsigned char)-29,0,7,0,(unsigned char)-28,0,7,0,(unsigned char)-27,0, | |
+4,0,(unsigned char)-26,0,4,0,(unsigned char)-25,0,4,0,(unsigned char)-24,0,4,0,(unsigned char)-23,0,4,0,116,0, | |
+68,0,12,0,15,0,(unsigned char)-22,0,15,0,(unsigned char)-21,0,15,0,(unsigned char)-20,0,13,0,(unsigned char)-19,0, | |
+13,0,(unsigned char)-18,0,7,0,(unsigned char)-17,0,4,0,(unsigned char)-16,0,4,0,(unsigned char)-15,0,4,0,(unsigned char)-14,0, | |
+4,0,(unsigned char)-13,0,7,0,(unsigned char)-53,0,4,0,53,0,69,0,27,0,17,0,(unsigned char)-12,0, | |
+15,0,(unsigned char)-11,0,15,0,(unsigned char)-10,0,13,0,(unsigned char)-19,0,13,0,(unsigned char)-9,0,13,0,(unsigned char)-8,0, | |
+13,0,(unsigned char)-7,0,13,0,(unsigned char)-6,0,13,0,(unsigned char)-5,0,4,0,(unsigned char)-4,0,7,0,(unsigned char)-3,0, | |
+4,0,(unsigned char)-2,0,4,0,(unsigned char)-1,0,4,0,0,1,7,0,1,1,7,0,2,1, | |
4,0,3,1,4,0,4,1,7,0,5,1,7,0,6,1,7,0,7,1, | |
7,0,8,1,7,0,9,1,7,0,10,1,4,0,11,1,4,0,12,1, | |
4,0,13,1,70,0,12,0,9,0,14,1,9,0,15,1,13,0,16,1, | |
@@ -411,7 +411,7 @@ unsigned char sBulletDNAstr[]= { | |
4,0,22,1,4,0,23,1,4,0,24,1,4,0,53,0,71,0,19,0, | |
47,0,122,0,68,0,25,1,61,0,26,1,62,0,27,1,63,0,28,1, | |
64,0,29,1,65,0,30,1,66,0,31,1,69,0,32,1,70,0,33,1, | |
-4,0,34,1,4,0,-1,0,4,0,35,1,4,0,36,1,4,0,37,1, | |
+4,0,34,1,4,0,(unsigned char)-1,0,4,0,35,1,4,0,36,1,4,0,37,1, | |
4,0,38,1,4,0,39,1,4,0,40,1,67,0,41,1,}; | |
int sBulletDNAlen= sizeof(sBulletDNAstr); | |
unsigned char sBulletDNAstr64[]= { | |
@@ -721,12 +721,12 @@ unsigned char sBulletDNAstr64[]= { | |
97,116,97,0,98,116,83,111,102,116,66,111,100,121,70,108,111,97,116,68, | |
97,116,97,0,84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0, | |
4,0,4,0,8,0,0,0,16,0,48,0,16,0,16,0,32,0,48,0, | |
-96,0,64,0,-128,0,20,0,48,0,80,0,16,0,96,0,-112,0,16,0, | |
+96,0,64,0,(unsigned char)-128,0,20,0,48,0,80,0,16,0,96,0,(unsigned char)-112,0,16,0, | |
56,0,56,0,20,0,72,0,4,0,4,0,8,0,4,0,56,0,32,0, | |
80,0,72,0,96,0,80,0,32,0,64,0,64,0,16,0,72,0,80,0, | |
--40,1,8,1,-16,1,-88,3,8,0,56,0,0,0,88,0,120,0,96,1, | |
--32,0,-40,0,0,1,96,1,-48,0,16,0,104,0,24,0,40,0,104,0, | |
-96,0,104,0,-56,0,104,1,112,0,-40,1,83,84,82,67,61,0,0,0, | |
+(unsigned char)-40,1,8,1,(unsigned char)-16,1,(unsigned char)-88,3,8,0,56,0,0,0,88,0,120,0,96,1, | |
+(unsigned char)-32,0,(unsigned char)-40,0,0,1,96,1,(unsigned char)-48,0,16,0,104,0,24,0,40,0,104,0, | |
+96,0,104,0,(unsigned char)-56,0,104,1,112,0,(unsigned char)-40,1,83,84,82,67,61,0,0,0, | |
10,0,3,0,4,0,0,0,4,0,1,0,9,0,2,0,11,0,3,0, | |
10,0,3,0,10,0,4,0,10,0,5,0,12,0,2,0,9,0,6,0, | |
9,0,7,0,13,0,1,0,7,0,8,0,14,0,1,0,8,0,8,0, | |
@@ -775,51 +775,51 @@ unsigned char sBulletDNAstr64[]= { | |
7,0,114,0,4,0,115,0,4,0,116,0,4,0,117,0,4,0,118,0, | |
4,0,119,0,4,0,120,0,4,0,121,0,48,0,21,0,47,0,122,0, | |
15,0,123,0,13,0,124,0,13,0,125,0,13,0,126,0,13,0,127,0, | |
-13,0,-128,0,13,0,-127,0,13,0,-126,0,13,0,-125,0,13,0,-124,0, | |
-7,0,-123,0,7,0,-122,0,7,0,-121,0,7,0,-120,0,7,0,-119,0, | |
-7,0,-118,0,7,0,-117,0,7,0,-116,0,7,0,-115,0,4,0,-114,0, | |
+13,0,(unsigned char)-128,0,13,0,(unsigned char)-127,0,13,0,(unsigned char)-126,0,13,0,(unsigned char)-125,0,13,0,(unsigned char)-124,0, | |
+7,0,(unsigned char)-123,0,7,0,(unsigned char)-122,0,7,0,(unsigned char)-121,0,7,0,(unsigned char)-120,0,7,0,(unsigned char)-119,0, | |
+7,0,(unsigned char)-118,0,7,0,(unsigned char)-117,0,7,0,(unsigned char)-116,0,7,0,(unsigned char)-115,0,4,0,(unsigned char)-114,0, | |
49,0,22,0,46,0,122,0,16,0,123,0,14,0,124,0,14,0,125,0, | |
-14,0,126,0,14,0,127,0,14,0,-128,0,14,0,-127,0,14,0,-126,0, | |
-14,0,-125,0,14,0,-124,0,8,0,-123,0,8,0,-122,0,8,0,-121,0, | |
-8,0,-120,0,8,0,-119,0,8,0,-118,0,8,0,-117,0,8,0,-116,0, | |
-8,0,-115,0,4,0,-114,0,0,0,37,0,50,0,2,0,4,0,-113,0, | |
-4,0,-112,0,51,0,11,0,52,0,-111,0,52,0,-110,0,0,0,35,0, | |
-4,0,-109,0,4,0,-108,0,4,0,-107,0,4,0,-106,0,7,0,-105,0, | |
-7,0,-104,0,4,0,-103,0,0,0,-102,0,53,0,3,0,51,0,-101,0, | |
-13,0,-100,0,13,0,-99,0,54,0,3,0,51,0,-101,0,14,0,-100,0, | |
-14,0,-99,0,55,0,13,0,51,0,-101,0,18,0,-98,0,18,0,-97,0, | |
-4,0,-96,0,4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0, | |
-7,0,-91,0,7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0, | |
-56,0,13,0,51,0,-101,0,17,0,-98,0,17,0,-97,0,4,0,-96,0, | |
-4,0,-95,0,4,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0, | |
-7,0,-90,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,57,0,11,0, | |
-51,0,-101,0,17,0,-98,0,17,0,-97,0,7,0,-86,0,7,0,-85,0, | |
-7,0,-84,0,7,0,-89,0,7,0,-88,0,7,0,-87,0,7,0,-83,0, | |
-0,0,21,0,58,0,9,0,51,0,-101,0,17,0,-98,0,17,0,-97,0, | |
-13,0,-82,0,13,0,-81,0,13,0,-80,0,13,0,-79,0,4,0,-78,0, | |
-4,0,-77,0,59,0,5,0,58,0,-76,0,4,0,-75,0,7,0,-74,0, | |
-7,0,-73,0,7,0,-72,0,60,0,9,0,51,0,-101,0,17,0,-98,0, | |
-17,0,-97,0,7,0,-82,0,7,0,-81,0,7,0,-80,0,7,0,-79,0, | |
-4,0,-78,0,4,0,-77,0,61,0,4,0,7,0,-71,0,7,0,-70,0, | |
-7,0,-69,0,4,0,78,0,62,0,10,0,61,0,-68,0,13,0,-67,0, | |
-13,0,-66,0,13,0,-65,0,13,0,-64,0,13,0,-63,0,7,0,-123,0, | |
-7,0,-62,0,4,0,-61,0,4,0,53,0,63,0,4,0,61,0,-68,0, | |
-4,0,-60,0,7,0,-59,0,4,0,-58,0,64,0,4,0,13,0,-63,0, | |
-61,0,-68,0,4,0,-57,0,7,0,-56,0,65,0,7,0,13,0,-55,0, | |
-61,0,-68,0,4,0,-54,0,7,0,-53,0,7,0,-52,0,7,0,-51,0, | |
-4,0,53,0,66,0,6,0,15,0,-50,0,13,0,-52,0,13,0,-49,0, | |
-52,0,-48,0,4,0,-47,0,7,0,-51,0,67,0,26,0,4,0,-46,0, | |
-7,0,-45,0,7,0,-83,0,7,0,-44,0,7,0,-43,0,7,0,-42,0, | |
-7,0,-41,0,7,0,-40,0,7,0,-39,0,7,0,-38,0,7,0,-37,0, | |
-7,0,-36,0,7,0,-35,0,7,0,-34,0,7,0,-33,0,7,0,-32,0, | |
-7,0,-31,0,7,0,-30,0,7,0,-29,0,7,0,-28,0,7,0,-27,0, | |
-4,0,-26,0,4,0,-25,0,4,0,-24,0,4,0,-23,0,4,0,116,0, | |
-68,0,12,0,15,0,-22,0,15,0,-21,0,15,0,-20,0,13,0,-19,0, | |
-13,0,-18,0,7,0,-17,0,4,0,-16,0,4,0,-15,0,4,0,-14,0, | |
-4,0,-13,0,7,0,-53,0,4,0,53,0,69,0,27,0,17,0,-12,0, | |
-15,0,-11,0,15,0,-10,0,13,0,-19,0,13,0,-9,0,13,0,-8,0, | |
-13,0,-7,0,13,0,-6,0,13,0,-5,0,4,0,-4,0,7,0,-3,0, | |
-4,0,-2,0,4,0,-1,0,4,0,0,1,7,0,1,1,7,0,2,1, | |
+14,0,126,0,14,0,127,0,14,0,(unsigned char)-128,0,14,0,(unsigned char)-127,0,14,0,(unsigned char)-126,0, | |
+14,0,(unsigned char)-125,0,14,0,(unsigned char)-124,0,8,0,(unsigned char)-123,0,8,0,(unsigned char)-122,0,8,0,(unsigned char)-121,0, | |
+8,0,(unsigned char)-120,0,8,0,(unsigned char)-119,0,8,0,(unsigned char)-118,0,8,0,(unsigned char)-117,0,8,0,(unsigned char)-116,0, | |
+8,0,(unsigned char)-115,0,4,0,(unsigned char)-114,0,0,0,37,0,50,0,2,0,4,0,(unsigned char)-113,0, | |
+4,0,(unsigned char)-112,0,51,0,11,0,52,0,(unsigned char)-111,0,52,0,(unsigned char)-110,0,0,0,35,0, | |
+4,0,(unsigned char)-109,0,4,0,(unsigned char)-108,0,4,0,(unsigned char)-107,0,4,0,(unsigned char)-106,0,7,0,(unsigned char)-105,0, | |
+7,0,(unsigned char)-104,0,4,0,(unsigned char)-103,0,0,0,(unsigned char)-102,0,53,0,3,0,51,0,(unsigned char)-101,0, | |
+13,0,(unsigned char)-100,0,13,0,(unsigned char)-99,0,54,0,3,0,51,0,(unsigned char)-101,0,14,0,(unsigned char)-100,0, | |
+14,0,(unsigned char)-99,0,55,0,13,0,51,0,(unsigned char)-101,0,18,0,(unsigned char)-98,0,18,0,(unsigned char)-97,0, | |
+4,0,(unsigned char)-96,0,4,0,(unsigned char)-95,0,4,0,(unsigned char)-94,0,7,0,(unsigned char)-93,0,7,0,(unsigned char)-92,0, | |
+7,0,(unsigned char)-91,0,7,0,(unsigned char)-90,0,7,0,(unsigned char)-89,0,7,0,(unsigned char)-88,0,7,0,(unsigned char)-87,0, | |
+56,0,13,0,51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0,17,0,(unsigned char)-97,0,4,0,(unsigned char)-96,0, | |
+4,0,(unsigned char)-95,0,4,0,(unsigned char)-94,0,7,0,(unsigned char)-93,0,7,0,(unsigned char)-92,0,7,0,(unsigned char)-91,0, | |
+7,0,(unsigned char)-90,0,7,0,(unsigned char)-89,0,7,0,(unsigned char)-88,0,7,0,(unsigned char)-87,0,57,0,11,0, | |
+51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0,17,0,(unsigned char)-97,0,7,0,(unsigned char)-86,0,7,0,(unsigned char)-85,0, | |
+7,0,(unsigned char)-84,0,7,0,(unsigned char)-89,0,7,0,(unsigned char)-88,0,7,0,(unsigned char)-87,0,7,0,(unsigned char)-83,0, | |
+0,0,21,0,58,0,9,0,51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0,17,0,(unsigned char)-97,0, | |
+13,0,(unsigned char)-82,0,13,0,(unsigned char)-81,0,13,0,(unsigned char)-80,0,13,0,(unsigned char)-79,0,4,0,(unsigned char)-78,0, | |
+4,0,(unsigned char)-77,0,59,0,5,0,58,0,(unsigned char)-76,0,4,0,(unsigned char)-75,0,7,0,(unsigned char)-74,0, | |
+7,0,(unsigned char)-73,0,7,0,(unsigned char)-72,0,60,0,9,0,51,0,(unsigned char)-101,0,17,0,(unsigned char)-98,0, | |
+17,0,(unsigned char)-97,0,7,0,(unsigned char)-82,0,7,0,(unsigned char)-81,0,7,0,(unsigned char)-80,0,7,0,(unsigned char)-79,0, | |
+4,0,(unsigned char)-78,0,4,0,(unsigned char)-77,0,61,0,4,0,7,0,(unsigned char)-71,0,7,0,(unsigned char)-70,0, | |
+7,0,(unsigned char)-69,0,4,0,78,0,62,0,10,0,61,0,(unsigned char)-68,0,13,0,(unsigned char)-67,0, | |
+13,0,(unsigned char)-66,0,13,0,(unsigned char)-65,0,13,0,(unsigned char)-64,0,13,0,(unsigned char)-63,0,7,0,(unsigned char)-123,0, | |
+7,0,(unsigned char)-62,0,4,0,(unsigned char)-61,0,4,0,53,0,63,0,4,0,61,0,(unsigned char)-68,0, | |
+4,0,(unsigned char)-60,0,7,0,(unsigned char)-59,0,4,0,(unsigned char)-58,0,64,0,4,0,13,0,(unsigned char)-63,0, | |
+61,0,(unsigned char)-68,0,4,0,(unsigned char)-57,0,7,0,(unsigned char)-56,0,65,0,7,0,13,0,(unsigned char)-55,0, | |
+61,0,(unsigned char)-68,0,4,0,(unsigned char)-54,0,7,0,(unsigned char)-53,0,7,0,(unsigned char)-52,0,7,0,(unsigned char)-51,0, | |
+4,0,53,0,66,0,6,0,15,0,(unsigned char)-50,0,13,0,(unsigned char)-52,0,13,0,(unsigned char)-49,0, | |
+52,0,(unsigned char)-48,0,4,0,(unsigned char)-47,0,7,0,(unsigned char)-51,0,67,0,26,0,4,0,(unsigned char)-46,0, | |
+7,0,(unsigned char)-45,0,7,0,(unsigned char)-83,0,7,0,(unsigned char)-44,0,7,0,(unsigned char)-43,0,7,0,(unsigned char)-42,0, | |
+7,0,(unsigned char)-41,0,7,0,(unsigned char)-40,0,7,0,(unsigned char)-39,0,7,0,(unsigned char)-38,0,7,0,(unsigned char)-37,0, | |
+7,0,(unsigned char)-36,0,7,0,(unsigned char)-35,0,7,0,(unsigned char)-34,0,7,0,(unsigned char)-33,0,7,0,(unsigned char)-32,0, | |
+7,0,(unsigned char)-31,0,7,0,(unsigned char)-30,0,7,0,(unsigned char)-29,0,7,0,(unsigned char)-28,0,7,0,(unsigned char)-27,0, | |
+4,0,(unsigned char)-26,0,4,0,(unsigned char)-25,0,4,0,(unsigned char)-24,0,4,0,(unsigned char)-23,0,4,0,116,0, | |
+68,0,12,0,15,0,(unsigned char)-22,0,15,0,(unsigned char)-21,0,15,0,(unsigned char)-20,0,13,0,(unsigned char)-19,0, | |
+13,0,(unsigned char)-18,0,7,0,(unsigned char)-17,0,4,0,(unsigned char)-16,0,4,0,(unsigned char)-15,0,4,0,(unsigned char)-14,0, | |
+4,0,(unsigned char)-13,0,7,0,(unsigned char)-53,0,4,0,53,0,69,0,27,0,17,0,(unsigned char)-12,0, | |
+15,0,(unsigned char)-11,0,15,0,(unsigned char)-10,0,13,0,(unsigned char)-19,0,13,0,(unsigned char)-9,0,13,0,(unsigned char)-8,0, | |
+13,0,(unsigned char)-7,0,13,0,(unsigned char)-6,0,13,0,(unsigned char)-5,0,4,0,(unsigned char)-4,0,7,0,(unsigned char)-3,0, | |
+4,0,(unsigned char)-2,0,4,0,(unsigned char)-1,0,4,0,0,1,7,0,1,1,7,0,2,1, | |
4,0,3,1,4,0,4,1,7,0,5,1,7,0,6,1,7,0,7,1, | |
7,0,8,1,7,0,9,1,7,0,10,1,4,0,11,1,4,0,12,1, | |
4,0,13,1,70,0,12,0,9,0,14,1,9,0,15,1,13,0,16,1, | |
@@ -827,6 +827,6 @@ unsigned char sBulletDNAstr64[]= { | |
4,0,22,1,4,0,23,1,4,0,24,1,4,0,53,0,71,0,19,0, | |
47,0,122,0,68,0,25,1,61,0,26,1,62,0,27,1,63,0,28,1, | |
64,0,29,1,65,0,30,1,66,0,31,1,69,0,32,1,70,0,33,1, | |
-4,0,34,1,4,0,-1,0,4,0,35,1,4,0,36,1,4,0,37,1, | |
+4,0,34,1,4,0,(unsigned char)-1,0,4,0,35,1,4,0,36,1,4,0,37,1, | |
4,0,38,1,4,0,39,1,4,0,40,1,67,0,41,1,}; | |
int sBulletDNAlen64= sizeof(sBulletDNAstr64); | |
diff --git a/tests/bullet/src/LinearMath/btSerializer.h b/tests/bullet/src/LinearMath/btSerializer.h | |
index 8a89374..8abf9b1 100644 | |
--- a/tests/bullet/src/LinearMath/btSerializer.h | |
+++ b/tests/bullet/src/LinearMath/btSerializer.h | |
@@ -20,7 +20,7 @@ subject to the following restrictions: | |
#include "btStackAlloc.h" | |
#include "btHashMap.h" | |
-#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__) | |
+#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__) && !(__CHEERP__) | |
#include <memory.h> | |
#endif | |
#include <string.h> | |
@@ -127,7 +127,7 @@ public: | |
struct btPointerUid | |
{ | |
- union | |
+ struct | |
{ | |
void* m_ptr; | |
int m_uniqueIds[2]; | |
diff --git a/tests/bullet/src/LinearMath/btVector3.h b/tests/bullet/src/LinearMath/btVector3.h | |
index d99b7c8..70a4e8d 100644 | |
--- a/tests/bullet/src/LinearMath/btVector3.h | |
+++ b/tests/bullet/src/LinearMath/btVector3.h | |
@@ -79,7 +79,7 @@ public: | |
* @param y Y value | |
* @param z Z value | |
*/ | |
- SIMD_FORCE_INLINE btVector3(const btScalar& x, const btScalar& y, const btScalar& z) | |
+ SIMD_FORCE_INLINE btVector3(const btScalar x, const btScalar y, const btScalar z) | |
{ | |
m_floats[0] = x; | |
m_floats[1] = y; | |
@@ -87,6 +87,14 @@ public: | |
m_floats[3] = btScalar(0.); | |
} | |
+ btVector3(const btScalar* p) | |
+ { | |
+ m_floats[0] = p[0]; | |
+ m_floats[1] = p[1]; | |
+ m_floats[2] = p[2]; | |
+ m_floats[3] = p[3]; | |
+ } | |
+ | |
/**@brief Add a vector to this one | |
* @param The vector to add to this one */ | |
@@ -107,7 +115,7 @@ public: | |
} | |
/**@brief Scale the vector | |
* @param s Scale factor */ | |
- SIMD_FORCE_INLINE btVector3& operator*=(const btScalar& s) | |
+ SIMD_FORCE_INLINE btVector3& operator*=(const btScalar s) | |
{ | |
m_floats[0] *= s; m_floats[1] *= s;m_floats[2] *= s; | |
return *this; | |
@@ -115,7 +123,7 @@ public: | |
/**@brief Inversely scale the vector | |
* @param s Scale factor to divide by */ | |
- SIMD_FORCE_INLINE btVector3& operator/=(const btScalar& s) | |
+ SIMD_FORCE_INLINE btVector3& operator/=(const btScalar s) | |
{ | |
btFullAssert(s != btScalar(0.0)); | |
return *this *= btScalar(1.0) / s; | |
@@ -246,7 +254,7 @@ public: | |
/**@brief Return the linear interpolation between this and another vector | |
* @param v The other vector | |
* @param t The ration of this to v (t = 0 => return this, t=1 => return other) */ | |
- SIMD_FORCE_INLINE btVector3 lerp(const btVector3& v, const btScalar& t) const | |
+ SIMD_FORCE_INLINE btVector3 lerp(const btVector3& v, const btScalar t) const | |
{ | |
return btVector3(m_floats[0] + (v.m_floats[0] - m_floats[0]) * t, | |
m_floats[1] + (v.m_floats[1] - m_floats[1]) * t, | |
@@ -321,7 +329,7 @@ public: | |
btSetMin(m_floats[3], other.w()); | |
} | |
- SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z) | |
+ SIMD_FORCE_INLINE void setValue(const btScalar x, const btScalar y, const btScalar z) | |
{ | |
m_floats[0]=x; | |
m_floats[1]=y; | |
@@ -394,21 +402,21 @@ operator-(const btVector3& v) | |
/**@brief Return the vector scaled by s */ | |
SIMD_FORCE_INLINE btVector3 | |
-operator*(const btVector3& v, const btScalar& s) | |
+operator*(const btVector3& v, const btScalar s) | |
{ | |
return btVector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s); | |
} | |
/**@brief Return the vector scaled by s */ | |
SIMD_FORCE_INLINE btVector3 | |
-operator*(const btScalar& s, const btVector3& v) | |
+operator*(const btScalar s, const btVector3& v) | |
{ | |
return v * s; | |
} | |
/**@brief Return the vector inversely scaled by s */ | |
SIMD_FORCE_INLINE btVector3 | |
-operator/(const btVector3& v, const btScalar& s) | |
+operator/(const btVector3& v, const btScalar s) | |
{ | |
btFullAssert(s != btScalar(0.0)); | |
return v * (btScalar(1.0) / s); | |
@@ -469,7 +477,7 @@ btTriple(const btVector3& v1, const btVector3& v2, const btVector3& v3) | |
* @param v2 The other vector | |
* @param t The ration of this to v (t = 0 => return v1, t=1 => return v2) */ | |
SIMD_FORCE_INLINE btVector3 | |
-lerp(const btVector3& v1, const btVector3& v2, const btScalar& t) | |
+lerp(const btVector3& v1, const btVector3& v2, const btScalar t) | |
{ | |
return v1.lerp(v2, t); | |
} | |
@@ -511,7 +519,7 @@ public: | |
SIMD_FORCE_INLINE btVector4() {} | |
- SIMD_FORCE_INLINE btVector4(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w) | |
+ SIMD_FORCE_INLINE btVector4(const btScalar x, const btScalar y, const btScalar z,const btScalar w) | |
: btVector3(x,y,z) | |
{ | |
m_floats[3] = w; | |
@@ -623,7 +631,7 @@ public: | |
* @param z Value of z | |
* @param w Value of w | |
*/ | |
- SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w) | |
+ SIMD_FORCE_INLINE void setValue(const btScalar x, const btScalar y, const btScalar z,const btScalar w) | |
{ | |
m_floats[0]=x; | |
m_floats[1]=y; | |
@@ -636,7 +644,7 @@ public: | |
///btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization | |
-SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar& sourceVal, btScalar& destVal) | |
+SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar sourceVal, btScalar destVal) | |
{ | |
#ifdef BT_USE_DOUBLE_PRECISION | |
unsigned char* dest = (unsigned char*) &destVal; | |
diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py | |
index a15ff72..5007749 100644 | |
--- a/tests/test_benchmark.py | |
+++ b/tests/test_benchmark.py | |
@@ -60,7 +60,7 @@ class NativeBenchmarker(Benchmarker): | |
def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder): | |
self.parent = parent | |
- if lib_builder: native_args = native_args + lib_builder(self.name, native=True, env_init={ 'CC': self.cc, 'CXX': self.cxx }) | |
+ if lib_builder: native_args = native_args + lib_builder(self.name, native=True, env_init={ 'CC': self.cc, 'CXX': self.cxx }, archive_extension="a", target_configure_args=[]) | |
if not native_exec: | |
compiler = self.cxx if filename.endswith('cpp') else self.cc | |
process = Popen([compiler, '-fno-math-errno', filename, '-o', filename+'.native'] + self.args + shared_args + native_args, stdout=PIPE, stderr=parent.stderr_redirect) | |
@@ -92,7 +92,7 @@ class JSBenchmarker(Benchmarker): | |
def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder): | |
self.filename = filename | |
llvm_root = self.env.get('LLVM') or LLVM_ROOT | |
- if lib_builder: emcc_args = emcc_args + lib_builder('js_' + llvm_root, native=False, env_init=self.env) | |
+ if lib_builder: emcc_args = emcc_args + lib_builder('js_' + llvm_root, native=False, env_init=self.env, archive_extension="a", target_configure_args=[]) | |
open('hardcode.py', 'w').write(''' | |
def process(filename): | |
@@ -120,6 +120,29 @@ process(sys.argv[1]) | |
def run(self, args): | |
return run_js(self.filename, engine=self.engine, args=args, stderr=PIPE, full_output=True, assert_returncode=None) | |
+class CheerpBenchmarker(Benchmarker): | |
+ def __init__(self, name, engine, extra_args=[], env={}): | |
+ self.name = name | |
+ self.engine = engine | |
+ self.extra_args = extra_args | |
+ self.env = os.environ.copy() | |
+ for k, v in env.iteritems(): | |
+ self.env[k] = v | |
+ | |
+ def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder): | |
+ self.filename = filename | |
+ libs_args = []; | |
+ if lib_builder: libs_args = lib_builder(self.name, native=True, env_init={ 'CC': '/opt/cheerp/bin/clang -target cheerp', 'CXX': '/opt/cheerp/bin/clang++ -target cheerp', 'LLVMLINK': '/opt/cheerp/bin/llvm-link' }, archive_extension="bc", target_configure_args=['-DCMAKE_TOOLCHAIN_FILE=/opt/cheerp/share/cmake/Modules/CheerpToolchain.cmake']) | |
+ final = os.path.dirname(filename) + os.path.sep + self.name+'_' + os.path.basename(filename) + '.js' | |
+ try_delete(final) | |
+ output = Popen(["/opt/cheerp/bin/clang++", "-target", "cheerp", filename, path_from_root('tests', 'cheerptrampoline.cpp'), '-Os', '-o', final] + shared_args + libs_args + self.extra_args, stdout=PIPE, stderr=PIPE, env=self.env).communicate() | |
+ assert os.path.exists(final), 'Failed to compile file: ' + output[0] | |
+ Popen(["/bin/sed","-i","s/console.log/print/",final]).wait(); | |
+ self.filename = final | |
+ | |
+ def run(self, args): | |
+ return run_js(self.filename, engine=self.engine, args=args, stderr=PIPE, full_output=True, assert_returncode=None) | |
+ | |
# Benchmarkers | |
try: | |
default_native = LLVM_3_2 | |
@@ -136,12 +159,14 @@ try: | |
#NativeBenchmarker(default_native_name, os.path.join(default_native, 'clang'), os.path.join(default_native, 'clang++')), | |
#NativeBenchmarker('clang', CLANG_CC, CLANG), | |
#NativeBenchmarker('clang-3.6', os.path.join(LLVM_3_6, 'clang'), os.path.join(LLVM_3_6, 'clang++')), | |
- #NativeBenchmarker(default_native_name, os.path.join(default_native, 'clang'), os.path.join(default_native, 'clang++')), | |
+ NativeBenchmarker(default_native_name, os.path.join(default_native, 'clang'), os.path.join(default_native, 'clang++')), | |
#NativeBenchmarker('clang-3.2-O3', os.path.join(default_native, 'clang'), os.path.join(default_native, 'clang++'), ['-O3']), | |
#NativeBenchmarker('clang-3.3', os.path.join(LLVM_3_3, 'clang'), os.path.join(LLVM_3_3, 'clang++')), | |
#NativeBenchmarker('clang-3.4', os.path.join(LLVM_3_4, 'clang'), os.path.join(LLVM_3_4, 'clang++')), | |
#NativeBenchmarker('gcc', 'gcc', 'g++'), | |
+ JSBenchmarker('sm', SPIDERMONKEY_ENGINE, []), | |
JSBenchmarker('sm-f32', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2']), | |
+ CheerpBenchmarker('sm-cheerp', SPIDERMONKEY_ENGINE), | |
#JSBenchmarker('sm-f32-si', SPIDERMONKEY_ENGINE, ['--profiling', '-s', 'PRECISE_F32=2', '-s', 'SIMPLIFY_IFS=1']), | |
#JSBenchmarker('sm-f32-aggro', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2', '-s', 'AGGRESSIVE_VARIABLE_ELIMINATION=1']), | |
#JSBenchmarker('sm-f32-3.2', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2'], env={ 'LLVM': LLVM_3_2 }), | |
@@ -149,7 +174,8 @@ try: | |
#JSBenchmarker('sm-f32-3.4', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2'], env={ 'LLVM': LLVM_3_4 }), | |
#JSBenchmarker('sm-noasm', SPIDERMONKEY_ENGINE + ['--no-asmjs']), | |
#JSBenchmarker('sm-noasm-f32', SPIDERMONKEY_ENGINE + ['--no-asmjs'], ['-s', 'PRECISE_F32=2']), | |
- #JSBenchmarker('v8', V8_ENGINE), | |
+ JSBenchmarker('v8', V8_ENGINE), | |
+ CheerpBenchmarker('v8-cheerp', V8_ENGINE), | |
#JSBenchmarker('sm-emterp', SPIDERMONKEY_ENGINE, ['-s', 'EMTERPRETIFY=1', '--memory-init-file', '1']), | |
] | |
except Exception, e: | |
@@ -567,8 +593,8 @@ class benchmark(RunnerCore): | |
def lua(self, benchmark, expected, output_parser=None, args_processor=None): | |
shutil.copyfile(path_from_root('tests', 'lua', benchmark + '.lua'), benchmark + '.lua') | |
- def lib_builder(name, native, env_init): | |
- ret = self.get_library('lua_native' if native else 'lua', [os.path.join('src', 'lua'), os.path.join('src', 'liblua.a')], make=['make', 'generic'], configure=None, native=native, cache_name_extra=name, env_init=env_init) | |
+ def lib_builder(name, native, env_init, archive_extension, target_configure_args): | |
+ ret = self.get_library('lua_native' if native else 'lua', [os.path.join('src', 'lua'), os.path.join('src', 'liblua.'+archive_extension)], make=['make', 'generic'], configure=None, native=native, cache_name_extra=name+archive_extension, env_init=env_init) | |
if native: return ret | |
shutil.copyfile(ret[0], ret[0] + '.bc') | |
ret[0] += '.bc' | |
@@ -579,40 +605,51 @@ class benchmark(RunnerCore): | |
output_parser=output_parser, args_processor=args_processor) | |
def test_zzz_lua_scimark(self): | |
+ if CORE_BENCHMARKS: return | |
def output_parser(output): | |
return 100.0/float(re.search('\nSciMark +([\d\.]+) ', output).group(1)) | |
self.lua('scimark', '[small problem sizes]', output_parser=output_parser) | |
def test_zzz_lua_binarytrees(self): | |
+ if CORE_BENCHMARKS: return | |
# js version: ['binarytrees.lua', {0: 0, 1: 9.5, 2: 11.99, 3: 12.85, 4: 14.72, 5: 15.82}[arguments[0]]] | |
self.lua('binarytrees', 'long lived tree of depth') | |
def test_zzz_zlib(self): | |
+ if CORE_BENCHMARKS: return | |
src = open(path_from_root('tests', 'zlib', 'benchmark.c'), 'r').read() | |
- def lib_builder(name, native, env_init): | |
- return self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a'], native=native, cache_name_extra=name, env_init=env_init) | |
+ def lib_builder(name, native, env_init, archive_extension, target_configure_args): | |
+ return self.get_library('zlib', os.path.join('libz.'+archive_extension), make_args=['libz.'+archive_extension], native=native, cache_name_extra=name+archive_extension, env_init=env_init) | |
self.do_benchmark('zlib', src, '''ok.''', | |
force_c=True, shared_args=['-I' + path_from_root('tests', 'zlib')], lib_builder=lib_builder) | |
def test_zzz_box2d(self): # Called thus so it runs late in the alphabetical cycle... it is long | |
src = open(path_from_root('tests', 'box2d', 'Benchmark.cpp'), 'r').read() | |
- def lib_builder(name, native, env_init): | |
- return self.get_library('box2d', [os.path.join('box2d.a')], configure=None, native=native, cache_name_extra=name, env_init=env_init) | |
+ def lib_builder(name, native, env_init, archive_extension, target_configure_args): | |
+ return self.get_library('box2d', [os.path.join('box2d.'+archive_extension)], configure=None, make_args=['box2d.'+archive_extension], native=native, cache_name_extra=name+archive_extension, env_init=env_init) | |
self.do_benchmark('box2d', src, 'frame averages', shared_args=['-I' + path_from_root('tests', 'box2d')], lib_builder=lib_builder) | |
def test_zzz_bullet(self): # Called thus so it runs late in the alphabetical cycle... it is long | |
src = open(path_from_root('tests', 'bullet', 'Demos', 'Benchmarks', 'BenchmarkDemo.cpp'), 'r').read() + \ | |
open(path_from_root('tests', 'bullet', 'Demos', 'Benchmarks', 'main.cpp'), 'r').read() | |
- def lib_builder(name, native, env_init): | |
- return self.get_library('bullet', [os.path.join('src', '.libs', 'libBulletDynamics.a'), | |
- os.path.join('src', '.libs', 'libBulletCollision.a'), | |
- os.path.join('src', '.libs', 'libLinearMath.a')], | |
- configure_args=['--disable-demos','--disable-dependency-tracking'], native=native, cache_name_extra=name, env_init=env_init) | |
+ def lib_builder(name, native, env_init, archive_extension, target_configure_args): | |
+ return self.get_library('bullet', [os.path.join('src', 'BulletDynamics', 'libBulletDynamics.'+archive_extension), | |
+ os.path.join('src', 'BulletCollision', 'libBulletCollision.'+archive_extension), | |
+ os.path.join('src', 'LinearMath', 'libLinearMath.'+archive_extension)], | |
+ configure=['cmake'], configure_args=['-DBUILD_DEMOS=0','-DBUILD_EXTRAS=0'] + target_configure_args, | |
+ make_args=['LinearMath','BulletCollision','BulletDynamics'], | |
+ native=native, cache_name_extra=name+archive_extension, env_init=env_init) | |
+ | |
+ emcc_args = ['-s', 'DEAD_FUNCTIONS=["__ZSt9terminatev"]'] | |
+ | |
+ self.do_benchmark('bullet', src, '\nok.\n', emcc_args=emcc_args, shared_args=['-I' + path_from_root('tests', 'bullet', 'src'), | |
+ '-I' + path_from_root('tests', 'bullet', 'Demos', 'Benchmarks'), '-DBT_USE_DOUBLE_PRECISION'], lib_builder=lib_builder) | |
+ | |
emcc_args = ['-s', 'DEAD_FUNCTIONS=["__ZSt9terminatev"]'] | |
self.do_benchmark('bullet', src, '\nok.\n', emcc_args=emcc_args, shared_args=['-I' + path_from_root('tests', 'bullet', 'src'), | |
- '-I' + path_from_root('tests', 'bullet', 'Demos', 'Benchmarks')], lib_builder=lib_builder) | |
+ '-I' + path_from_root('tests', 'bullet', 'Demos', 'HelloWorld'), '-DBT_USE_DOUBLE_PRECISION'], lib_builder=lib_builder) | |
-- | |
2.1.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment