Skip to content

Commit 80b3c99

Browse files
committed
Merge github.com:OpenXRay/xray-16 into linux
xrCore: implement CPU::Detect() (Unfinished!)
2 parents ae9eb44 + dae188f commit 80b3c99

File tree

95 files changed

+1867
-1181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1867
-1181
lines changed

Externals/ode/include/ode/config.h

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,40 +60,29 @@ extern "C" {
6060

6161
#include <math.h>
6262

63-
64-
65-
#if defined(WIN32) && (defined(MSVC) || defined(MINGW))
66-
67-
static union { unsigned char __c[4]; float __f; } __ode_huge_valf =
68-
69-
{{0,0,0x80,0x7f}};
70-
71-
#define _INFINITY4 (__ode_huge_valf.__f)
72-
73-
static union { unsigned char __c[8]; double __d; } __ode_huge_val =
74-
75-
{{0,0,0,0,0,0,0xf0,0x7f }};
76-
77-
#define _INFINITY8 (__ode_huge_val.__d)
78-
63+
/* Define the dInfinity macro */
64+
#ifdef INFINITY
65+
#ifdef dSINGLE
66+
#define dInfinity ((float)INFINITY)
7967
#else
80-
81-
#define _INFINITY8 HUGE_VAL
82-
83-
#define _INFINITY4 HUGE_VALF
84-
68+
#define dInfinity ((double)INFINITY)
8569
#endif
86-
87-
88-
89-
#if defined(dSINGLE)
90-
91-
#define dInfinity _INFINITY4
92-
70+
#elif defined(HUGE_VAL)
71+
#ifdef dSINGLE
72+
#ifdef HUGE_VALF
73+
#define dInfinity HUGE_VALF
9374
#else
94-
95-
#define dInfinity _INFINITY8
96-
75+
#define dInfinity ((float)HUGE_VAL)
76+
#endif
77+
#else
78+
#define dInfinity HUGE_VAL
79+
#endif
80+
#else
81+
#ifdef dSINGLE
82+
#define dInfinity ((float)(1.0/0.0))
83+
#else
84+
#define dInfinity (1.0/0.0)
85+
#endif
9786
#endif
9887

9988

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;
@@ -120,10 +119,17 @@ extern "C" void dMessage (int num, const char *msg, ...)
120119

121120
#ifdef WIN32
122121

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

125-
//#ifdef _DEBUG_
126-
void _cdecl dError (int num, const char *msg, ...)
131+
132+
extern "C" void dError (int num, const char *msg, ...)
127133
{
128134
va_list ap;
129135
va_start (ap,msg);
@@ -139,29 +145,29 @@ void _cdecl dError (int num, const char *msg, ...)
139145
}
140146

141147

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

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

166172

167173
#endif

Externals/ode/ode/src/export-dif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ void dWorldExportDIF (dWorldID w, FILE *file, const char *prefix)
448448
b->tag = num;
449449
fprintf (file,"%sbody[%d] = dynamics.body {\n\tworld = %sworld,\n",prefix,num,prefix);
450450
c.indent++;
451-
c.print ("pos",b->pos);
451+
c.print ("pos",b->posr.pos);
452452
c.print ("q",b->q,4);
453453
c.print ("lvel",b->lvel);
454454
c.print ("avel",b->avel);

0 commit comments

Comments
 (0)