Skip to content

Commit 28fd68a

Browse files
committed
ODE: replaced pos and R with posr
Syncronised with ODE 0.6 files: error.cpp collision_quadtreespace.cpp timer.cpp util.cpp stepfast.cpp
1 parent f64580e commit 28fd68a

File tree

16 files changed

+273
-265
lines changed

16 files changed

+273
-265
lines changed

Externals/ode/ode/src/collision_kernel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ void dGeomSetBody (dxGeom *g, dxBody *b)
313313

314314
if (b) {
315315
if (!g->body) dFree (g->pos,sizeof(dxPosR));
316-
g->pos = b->pos;
317-
g->R = b->R;
316+
g->pos = b->posr.pos;
317+
g->R = b->posr.R;
318318
dGeomMoved (g);
319319
if (g->body != b) {
320320
g->bodyRemove();
@@ -326,8 +326,8 @@ void dGeomSetBody (dxGeom *g, dxBody *b)
326326
dxPosR *pr = (dxPosR*) dAlloc (sizeof(dxPosR));
327327
g->pos = pr->pos;
328328
g->R = pr->R;
329-
memcpy (g->pos,g->body->pos,sizeof(dVector3));
330-
memcpy (g->R,g->body->R,sizeof(dMatrix3));
329+
memcpy (g->pos,g->body->posr.pos,sizeof(dVector3));
330+
memcpy (g->R,g->body->posr.R,sizeof(dMatrix3));
331331
g->bodyRemove();
332332
}
333333
// dGeomMoved() should not be called if the body is being set to 0, as the

Externals/ode/ode/src/collision_kernel.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ internal data structures and functions for collision detection.
4646
//****************************************************************************
4747
// geometry object base class
4848

49-
// position vector and rotation matrix for geometry objects that are not
50-
// connected to bodies.
51-
52-
struct dxPosR {
53-
dVector3 pos;
54-
dMatrix3 R;
55-
};
56-
5749

5850
// geom flags.
5951
//

Externals/ode/ode/src/collision_quadtreespace.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ dxQuadTreeSpace::dxQuadTreeSpace(dSpaceID _space, dVector3 Center, dVector3 Exte
351351

352352
int BlockCount = 0;
353353
for (int i = 0; i <= Depth; i++){
354-
BlockCount += (int)powf(SPLITS, i);
354+
BlockCount += (int)pow((dReal)SPLITS, i);
355355
}
356356

357357
Blocks = (Block*)dAlloc(BlockCount * sizeof(Block));
@@ -384,7 +384,7 @@ dxQuadTreeSpace::~dxQuadTreeSpace(){
384384

385385
int BlockCount = 0;
386386
for (int i = 0; i < Depth; i++){
387-
BlockCount += (int)powf(SPLITS, i);
387+
BlockCount += (int)pow((dReal)SPLITS, i);
388388
}
389389

390390
dFree(Blocks, BlockCount * sizeof(Block));
@@ -495,7 +495,8 @@ void dxQuadTreeSpace::remove(dxGeom* g){
495495
for (int i = 0; i < DirtyList.size(); i++){
496496
if (DirtyList[i] == g){
497497
DirtyList.remove(i);
498-
break;
498+
// (mg) there can be multiple instances of a dirty object on stack be sure to remove ALL and not just first, for this we decrement i
499+
--i;
499500
}
500501
}
501502

Externals/ode/ode/src/error.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <ode/config.h>
2424
#include <ode/error.h>
2525

26-
#pragma warning(disable:4996)
2726

2827
static dMessageFunction *error_function = 0;
2928
static dMessageFunction *debug_function = 0;
@@ -119,10 +118,17 @@ extern "C" void dMessage (int num, const char *msg, ...)
119118

120119
#ifdef WIN32
121120

121+
// isn't cygwin annoying!
122+
#ifdef CYGWIN
123+
#define _snprintf snprintf
124+
#define _vsnprintf vsnprintf
125+
#endif
126+
127+
122128
#include "windows.h"
123129

124-
//#ifdef _DEBUG_
125-
void _cdecl dError (int num, const char *msg, ...)
130+
131+
extern "C" void dError (int num, const char *msg, ...)
126132
{
127133
va_list ap;
128134
va_start (ap,msg);
@@ -138,29 +144,29 @@ void _cdecl dError (int num, const char *msg, ...)
138144
}
139145

140146

141-
void _cdecl dDebug (int num, const char *msg, ...)
147+
extern "C" void dDebug (int num, const char *msg, ...)
142148
{
143149
va_list ap;
144150
va_start (ap,msg);
145151
if (debug_function) debug_function (num,msg,ap);
146152
else {
147153
char s[1000],title[100];
148-
_snprintf (title,sizeof(title),"ODE INTERNAL ERROR %d",num);
149-
_vsnprintf (s,sizeof(s),msg,ap);
154+
_snprintf (title,sizeof(title),"ODE INTERNAL ERROR %d",num);
155+
_vsnprintf (s,sizeof(s),msg,ap);
150156
s[sizeof(s)-1] = 0;
151157
MessageBox(0,s,title,MB_OK | MB_ICONSTOP);
152158
}
153159
abort();
154160
}
155161

156-
void _cdecl dMessage (int num, const char *msg, ...)
162+
163+
extern "C" void dMessage (int num, const char *msg, ...)
157164
{
158165
va_list ap;
159166
va_start (ap,msg);
160167
if (message_function) message_function (num,msg,ap);
161168
else printMessage (num,"ODE Message",msg,ap);
162169
}
163-
//#endif
164170

165171

166172
#endif

0 commit comments

Comments
 (0)