aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer
diff options
context:
space:
mode:
authoricculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-26 07:46:21 +0000
committericculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-26 07:46:21 +0000
commit441c7633e0aa67faa91dc5896ee83e6c29de0ba6 (patch)
treeed6f97f0be5940123e9e3f244ae91a475787ff64 /code/renderer
parentb0c6a473e2a34000db73c75bc0ff43bba45fddb2 (diff)
downloadioquake3-aero-441c7633e0aa67faa91dc5896ee83e6c29de0ba6.tar.gz
ioquake3-aero-441c7633e0aa67faa91dc5896ee83e6c29de0ba6.zip
Mac OS X work...lots of little changes that touch a lot of random places.
Still work to be done, but this at least matches the PowerPC Linux status now. MacOS-specific directory (and XCode project) is gone...this now uses SDL, OpenAL, and the Unix Makefiles. --ryan. git-svn-id: svn://svn.icculus.org/quake3/trunk@373 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/renderer')
-rw-r--r--code/renderer/qgl.h19
-rw-r--r--code/renderer/tr_curve.c2
-rw-r--r--code/renderer/tr_init.c3
-rw-r--r--code/renderer/tr_shade.c193
-rw-r--r--code/renderer/tr_shade_calc.c68
-rw-r--r--code/renderer/tr_surface.c108
-rw-r--r--code/renderer/tr_types.h5
7 files changed, 335 insertions, 63 deletions
diff --git a/code/renderer/qgl.h b/code/renderer/qgl.h
index 1db2dac..c1a2b1d 100644
--- a/code/renderer/qgl.h
+++ b/code/renderer/qgl.h
@@ -46,7 +46,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#elif defined(MACOS_X)
-#include "macosx_glimp.h"
+#include <OpenGL/OpenGL.h>
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#ifndef GL_EXT_abgr
+#include <OpenGL/glext.h>
+#endif
+
+// This can be defined to use the CGLMacro.h support which avoids looking up
+// the current context.
+//#define USE_CGLMACROS
+
+#ifdef USE_CGLMACROS
+#include "macosx_local.h"
+#define cgl_ctx glw_state._cgl_ctx
+#include <OpenGL/CGLMacro.h>
+#endif
#elif defined( __linux__ ) || defined(__FreeBSD__)
@@ -164,7 +179,7 @@ extern void ( APIENTRY * qglUnlockArraysEXT) (void);
#include "qgl_linked.h"
-#elif defined(MACOS_X)
+#elif (defined(MACOS_X) && !defined(USE_SDL_VIDEO))
// This includes #ifdefs for optional logging and GL error checking after every GL call as well as #defines to prevent incorrect usage of the non-'qgl' versions of the GL API.
#include "macosx_qgl.h"
diff --git a/code/renderer/tr_curve.c b/code/renderer/tr_curve.c
index d57c99f..7eb1b4c 100644
--- a/code/renderer/tr_curve.c
+++ b/code/renderer/tr_curve.c
@@ -113,7 +113,7 @@ static void MakeMeshNormals( int width, int height, drawVert_t ctrl[MAX_GRID_SIZ
int i, j, k, dist;
vec3_t normal;
vec3_t sum;
- int count;
+ int count = 0;
vec3_t base;
vec3_t delta;
int x, y;
diff --git a/code/renderer/tr_init.c b/code/renderer/tr_init.c
index 9f376e5..c8a2804 100644
--- a/code/renderer/tr_init.c
+++ b/code/renderer/tr_init.c
@@ -150,12 +150,15 @@ int max_polys;
cvar_t *r_maxpolyverts;
int max_polyverts;
+/* !!! FIXME: Why are these here?! */
+#if 0
void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
void ( APIENTRY * qglLockArraysEXT)( GLint, GLint);
void ( APIENTRY * qglUnlockArraysEXT) ( void );
+#endif
static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral )
{
diff --git a/code/renderer/tr_shade.c b/code/renderer/tr_shade.c
index 838e25d..043bd90 100644
--- a/code/renderer/tr_shade.c
+++ b/code/renderer/tr_shade.c
@@ -402,9 +402,9 @@ ProjectDlightTexture
Perform dynamic lighting with another rendering pass
===================
*/
-static void ProjectDlightTexture( void ) {
- int i, l;
#if idppc_altivec
+static void ProjectDlightTexture_altivec( void ) {
+ int i, l;
vec_t origin0, origin1, origin2;
float texCoords0, texCoords1;
vector float floatColorVec0, floatColorVec1;
@@ -412,13 +412,10 @@ static void ProjectDlightTexture( void ) {
vector short colorShort;
vector signed int colorInt;
vector unsigned char floatColorVecPerm, modulatePerm, colorChar;
- vector unsigned char vSel = (vector unsigned char){0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff};
-#else
- vec3_t origin;
-#endif
+ vector unsigned char vSel = VECCONST_UINT8(0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xff);
float *texCoords;
byte *colors;
byte clipBits[SHADER_MAX_VERTEXES];
@@ -429,20 +426,18 @@ static void ProjectDlightTexture( void ) {
float scale;
float radius;
vec3_t floatColor;
- float modulate;
+ float modulate = 0.0f;
if ( !backEnd.refdef.num_dlights ) {
return;
}
-#if idppc_altivec
- // There has to be a better way to do this so that floatColor
+ // There has to be a better way to do this so that floatColor
// and/or modulate are already 16-byte aligned.
floatColorVecPerm = vec_lvsl(0,(float *)floatColor);
modulatePerm = vec_lvsl(0,(float *)&modulate);
modulatePerm = (vector unsigned char)vec_splat((vector unsigned int)modulatePerm,0);
zero = (vector float)vec_splat_s8(0);
-#endif
for ( l = 0 ; l < backEnd.refdef.num_dlights ; l++ ) {
dlight_t *dl;
@@ -454,27 +449,20 @@ static void ProjectDlightTexture( void ) {
colors = colorArray[0];
dl = &backEnd.refdef.dlights[l];
-#if idppc_altivec
origin0 = dl->transformed[0];
origin1 = dl->transformed[1];
origin2 = dl->transformed[2];
-#else
- VectorCopy( dl->transformed, origin );
-#endif
radius = dl->radius;
scale = 1.0f / radius;
floatColor[0] = dl->color[0] * 255.0f;
floatColor[1] = dl->color[1] * 255.0f;
floatColor[2] = dl->color[2] * 255.0f;
-#if idppc_altivec
floatColorVec0 = vec_ld(0, floatColor);
floatColorVec1 = vec_ld(11, floatColor);
floatColorVec0 = vec_perm(floatColorVec0,floatColorVec0,floatColorVecPerm);
-#endif
for ( i = 0 ; i < tess.numVertexes ; i++, texCoords += 2, colors += 4 ) {
int clip = 0;
-#if idppc_altivec
#define DIST0 dist0
#define DIST1 dist1
#define DIST2 dist2
@@ -485,16 +473,6 @@ static void ProjectDlightTexture( void ) {
dist0 = origin0 - tess.xyz[i][0];
dist1 = origin1 - tess.xyz[i][1];
dist2 = origin2 - tess.xyz[i][2];
-#else
-#define DIST0 dist[0]
-#define DIST1 dist[1]
-#define DIST2 dist[2]
-#define TEXCOORDS0 texCoords[0]
-#define TEXCOORDS1 texCoords[1]
- vec3_t dist;
-
- VectorSubtract( origin, tess.xyz[i], dist );
-#endif
backEnd.pc.c_dlightVertexes++;
@@ -539,7 +517,6 @@ static void ProjectDlightTexture( void ) {
}
clipBits[i] = clip;
-#if idppc_altivec
modulateVec = vec_ld(0,(float *)&modulate);
modulateVec = vec_perm(modulateVec,modulateVec,modulatePerm);
colorVec = vec_madd(floatColorVec0,modulateVec,zero);
@@ -548,12 +525,150 @@ static void ProjectDlightTexture( void ) {
colorChar = vec_packsu(colorShort,colorShort); // RGBxRGBxRGBxRGBx
colorChar = vec_sel(colorChar,vSel,vSel); // RGBARGBARGBARGBA replace alpha with 255
vec_ste((vector unsigned int)colorChar,0,(unsigned int *)colors); // store color
-#else
+ }
+#undef DIST0
+#undef DIST1
+#undef DIST2
+#undef TEXCOORDS0
+#undef TEXCOORDS1
+
+ // build a list of triangles that need light
+ numIndexes = 0;
+ for ( i = 0 ; i < tess.numIndexes ; i += 3 ) {
+ int a, b, c;
+
+ a = tess.indexes[i];
+ b = tess.indexes[i+1];
+ c = tess.indexes[i+2];
+ if ( clipBits[a] & clipBits[b] & clipBits[c] ) {
+ continue; // not lighted
+ }
+ hitIndexes[numIndexes] = a;
+ hitIndexes[numIndexes+1] = b;
+ hitIndexes[numIndexes+2] = c;
+ numIndexes += 3;
+ }
+
+ if ( !numIndexes ) {
+ continue;
+ }
+
+ qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
+ qglTexCoordPointer( 2, GL_FLOAT, 0, texCoordsArray[0] );
+
+ qglEnableClientState( GL_COLOR_ARRAY );
+ qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
+
+ GL_Bind( tr.dlightImage );
+ // include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light
+ // where they aren't rendered
+ if ( dl->additive ) {
+ GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL );
+ }
+ else {
+ GL_State( GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL );
+ }
+ R_DrawElements( numIndexes, hitIndexes );
+ backEnd.pc.c_totalIndexes += numIndexes;
+ backEnd.pc.c_dlightIndexes += numIndexes;
+ }
+}
+#endif
+
+
+static void ProjectDlightTexture_scalar( void ) {
+ int i, l;
+ vec3_t origin;
+ float *texCoords;
+ byte *colors;
+ byte clipBits[SHADER_MAX_VERTEXES];
+ float texCoordsArray[SHADER_MAX_VERTEXES][2];
+ byte colorArray[SHADER_MAX_VERTEXES][4];
+ unsigned hitIndexes[SHADER_MAX_INDEXES];
+ int numIndexes;
+ float scale;
+ float radius;
+ vec3_t floatColor;
+ float modulate = 0.0f;
+
+ if ( !backEnd.refdef.num_dlights ) {
+ return;
+ }
+
+ for ( l = 0 ; l < backEnd.refdef.num_dlights ; l++ ) {
+ dlight_t *dl;
+
+ if ( !( tess.dlightBits & ( 1 << l ) ) ) {
+ continue; // this surface definately doesn't have any of this light
+ }
+ texCoords = texCoordsArray[0];
+ colors = colorArray[0];
+
+ dl = &backEnd.refdef.dlights[l];
+ VectorCopy( dl->transformed, origin );
+ radius = dl->radius;
+ scale = 1.0f / radius;
+
+ floatColor[0] = dl->color[0] * 255.0f;
+ floatColor[1] = dl->color[1] * 255.0f;
+ floatColor[2] = dl->color[2] * 255.0f;
+ for ( i = 0 ; i < tess.numVertexes ; i++, texCoords += 2, colors += 4 ) {
+ int clip = 0;
+#define DIST0 dist[0]
+#define DIST1 dist[1]
+#define DIST2 dist[2]
+#define TEXCOORDS0 texCoords[0]
+#define TEXCOORDS1 texCoords[1]
+ vec3_t dist;
+
+ VectorSubtract( origin, tess.xyz[i], dist );
+
+ backEnd.pc.c_dlightVertexes++;
+
+ TEXCOORDS0 = 0.5f + DIST0 * scale;
+ TEXCOORDS1 = 0.5f + DIST1 * scale;
+
+ if( !r_dlightBacks->integer &&
+ // dist . tess.normal[i]
+ ( DIST0 * tess.normal[i][0] +
+ DIST1 * tess.normal[i][1] +
+ DIST2 * tess.normal[i][2] ) < 0.0f ) {
+ clip = 63;
+ } else {
+ if ( TEXCOORDS0 < 0.0f ) {
+ clip |= 1;
+ } else if ( TEXCOORDS0 > 1.0f ) {
+ clip |= 2;
+ }
+ if ( TEXCOORDS1 < 0.0f ) {
+ clip |= 4;
+ } else if ( TEXCOORDS1 > 1.0f ) {
+ clip |= 8;
+ }
+ texCoords[0] = TEXCOORDS0;
+ texCoords[1] = TEXCOORDS1;
+
+ // modulate the strength based on the height and color
+ if ( DIST2 > radius ) {
+ clip |= 16;
+ modulate = 0.0f;
+ } else if ( DIST2 < -radius ) {
+ clip |= 32;
+ modulate = 0.0f;
+ } else {
+ DIST2 = Q_fabs(DIST2);
+ if ( DIST2 < radius * 0.5f ) {
+ modulate = 1.0f;
+ } else {
+ modulate = 2.0f * (radius - DIST2) * scale;
+ }
+ }
+ }
+ clipBits[i] = clip;
colors[0] = myftol(floatColor[0] * modulate);
colors[1] = myftol(floatColor[1] * modulate);
colors[2] = myftol(floatColor[2] * modulate);
colors[3] = 255;
-#endif
}
#undef DIST0
#undef DIST1
@@ -603,6 +718,18 @@ static void ProjectDlightTexture( void ) {
}
}
+static void ProjectDlightTexture( void ) {
+ #if idppc_altivec
+ extern cvar_t *com_altivec;
+ if (com_altivec->integer) {
+ // must be in a seperate function or G3 systems will crash.
+ ProjectDlightTexture_altivec();
+ return;
+ }
+ #endif
+ ProjectDlightTexture_scalar();
+}
+
/*
===================
diff --git a/code/renderer/tr_shade_calc.c b/code/renderer/tr_shade_calc.c
index 27bb89a..9e0c06a 100644
--- a/code/renderer/tr_shade_calc.c
+++ b/code/renderer/tr_shade_calc.c
@@ -1097,22 +1097,19 @@ void RB_CalcSpecularAlpha( unsigned char *alphas ) {
**
** The basic vertex lighting calc
*/
-void RB_CalcDiffuseColor( unsigned char *colors )
+#if idppc_altivec
+static void RB_CalcDiffuseColor_altivec( unsigned char *colors )
{
- int i, j;
+ int i;
float *v, *normal;
- float incoming;
trRefEntity_t *ent;
int ambientLightInt;
- vec3_t ambientLight;
vec3_t lightDir;
- vec3_t directedLight;
int numVertexes;
-#if idppc_altivec
- vector unsigned char vSel = (vector unsigned char){0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0xff};
+ vector unsigned char vSel = VECCONST_UINT8(0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xff);
vector float ambientLightVec;
vector float directedLightVec;
vector float lightDirVec;
@@ -1122,10 +1119,8 @@ void RB_CalcDiffuseColor( unsigned char *colors )
vector signed int jVecInt;
vector signed short jVecShort;
vector unsigned char jVecChar, normalPerm;
-#endif
ent = backEnd.currentEntity;
ambientLightInt = ent->ambientLightInt;
-#if idppc_altivec
// A lot of this could be simplified if we made sure
// entities light info was 16-byte aligned.
jVecChar = vec_lvsl(0, ent->ambientLight);
@@ -1145,21 +1140,13 @@ void RB_CalcDiffuseColor( unsigned char *colors )
zero = (vector float)vec_splat_s8(0);
VectorCopy( ent->lightDir, lightDir );
-#else
- VectorCopy( ent->ambientLight, ambientLight );
- VectorCopy( ent->directedLight, directedLight );
- VectorCopy( ent->lightDir, lightDir );
-#endif
v = tess.xyz[0];
normal = tess.normal[0];
-#if idppc_altivec
normalPerm = vec_lvsl(0,normal);
-#endif
numVertexes = tess.numVertexes;
for (i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) {
-#if idppc_altivec
normalVec0 = vec_ld(0,(vector float *)normal);
normalVec1 = vec_ld(11,(vector float *)normal);
normalVec0 = vec_perm(normalVec0,normalVec1,normalPerm);
@@ -1177,7 +1164,32 @@ void RB_CalcDiffuseColor( unsigned char *colors )
jVecChar = vec_packsu(jVecShort,jVecShort); // RGBxRGBxRGBxRGBx
jVecChar = vec_sel(jVecChar,vSel,vSel); // RGBARGBARGBARGBA replace alpha with 255
vec_ste((vector unsigned int)jVecChar,0,(unsigned int *)&colors[i*4]); // store color
-#else
+ }
+}
+#endif
+
+static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
+{
+ int i, j;
+ float *v, *normal;
+ float incoming;
+ trRefEntity_t *ent;
+ int ambientLightInt;
+ vec3_t ambientLight;
+ vec3_t lightDir;
+ vec3_t directedLight;
+ int numVertexes;
+ ent = backEnd.currentEntity;
+ ambientLightInt = ent->ambientLightInt;
+ VectorCopy( ent->ambientLight, ambientLight );
+ VectorCopy( ent->directedLight, directedLight );
+ VectorCopy( ent->lightDir, lightDir );
+
+ v = tess.xyz[0];
+ normal = tess.normal[0];
+
+ numVertexes = tess.numVertexes;
+ for (i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) {
incoming = DotProduct (normal, lightDir);
if ( incoming <= 0 ) {
*(int *)&colors[i*4] = ambientLightInt;
@@ -1202,7 +1214,19 @@ void RB_CalcDiffuseColor( unsigned char *colors )
colors[i*4+2] = j;
colors[i*4+3] = 255;
-#endif
}
}
+void RB_CalcDiffuseColor( unsigned char *colors )
+{
+ #if idppc_altivec
+ extern cvar_t *com_altivec;
+ if (com_altivec->integer) {
+ // must be in a seperate function or G3 systems will crash.
+ RB_CalcDiffuseColor_altivec( colors );
+ return;
+ }
+ #endif
+ RB_CalcDiffuseColor_scalar( colors );
+}
+
diff --git a/code/renderer/tr_surface.c b/code/renderer/tr_surface.c
index 66d5b93..b5cb0c0 100644
--- a/code/renderer/tr_surface.c
+++ b/code/renderer/tr_surface.c
@@ -610,7 +610,8 @@ static void VectorArrayNormalize(vec4_t *normals, unsigned int count)
/*
** LerpMeshVertexes
*/
-static void LerpMeshVertexes (md3Surface_t *surf, float backlerp)
+#if idppc_altivec
+static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp)
{
short *oldXyz, *newXyz, *oldNormals, *newNormals;
float *outXyz, *outNormal;
@@ -633,7 +634,6 @@ static void LerpMeshVertexes (md3Surface_t *surf, float backlerp)
numVerts = surf->numVerts;
if ( backlerp == 0 ) {
-#if idppc_altivec
vector signed short newNormalsVec0;
vector signed short newNormalsVec1;
vector signed int newNormalsIntVec;
@@ -687,8 +687,80 @@ static void LerpMeshVertexes (md3Surface_t *surf, float backlerp)
vec_ste(newNormalsFloatVec,4,outXyz);
vec_ste(newNormalsFloatVec,8,outXyz);
}
-
-#else
+ } else {
+ //
+ // interpolate and copy the vertex and normal
+ //
+ oldXyz = (short *)((byte *)surf + surf->ofsXyzNormals)
+ + (backEnd.currentEntity->e.oldframe * surf->numVerts * 4);
+ oldNormals = oldXyz + 3;
+
+ oldXyzScale = MD3_XYZ_SCALE * backlerp;
+ oldNormalScale = backlerp;
+
+ for (vertNum=0 ; vertNum < numVerts ; vertNum++,
+ oldXyz += 4, newXyz += 4, oldNormals += 4, newNormals += 4,
+ outXyz += 4, outNormal += 4)
+ {
+ vec3_t uncompressedOldNormal, uncompressedNewNormal;
+
+ // interpolate the xyz
+ outXyz[0] = oldXyz[0] * oldXyzScale + newXyz[0] * newXyzScale;
+ outXyz[1] = oldXyz[1] * oldXyzScale + newXyz[1] * newXyzScale;
+ outXyz[2] = oldXyz[2] * oldXyzScale + newXyz[2] * newXyzScale;
+
+ // FIXME: interpolate lat/long instead?
+ lat = ( newNormals[0] >> 8 ) & 0xff;
+ lng = ( newNormals[0] & 0xff );
+ lat *= 4;
+ lng *= 4;
+ uncompressedNewNormal[0] = tr.sinTable[(lat+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK] * tr.sinTable[lng];
+ uncompressedNewNormal[1] = tr.sinTable[lat] * tr.sinTable[lng];
+ uncompressedNewNormal[2] = tr.sinTable[(lng+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK];
+
+ lat = ( oldNormals[0] >> 8 ) & 0xff;
+ lng = ( oldNormals[0] & 0xff );
+ lat *= 4;
+ lng *= 4;
+
+ uncompressedOldNormal[0] = tr.sinTable[(lat+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK] * tr.sinTable[lng];
+ uncompressedOldNormal[1] = tr.sinTable[lat] * tr.sinTable[lng];
+ uncompressedOldNormal[2] = tr.sinTable[(lng+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK];
+
+ outNormal[0] = uncompressedOldNormal[0] * oldNormalScale + uncompressedNewNormal[0] * newNormalScale;
+ outNormal[1] = uncompressedOldNormal[1] * oldNormalScale + uncompressedNewNormal[1] * newNormalScale;
+ outNormal[2] = uncompressedOldNormal[2] * oldNormalScale + uncompressedNewNormal[2] * newNormalScale;
+
+// VectorNormalize (outNormal);
+ }
+ VectorArrayNormalize((vec4_t *)tess.normal[tess.numVertexes], numVerts);
+ }
+}
+#endif
+
+static void LerpMeshVertexes_scalar(md3Surface_t *surf, float backlerp)
+{
+ short *oldXyz, *newXyz, *oldNormals, *newNormals;
+ float *outXyz, *outNormal;
+ float oldXyzScale, newXyzScale;
+ float oldNormalScale, newNormalScale;
+ int vertNum;
+ unsigned lat, lng;
+ int numVerts;
+
+ outXyz = tess.xyz[tess.numVertexes];
+ outNormal = tess.normal[tess.numVertexes];
+
+ newXyz = (short *)((byte *)surf + surf->ofsXyzNormals)
+ + (backEnd.currentEntity->e.frame * surf->numVerts * 4);
+ newNormals = newXyz + 3;
+
+ newXyzScale = MD3_XYZ_SCALE * (1.0 - backlerp);
+ newNormalScale = 1.0 - backlerp;
+
+ numVerts = surf->numVerts;
+
+ if ( backlerp == 0 ) {
//
// just copy the vertexes
//
@@ -714,7 +786,6 @@ static void LerpMeshVertexes (md3Surface_t *surf, float backlerp)
outNormal[1] = tr.sinTable[lat] * tr.sinTable[lng];
outNormal[2] = tr.sinTable[(lng+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK];
}
-#endif
} else {
//
// interpolate and copy the vertex and normal
@@ -765,6 +836,33 @@ static void LerpMeshVertexes (md3Surface_t *surf, float backlerp)
}
}
+static void LerpMeshVertexes(md3Surface_t *surf, float backlerp)
+{
+ #if idppc_altivec
+
+ // !!! FIXME: figure out what's broken and remove this.
+ #ifndef NDEBUG
+ static int already_complained = 0;
+ if (!already_complained)
+ {
+ already_complained = 1;
+ Com_Printf("WARNING! FIXME! Altivec mesh lerping broken in debug builds!\n");
+ }
+ #else
+ extern cvar_t *com_altivec;
+ if (com_altivec->integer) {
+ // must be in a seperate function or G3 systems will crash.
+ LerpMeshVertexes_altivec( surf, backlerp );
+ return;
+ }
+ #endif
+
+ #endif // idppc_altivec
+
+ LerpMeshVertexes_scalar( surf, backlerp );
+}
+
+
/*
=============
RB_SurfaceMesh
diff --git a/code/renderer/tr_types.h b/code/renderer/tr_types.h
index 8c16113..12b526e 100644
--- a/code/renderer/tr_types.h
+++ b/code/renderer/tr_types.h
@@ -218,6 +218,11 @@ typedef struct {
#define _3DFX_DRIVER_NAME "3dfxvgl"
#define OPENGL_DRIVER_NAME "opengl32"
+#elif defined(MACOS_X)
+
+#define _3DFX_DRIVER_NAME "libMesaVoodooGL.dylib"
+#define OPENGL_DRIVER_NAME "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
+
#else
#define _3DFX_DRIVER_NAME "libMesaVoodooGL.so"