diff options
Diffstat (limited to 'src/renderer')
-rw-r--r-- | src/renderer/tr_light.c | 6 | ||||
-rw-r--r-- | src/renderer/tr_local.h | 8 | ||||
-rw-r--r-- | src/renderer/tr_mesh.c | 2 | ||||
-rw-r--r-- | src/renderer/tr_shade.c | 8 | ||||
-rw-r--r-- | src/renderer/tr_shade_calc.c | 25 | ||||
-rw-r--r-- | src/renderer/tr_sky.c | 8 |
6 files changed, 17 insertions, 40 deletions
diff --git a/src/renderer/tr_light.c b/src/renderer/tr_light.c index 18dea318..05aca8b8 100644 --- a/src/renderer/tr_light.c +++ b/src/renderer/tr_light.c @@ -360,9 +360,9 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) { } // save out the byte packet version - ((byte *)&ent->ambientLightInt)[0] = myftol( ent->ambientLight[0] ); - ((byte *)&ent->ambientLightInt)[1] = myftol( ent->ambientLight[1] ); - ((byte *)&ent->ambientLightInt)[2] = myftol( ent->ambientLight[2] ); + ((byte *)&ent->ambientLightInt)[0] = Q_ftol(ent->ambientLight[0]); + ((byte *)&ent->ambientLightInt)[1] = Q_ftol(ent->ambientLight[1]); + ((byte *)&ent->ambientLightInt)[2] = Q_ftol(ent->ambientLight[2]); ((byte *)&ent->ambientLightInt)[3] = 0xff; // transform the direction to local space diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h index ef49e217..1dea4bb3 100644 --- a/src/renderer/tr_local.h +++ b/src/renderer/tr_local.h @@ -35,14 +35,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define GL_INDEX_TYPE GL_UNSIGNED_INT typedef unsigned int glIndex_t; -// fast float to int conversion -#if id386 && !defined(__GNUC__) -long myftol( float f ); -#else -#define myftol(x) ((int)(x)) -#endif - - // everything that is needed by the backend needs // to be double buffered to allow it to run in // parallel on a dual cpu machine diff --git a/src/renderer/tr_mesh.c b/src/renderer/tr_mesh.c index ddcc62f7..446ee836 100644 --- a/src/renderer/tr_mesh.c +++ b/src/renderer/tr_mesh.c @@ -219,7 +219,7 @@ int R_ComputeLOD( trRefEntity_t *ent ) { } flod *= tr.currentModel->numLods; - lod = myftol( flod ); + lod = Q_ftol(flod); if ( lod < 0 ) { diff --git a/src/renderer/tr_shade.c b/src/renderer/tr_shade.c index b40a06c5..f12519b4 100644 --- a/src/renderer/tr_shade.c +++ b/src/renderer/tr_shade.c @@ -234,7 +234,7 @@ static void R_BindAnimatedImage( textureBundle_t *bundle ) { // it is necessary to do this messy calc to make sure animations line up // exactly with waveforms of the same frequency - index = myftol( tess.shaderTime * bundle->imageAnimationSpeed * FUNCTABLE_SIZE ); + index = Q_ftol(tess.shaderTime * bundle->imageAnimationSpeed * FUNCTABLE_SIZE); index >>= FUNCTABLE_SIZE2; if ( index < 0 ) { @@ -690,9 +690,9 @@ static void ProjectDlightTexture_scalar( void ) { } } clipBits[i] = clip; - colors[0] = myftol(floatColor[0] * modulate); - colors[1] = myftol(floatColor[1] * modulate); - colors[2] = myftol(floatColor[2] * modulate); + colors[0] = Q_ftol(floatColor[0] * modulate); + colors[1] = Q_ftol(floatColor[1] * modulate); + colors[2] = Q_ftol(floatColor[2] * modulate); colors[3] = 255; } diff --git a/src/renderer/tr_shade_calc.c b/src/renderer/tr_shade_calc.c index 13fcf0b5..8d02177b 100644 --- a/src/renderer/tr_shade_calc.c +++ b/src/renderer/tr_shade_calc.c @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif -#define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ myftol( ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude)) +#define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ Q_ftol( ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude)) static float *TableForFunc( genFunc_t func ) { @@ -700,7 +700,7 @@ void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors ) glow = 1; } - v = myftol( 255 * glow ); + v = Q_ftol(255 * glow); color[0] = color[1] = color[2] = v; color[3] = 255; v = *(int *)color; @@ -1019,21 +1019,6 @@ void RB_CalcRotateTexCoords( float degsPerSecond, float *st ) } - - - - -#if id386 && !defined(__GNUC__) - -long myftol( float f ) { - static int tmp; - __asm fld f - __asm fistp tmp - __asm mov eax, tmp -} - -#endif - /* ** RB_CalcSpecularAlpha ** @@ -1196,19 +1181,19 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors ) *(int *)&colors[i*4] = ambientLightInt; continue; } - j = myftol( ambientLight[0] + incoming * directedLight[0] ); + j = Q_ftol(ambientLight[0] + incoming * directedLight[0]); if ( j > 255 ) { j = 255; } colors[i*4+0] = j; - j = myftol( ambientLight[1] + incoming * directedLight[1] ); + j = Q_ftol(ambientLight[1] + incoming * directedLight[1]); if ( j > 255 ) { j = 255; } colors[i*4+1] = j; - j = myftol( ambientLight[2] + incoming * directedLight[2] ); + j = Q_ftol(ambientLight[2] + incoming * directedLight[2]); if ( j > 255 ) { j = 255; } diff --git a/src/renderer/tr_sky.c b/src/renderer/tr_sky.c index 6ab8aa6e..5c7788c0 100644 --- a/src/renderer/tr_sky.c +++ b/src/renderer/tr_sky.c @@ -554,10 +554,10 @@ static void FillCloudBox( const shader_t *shader, int stage ) continue; } - sky_mins_subd[0] = myftol( sky_mins[0][i] * HALF_SKY_SUBDIVISIONS ); - sky_mins_subd[1] = myftol( sky_mins[1][i] * HALF_SKY_SUBDIVISIONS ); - sky_maxs_subd[0] = myftol( sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS ); - sky_maxs_subd[1] = myftol( sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS ); + sky_mins_subd[0] = Q_ftol(sky_mins[0][i] * HALF_SKY_SUBDIVISIONS); + sky_mins_subd[1] = Q_ftol(sky_mins[1][i] * HALF_SKY_SUBDIVISIONS); + sky_maxs_subd[0] = Q_ftol(sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS); + sky_maxs_subd[1] = Q_ftol(sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS); if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS ) sky_mins_subd[0] = -HALF_SKY_SUBDIVISIONS; |