diff options
Diffstat (limited to 'src/rend2/tr_shade.c')
-rw-r--r-- | src/rend2/tr_shade.c | 60 |
1 files changed, 47 insertions, 13 deletions
diff --git a/src/rend2/tr_shade.c b/src/rend2/tr_shade.c index ba2b8460..f0bcd7f8 100644 --- a/src/rend2/tr_shade.c +++ b/src/rend2/tr_shade.c @@ -363,7 +363,7 @@ static void ProjectDlightTexture( void ) { radius = dl->radius; scale = 1.0f / radius; - sp = &tr.dlightallShader; + sp = &tr.dlightShader[deformGen == DGEN_NONE ? 0 : 1]; backEnd.pc.c_dlightDraws++; @@ -397,10 +397,10 @@ static void ProjectDlightTexture( void ) { // include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light // where they aren't rendered if ( dl->additive ) { - GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL ); + GL_State( GLS_ATEST_GT_0 | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL ); } else { - GL_State( GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL ); + GL_State( GLS_ATEST_GT_0 | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL ); } if (tess.multiDrawPrimitives) @@ -462,12 +462,12 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t case CGEN_EXACT_VERTEX_LIT: baseColor[0] = baseColor[1] = - baseColor[2] = 1.0f; + baseColor[2] = baseColor[3] = 0.0f; vertColor[0] = vertColor[1] = - vertColor[2] = 0.0f; + vertColor[2] = vertColor[3] = 1.0f; break; case CGEN_CONST: @@ -495,13 +495,13 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t case CGEN_VERTEX_LIT: baseColor[0] = baseColor[1] = - baseColor[2] = tr.identityLight; + baseColor[2] = baseColor[3] = 0.0f; vertColor[0] = vertColor[1] = - vertColor[2] = 0.0f; - vertColor[3] = 1.0f; + vertColor[2] = + vertColor[3] = tr.identityLight; break; case CGEN_ONE_MINUS_VERTEX: baseColor[0] = @@ -850,7 +850,14 @@ static void ForwardDlight( void ) { } ComputeTexMatrix( pStage, TB_DIFFUSEMAP, matrix ); - GLSL_SetUniformMatrix16(sp, GENERIC_UNIFORM_DIFFUSETEXMATRIX, matrix); + + VectorSet4(vector, matrix[0], matrix[1], matrix[4], matrix[5]); + GLSL_SetUniformVec4(sp, GENERIC_UNIFORM_DIFFUSETEXMATRIX, vector); + + VectorSet4(vector, matrix[8], matrix[9], matrix[12], matrix[13]); + GLSL_SetUniformVec4(sp, GENERIC_UNIFORM_DIFFUSETEXOFFTURB, vector); + + GLSL_SetUniformInt(sp, GENERIC_UNIFORM_TCGEN0, pStage->bundle[0].tcGen); // // draw @@ -926,7 +933,7 @@ static void ForwardSunlight( void ) { { shaderStage_t *pStage = input->xstages[stage]; shaderProgram_t *sp; - //vec4_t vector; + vec4_t vector; matrix_t matrix; if ( !pStage ) @@ -1046,7 +1053,14 @@ static void ForwardSunlight( void ) { GL_BindToTMU(tr.screenShadowImage, TB_SHADOWMAP); ComputeTexMatrix( pStage, TB_DIFFUSEMAP, matrix ); - GLSL_SetUniformMatrix16(sp, GENERIC_UNIFORM_DIFFUSETEXMATRIX, matrix); + + VectorSet4(vector, matrix[0], matrix[1], matrix[4], matrix[5]); + GLSL_SetUniformVec4(sp, GENERIC_UNIFORM_DIFFUSETEXMATRIX, vector); + + VectorSet4(vector, matrix[8], matrix[9], matrix[12], matrix[13]); + GLSL_SetUniformVec4(sp, GENERIC_UNIFORM_DIFFUSETEXOFFTURB, vector); + + GLSL_SetUniformInt(sp, GENERIC_UNIFORM_TCGEN0, pStage->bundle[0].tcGen); // // draw @@ -1155,13 +1169,25 @@ static void RB_FogPass( void ) { vec4_t color; vec4_t fogDistanceVector, fogDepthVector = {0, 0, 0, 0}; float eyeT = 0; - shaderProgram_t *sp = &tr.fogShader; + shaderProgram_t *sp; int deformGen; vec5_t deformParams; ComputeDeformValues(&deformGen, deformParams); + { + int index = 0; + + if (deformGen |= DGEN_NONE) + index |= FOGDEF_USE_DEFORM_VERTEXES; + + if (glState.vertexAttribsInterpolation) + index |= FOGDEF_USE_VERTEX_ANIMATION; + + sp = &tr.fogShader[index]; + } + backEnd.pc.c_fogDraws++; GLSL_BindProgram(sp); @@ -1415,7 +1441,15 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) } ComputeTexMatrix( pStage, TB_DIFFUSEMAP, matrix ); - GLSL_SetUniformMatrix16(sp, GENERIC_UNIFORM_DIFFUSETEXMATRIX, matrix); + + { + vec4_t vector; + VectorSet4(vector, matrix[0], matrix[1], matrix[4], matrix[5]); + GLSL_SetUniformVec4(sp, GENERIC_UNIFORM_DIFFUSETEXMATRIX, vector); + + VectorSet4(vector, matrix[8], matrix[9], matrix[12], matrix[13]); + GLSL_SetUniformVec4(sp, GENERIC_UNIFORM_DIFFUSETEXOFFTURB, vector); + } GLSL_SetUniformInt(sp, GENERIC_UNIFORM_TCGEN0, pStage->bundle[0].tcGen); if (pStage->bundle[0].tcGen == TCGEN_VECTOR) |