@@ -1150,7 +1150,7 @@ void RB_CalcEnvironmentTexCoordsR( float *st )
11501150 vec3_t sundy ;
11511151 float size ;
11521152 float dist ;
1153- vec3_t origin , vec1 , vec2 ;
1153+ vec3_t vec1 , vec2 ;
11541154
11551155 v = tess .xyz [0 ];
11561156 normal = tess .normal [0 ];
@@ -1196,7 +1196,7 @@ void RB_CalcCelTexCoords( float *st )
11961196{
11971197 int i ;
11981198 float * v , * normal ;
1199- vec3_t viewer , reflected , lightdir , directedLight , lightdured ;
1199+ vec3_t viewer , reflected , lightdir , directedLight ;
12001200 float d , l , p ;
12011201
12021202
@@ -1385,12 +1385,12 @@ void RB_CalcRotateTexCoords( float degsPerSecond, float *st )
13851385
13861386void RB_CalcAtlasTexCoords ( const atlas_t * at , float * st )
13871387{
1388- float p ;
13891388 texModInfo_t tmi ;
13901389 int w = (int )at -> width ;
13911390 int h = (int )at -> height ;
13921391
1393- int framex , framey ;
1392+ int framex = 0 ;
1393+ int framey = 0 ;
13941394
13951395 // modes:
13961396 // 0 - static / animated
@@ -1707,28 +1707,16 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
17071707// leilei - reveal normals to GLSL for light processing. HACK HACK HACK HACK HACK HACK
17081708void RB_CalcNormal ( unsigned char * colors )
17091709{
1710- int i , j ;
17111710 float * v ;
1712- float * normal = ( float * ) tess .normal ;
1713- float incoming ;
1714- trRefEntity_t * ent ;
1715- int ambientLightInt ;
1716- vec3_t ambientLight ;
1717- vec3_t lightDir ;
1718- vec3_t directedLight ;
1711+ float * normal = ( float * ) tess .normal ;
17191712 vec3_t n , m ;
17201713 int numVertexes ;
1721- float mult = r_shownormals -> value - 1 ;
1722- ent = backEnd .currentEntity ;
1723- ambientLightInt = ent -> ambientLightInt ;
17241714
17251715 v = tess .xyz [0 ];
17261716 //normal = tess.normal[0];
17271717
1728-
1729-
17301718 numVertexes = tess .numVertexes ;
1731- for (i = 0 ; i < numVertexes ; i ++ , v += 4 , normal += 4 ) {
1719+ for (int i = 0 ; i < numVertexes ; i ++ , v += 4 , normal += 4 ) {
17321720 int y ;
17331721 float mid ;
17341722 for (y = 0 ;y < 3 ;y ++ ){
@@ -1765,7 +1753,6 @@ void RB_CalcNormal( unsigned char *colors )
17651753void RB_CalcDiffuseColor_Specular ( unsigned char * colors )
17661754{
17671755 int i , j ;
1768- int speccap = 0 ;
17691756 float spec ;
17701757 float * v , * normal ;
17711758 float incoming ;
@@ -1825,16 +1812,13 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18251812
18261813 {
18271814 float ilength ;
1828- int b ;
18291815 vec3_t viewer , reflected ;
1830- float l , d ;
1831- // int b;
18321816
18331817 VectorCopy ( backEnd .currentEntity -> lightDir , lightDir );
18341818 VectorNormalizeFast ( lightDir );
18351819
18361820 // calculate the specular color
1837- d = DotProduct (normal , lightDir );
1821+ float d = DotProduct (normal , lightDir );
18381822
18391823 // we don't optimize for the d < 0 case since this tends to
18401824 // cause visual artifacts such as faceted "snapping"
@@ -1844,7 +1828,7 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18441828
18451829 VectorSubtract (backEnd .or .viewOrigin , v , viewer );
18461830 ilength = Q_rsqrt ( DotProduct ( viewer , viewer ) );
1847- l = DotProduct (reflected , viewer );
1831+ float l = DotProduct (reflected , viewer );
18481832 l *= ilength ;
18491833
18501834 if (l < 0 ) {
@@ -1869,14 +1853,20 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18691853 }
18701854
18711855 j = ri .ftol (ambientLight [0 ] + incoming * directedLight [0 ]);
1872- if ( j > shadecap ) {j = shadecap ; j += ri .ftol (spec * specularLight [0 ]); }
1856+ if ( j > shadecap ) {
1857+ j = shadecap ;
1858+ j += ri .ftol (spec * specularLight [0 ]);
1859+ }
18731860
18741861 // j += specularLight[0];
18751862 if ( j > 255 ) j = 255 ;
18761863 colors [i * 4 + 0 ] = j ;
18771864
18781865 j = ri .ftol (ambientLight [1 ] + incoming * directedLight [1 ]);
1879- if ( j > shadecap ) { j = shadecap ; j += ri .ftol (spec * specularLight [1 ]); }
1866+ if ( j > shadecap ) {
1867+ j = shadecap ;
1868+ j += ri .ftol (spec * specularLight [1 ]);
1869+ }
18801870
18811871 // j += specularLight[1];
18821872 if ( j > 255 ) j = 255 ;
@@ -1885,7 +1875,10 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18851875 colors [i * 4 + 1 ] = j ;
18861876
18871877 j = ri .ftol (ambientLight [2 ] + incoming * directedLight [2 ]);
1888- if ( j > shadecap ) {j = shadecap ; j += ri .ftol (spec * specularLight [2 ]); }
1878+ if ( j > shadecap ) {
1879+ j = shadecap ;
1880+ j += ri .ftol (spec * specularLight [2 ]);
1881+ }
18891882
18901883 // j += specularLight[2];
18911884 if ( j > 255 ) j = 255 ;
@@ -1925,15 +1918,15 @@ void RB_CalcUniformColor( unsigned char *colors )
19251918 int i ;
19261919 trRefEntity_t * ent ;
19271920 vec3_t ambientLight ;
1928- vec3_t directedLight ;
1921+ // vec3_t directedLight;
19291922 vec4_t uniformLight ;
19301923 int numVertexes ;
19311924 float normalize ;
19321925
19331926 ent = backEnd .currentEntity ;
19341927
19351928 VectorCopy ( ent -> ambientLight , ambientLight );
1936- VectorCopy ( ent -> directedLight , directedLight );
1929+ // VectorCopy( ent->directedLight, directedLight );
19371930
19381931 VectorAdd ( ambientLight , ambientLight /*directedLight*/ , uniformLight );
19391932
@@ -1990,22 +1983,11 @@ void RB_CalcFlatAmbient( unsigned char *colors )
19901983{
19911984 int i , j ;
19921985 float * v , * normal ;
1993- float incoming ;
19941986 trRefEntity_t * ent ;
1995- int ambientLightInt ;
19961987 vec3_t ambientLight ;
1997- vec3_t lightDir ;
1998- vec3_t directedLight ;
19991988 int numVertexes ;
20001989 ent = backEnd .currentEntity ;
2001- ambientLightInt = ent -> ambientLightInt ;
20021990 VectorCopy ( ent -> ambientLight , ambientLight );
2003- //VectorCopy( ent->directedLight, directedLight );
2004-
2005-
2006- lightDir [0 ] = 0 ;
2007- lightDir [1 ] = 0 ;
2008- lightDir [2 ] = 1 ;
20091991
20101992 v = tess .xyz [0 ];
20111993 normal = tess .normal [0 ];
@@ -2038,15 +2020,11 @@ void RB_CalcFlatDirect( unsigned char *colors )
20382020{
20392021 int i , j ;
20402022 float * v , * normal ;
2041- float incoming ;
20422023 trRefEntity_t * ent ;
2043- int ambientLightInt ;
20442024 vec3_t ambientLight ;
2045- vec3_t lightDir ;
20462025 vec3_t directedLight ;
20472026 int numVertexes ;
20482027 ent = backEnd .currentEntity ;
2049- ambientLightInt = ent -> ambientLightInt ;
20502028 VectorCopy ( ent -> ambientLight , ambientLight );
20512029 VectorCopy ( ent -> directedLight , directedLight );
20522030
@@ -2060,10 +2038,6 @@ void RB_CalcFlatDirect( unsigned char *colors )
20602038 if (directedLight [1 ] < 0 ) directedLight [1 ] = 0 ;
20612039 if (directedLight [2 ] < 0 ) directedLight [2 ] = 0 ;
20622040
2063- lightDir [0 ] = 0 ;
2064- lightDir [1 ] = 0 ;
2065- lightDir [2 ] = 1 ;
2066-
20672041 v = tess .xyz [0 ];
20682042 normal = tess .normal [0 ];
20692043
@@ -2118,14 +2092,12 @@ void RB_CalcEyes( float *st, qboolean theothereye)
21182092{
21192093 int i ;
21202094 float * v , * normal ;
2121- vec3_t viewer , reflected , eyepos , eyelook , stare ;
2122- float d , l , erp ;
2095+ vec3_t viewer , reflected , eyepos , stare ;
2096+ float d ;
21232097 int idk ;
21242098
2125- vec3_t stareat , staree ;
2126- float dilation = 2 ;
2099+ vec3_t stareat ;
21272100
2128- VectorCopy (lightOrigin , staree );
21292101 VectorCopy (backEnd .or .viewOrigin , stareat );
21302102
21312103
@@ -2156,11 +2128,11 @@ void RB_CalcEyes( float *st, qboolean theothereye)
21562128 // We need to adjust the stareat vectors to local coordinates
21572129
21582130
2159- vec3_t temp ;
2160- VectorSubtract ( stareat , backEnd .currentEntity -> e .origin , temp );
2161- stareat [0 ] = DotProduct ( temp , backEnd .currentEntity -> e .axis [0 ] );
2162- stareat [1 ] = DotProduct ( temp , backEnd .currentEntity -> e .axis [1 ] );
2163- stareat [2 ] = DotProduct ( temp , backEnd .currentEntity -> e .axis [2 ] );
2131+ vec3_t temp ;
2132+ VectorSubtract ( stareat , backEnd .currentEntity -> e .origin , temp );
2133+ stareat [0 ] = DotProduct ( temp , backEnd .currentEntity -> e .axis [0 ] );
2134+ stareat [1 ] = DotProduct ( temp , backEnd .currentEntity -> e .axis [1 ] );
2135+ stareat [2 ] = DotProduct ( temp , backEnd .currentEntity -> e .axis [2 ] );
21642136
21652137
21662138
@@ -2195,8 +2167,6 @@ if (r_leidebugeye->integer == 2)
21952167
21962168 for (i = 0 ; i < tess .numVertexes ; i ++ , v += 4 , normal += 4 , st += 2 )
21972169 {
2198-
2199- float norm1 , norm2 ;
22002170 // Base eye position
22012171 VectorSubtract (backEnd .or .viewOrigin , v , viewer );
22022172 //VectorSubtract (backEnd.currentEntity->e.eyepos[0], v, viewer);
@@ -2228,8 +2198,6 @@ if (r_leidebugeye->integer == 2)
22282198 VectorSubtract (stareat , v , stare );
22292199 VectorNormalizeFast (stare );
22302200
2231- erp = DotProduct (normal , stare );
2232-
22332201 // Limit the eye's turning so it doesn't have dead eyes
22342202 for (idk = 0 ;idk < 3 ;idk ++ ){
22352203 stare [idk ] *= 22 ;
0 commit comments