Skip to content

Commit

Permalink
ODE: replaced pos and R with posr
Browse files Browse the repository at this point in the history
Syncronised with ODE 0.6 files:
error.cpp
collision_quadtreespace.cpp
timer.cpp
util.cpp
stepfast.cpp
  • Loading branch information
Xottab-DUTY committed Jun 16, 2018
1 parent f64580e commit 28fd68a
Show file tree
Hide file tree
Showing 16 changed files with 273 additions and 265 deletions.
8 changes: 4 additions & 4 deletions Externals/ode/ode/src/collision_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ void dGeomSetBody (dxGeom *g, dxBody *b)

if (b) {
if (!g->body) dFree (g->pos,sizeof(dxPosR));
g->pos = b->pos;
g->R = b->R;
g->pos = b->posr.pos;
g->R = b->posr.R;
dGeomMoved (g);
if (g->body != b) {
g->bodyRemove();
Expand All @@ -326,8 +326,8 @@ void dGeomSetBody (dxGeom *g, dxBody *b)
dxPosR *pr = (dxPosR*) dAlloc (sizeof(dxPosR));
g->pos = pr->pos;
g->R = pr->R;
memcpy (g->pos,g->body->pos,sizeof(dVector3));
memcpy (g->R,g->body->R,sizeof(dMatrix3));
memcpy (g->pos,g->body->posr.pos,sizeof(dVector3));
memcpy (g->R,g->body->posr.R,sizeof(dMatrix3));
g->bodyRemove();
}
// dGeomMoved() should not be called if the body is being set to 0, as the
Expand Down
8 changes: 0 additions & 8 deletions Externals/ode/ode/src/collision_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ internal data structures and functions for collision detection.
//****************************************************************************
// geometry object base class

// position vector and rotation matrix for geometry objects that are not
// connected to bodies.

struct dxPosR {
dVector3 pos;
dMatrix3 R;
};


// geom flags.
//
Expand Down
7 changes: 4 additions & 3 deletions Externals/ode/ode/src/collision_quadtreespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ dxQuadTreeSpace::dxQuadTreeSpace(dSpaceID _space, dVector3 Center, dVector3 Exte

int BlockCount = 0;
for (int i = 0; i <= Depth; i++){
BlockCount += (int)powf(SPLITS, i);
BlockCount += (int)pow((dReal)SPLITS, i);
}

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

int BlockCount = 0;
for (int i = 0; i < Depth; i++){
BlockCount += (int)powf(SPLITS, i);
BlockCount += (int)pow((dReal)SPLITS, i);
}

dFree(Blocks, BlockCount * sizeof(Block));
Expand Down Expand Up @@ -495,7 +495,8 @@ void dxQuadTreeSpace::remove(dxGeom* g){
for (int i = 0; i < DirtyList.size(); i++){
if (DirtyList[i] == g){
DirtyList.remove(i);
break;
// (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
--i;
}
}

Expand Down
22 changes: 14 additions & 8 deletions Externals/ode/ode/src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <ode/config.h>
#include <ode/error.h>

#pragma warning(disable:4996)

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

#ifdef WIN32

// isn't cygwin annoying!
#ifdef CYGWIN
#define _snprintf snprintf
#define _vsnprintf vsnprintf
#endif


#include "windows.h"

//#ifdef _DEBUG_
void _cdecl dError (int num, const char *msg, ...)

extern "C" void dError (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
Expand All @@ -138,29 +144,29 @@ void _cdecl dError (int num, const char *msg, ...)
}


void _cdecl dDebug (int num, const char *msg, ...)
extern "C" void dDebug (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (debug_function) debug_function (num,msg,ap);
else {
char s[1000],title[100];
_snprintf (title,sizeof(title),"ODE INTERNAL ERROR %d",num);
_vsnprintf (s,sizeof(s),msg,ap);
_snprintf (title,sizeof(title),"ODE INTERNAL ERROR %d",num);
_vsnprintf (s,sizeof(s),msg,ap);
s[sizeof(s)-1] = 0;
MessageBox(0,s,title,MB_OK | MB_ICONSTOP);
}
abort();
}

void _cdecl dMessage (int num, const char *msg, ...)

extern "C" void dMessage (int num, const char *msg, ...)
{
va_list ap;
va_start (ap,msg);
if (message_function) message_function (num,msg,ap);
else printMessage (num,"ODE Message",msg,ap);
}
//#endif


#endif
Loading

0 comments on commit 28fd68a

Please sign in to comment.