- Some changes to support the anime glsl/texture map hack i'm doing. Cvar will be r_anime
- r_envmode 2 replaced with JK2 envmapping - r_leidebug because I need it
This commit is contained in:
@@ -61,6 +61,8 @@ void GL_Bind( image_t *image ) {
|
||||
}
|
||||
void R_LeiFXPostprocessDitherScreen( void );
|
||||
void R_LeiFXPostprocessFilterScreen( void );
|
||||
|
||||
|
||||
/*
|
||||
** GL_SelectTexture
|
||||
*/
|
||||
@@ -1506,6 +1508,7 @@ const void *RB_SwapBuffers( const void *data ) {
|
||||
backEnd.doneAltBrightness = qfalse;
|
||||
backEnd.doneFilm = qfalse;
|
||||
backEnd.doneleifx = qfalse;
|
||||
backEnd.doneanime = qfalse;
|
||||
backEnd.doneSurfaces = qfalse;
|
||||
backEnd.doneSun = qfalse;
|
||||
backEnd.doneSunFlare = qfalse;
|
||||
@@ -1561,7 +1564,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
||||
R_PostprocessScreen();
|
||||
R_BloomScreen();
|
||||
R_FilmScreen();
|
||||
|
||||
R_AnimeScreen();
|
||||
data = RB_StretchPic( data );
|
||||
break;
|
||||
case RC_DRAW_SURFS:
|
||||
@@ -1576,7 +1579,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
||||
R_PostprocessScreen();
|
||||
R_BloomScreen();
|
||||
R_FilmScreen();
|
||||
|
||||
R_AnimeScreen();
|
||||
|
||||
data = RB_SwapBuffers( data );
|
||||
break;
|
||||
|
@@ -652,6 +652,8 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
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];}
|
||||
if (leifxmode == 888){ if (vertexShaders) R_GLSL_UseProgram(tr.animeProgram); program=tr.programs[tr.animeProgram];}
|
||||
if (leifxmode == 999){ if (vertexShaders) R_GLSL_UseProgram(tr.animeFilmProgram); program=tr.programs[tr.animeFilmProgram];}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -995,6 +997,44 @@ void R_LeiFXPostprocessFilterScreen( void )
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void R_AnimeScreen( void )
|
||||
{
|
||||
if( !r_anime->integer)
|
||||
return;
|
||||
if ( backEnd.doneanime)
|
||||
return;
|
||||
if ( !backEnd.doneSurfaces )
|
||||
return;
|
||||
if( !postproc.started ) {
|
||||
force32upload = 1;
|
||||
R_Postprocess_InitTextures();
|
||||
if( !postproc.started )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !backEnd.projection2D )
|
||||
RB_SetGL2D();
|
||||
|
||||
force32upload = 1;
|
||||
|
||||
leifxmode = 888; // anime effect - outlines, desat, bloom and other crap to go with it
|
||||
R_LeiFX_Stupid_Hack();
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
leifxmode = 999; // film effect - to blur things slightly, and add some grain and chroma stuff
|
||||
R_LeiFX_Stupid_Hack();
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
backEnd.doneanime = qtrue;
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void R_BloomInit( void ) {
|
||||
memset( &bloom, 0, sizeof( bloom ));
|
||||
|
||||
|
@@ -193,6 +193,8 @@ cvar_t *r_flaresDlight;
|
||||
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_anime; // Leilei - anime filter
|
||||
cvar_t *r_leidebug; // Leilei - debug
|
||||
|
||||
cvar_t *r_slowness; // Leilei - the cvar that slows everything down. use with caution.
|
||||
cvar_t *r_slowness_cpu; // Leilei
|
||||
@@ -1209,6 +1211,9 @@ void R_Register( void )
|
||||
|
||||
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_anime = ri.Cvar_Get( "r_anime", "0" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_leidebug = ri.Cvar_Get( "r_leidebug", "0" , CVAR_CHEAT);
|
||||
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.
|
||||
@@ -1325,6 +1330,15 @@ void R_GLSL_Init(void) {
|
||||
|
||||
|
||||
|
||||
Q_strncpyz(programVertexObjects[0], "glsl/anime_vp.glsl", sizeof(programVertexObjects[0]));
|
||||
Q_strncpyz(programFragmentObjects[0], "glsl/anime_fp.glsl", sizeof(programFragmentObjects[0]));
|
||||
tr.animeProgram = RE_GLSL_RegisterProgram("anime", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
|
||||
|
||||
Q_strncpyz(programVertexObjects[0], "glsl/anime_film_vp.glsl", sizeof(programVertexObjects[0]));
|
||||
Q_strncpyz(programFragmentObjects[0], "glsl/anime_film_fp.glsl", sizeof(programFragmentObjects[0]));
|
||||
tr.animeFilmProgram = RE_GLSL_RegisterProgram("anime_film", (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);
|
||||
|
@@ -170,6 +170,8 @@ typedef enum {
|
||||
CGEN_LIGHTING_DIFFUSE,
|
||||
CGEN_LIGHTING_UNIFORM,
|
||||
CGEN_LIGHTING_DYNAMIC,
|
||||
CGEN_LIGHTING_FLAT_AMBIENT, // leilei - cel hack
|
||||
CGEN_LIGHTING_FLAT_DIRECT,
|
||||
CGEN_FOG, // standard fog
|
||||
CGEN_CONST // fixed color
|
||||
} colorGen_t;
|
||||
@@ -181,6 +183,7 @@ typedef enum {
|
||||
TCGEN_TEXTURE,
|
||||
TCGEN_ENVIRONMENT_MAPPED,
|
||||
TCGEN_ENVIRONMENT_CELSHADE_MAPPED,
|
||||
TCGEN_ENVIRONMENT_CELSHADE_LEILEI, // leilei - cel hack
|
||||
TCGEN_FOG,
|
||||
TCGEN_VECTOR // S and T from world coordinates
|
||||
} texCoordGen_t;
|
||||
@@ -210,6 +213,7 @@ typedef enum {
|
||||
TMOD_SCROLL,
|
||||
TMOD_SCALE,
|
||||
TMOD_STRETCH,
|
||||
TMOD_LIGHTSCALE, // leilei - cel hack
|
||||
TMOD_ROTATE,
|
||||
TMOD_ENTITY_TRANSLATE
|
||||
} texMod_t;
|
||||
@@ -976,6 +980,7 @@ typedef struct {
|
||||
qboolean doneBloom; // done bloom this frame
|
||||
qboolean donepostproc; // done postprocess this frame
|
||||
qboolean doneleifx; // leilei - done leifxing this frame
|
||||
qboolean doneanime; // leilei - done animeing 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
|
||||
@@ -1034,6 +1039,8 @@ typedef struct {
|
||||
qhandle_t leiFXDitherProgram; // leilei
|
||||
qhandle_t leiFXGammaProgram; // leilei
|
||||
qhandle_t leiFXFilterProgram; // leilei
|
||||
qhandle_t animeProgram; // leilei
|
||||
qhandle_t animeFilmProgram; // leilei
|
||||
|
||||
int numPrograms;
|
||||
glslProgram_t *programs[MAX_PROGRAMS];
|
||||
@@ -1235,7 +1242,10 @@ extern cvar_t *r_flaresDlight;
|
||||
|
||||
extern cvar_t *r_alternateBrightness; // leilei - alternate brightness
|
||||
|
||||
extern cvar_t *r_leifx; // Leilei - leifx nostalgia filter
|
||||
extern cvar_t *r_leifx; // Leilei - leifx nostalgia filter
|
||||
|
||||
extern cvar_t *r_anime; // Leilei - anime filter
|
||||
extern cvar_t *r_leidebug; // Leilei - debug only!
|
||||
|
||||
//====================================================================
|
||||
|
||||
@@ -1870,6 +1880,8 @@ void R_TransformClipToWindow( const vec4_t clip, const viewParms_t *view, vec4_t
|
||||
void RB_DeformTessGeometry( void );
|
||||
|
||||
void RB_CalcEnvironmentTexCoords( float *dstTexCoords );
|
||||
void RB_CalcCelTexCoords( float *dstTexCoords ); // leilei - cel hack
|
||||
void RB_CalcEnvironmentTexCoordsJO( float *dstTexCoords ); // leilei
|
||||
void RB_CalcEnvironmentCelShadeTexCoords( float *dstTexCoords );
|
||||
void RB_CalcEnvironmentTexCoordsNew( float *dstTexCoords );
|
||||
void RB_CalcEnvironmentTexCoordsHW(void);
|
||||
@@ -1887,6 +1899,7 @@ void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors );
|
||||
void RB_CalcAlphaFromEntity( unsigned char *dstColors );
|
||||
void RB_CalcAlphaFromOneMinusEntity( unsigned char *dstColors );
|
||||
void RB_CalcStretchTexCoords( const waveForm_t *wf, float *texCoords );
|
||||
void RB_CalcLightscaleTexCoords( float *texCoords );
|
||||
void RB_CalcColorFromEntity( unsigned char *dstColors );
|
||||
void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors );
|
||||
void RB_CalcSpecularAlpha( unsigned char *alphas );
|
||||
@@ -1895,6 +1908,9 @@ void RB_CalcDiffuseColor( unsigned char *colors );
|
||||
void RB_CalcUniformColor( unsigned char *colors );
|
||||
void RB_CalcDynamicColor( unsigned char *colors );
|
||||
|
||||
void RB_CalcFlatAmbient( unsigned char *colors ); // leilei - cel hack
|
||||
void RB_CalcFlatDirect( unsigned char *colors ); // leilei - cel hack
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
@@ -2054,6 +2070,7 @@ void RE_TakeVideoFrame( int width, int height,
|
||||
//Bloom Stuff
|
||||
void R_BloomInit( void );
|
||||
void R_BloomScreen( void );
|
||||
void R_AnimeScreen( void );
|
||||
|
||||
// Postprocessing
|
||||
void R_PostprocessScreen( void );
|
||||
|
@@ -884,6 +884,30 @@ static void ComputeColors( shaderStage_t *pStage )
|
||||
case CGEN_LIGHTING_DYNAMIC:
|
||||
RB_CalcDynamicColor( ( unsigned char * ) tess.svars.colors );
|
||||
break;
|
||||
case CGEN_LIGHTING_FLAT_AMBIENT:
|
||||
RB_CalcFlatAmbient( ( unsigned char * ) tess.svars.colors );
|
||||
if(r_monolightmaps->integer)
|
||||
{
|
||||
int scale;
|
||||
for(i = 0; i < tess.numVertexes; i++)
|
||||
{
|
||||
scale = LUMA(tess.svars.colors[i][0], tess.svars.colors[i][1], tess.svars.colors[i][2]);
|
||||
tess.svars.colors[i][0] = tess.svars.colors[i][1] = tess.svars.colors[i][2] = scale;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CGEN_LIGHTING_FLAT_DIRECT:
|
||||
RB_CalcFlatDirect( ( unsigned char * ) tess.svars.colors );
|
||||
if(r_monolightmaps->integer)
|
||||
{
|
||||
int scale;
|
||||
for(i = 0; i < tess.numVertexes; i++)
|
||||
{
|
||||
scale = LUMA(tess.svars.colors[i][0], tess.svars.colors[i][1], tess.svars.colors[i][2]);
|
||||
tess.svars.colors[i][0] = tess.svars.colors[i][1] = tess.svars.colors[i][2] = scale;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CGEN_EXACT_VERTEX:
|
||||
Com_Memcpy( tess.svars.colors, tess.vertexColors, tess.numVertexes * sizeof( tess.vertexColors[0] ) );
|
||||
break;
|
||||
@@ -1126,7 +1150,7 @@ static void ComputeTexCoords( shaderStage_t *pStage ) {
|
||||
RB_CalcEnvironmentTexCoordsNew( ( float * ) tess.svars.texcoords[b] );
|
||||
} // new dancing one
|
||||
else if ( r_envMode->integer == 2 ) {
|
||||
RB_CalcEnvironmentTexCoordsHW();
|
||||
RB_CalcEnvironmentTexCoordsJO( ( float * ) tess.svars.texcoords[b] );
|
||||
} // odin's
|
||||
else {
|
||||
RB_CalcEnvironmentTexCoords( ( float * ) tess.svars.texcoords[b] );
|
||||
@@ -1135,6 +1159,9 @@ static void ComputeTexCoords( shaderStage_t *pStage ) {
|
||||
case TCGEN_ENVIRONMENT_CELSHADE_MAPPED:
|
||||
RB_CalcEnvironmentCelShadeTexCoords( ( float * ) tess.svars.texcoords[b] );
|
||||
break;
|
||||
case TCGEN_ENVIRONMENT_CELSHADE_LEILEI:
|
||||
RB_CalcCelTexCoords( ( float * ) tess.svars.texcoords[b] );
|
||||
break;
|
||||
case TCGEN_BAD:
|
||||
return;
|
||||
}
|
||||
@@ -1174,6 +1201,10 @@ static void ComputeTexCoords( shaderStage_t *pStage ) {
|
||||
( float * ) tess.svars.texcoords[b] );
|
||||
break;
|
||||
|
||||
case TMOD_LIGHTSCALE:
|
||||
RB_CalcLightscaleTexCoords( ( float * ) tess.svars.texcoords[b] );
|
||||
break;
|
||||
|
||||
case TMOD_TRANSFORM:
|
||||
RB_CalcTransformTexCoords( &pStage->bundle[b].texMods[tm],
|
||||
( float * ) tess.svars.texcoords[b] );
|
||||
|
@@ -104,6 +104,42 @@ void RB_CalcStretchTexCoords( const waveForm_t *wf, float *st )
|
||||
RB_CalcTransformTexCoords( &tmi, st );
|
||||
}
|
||||
|
||||
|
||||
// leilei - this is for celshading
|
||||
void RB_CalcLightscaleTexCoords(float *st )
|
||||
{
|
||||
float p;
|
||||
texModInfo_t tmi;
|
||||
float light = 1.0f;
|
||||
float ilength;
|
||||
vec3_t lightDir;
|
||||
vec3_t ambientLight;
|
||||
vec3_t directedLight;
|
||||
VectorCopy( backEnd.currentEntity->ambientLight, ambientLight );
|
||||
VectorCopy( backEnd.currentEntity->directedLight, directedLight );
|
||||
VectorCopy( backEnd.currentEntity->lightDir, lightDir );
|
||||
//light = DotProduct (directedLight, lightDir);
|
||||
light = ((directedLight[0] + directedLight[1] + directedLight[2]) * 0.333) / 255;
|
||||
if (light > 1)
|
||||
light = 1.0f;
|
||||
|
||||
p = 1.0f - (light * 0.7f);
|
||||
|
||||
tmi.matrix[0][0] = p;
|
||||
tmi.matrix[1][0] = 0;
|
||||
tmi.translate[0] = 0.5f - 0.5f * p;
|
||||
|
||||
tmi.matrix[0][1] = 0;
|
||||
tmi.matrix[1][1] = p;
|
||||
tmi.translate[1] = 0.5f - 0.5f * p;
|
||||
|
||||
RB_CalcTransformTexCoords( &tmi, st );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
====================================================================
|
||||
|
||||
@@ -991,12 +1027,123 @@ void RB_CalcEnvironmentTexCoordsHW()
|
||||
qglEnable(GL_TEXTURE_GEN_R);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** RB_CalcEnvironmentTexCoordsJO
|
||||
from JediOutcast source
|
||||
*/
|
||||
void RB_CalcEnvironmentTexCoordsJO( float *st )
|
||||
{
|
||||
int i;
|
||||
float *v, *normal;
|
||||
vec3_t viewer;
|
||||
float d;
|
||||
|
||||
v = tess.xyz[0];
|
||||
normal = tess.normal[0];
|
||||
|
||||
if (backEnd.currentEntity && backEnd.currentEntity->e.renderfx&RF_FIRST_PERSON) //this is a view model so we must use world lights instead of vieworg
|
||||
{
|
||||
for (i = 0 ; i < tess.numVertexes ; i++, v += 4, normal += 4, st += 2 )
|
||||
{
|
||||
d = DotProduct (normal, backEnd.currentEntity->lightDir);
|
||||
st[0] = normal[0]*d - backEnd.currentEntity->lightDir[0];
|
||||
st[1] = normal[1]*d - backEnd.currentEntity->lightDir[1];
|
||||
}
|
||||
} else { //the normal way
|
||||
for (i = 0 ; i < tess.numVertexes ; i++, v += 4, normal += 4, st += 2 )
|
||||
{
|
||||
VectorSubtract (backEnd.or.viewOrigin, v, viewer);
|
||||
VectorNormalizeFast (viewer);
|
||||
|
||||
d = DotProduct (normal, viewer);
|
||||
st[0] = normal[0]*d - 0.5*viewer[0];
|
||||
st[1] = normal[1]*d - 0.5*viewer[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** RB_CalcCelTexCoords
|
||||
Butchered from JediOutcast source, note that this is not the same method as ZEQ2.
|
||||
*/
|
||||
void RB_CalcCelTexCoords( float *st )
|
||||
{
|
||||
int i;
|
||||
float *v, *normal;
|
||||
vec3_t viewer, reflected, lightdir, directedLight, lightdured;
|
||||
float d, l, p;
|
||||
|
||||
|
||||
v = tess.xyz[0];
|
||||
normal = tess.normal[0];
|
||||
|
||||
VectorCopy(backEnd.currentEntity->lightDir, lightdir);
|
||||
VectorCopy(backEnd.currentEntity->directedLight, directedLight);
|
||||
float light = (directedLight[0] + directedLight[1] + directedLight[2] / 3);
|
||||
// if (light > 1)
|
||||
// light = 1.0f;
|
||||
|
||||
//p = 0.9f - (light * 0.9f);
|
||||
p = 1.0f - (light / 255);
|
||||
|
||||
|
||||
|
||||
// for (i = 0 ; i < tess.numVertexes ; i++, v += 4, normal += 4, st += 2 )
|
||||
// {
|
||||
//
|
||||
// d = DotProduct (normal, backEnd.currentEntity->lightDir);
|
||||
// st[0] = normal[0]*d - backEnd.currentEntity->lightDir[0];
|
||||
// st[1] = normal[1]*d - backEnd.currentEntity->lightDir[1];
|
||||
// }
|
||||
|
||||
for (i = 0 ; i < tess.numVertexes ; i++, v += 4, normal += 4, st += 2 )
|
||||
{
|
||||
VectorSubtract (backEnd.or.viewOrigin, v, viewer);
|
||||
VectorNormalizeFast (viewer);
|
||||
|
||||
d = DotProduct (normal, viewer);
|
||||
|
||||
l = DotProduct (normal, backEnd.currentEntity->lightDir);
|
||||
|
||||
if (d < 0)d = 0;
|
||||
if (l < 0)l = 0;
|
||||
//if (d > 1)d = 1;
|
||||
//if (l > 1)l = 1;
|
||||
|
||||
|
||||
if (d < p)d = p;
|
||||
if (l < p)l = p;
|
||||
|
||||
reflected[0] = normal[0]*1*(d+l) - (viewer[0] + lightdir[0] );
|
||||
reflected[1] = normal[1]*1*(d+l) - (viewer[1] + lightdir[1] );
|
||||
reflected[2] = normal[2]*1*(d+l) - (viewer[2] + lightdir[2] );
|
||||
|
||||
// reflected[0] = normal[0]*2*l - lightdir[0];
|
||||
// reflected[1] = normal[1]*2*l - lightdir[1];
|
||||
// reflected[2] = normal[2]*2*l - lightdir[2];
|
||||
|
||||
|
||||
st[0] = 0.5 + reflected[1] * 0.5;
|
||||
st[1] = 0.5 - reflected[2] * 0.5;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** RB_CalcEnvironmentCelShadeTexCoords
|
||||
**
|
||||
** RiO; celshade 1D environment map
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
void RB_CalcEnvironmentCelShadeTexCoords( float *st )
|
||||
{
|
||||
int i;
|
||||
@@ -1612,3 +1759,113 @@ void RB_CalcDynamicColor( unsigned char *colors )
|
||||
colors[i*4+3] = dynamic[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// leilei celsperiment
|
||||
|
||||
|
||||
void RB_CalcFlatAmbient( 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) {
|
||||
j = ri.ftol(ambientLight[0]);
|
||||
if ( j > 255 ) {
|
||||
j = 255;
|
||||
}
|
||||
colors[i*4+0] = j;
|
||||
|
||||
j = ri.ftol(ambientLight[1]);
|
||||
if ( j > 255 ) {
|
||||
j = 255;
|
||||
}
|
||||
colors[i*4+1] = j;
|
||||
|
||||
j = ri.ftol(ambientLight[2]);
|
||||
if ( j > 255 ) {
|
||||
j = 255;
|
||||
}
|
||||
colors[i*4+2] = j;
|
||||
colors[i*4+3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RB_CalcFlatDirect( 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 );
|
||||
|
||||
|
||||
|
||||
directedLight[0] -= ambientLight[0];
|
||||
directedLight[1] -= ambientLight[1];
|
||||
directedLight[2] -= ambientLight[2];
|
||||
|
||||
if (directedLight[0] < 0) directedLight[0] = 0;
|
||||
if (directedLight[1] < 0) directedLight[1] = 0;
|
||||
if (directedLight[2] < 0) directedLight[2] = 0;
|
||||
|
||||
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) {
|
||||
j = ri.ftol(directedLight[0]);
|
||||
if ( j > 255 ) {
|
||||
j = 255;
|
||||
}
|
||||
colors[i*4+0] = j;
|
||||
|
||||
j = ri.ftol(directedLight[1]);
|
||||
if ( j > 255 ) {
|
||||
j = 255;
|
||||
}
|
||||
colors[i*4+1] = j;
|
||||
|
||||
j = ri.ftol(directedLight[2]);
|
||||
if ( j > 255 ) {
|
||||
j = 255;
|
||||
}
|
||||
colors[i*4+2] = j;
|
||||
colors[i*4+3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -894,6 +894,13 @@ static void ParseTexMod( char *_text, shaderStage_t *stage )
|
||||
|
||||
tmi->type = TMOD_STRETCH;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "lightscale" ) )
|
||||
{
|
||||
token = COM_ParseExt( text, qfalse );
|
||||
|
||||
tmi->type = TMOD_LIGHTSCALE;
|
||||
}
|
||||
|
||||
//
|
||||
// transform
|
||||
//
|
||||
@@ -2499,6 +2506,14 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
{
|
||||
stage->rgbGen = CGEN_LIGHTING_DYNAMIC;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "flatAmbient" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_LIGHTING_FLAT_AMBIENT;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "flatDirect" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_LIGHTING_FLAT_DIRECT;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "oneMinusVertex" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_ONE_MINUS_VERTEX;
|
||||
@@ -2596,6 +2611,10 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
{
|
||||
stage->bundle[0].tcGen = TCGEN_ENVIRONMENT_CELSHADE_MAPPED;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "celshading" ) ) // leilei - my technique is different
|
||||
{
|
||||
stage->bundle[0].tcGen = TCGEN_ENVIRONMENT_CELSHADE_LEILEI;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "lightmap" ) )
|
||||
{
|
||||
stage->bundle[0].tcGen = TCGEN_LIGHTMAP;
|
||||
@@ -4378,6 +4397,8 @@ qhandle_t RE_RegisterShaderLightMap( const char *name, int lightmapIndex ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
RE_RegisterShader
|
||||
@@ -4397,6 +4418,8 @@ qhandle_t RE_RegisterShader( const char *name ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sh = R_FindShader( name, LIGHTMAP_2D, qtrue );
|
||||
|
||||
// we want to return 0 if the shader failed to
|
||||
|
Reference in New Issue
Block a user