From fc51a7cf708cf10112a4e90ea5825ec3e10a5192 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sun, 11 May 2014 14:37:58 +0200 Subject: [PATCH] Updated embedded shaders --- neo/renderer/RenderProgs_embedded.h | 113 +++++++++++++++------------- 1 file changed, 61 insertions(+), 52 deletions(-) diff --git a/neo/renderer/RenderProgs_embedded.h b/neo/renderer/RenderProgs_embedded.h index af0e93c4..f768a8d5 100644 --- a/neo/renderer/RenderProgs_embedded.h +++ b/neo/renderer/RenderProgs_embedded.h @@ -221,7 +221,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" - "Copyright (C) 2013 Robert Beckebans\n" + "Copyright (C) 2013-2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -261,22 +261,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -1433,6 +1433,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -1495,22 +1496,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -2098,6 +2099,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -2147,22 +2149,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -2377,6 +2379,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -2433,22 +2436,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -2785,6 +2788,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -2837,22 +2841,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -4029,22 +4033,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -4352,7 +4356,7 @@ static const cgShaderDef_t cg_renderprogs[] = " shadowTexcoord.xyz /= shadowTexcoord.w;\n" " shadowTexcoord.z = shadowTexcoord.z * 0.9991;\n" " //shadowTexcoord.z = shadowTexcoord.z - bias;\n" - " shadowTexcoord.w = shadowIndex;\n" + " shadowTexcoord.w = float(shadowIndex);\n" "\n" "#if 0\n" " result.color.xyz = float3( shadowTexcoord.z, shadowTexcoord.z, shadowTexcoord.z );\n" @@ -4398,7 +4402,7 @@ static const cgShaderDef_t cg_renderprogs[] = " \n" " float shadow = 0.0;\n" " \n" - " float stepSize = 1.0 / 16;\n" + " float stepSize = 1.0 / 16.0;\n" " \n" " float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;\n" " for( int i = 0; i < 16; i++ )\n" @@ -4410,7 +4414,7 @@ static const cgShaderDef_t cg_renderprogs[] = " jitterTC.x += stepSize;\n" " }\n" " \n" - " shadow *= ( 1.0 / 16 );\n" + " shadow *= ( 1.0 / 16.0 );\n" "#else \n" " float shadow = texture( samp5, shadowTexcoord.xywz );\n" "#endif\n" @@ -4941,6 +4945,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -5005,22 +5010,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -5117,6 +5122,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -5190,11 +5196,11 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 delta = ( fragment.texcoord0 - prevTexCoord );\n" "\n" " float3 sum = float3( 0.0 );\n" - " float goodSamples = 0;\n" + " float goodSamples = 0.0;\n" " float samples = rpOverbright.x;\n" "\n" - " for ( float i = 0 ; i < samples ; i = i + 1 ) {\n" - " float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1 ) ) - 0.5 );\n" + " for ( float i = 0.0 ; i < samples ; i = i + 1.0 ) {\n" + " float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1.0 ) ) - 0.5 );\n" " float4 color = tex2D( samp0, pos );\n" " // only take the values that are not part of the weapon\n" " sum += color.xyz * color.w;\n" @@ -5605,6 +5611,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -5654,22 +5661,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -5744,6 +5751,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Coypright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -5793,22 +5801,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -5965,7 +5973,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" - "Copyright (C) 2013 Robert Beckebans\n" + "Copyright (C) 2013-2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -6005,22 +6013,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n" @@ -6777,6 +6785,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 2014 Robert Beckebans\n" "\n" "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" "\n" @@ -6829,22 +6838,22 @@ static const cgShaderDef_t cg_renderprogs[] = " const float w3 = vertex.color2.w;\n" "\n" " float4 matX, matY, matZ; // must be float4 for vec4\n" - " float joint = vertex.color.x * 255.1 * 3;\n" + " int joint = int(vertex.color.x * 255.1 * 3.0);\n" " matX = matrices[int(joint+0)] * w0;\n" " matY = matrices[int(joint+1)] * w0;\n" " matZ = matrices[int(joint+2)] * w0;\n" "\n" - " joint = vertex.color.y * 255.1 * 3;\n" + " joint = int(vertex.color.y * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w1;\n" " matY += matrices[int(joint+1)] * w1;\n" " matZ += matrices[int(joint+2)] * w1;\n" "\n" - " joint = vertex.color.z * 255.1 * 3;\n" + " joint = int(vertex.color.z * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w2;\n" " matY += matrices[int(joint+1)] * w2;\n" " matZ += matrices[int(joint+2)] * w2;\n" "\n" - " joint = vertex.color.w * 255.1 * 3;\n" + " joint = int(vertex.color.w * 255.1 * 3.0);\n" " matX += matrices[int(joint+0)] * w3;\n" " matY += matrices[int(joint+1)] * w3;\n" " matZ += matrices[int(joint+2)] * w3;\n"