aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-26 15:01:28 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-26 15:01:28 +0000
commit59b6a5ccdb397cdd3a47c97d6cda5438a225a338 (patch)
tree2fab1bfb840fc08009145560102c678ccf79ed2c /code/renderer
parent26b9cf5a0ca15a80690060daf5f3cbf0576ade28 (diff)
downloadioquake3-aero-59b6a5ccdb397cdd3a47c97d6cda5438a225a338.tar.gz
ioquake3-aero-59b6a5ccdb397cdd3a47c97d6cda5438a225a338.zip
* Disable ccache by default. If you want it, add USE_CCACHE=1 to Makefile.local
* Remove -gfull from linux section in Makefile -- it's darwin only * Cast away some warnings that surfaced from using "new" AL headers * Various whitespace and consistency fixes git-svn-id: svn://svn.icculus.org/quake3/trunk@375 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/renderer')
-rw-r--r--code/renderer/tr_shade.c101
-rw-r--r--code/renderer/tr_shade_calc.c17
-rw-r--r--code/renderer/tr_surface.c39
3 files changed, 65 insertions, 92 deletions
diff --git a/code/renderer/tr_shade.c b/code/renderer/tr_shade.c
index 043bd90..6f22b7c 100644
--- a/code/renderer/tr_shade.c
+++ b/code/renderer/tr_shade.c
@@ -463,11 +463,6 @@ static void ProjectDlightTexture_altivec( void ) {
floatColorVec0 = vec_perm(floatColorVec0,floatColorVec0,floatColorVecPerm);
for ( i = 0 ; i < tess.numVertexes ; i++, texCoords += 2, colors += 4 ) {
int clip = 0;
-#define DIST0 dist0
-#define DIST1 dist1
-#define DIST2 dist2
-#define TEXCOORDS0 texCoords0
-#define TEXCOORDS1 texCoords1
vec_t dist0, dist1, dist2;
dist0 = origin0 - tess.xyz[i][0];
@@ -476,42 +471,42 @@ static void ProjectDlightTexture_altivec( void ) {
backEnd.pc.c_dlightVertexes++;
- TEXCOORDS0 = 0.5f + DIST0 * scale;
- TEXCOORDS1 = 0.5f + DIST1 * scale;
+ 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 ) {
+ ( dist0 * tess.normal[i][0] +
+ dist1 * tess.normal[i][1] +
+ dist2 * tess.normal[i][2] ) < 0.0f ) {
clip = 63;
} else {
- if ( TEXCOORDS0 < 0.0f ) {
+ if ( texCoords0 < 0.0f ) {
clip |= 1;
- } else if ( TEXCOORDS0 > 1.0f ) {
+ } else if ( texCoords0 > 1.0f ) {
clip |= 2;
}
- if ( TEXCOORDS1 < 0.0f ) {
+ if ( texCoords1 < 0.0f ) {
clip |= 4;
- } else if ( TEXCOORDS1 > 1.0f ) {
+ } else if ( texCoords1 > 1.0f ) {
clip |= 8;
}
- texCoords[0] = TEXCOORDS0;
- texCoords[1] = TEXCOORDS1;
+ texCoords[0] = texCoords0;
+ texCoords[1] = texCoords1;
// modulate the strength based on the height and color
- if ( DIST2 > radius ) {
+ if ( dist2 > radius ) {
clip |= 16;
modulate = 0.0f;
- } else if ( DIST2 < -radius ) {
+ } else if ( dist2 < -radius ) {
clip |= 32;
modulate = 0.0f;
} else {
- DIST2 = Q_fabs(DIST2);
- if ( DIST2 < radius * 0.5f ) {
+ dist2 = Q_fabs(dist2);
+ if ( dist2 < radius * 0.5f ) {
modulate = 1.0f;
} else {
- modulate = 2.0f * (radius - DIST2) * scale;
+ modulate = 2.0f * (radius - dist2) * scale;
}
}
}
@@ -526,11 +521,6 @@ static void ProjectDlightTexture_altivec( void ) {
colorChar = vec_sel(colorChar,vSel,vSel); // RGBARGBARGBARGBA replace alpha with 255
vec_ste((vector unsigned int)colorChar,0,(unsigned int *)colors); // store color
}
-#undef DIST0
-#undef DIST1
-#undef DIST2
-#undef TEXCOORDS0
-#undef TEXCOORDS1
// build a list of triangles that need light
numIndexes = 0;
@@ -614,53 +604,48 @@ static void ProjectDlightTexture_scalar( void ) {
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;
+ texCoords[0] = 0.5f + dist[0] * scale;
+ texCoords[1] = 0.5f + dist[1] * 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 ) {
+ ( dist[0] * tess.normal[i][0] +
+ dist[1] * tess.normal[i][1] +
+ dist[2] * tess.normal[i][2] ) < 0.0f ) {
clip = 63;
} else {
- if ( TEXCOORDS0 < 0.0f ) {
+ if ( texCoords[0] < 0.0f ) {
clip |= 1;
- } else if ( TEXCOORDS0 > 1.0f ) {
+ } else if ( texCoords[0] > 1.0f ) {
clip |= 2;
}
- if ( TEXCOORDS1 < 0.0f ) {
+ if ( texCoords[1] < 0.0f ) {
clip |= 4;
- } else if ( TEXCOORDS1 > 1.0f ) {
+ } else if ( texCoords[1] > 1.0f ) {
clip |= 8;
}
- texCoords[0] = TEXCOORDS0;
- texCoords[1] = TEXCOORDS1;
+ texCoords[0] = texCoords[0];
+ texCoords[1] = texCoords[1];
// modulate the strength based on the height and color
- if ( DIST2 > radius ) {
+ if ( dist[2] > radius ) {
clip |= 16;
modulate = 0.0f;
- } else if ( DIST2 < -radius ) {
+ } else if ( dist[2] < -radius ) {
clip |= 32;
modulate = 0.0f;
} else {
- DIST2 = Q_fabs(DIST2);
- if ( DIST2 < radius * 0.5f ) {
+ dist[2] = Q_fabs(dist[2]);
+ if ( dist[2] < radius * 0.5f ) {
modulate = 1.0f;
} else {
- modulate = 2.0f * (radius - DIST2) * scale;
+ modulate = 2.0f * (radius - dist[2]) * scale;
}
}
}
@@ -670,11 +655,6 @@ static void ProjectDlightTexture_scalar( void ) {
colors[2] = myftol(floatColor[2] * modulate);
colors[3] = 255;
}
-#undef DIST0
-#undef DIST1
-#undef DIST2
-#undef TEXCOORDS0
-#undef TEXCOORDS1
// build a list of triangles that need light
numIndexes = 0;
@@ -719,15 +699,14 @@ static void ProjectDlightTexture_scalar( 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();
+#if idppc_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 9e0c06a..15fbe77 100644
--- a/code/renderer/tr_shade_calc.c
+++ b/code/renderer/tr_shade_calc.c
@@ -1219,14 +1219,13 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
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 );
+#if idppc_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 b5cb0c0..04e26d1 100644
--- a/code/renderer/tr_surface.c
+++ b/code/renderer/tr_surface.c
@@ -838,28 +838,23 @@ static void LerpMeshVertexes_scalar(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 );
+#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
+ 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 );
}