Skip to content

Commit

Permalink
Merge github.com:OpenXRay/xray-16 into linux
Browse files Browse the repository at this point in the history
xrCore: implement CPU::Detect() (Unfinished!)
  • Loading branch information
eagleivg committed Jun 20, 2018
2 parents ae9eb44 + dae188f commit 80b3c99
Show file tree
Hide file tree
Showing 95 changed files with 1,867 additions and 1,181 deletions.
51 changes: 20 additions & 31 deletions Externals/ode/include/ode/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,29 @@ extern "C" {

#include <math.h>



#if defined(WIN32) && (defined(MSVC) || defined(MINGW))

static union { unsigned char __c[4]; float __f; } __ode_huge_valf =

{{0,0,0x80,0x7f}};

#define _INFINITY4 (__ode_huge_valf.__f)

static union { unsigned char __c[8]; double __d; } __ode_huge_val =

{{0,0,0,0,0,0,0xf0,0x7f }};

#define _INFINITY8 (__ode_huge_val.__d)

/* Define the dInfinity macro */
#ifdef INFINITY
#ifdef dSINGLE
#define dInfinity ((float)INFINITY)
#else

#define _INFINITY8 HUGE_VAL

#define _INFINITY4 HUGE_VALF

#define dInfinity ((double)INFINITY)
#endif



#if defined(dSINGLE)

#define dInfinity _INFINITY4

#elif defined(HUGE_VAL)
#ifdef dSINGLE
#ifdef HUGE_VALF
#define dInfinity HUGE_VALF
#else

#define dInfinity _INFINITY8

#define dInfinity ((float)HUGE_VAL)
#endif
#else
#define dInfinity HUGE_VAL
#endif
#else
#ifdef dSINGLE
#define dInfinity ((float)(1.0/0.0))
#else
#define dInfinity (1.0/0.0)
#endif
#endif


Expand Down
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 @@ -120,10 +119,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 @@ -139,29 +145,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
2 changes: 1 addition & 1 deletion Externals/ode/ode/src/export-dif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ void dWorldExportDIF (dWorldID w, FILE *file, const char *prefix)
b->tag = num;
fprintf (file,"%sbody[%d] = dynamics.body {\n\tworld = %sworld,\n",prefix,num,prefix);
c.indent++;
c.print ("pos",b->pos);
c.print ("pos",b->posr.pos);
c.print ("q",b->q,4);
c.print ("lvel",b->lvel);
c.print ("avel",b->avel);
Expand Down
Loading

0 comments on commit 80b3c99

Please sign in to comment.