- r_leifx cvar that controls the magnitude of faking a certain ubiquitous video card, requires leifx_filter/dither/gamma shaders (not committed yet)

- r_slowness, r_slowness_cpu and r_slowness_gpu cvars that sort of fake system bottlenecks. not useful for playing
- more r_modes, no standards followed.
- some additional but dummied out model shading functions
This commit is contained in:
leilei-
2014-03-28 07:05:56 -04:00
parent c356889cfe
commit 7c0facdacc
6 changed files with 435 additions and 16 deletions

View File

@@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
backEndData_t *backEndData;
backEndState_t backEnd;
static float s_flipMatrix[16] = {
// convert from our coordinate system (looking down X)
// to OpenGL's coordinate system (looking down -Z)
@@ -60,7 +59,8 @@ void GL_Bind( image_t *image ) {
qglBindTexture (GL_TEXTURE_2D, texnum);
}
}
void R_LeiFXPostprocessDitherScreen( void );
void R_LeiFXPostprocessFilterScreen( void );
/*
** GL_SelectTexture
*/
@@ -1435,6 +1435,13 @@ const void *RB_ClearDepth(const void *data)
return (const void *)(cmd + 1);
}
extern cvar_t *r_slowness; // leilei - experimental variable slowness
extern cvar_t *r_slowness_cpu; // leilei - experimental variable slowness
extern cvar_t *r_slowness_gpu; // leilei - experimental variable slowness
/*
=============
RB_SwapBuffers
@@ -1454,6 +1461,13 @@ const void *RB_SwapBuffers( const void *data ) {
RB_ShowImages();
}
if (r_ext_vertex_shader->integer){ // leilei - leifx filters
R_LeiFXPostprocessDitherScreen();
R_LeiFXPostprocessFilterScreen();
}
R_BrightScreen(); // leilei - alternate brightness - do it here so we hit evereything
cmd = (const swapBuffersCommand_t *)data;
@@ -1491,10 +1505,36 @@ const void *RB_SwapBuffers( const void *data ) {
backEnd.donepostproc = qfalse;
backEnd.doneAltBrightness = qfalse;
backEnd.doneFilm = qfalse;
backEnd.doneleifx = qfalse;
backEnd.doneSurfaces = qfalse;
backEnd.doneSun = qfalse;
backEnd.doneSunFlare = qfalse;
// leilei - artificial slowness (mapper debug) - this might be windows only
#ifdef _WIN32
if (r_slowness->integer > 2){
// Should be roughly equiv to a P2 300 at value 1.0 (target system)
float cpuspeed = r_slowness_cpu->value;
float gpuspeed = r_slowness_gpu->value;
if (cpuspeed < 1) cpuspeed = 1;
if (gpuspeed < 1) gpuspeed = 1; // avoid div0
float slowit = (float)(((float)(backEnd.pc.c_surfaces) / 16) + ((float)backEnd.pc.c_vertexes / 64) + 5400.0f);
slowit /= cpuspeed; // yeah it's the cpu
float blowit = ((float)(backEnd.pc.c_surfaces / 32) + (backEnd.pc.c_indexes / 1324 * (float)(glConfig.vidWidth * glConfig.vidHeight / 1100)));
blowit /= gpuspeed; // yeah it's the gpu
if (blowit > slowit) slowit = blowit; // GPU bottleneck
else if (slowit > blowit) blowit = slowit; // CPU bottlebeck
if (slowit > 8500) slowit = 8500; // but not too much?
Sleep(slowit); // FORCE A SLEEP!! HAHAHAHA!!!
}
#endif
return (const void *)(cmd + 1);
}
@@ -1517,6 +1557,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
break;
case RC_STRETCH_PIC:
//Check if it's time for BLOOM!
leifxmode = 0;
R_PostprocessScreen();
R_BloomScreen();
R_FilmScreen();
@@ -1531,6 +1572,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
break;
case RC_SWAP_BUFFERS:
//Check if it's time for BLOOM!
leifxmode = 0;
R_PostprocessScreen();
R_BloomScreen();
R_FilmScreen();

View File

@@ -40,7 +40,7 @@ static cvar_t *r_bloom_reflection; // LEILEI
static cvar_t *r_bloom_sky_only; // LEILEI
cvar_t *r_film;
extern int force32upload;
int leifxmode;
int fakeit = 0;
/*
==============================================================================
@@ -253,7 +253,7 @@ R_Postprocess_InitTextures
static void R_Postprocess_InitTextures( void )
{
byte *data;
force32upload = 1;
// find closer power of 2 to screen size
for (postproc.screen.width = 1;postproc.screen.width< glConfig.vidWidth;postproc.screen.width *= 2);
for (postproc.screen.height = 1;postproc.screen.height < glConfig.vidHeight;postproc.screen.height *= 2);
@@ -646,9 +646,20 @@ Restore the temporary framebuffer section we used with the backup texture
*/
static void R_Bloom_RestoreScreen_Postprocessed( void ) {
glslProgram_t *program;
if (leifxmode)
{
if (leifxmode == 1){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXDitherProgram); program=tr.programs[tr.leiFXDitherProgram];}
if (leifxmode == 2){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXGammaProgram); program=tr.programs[tr.leiFXGammaProgram];}
if (leifxmode == 3){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXFilterProgram); program=tr.programs[tr.leiFXFilterProgram];}
}
else
{
if (vertexShaders) R_GLSL_UseProgram(tr.postprocessingProgram);
// Feed GLSL postprocess program
program=tr.programs[tr.postprocessingProgram];
}
if (program->u_ScreenSizeX > -1) R_GLSL_SetUniform_u_ScreenSizeX(program, glConfig.vidWidth);
if (program->u_ScreenSizeY > -1) R_GLSL_SetUniform_u_ScreenSizeY(program, glConfig.vidHeight);
@@ -669,6 +680,7 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
postproc.screen.readW,postproc.screen.readH );
if (vertexShaders) R_GLSL_UseProgram(0);
GL_SelectTexture(0);
}
/*
@@ -857,6 +869,132 @@ void R_PostprocessScreen( void )
R_Bloom_RestoreScreen_Postprocessed();
}
static void ID_INLINE R_LeiFX_Pointless_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) {
int x = 0;
int y = 0;
x = 0;
y += glConfig.vidHeight - height;
width += x;
height += y;
texWidth += texX;
texHeight += texY;
qglBegin( GL_QUADS );
qglTexCoord2f( texX, texHeight );
qglVertex2f( x, y );
qglTexCoord2f( texX, texY );
qglVertex2f( x, height );
qglTexCoord2f( texWidth, texY );
qglVertex2f( width, height );
qglTexCoord2f( texWidth, texHeight );
qglVertex2f( width, y );
qglEnd ();
}
void R_LeiFX_Stupid_Hack (void)
{
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR);
GL_Bind( tr.whiteImage );
GL_Cull( CT_TWO_SIDED );
qglColor4f( 1, 1, 1, 1 );
R_LeiFX_Pointless_Quad( 0, 0, 0, 0, 1, 1 );
}
void R_LeiFXPostprocessDitherScreen( void )
{
if( !r_leifx->integer)
return;
if ( backEnd.doneleifx)
return;
if ( !backEnd.doneSurfaces )
return;
// backEnd.doneleifx = qtrue;
if( !postproc.started ) {
force32upload = 1;
R_Postprocess_InitTextures();
if( !postproc.started )
return;
}
if ( !backEnd.projection2D )
RB_SetGL2D();
// postprocess = 1;
leifxmode = 1;
// The stupidest hack in america
R_LeiFX_Stupid_Hack();
if (r_leifx->integer > 1){
leifxmode = 1; // reduct and dither - 1 pass
R_Postprocess_BackupScreen();
R_Bloom_RestoreScreen_Postprocessed();
}
force32upload = 0;
}
void R_LeiFXPostprocessFilterScreen( void )
{
if( !r_leifx->integer)
return;
if ( backEnd.doneleifx)
return;
if ( !backEnd.doneSurfaces )
return;
if( !postproc.started ) {
force32upload = 1;
R_Postprocess_InitTextures();
if( !postproc.started )
return;
}
if ( !backEnd.projection2D )
RB_SetGL2D();
force32upload = 1;
// postprocess = 1;
if (r_leifx->integer == 3){
leifxmode = 2; // gamma - 1 pass
// The stupidest hack in america
R_LeiFX_Stupid_Hack();
R_Postprocess_BackupScreen();
R_Bloom_RestoreScreen_Postprocessed();
}
if (r_leifx->integer > 3){
leifxmode = 3; // filter - 4 pass
// The stupidest hack in america
R_LeiFX_Stupid_Hack();
R_Postprocess_BackupScreen();
R_Bloom_RestoreScreen_Postprocessed();
R_Postprocess_BackupScreen();
R_Bloom_RestoreScreen_Postprocessed();
R_Postprocess_BackupScreen();
R_Bloom_RestoreScreen_Postprocessed();
R_Postprocess_BackupScreen();
R_Bloom_RestoreScreen_Postprocessed();
leifxmode = 2;
R_Postprocess_BackupScreen();
R_Bloom_RestoreScreen_Postprocessed();
}
backEnd.doneleifx = qtrue;
force32upload = 0;
}
void R_BloomInit( void ) {
memset( &bloom, 0, sizeof( bloom ));

View File

@@ -367,6 +367,7 @@ int R_SumOfUsedImages( void ) {
return total;
}
/*
===============
R_ImageList_f
@@ -1018,6 +1019,7 @@ static void Upload32( unsigned *data,
GLenum temp_GLformat = GL_RGBA;
GLenum temp_GLtype = GL_UNSIGNED_BYTE;
float rMax = 0, gMax = 0, bMax = 0;
int texsizex, texsizey;
@@ -1046,6 +1048,15 @@ static void Upload32( unsigned *data,
}
texsizex = glConfig.maxTextureSize;
texsizey = glConfig.maxTextureSize;
if (r_leifx->integer && !force32upload){ // leilei
texsizex = 256; // 3dfx
texsizey = 256; // 3dfx
}
//
// perform optional picmip operation
@@ -1055,6 +1066,8 @@ static void Upload32( unsigned *data,
scaled_height >>= r_picmip->integer;
}
//
// clamp to minimum size
//
@@ -1065,19 +1078,22 @@ static void Upload32( unsigned *data,
scaled_height = 1;
}
//
// clamp to the current upper OpenGL limit
// scale both axis down equally so we don't have to
// deal with a half mip resampling
//
while ( scaled_width > glConfig.maxTextureSize
|| scaled_height > glConfig.maxTextureSize ) {
while ( scaled_width > texsizex
|| scaled_height > texsizey ) {
scaled_width >>= 1;
scaled_height >>= 1;
}
scaledBuffer = ri.Hunk_AllocateTempMemory( sizeof( unsigned ) * scaled_width * scaled_height );
//
@@ -1244,6 +1260,7 @@ static void Upload32( unsigned *data,
}
if (detailhack) internalFormat = GL_LUMINANCE; // leilei - use paletted mono format for detail textures
if (force32upload) internalFormat = GL_RGB8; // leilei - gets bloom and postproc working on s3tc & 8bit & palettes
if (r_leifx->integer && !force32upload) internalFormat = GL_RGB5;
}
}
else if ( samples == 4 )
@@ -1289,6 +1306,7 @@ static void Upload32( unsigned *data,
internalFormat = GL_RGBA;
}
if (force32upload) internalFormat = GL_RGBA8; // leilei - gets bloom and postproc working on s3tc & 8bit & palettes
if (r_leifx->integer && !force32upload) internalFormat = GL_RGBA4;
}
}
}
@@ -1484,10 +1502,10 @@ static void Upload8( unsigned *data,
texsizey = glConfig.maxTextureSize;
// if (r_mockvoodoo->integer){ // leilei
// texsizex = 256; // 3dfx
// texsizey = 256; // 3dfx
// }
if (r_leifx->integer && !force32upload){ // leilei
texsizex = 256; // 3dfx
texsizey = 256; // 3dfx
}

View File

@@ -192,6 +192,11 @@ cvar_t *r_flaresDlight;
//cvar_t *r_flaresSurfradii;
cvar_t *r_alternateBrightness; // leilei - linux overbright fix
cvar_t *r_mockvr; // Leilei - for debugging PVR only!
cvar_t *r_leifx; // Leilei - leifx nostalgia filter
cvar_t *r_slowness; // Leilei - the cvar that slows everything down. use with caution.
cvar_t *r_slowness_cpu; // Leilei
cvar_t *r_slowness_gpu; // Leilei
/*
@@ -309,7 +314,20 @@ vidmode_t r_vidModes[] =
{ "Mode 8: 1280x1024", 1280, 1024, 1 },
{ "Mode 9: 1600x1200", 1600, 1200, 1 },
{ "Mode 10: 2048x1536", 2048, 1536, 1 },
{ "Mode 11: 856x480 (wide)",856, 480, 1 }
{ "Mode 11: 856x480",856, 480, 1 },
{ "Mode 12: 1280x720", 1280, 720, 1 },
{ "Mode 13: 1280x768", 1280, 768, 1 },
{ "Mode 14: 1280x800", 1280, 800, 1 },
{ "Mode 15: 1280x960", 1280, 960, 1 },
{ "Mode 16: 1360x768", 1360, 768, 1 },
{ "Mode 17: 1366x768", 1366, 768, 1 }, // yes there are some out there on that extra 6
{ "Mode 18: 1360x1024", 1360, 1024, 1 },
{ "Mode 19: 1400x1050", 1400, 1050, 1 },
{ "Mode 20: 1400x900", 1400, 900, 1 },
{ "Mode 21: 1600x900", 1600, 900, 1 },
{ "Mode 22: 1680x1050", 1680, 1050, 1 },
{ "Mode 23: 1920x1080", 1920, 1080, 1 },
{ "Mode 24: 1920x1440", 1920, 1440, 1 }
};
static int s_numVidModes = ARRAY_LEN( r_vidModes );
@@ -1188,7 +1206,12 @@ void R_Register( void )
r_flaresDlight = ri.Cvar_Get( "r_flaresDlight", "0" , CVAR_ARCHIVE ); // dynamic light flares
r_flareSun = ri.Cvar_Get( "r_flareSun", "0" , CVAR_ARCHIVE); // it's 0 because mappers expect 0.
r_mockvr = ri.Cvar_Get( "r_mockvr", "0" , CVAR_ARCHIVE | CVAR_CHEAT);
r_leifx = ri.Cvar_Get( "r_leifx", "0" , CVAR_ARCHIVE | CVAR_LATCH);
r_slowness = ri.Cvar_Get( "r_slowness", "0" , CVAR_ARCHIVE); // it's 0 because you want it to be the fastest possible by default.
r_slowness_cpu = ri.Cvar_Get( "r_slowness_cpu", "300" , CVAR_ARCHIVE); // it's 0 because you want it to be the fastest possible by default.
r_slowness_gpu = ri.Cvar_Get( "r_slowness_gpu", "96" , CVAR_ARCHIVE); // it's 0 because you want it to be the fastest possible by default.
// make sure all the commands added here are also
// removed in R_Shutdown
@@ -1245,6 +1268,7 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
program->u_Texture7 = -1;
program->u_Time = -1;
program->u_ViewOrigin = -1;
program->u_Normal = -1;
tr.programs[tr.numPrograms] = program;
tr.numPrograms++;
@@ -1281,8 +1305,8 @@ void R_GLSL_Init(void) {
/* load default programs */
tr.skipProgram = RE_GLSL_RegisterProgram("skip", (const char *)NULL, 0, (const char *)NULL, 0);
tr.defaultProgram = 0;
/* Q_strncpyz(programVertexObjects[0], "glsl/generic_vp.glsl", sizeof(programVertexObjects[0]));
//tr.defaultProgram = 0;
Q_strncpyz(programVertexObjects[0], "glsl/generic_vp.glsl", sizeof(programVertexObjects[0]));
Q_strncpyz(programFragmentObjects[0], "glsl/generic_fp.glsl", sizeof(programFragmentObjects[0]));
Q_strncpyz(programFragmentObjects[1], "glsl/texturing.glsl", sizeof(programFragmentObjects[1]));
tr.defaultProgram = RE_GLSL_RegisterProgram("generic", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 2);
@@ -1298,7 +1322,22 @@ void R_GLSL_Init(void) {
Q_strncpyz(programVertexObjects[0], "glsl/sky_vp.glsl", sizeof(programVertexObjects[0]));
Q_strncpyz(programFragmentObjects[0], "glsl/sky_fp.glsl", sizeof(programFragmentObjects[0]));
tr.skyProgram = RE_GLSL_RegisterProgram("sky", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
*/
Q_strncpyz(programVertexObjects[0], "glsl/leifx_dither_vp.glsl", sizeof(programVertexObjects[0]));
Q_strncpyz(programFragmentObjects[0], "glsl/leifx_dither_fp.glsl", sizeof(programFragmentObjects[0]));
tr.leiFXDitherProgram = RE_GLSL_RegisterProgram("leifx_dither", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
Q_strncpyz(programVertexObjects[0], "glsl/leifx_gamma_vp.glsl", sizeof(programVertexObjects[0]));
Q_strncpyz(programFragmentObjects[0], "glsl/leifx_gamma_fp.glsl", sizeof(programFragmentObjects[0]));
tr.leiFXGammaProgram = RE_GLSL_RegisterProgram("leifx_gamma", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
Q_strncpyz(programVertexObjects[0], "glsl/leifx_filter_vp.glsl", sizeof(programVertexObjects[0]));
Q_strncpyz(programFragmentObjects[0], "glsl/leifx_filter_fp.glsl", sizeof(programFragmentObjects[0]));
tr.leiFXFilterProgram = RE_GLSL_RegisterProgram("leifx_filter", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
if (strcmp( (const char *)r_postprocess->string, "none" ))
{

View File

@@ -827,7 +827,14 @@ typedef struct {
GLfloat u_zFar;
//End Postprocess Vars
// leilei - addition (HACK!)
GLint u_Normal;
vec3_t v_Normal;
} glslProgram_t;
@@ -968,6 +975,7 @@ typedef struct {
qboolean vertexes2D; // shader needs to be finished
qboolean doneBloom; // done bloom this frame
qboolean donepostproc; // done postprocess this frame
qboolean doneleifx; // leilei - done leifxing this frame
qboolean doneAltBrightness; // leilei - done alternate brightness this frame
qboolean doneFilm; // leilei - done film filtering this frame
qboolean doneSun; // leilei - done drawing a sun
@@ -1023,6 +1031,10 @@ typedef struct {
qhandle_t skyProgram;
qhandle_t postprocessingProgram;
qhandle_t leiFXDitherProgram; // leilei
qhandle_t leiFXGammaProgram; // leilei
qhandle_t leiFXFilterProgram; // leilei
int numPrograms;
glslProgram_t *programs[MAX_PROGRAMS];
@@ -1089,6 +1101,7 @@ extern glstate_t glState; // outside of TR since it shouldn't be cleared during
extern qboolean vertexShaders;
extern qboolean postprocess;
extern int leifxmode; // leilei - leifx
extern char depthimage;
//
@@ -1215,6 +1228,8 @@ extern cvar_t *r_flaresDlight;
extern cvar_t *r_alternateBrightness; // leilei - alternate brightness
extern cvar_t *r_leifx; // Leilei - leifx nostalgia filter
//====================================================================
void R_SwapBuffers( int );
@@ -2042,4 +2057,5 @@ void R_BrightScreen( void );
void R_AltBrightnessInit( void );
void R_FilmScreen( void ); // leilei - film effect
extern int softwaremode;
extern int leifxmode;
#endif //TR_LOCAL_H

View File

@@ -1367,6 +1367,168 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
}
}
// leilei - some slower, but bolder way of lighting
// i sure hope gcc unrolls this.
static void RB_CalcDiffuseColor_alternative( unsigned char *colors )
{
int i, j;
float *v, *normal;
float incoming;
float incoming2;
trRefEntity_t *ent;
int ambientLightInt;
vec3_t ambientLight;
vec3_t ambDir;
vec3_t lightDir;
vec3_t directedLight;
int numVertexes;
ent = backEnd.currentEntity;
float ilength;
int d, l, b;
vec3_t viewer, reflected;
ambientLightInt = ent->ambientLightInt;
VectorCopy( ent->ambientLight, ambientLight );
VectorCopy( ent->directedLight, directedLight );
VectorCopy( ent->lightDir, lightDir );
VectorCopy( ent->lightDir, ambDir );
VectorCopy( lightOrigin, ambDir );
VectorNormalizeFast( ambDir );
// crappy sun shine effect
if(backEnd.doneSunFlare == qtrue)
{
VectorCopy( tr.sunDirection, ambDir );
ambientLight[0] = tr.sunLight[0];
ambientLight[1] = tr.sunLight[1];
ambientLight[2] = tr.sunLight[2];
VectorNormalizeFast( ambDir );
}
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) * 0.6;
incoming2 = DotProduct (normal, ambDir) * 2;
if (incoming < 0) incoming = 0;
if (incoming2 < 0) incoming2 *= -0.7; // invert for fake rim effect
if (incoming2 < 0.9f) incoming2 = 0.9f; // clamp out black
/*
// add specular to ambient incoming
{
VectorSubtract( lightOrigin, v, ambDir );
ilength = Q_rsqrt( DotProduct( ambDir, ambDir ) );
VectorNormalizeFast( ambDir );
// calculate the specular color
d = DotProduct (normal, ambDir);
// d *= ilength;
// we don't optimize for the d < 0 case since this tends to
// cause visual artifacts such as faceted "snapping"
reflected[0] = normal[0]*2*d - ambDir[0];
reflected[1] = normal[1]*2*d - ambDir[1];
reflected[2] = normal[2]*2*d - ambDir[2];
VectorSubtract (backEnd.or.viewOrigin, v, viewer);
//ilength = Q_rsqrt( DotProduct( viewer, viewer ) );
l = DotProduct (reflected, viewer);
l *= ilength;
if (l < 0) {
b = 0;
l = 0;
} else {
l = l*l;
l = l*l;
}
}
incoming2 *= l;
*/
j = ri.ftol(ambientLight[0] * incoming2) + ri.ftol(incoming * directedLight[0]);
if ( j > 255 ) {
j = 255;
}
colors[i*4+0] = j;
j = ri.ftol(ambientLight[1] * incoming2) + ri.ftol(incoming * directedLight[1]);
if ( j > 255 ) {
j = 255;
}
colors[i*4+1] = j;
j = ri.ftol(ambientLight[2] * incoming2) + ri.ftol(incoming * directedLight[2]);
if ( j > 255 ) {
j = 255;
}
colors[i*4+2] = j;
colors[i*4+3] = 255;
}
}
// simple faster one without a direction of any kind, should be similar to q2/hl
static void RB_CalcDiffuseColor_lame( 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 );
lightDir[0] = 0;
lightDir[1] = 0;
lightDir[2] = 1;
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;
continue;
}
j = ri.ftol(ambientLight[0] + incoming * directedLight[0]);
if ( j > 255 ) {
j = 255;
}
colors[i*4+0] = j;
j = ri.ftol(ambientLight[1] + incoming * directedLight[1]);
if ( j > 255 ) {
j = 255;
}
colors[i*4+1] = j;
j = ri.ftol(ambientLight[2] + incoming * directedLight[2]);
if ( j > 255 ) {
j = 255;
}
colors[i*4+2] = j;
colors[i*4+3] = 255;
}
}
void RB_CalcDiffuseColor( unsigned char *colors )
{
#if idppc_altivec
@@ -1377,6 +1539,10 @@ void RB_CalcDiffuseColor( unsigned char *colors )
}
#endif
RB_CalcDiffuseColor_scalar( colors );
//RB_CalcDiffuseColor_alternative( colors );
//RB_CalcDiffuseColor_lame( colors );
}
/*