From 21a8c9024ebe038fe6431c9aa51f7bd557148f53 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 7 Sep 2011 04:12:30 +0000 Subject: [PATCH] initialize some variables differently in the HLSL shader to hush warnings git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11332 d7cf8633-e32d-0410-b094-e92efae38249 --- shader_hlsl.h | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/shader_hlsl.h b/shader_hlsl.h index cc191292..4f73330f 100644 --- a/shader_hlsl.h +++ b/shader_hlsl.h @@ -456,9 +456,7 @@ "{\n" " TexCoord = mul(TexMatrix, gl_MultiTexCoord0).xy;\n" " float3 EyeVectorModelSpace = EyePosition - gl_Vertex.xyz;\n" -" EyeVector.x = dot(EyeVectorModelSpace, gl_MultiTexCoord1.xyz);\n" -" EyeVector.y = dot(EyeVectorModelSpace, gl_MultiTexCoord2.xyz);\n" -" EyeVector.z = dot(EyeVectorModelSpace, gl_MultiTexCoord3.xyz);\n" +" EyeVector = float3(dot(EyeVectorModelSpace, gl_MultiTexCoord1.xyz), dot(EyeVectorModelSpace, gl_MultiTexCoord2.xyz), dot(EyeVectorModelSpace, gl_MultiTexCoord3.xyz));\n" " gl_Position = mul(ModelViewProjectionMatrix, gl_Vertex);\n" " ModelViewProjectionPosition = gl_Position;\n" "#ifdef USETRIPPY\n" @@ -758,9 +756,7 @@ " // transform unnormalized eye direction into tangent space\n" "#ifdef USEOFFSETMAPPING\n" " float3 EyeVectorModelSpace = EyePosition - gl_Vertex.xyz;\n" -" EyeVector.x = dot(EyeVectorModelSpace, gl_MultiTexCoord1.xyz);\n" -" EyeVector.y = dot(EyeVectorModelSpace, gl_MultiTexCoord2.xyz);\n" -" EyeVector.z = dot(EyeVectorModelSpace, gl_MultiTexCoord3.xyz);\n" +" EyeVector = float3(dot(EyeVectorModelSpace, gl_MultiTexCoord1.xyz), dot(EyeVectorModelSpace, gl_MultiTexCoord2.xyz), dot(EyeVectorModelSpace, gl_MultiTexCoord3.xyz));\n" "#endif\n" "\n" " VectorS = mul(ModelViewMatrix, float4(gl_MultiTexCoord1.xyz, 0)).xyz;\n" @@ -1073,24 +1069,18 @@ " // (we use unnormalized to ensure that it interpolates correctly and then\n" " // normalize it per pixel)\n" " float3 lightminusvertex = LightPosition - gl_Vertex.xyz;\n" -" LightVector.x = dot(lightminusvertex, gl_MultiTexCoord1.xyz);\n" -" LightVector.y = dot(lightminusvertex, gl_MultiTexCoord2.xyz);\n" -" LightVector.z = dot(lightminusvertex, gl_MultiTexCoord3.xyz);\n" +" LightVector = float3(dot(lightminusvertex, gl_MultiTexCoord1.xyz), dot(lightminusvertex, gl_MultiTexCoord2.xyz), dot(lightminusvertex, gl_MultiTexCoord3.xyz));\n" "# endif\n" "#endif\n" "\n" "#if defined(MODE_LIGHTDIRECTION) && defined(USEDIFFUSE)\n" -" LightVector.x = dot(LightDir, gl_MultiTexCoord1.xyz);\n" -" LightVector.y = dot(LightDir, gl_MultiTexCoord2.xyz);\n" -" LightVector.z = dot(LightDir, gl_MultiTexCoord3.xyz);\n" +" LightVector = float3(dot(LightDir, gl_MultiTexCoord1.xyz), dot(LightDir, gl_MultiTexCoord2.xyz), dot(LightDir, gl_MultiTexCoord3.xyz));\n" "#endif\n" "\n" " // transform unnormalized eye direction into tangent space\n" "#ifdef USEEYEVECTOR\n" " float3 EyeVectorModelSpace = EyePosition - gl_Vertex.xyz;\n" -" EyeVector.x = dot(EyeVectorModelSpace, gl_MultiTexCoord1.xyz);\n" -" EyeVector.y = dot(EyeVectorModelSpace, gl_MultiTexCoord2.xyz);\n" -" EyeVector.z = dot(EyeVectorModelSpace, gl_MultiTexCoord3.xyz);\n" +" EyeVector = float3(dot(EyeVectorModelSpace, gl_MultiTexCoord1.xyz), dot(EyeVectorModelSpace, gl_MultiTexCoord2.xyz), dot(EyeVectorModelSpace, gl_MultiTexCoord3.xyz));\n" "#endif\n" "\n" "#ifdef USEFOG\n" @@ -1425,10 +1415,7 @@ " half3 lightnormal_modelspace = half3(tex2D(Texture_Deluxemap, TexCoordLightmap).rgb) * 2.0 + half3(-1.0, -1.0, -1.0);\n" " half3 lightcolor = half3(tex2D(Texture_Lightmap, TexCoordLightmap).rgb);\n" " // convert modelspace light vector to tangentspace\n" -" half3 lightnormal;\n" -" lightnormal.x = dot(lightnormal_modelspace, half3(VectorS));\n" -" lightnormal.y = dot(lightnormal_modelspace, half3(VectorT));\n" -" lightnormal.z = dot(lightnormal_modelspace, half3(VectorR));\n" +" half3 lightnormal = half3(dot(lightnormal_modelspace, half3(VectorS)), dot(lightnormal_modelspace, half3(VectorT)), dot(lightnormal_modelspace, half3(VectorR)));\n" " // calculate directional shading (and undoing the existing angle attenuation on the lightmap by the division)\n" " // note that q3map2 is too stupid to calculate proper surface normals when q3map_nonplanar\n" " // is used (the lightmap and deluxemap coords correspond to virtually random coordinates\n" -- 2.39.2