diff --git a/code/renderer_oa/tr_model_mdo.c b/code/renderer_oa/tr_model_mdo.c index 08d74aac..e7701341 100644 --- a/code/renderer_oa/tr_model_mdo.c +++ b/code/renderer_oa/tr_model_mdo.c @@ -40,7 +40,7 @@ R_LoadMDO ================= */ qboolean R_LoadMDO( model_t *mod, void *buffer, int filesize, const char *mod_name ) { - int i, j, k, lodindex; + int i, j, lodindex; mdoHeader_t *pinmodel, *mdo; mdoFrame_t *frame; mdoLOD_t *lod; @@ -103,7 +103,7 @@ qboolean R_LoadMDO( model_t *mod, void *buffer, int filesize, const char *mod_na mod->numLods = mdo->numLODs; // ... don't forget this or LODs won't work // swap all the frames - frameSize = (int)( &((mdoFrame_t *)0)->bones[ mdo->numBones ] ); + frameSize = (size_t)( &((mdoFrame_t *)0)->bones[ mdo->numBones ] ); for ( i = 0 ; i < mdo->numFrames ; i++, frame++) { frame = (mdoFrame_t *) ( (byte *)mdo + mdo->ofsFrames + i * frameSize ); frame->radius = LittleFloat( frame->radius ); @@ -206,7 +206,7 @@ qboolean R_LoadMDO( model_t *mod, void *buffer, int filesize, const char *mod_na // find the next LOD lod = (mdoLOD_t *)( (byte *)lod + lod->ofsEnd ); } - + return qtrue; } @@ -357,7 +357,7 @@ void R_AddMDOSurfaces( trRefEntity_t *ent ) { mdoLOD_t *lod; shader_t *shader; skin_t *skin; - int i, j, k; + int i, j; int lodnum = 0; int fogNum = 0; int cull; @@ -581,8 +581,6 @@ md3Tag_t *R_GetMDOTag( mdoHeader_t *mod, int framenum, const char *tagName, md3T if ( !strcmp( bone->name, tagName ) ) { - vec4_t quat; - vec3_t trans; float matrix[3][4]; Q_strncpyz(dest->name, bone->name, sizeof(dest->name)); @@ -618,7 +616,7 @@ void RB_SurfaceMDO( mdoSurface_t *surface ) { int i, j, k; int frameSize; - float frontlerp, backlerp; + float backlerp; int *triangles; int indexes; int baseIndex, baseVertex; @@ -629,8 +627,7 @@ void RB_SurfaceMDO( mdoSurface_t *surface ) mdoHeader_t *header; mdoFrame_t *frame; mdoFrame_t *oldFrame; - boneMatrix_t bones[MDO_MAX_BONES], *bonePtr, *bone; - mdoBoneInfo_t *boneInfo; + boneMatrix_t bones[MDO_MAX_BONES], *bonePtr, *bone; refEntity_t *ent; ent = &backEnd.currentEntity->e; @@ -640,12 +637,10 @@ void RB_SurfaceMDO( mdoSurface_t *surface ) if (ent->oldframe == ent->frame) { backlerp = 0; // if backlerp is 0, lerping is off and frontlerp is never used - frontlerp = 1; } else { backlerp = ent->backlerp; - frontlerp = 1.0f - backlerp; } header = (mdoHeader_t *)((byte *)surface - surface->ofsHeader); @@ -678,9 +673,6 @@ void RB_SurfaceMDO( mdoSurface_t *surface ) boneRefList = ( int * )( (byte *)surface + surface->ofsBoneRefs ); boneRef = boneRefList; - // boneInfos - boneInfo = (mdoBoneInfo_t *)((byte *)header + header->ofsBones); - bonePtr = bones; for( i = 0 ; i < surface->numBoneRefs ; i++, boneRef++ ) { diff --git a/code/renderer_oa/tr_shade_calc.c b/code/renderer_oa/tr_shade_calc.c index b833a2ed..270affb8 100644 --- a/code/renderer_oa/tr_shade_calc.c +++ b/code/renderer_oa/tr_shade_calc.c @@ -1150,7 +1150,7 @@ void RB_CalcEnvironmentTexCoordsR( float *st ) vec3_t sundy; float size; float dist; - vec3_t origin, vec1, vec2; + vec3_t vec1, vec2; v = tess.xyz[0]; normal = tess.normal[0]; @@ -1196,7 +1196,7 @@ void RB_CalcCelTexCoords( float *st ) { int i; float *v, *normal; - vec3_t viewer, reflected, lightdir, directedLight, lightdured; + vec3_t viewer, reflected, lightdir, directedLight; float d, l, p; @@ -1385,12 +1385,12 @@ void RB_CalcRotateTexCoords( float degsPerSecond, float *st ) void RB_CalcAtlasTexCoords( const atlas_t *at, float *st ) { - float p; texModInfo_t tmi; int w = (int)at->width; int h = (int)at->height; - int framex, framey; + int framex = 0; + int framey = 0; // modes: // 0 - static / animated @@ -1707,28 +1707,16 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors ) // leilei - reveal normals to GLSL for light processing. HACK HACK HACK HACK HACK HACK void RB_CalcNormal( unsigned char *colors ) { - int i, j; float *v; - float *normal = ( float * ) tess.normal; - float incoming; - trRefEntity_t *ent; - int ambientLightInt; - vec3_t ambientLight; - vec3_t lightDir; - vec3_t directedLight; + float *normal = ( float * ) tess.normal; vec3_t n, m; int numVertexes; - float mult = r_shownormals->value - 1; - ent = backEnd.currentEntity; - ambientLightInt = ent->ambientLightInt; v = tess.xyz[0]; //normal = tess.normal[0]; - - numVertexes = tess.numVertexes; - for (i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) { + for (int i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) { int y; float mid; for (y=0;y<3;y++){ @@ -1765,7 +1753,6 @@ void RB_CalcNormal( unsigned char *colors ) void RB_CalcDiffuseColor_Specular( unsigned char *colors ) { int i, j; - int speccap = 0; float spec; float *v, *normal; float incoming; @@ -1825,16 +1812,13 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors ) { float ilength; - int b; vec3_t viewer, reflected; - float l, d; - // int b; VectorCopy( backEnd.currentEntity->lightDir, lightDir ); VectorNormalizeFast( lightDir ); // calculate the specular color - d = DotProduct (normal, lightDir); + float d = DotProduct (normal, lightDir); // we don't optimize for the d < 0 case since this tends to // cause visual artifacts such as faceted "snapping" @@ -1844,7 +1828,7 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors ) VectorSubtract (backEnd.or.viewOrigin, v, viewer); ilength = Q_rsqrt( DotProduct( viewer, viewer ) ); - l = DotProduct (reflected, viewer); + float l = DotProduct (reflected, viewer); l *= ilength; if (l < 0) { @@ -1869,14 +1853,20 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors ) } j = ri.ftol(ambientLight[0] + incoming * directedLight[0]); - if ( j > shadecap ) {j = shadecap ; j += ri.ftol(spec * specularLight[0]); } + if ( j > shadecap ) { + j = shadecap; + j += ri.ftol(spec * specularLight[0]); + } // j += specularLight[0]; if ( j > 255) j = 255; colors[i*4+0] = j; j = ri.ftol(ambientLight[1] + incoming * directedLight[1]); - if ( j > shadecap ) { j = shadecap ; j += ri.ftol(spec * specularLight[1]); } + if ( j > shadecap ) { + j = shadecap; + j += ri.ftol(spec * specularLight[1]); + } // j += specularLight[1]; if ( j > 255) j = 255; @@ -1885,7 +1875,10 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors ) colors[i*4+1] = j; j = ri.ftol(ambientLight[2] + incoming * directedLight[2]); - if ( j > shadecap ) {j = shadecap ; j += ri.ftol(spec * specularLight[2]); } + if ( j > shadecap ) { + j = shadecap; + j += ri.ftol(spec * specularLight[2]); + } // j += specularLight[2]; if ( j > 255) j = 255; @@ -1925,7 +1918,7 @@ void RB_CalcUniformColor( unsigned char *colors ) int i; trRefEntity_t *ent; vec3_t ambientLight; - vec3_t directedLight; + //vec3_t directedLight; vec4_t uniformLight; int numVertexes; float normalize; @@ -1933,7 +1926,7 @@ void RB_CalcUniformColor( unsigned char *colors ) ent = backEnd.currentEntity; VectorCopy( ent->ambientLight, ambientLight ); - VectorCopy( ent->directedLight, directedLight ); + //VectorCopy( ent->directedLight, directedLight ); VectorAdd( ambientLight, ambientLight/*directedLight*/, uniformLight ); @@ -1990,22 +1983,11 @@ 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]; @@ -2038,15 +2020,11 @@ 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 ); @@ -2060,10 +2038,6 @@ void RB_CalcFlatDirect( unsigned char *colors ) 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]; @@ -2118,14 +2092,12 @@ void RB_CalcEyes( float *st, qboolean theothereye) { int i; float *v, *normal; - vec3_t viewer, reflected, eyepos, eyelook, stare; - float d, l, erp; + vec3_t viewer, reflected, eyepos, stare; + float d; int idk; - vec3_t stareat, staree; - float dilation = 2; + vec3_t stareat; - VectorCopy(lightOrigin, staree); VectorCopy(backEnd.or.viewOrigin, stareat); @@ -2156,11 +2128,11 @@ void RB_CalcEyes( float *st, qboolean theothereye) // We need to adjust the stareat vectors to local coordinates - vec3_t temp; - VectorSubtract( stareat, backEnd.currentEntity->e.origin, temp ); - stareat[0] = DotProduct( temp, backEnd.currentEntity->e.axis[0] ); - stareat[1] = DotProduct( temp, backEnd.currentEntity->e.axis[1] ); - stareat[2] = DotProduct( temp, backEnd.currentEntity->e.axis[2] ); + vec3_t temp; + VectorSubtract( stareat, backEnd.currentEntity->e.origin, temp ); + stareat[0] = DotProduct( temp, backEnd.currentEntity->e.axis[0] ); + stareat[1] = DotProduct( temp, backEnd.currentEntity->e.axis[1] ); + stareat[2] = DotProduct( temp, backEnd.currentEntity->e.axis[2] ); @@ -2195,8 +2167,6 @@ if (r_leidebugeye->integer == 2) for (i = 0 ; i < tess.numVertexes ; i++, v += 4, normal += 4, st += 2 ) { - - float norm1, norm2; // Base eye position VectorSubtract (backEnd.or.viewOrigin, v, viewer); //VectorSubtract (backEnd.currentEntity->e.eyepos[0], v, viewer); @@ -2228,8 +2198,6 @@ if (r_leidebugeye->integer == 2) VectorSubtract (stareat, v, stare); VectorNormalizeFast (stare); - erp = DotProduct (normal, stare); - // Limit the eye's turning so it doesn't have dead eyes for (idk=0;idk<3;idk++){ stare[idk] *= 22;