From 0c37f88c3de135d989dde2a87f36d517571715cf Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 20 Nov 2010 07:38:25 +0000 Subject: [PATCH] fix camera texture colors git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10617 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 0e258b5b..c3431f7d 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -809,7 +809,11 @@ static const char *builtinshaderstring = "\n" "void main(void)\n" "{\n" +"#ifdef USEVIEWTINT\n" " gl_FragColor = gl_Color;\n" +"#else\n" +" gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n" +"#endif\n" "#ifdef USEDIFFUSE\n" " gl_FragColor *= texture2D(Texture_First, TexCoord1);\n" "#endif\n" @@ -2089,7 +2093,11 @@ const char *builtincgshaderstring = "out float4 gl_FragColor : COLOR\n" ")\n" "{\n" +"#ifdef USEVIEWTINT\n" " gl_FragColor = gl_FrontColor;\n" +"#else\n" +" gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n" +"#endif\n" "#ifdef USEDIFFUSE\n" " gl_FragColor *= tex2D(Texture_First, TexCoord1);\n" "#endif\n" @@ -3336,7 +3344,7 @@ typedef enum shaderpermutation_e { SHADERPERMUTATION_DIFFUSE = 1<<0, ///< (lightsource) whether to use directional shading SHADERPERMUTATION_VERTEXTEXTUREBLEND = 1<<1, ///< indicates this is a two-layer material blend based on vertex alpha (q3bsp) - SHADERPERMUTATION_VIEWTINT = 1<<2, ///< view tint (postprocessing only) + SHADERPERMUTATION_VIEWTINT = 1<<2, ///< view tint (postprocessing only), use vertex colors (generic only) SHADERPERMUTATION_COLORMAPPING = 1<<3, ///< indicates this is a colormapped skin SHADERPERMUTATION_SATURATION = 1<<4, ///< saturation (postprocessing only) SHADERPERMUTATION_FOGINSIDE = 1<<5, ///< tint the color by fog color or black if using additive blend mode @@ -5141,7 +5149,7 @@ void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemod { case RENDERPATH_D3D9: #ifdef SUPPORTD3D - R_SetupShader_SetPermutationHLSL(SHADERMODE_GENERIC, (first ? SHADERPERMUTATION_DIFFUSE : 0) | (second ? SHADERPERMUTATION_SPECULAR : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0)))); + R_SetupShader_SetPermutationHLSL(SHADERMODE_GENERIC, SHADERPERMUTATION_VIEWTINT | (first ? SHADERPERMUTATION_DIFFUSE : 0) | (second ? SHADERPERMUTATION_SPECULAR : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0)))); R_Mesh_TexBind(GL20TU_FIRST , first ); R_Mesh_TexBind(GL20TU_SECOND, second); #endif @@ -5153,14 +5161,14 @@ void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemod Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); break; case RENDERPATH_GL20: - R_SetupShader_SetPermutationGLSL(SHADERMODE_GENERIC, (first ? SHADERPERMUTATION_DIFFUSE : 0) | (second ? SHADERPERMUTATION_SPECULAR : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0)))); + R_SetupShader_SetPermutationGLSL(SHADERMODE_GENERIC, SHADERPERMUTATION_VIEWTINT | (first ? SHADERPERMUTATION_DIFFUSE : 0) | (second ? SHADERPERMUTATION_SPECULAR : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0)))); R_Mesh_TexBind(GL20TU_FIRST , first ); R_Mesh_TexBind(GL20TU_SECOND, second); break; case RENDERPATH_CGGL: #ifdef SUPPORTCG CHECKCGERROR - R_SetupShader_SetPermutationCG(SHADERMODE_GENERIC, (first ? SHADERPERMUTATION_DIFFUSE : 0) | (second ? SHADERPERMUTATION_SPECULAR : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0)))); + R_SetupShader_SetPermutationCG(SHADERMODE_GENERIC, SHADERPERMUTATION_VIEWTINT | (first ? SHADERPERMUTATION_DIFFUSE : 0) | (second ? SHADERPERMUTATION_SPECULAR : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0)))); if (r_cg_permutation->fp_Texture_First ) CG_BindTexture(r_cg_permutation->fp_Texture_First , first );CHECKCGERROR if (r_cg_permutation->fp_Texture_Second) CG_BindTexture(r_cg_permutation->fp_Texture_Second, second);CHECKCGERROR #endif -- 2.39.2