diff --git a/base/renderprogs/_manifest.lua b/base/renderprogs/_manifest.lua index 05f27770..f7b7c19e 100644 --- a/base/renderprogs/_manifest.lua +++ b/base/renderprogs/_manifest.lua @@ -3,7 +3,7 @@ return -- includes "global.inc.hlsl", "skinning.inc.hlsl", - "SMAA.inc.hlsl", + "builtin/post/SMAA.inc.hlsl", "BRDF.inc.hlsl", -- shaders diff --git a/base/renderprogs/builtin/lighting/ambient_lighting.ps.hlsl b/base/renderprogs/builtin/lighting/ambient_lighting.ps.hlsl index 517d9753..84a05230 100644 --- a/base/renderprogs/builtin/lighting/ambient_lighting.ps.hlsl +++ b/base/renderprogs/builtin/lighting/ambient_lighting.ps.hlsl @@ -34,8 +34,8 @@ If you have questions concerning this license or the applicable additional terms uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map -uniform sampler2D samp3 : register(s3); // texture 4 is the light falloff texture -uniform sampler2D samp4 : register(s4); // texture 5 is the light projection texture +uniform sampler2D samp3 : register(s3); // texture 3 is the BRDF LUT +uniform sampler2D samp4 : register(s4); // texture 4 is SSAO struct PS_IN { half4 position : VPOS; @@ -79,7 +79,7 @@ void main( PS_IN fragment, out PS_OUT result ) // RB: added abs half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) ); - half3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz ) * 1.5f; + half3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz * 0.5f ); half3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz ); // RB: http://developer.valvesoftware.com/wiki/Half_Lambert diff --git a/neo/renderer/RenderProgs_embedded.h b/neo/renderer/RenderProgs_embedded.h index da7d9ce4..2c9fcdfc 100644 --- a/neo/renderer/RenderProgs_embedded.h +++ b/neo/renderer/RenderProgs_embedded.h @@ -219,8 +219,49 @@ static const cgShaderDef_t cg_renderprogs[] = "#endif\n" "}\n" "\n" + "/** Efficient GPU implementation of the octahedral unit vector encoding from\n" + "\n" + " Cigolle, Donow, Evangelakos, Mara, McGuire, Meyer,\n" + " A Survey of Efficient Representations for Independent Unit Vectors, Journal of Computer Graphics Techniques (JCGT), vol. 3, no. 2, 1-30, 2014\n" + "\n" + " Available online http://jcgt.org/published/0003/02/01/\n" + "*/\n" + "\n" + "float signNotZeroFloat( float k )\n" + "{\n" + " return ( k >= 0.0 ) ? 1.0 : -1.0;\n" + "}\n" "\n" "\n" + "float2 signNotZero( float2 v )\n" + "{\n" + " return float2( signNotZeroFloat( v.x ), signNotZeroFloat( v.y ) );\n" + "}\n" + "\n" + "/** Assumes that v is a unit vector. The result is an octahedral vector on the [-1, +1] square. */\n" + "float2 octEncode( float3 v )\n" + "{\n" + " float l1norm = abs( v.x ) + abs( v.y ) + abs( v.z );\n" + " float2 oct = v.xy * ( 1.0 / l1norm );\n" + " if( v.z < 0.0 )\n" + " {\n" + " oct = ( 1.0 - abs( oct.yx ) ) * signNotZero( oct.xy );\n" + " }\n" + " return oct;\n" + "}\n" + "\n" + "\n" + "/** Returns a unit vector. Argument o is an octahedral vector packed via octEncode,\n" + " on the [-1, +1] square*/\n" + "float3 octDecode( float2 o )\n" + "{\n" + " float3 v = float3( o.x, o.y, 1.0 - abs( o.x ) - abs( o.y ) );\n" + " if( v.z < 0.0 )\n" + " {\n" + " v.xy = ( 1.0 - abs( v.yx ) ) * signNotZero( v.xy );\n" + " }\n" + " return normalize( v );\n" + "}\n" "\n" "// RB end\n" "\n" @@ -434,9 +475,9 @@ static const cgShaderDef_t cg_renderprogs[] = " return color;\n" "}\n" "\n" - + }, - + { "renderprogs/skinning.inc.hlsl", "/*\n" @@ -517,11 +558,11 @@ static const cgShaderDef_t cg_renderprogs[] = "result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" "result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" "result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - + }, - + { - "renderprogs/SMAA.inc.hlsl", + "renderprogs/builtin/post/SMAA.inc.hlsl", "/**\n" " * Copyright (C) 2013 Jorge Jimenez (jorge@iryoku.com)\n" " * Copyright (C) 2013 Jose I. Echevarria (joseignacioechevarria@gmail.com)\n" @@ -1970,9 +2011,9 @@ static const cgShaderDef_t cg_renderprogs[] = "//-----------------------------------------------------------------------------\n" "#endif // SMAA_INCLUDE_PS\n" "\n" - + }, - + { "renderprogs/BRDF.inc.hlsl", "/*\n" @@ -2125,11 +2166,1997 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "\n" "\n" - + }, - + { - "renderprogs/ambient_lighting.ps.hlsl", + "renderprogs/builtin/debug/debug_shadowmap.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2DArray samp0 : register(s0);\n" + "\n" + "struct PS_IN\n" + "{\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT\n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float3 tc;\n" + " tc.xy = fragment.texcoord0.xy;\n" + " tc.z = rpScreenCorrectionFactor.x; // layer\n" + "\n" + " result.color = texture( samp0, tc );// * rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/debug/debug_shadowmap.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " // compute oldschool texgen or multiply by texture matrix\n" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" + " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" + " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" + " }\n" + " else\n" + " {\n" + " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" + " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" + " }\n" + "}\n" + + }, + + { + "renderprogs/builtin/debug/shadowDebug.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/debug/shadowDebug.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " float4 vPos = vertex.position - rpLocalLightOrigin;\n" + " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" + "\n" + " result.position.x = dot4( vPos, rpMVPmatrixX );\n" + " result.position.y = dot4( vPos, rpMVPmatrixY );\n" + " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" + " result.position.w = dot4( vPos, rpMVPmatrixW );\n" + "}\n" + + }, + + { + "renderprogs/builtin/debug/shadowDebug_skinned.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/debug/shadowDebug_skinned.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float4 vertexPosition = vertex.position;\n" + " vertexPosition.w = 1.0;\n" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertexPosition );\n" + " modelPosition.y = dot4( matY, vertexPosition );\n" + " modelPosition.z = dot4( matZ, vertexPosition );\n" + " modelPosition.w = vertex.position.w;\n" + "\n" + " float4 vPos = modelPosition - rpLocalLightOrigin;\n" + " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" + "\n" + " result.position.x = dot4( vPos, rpMVPmatrixX );\n" + " result.position.y = dot4( vPos, rpMVPmatrixY );\n" + " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" + " result.position.w = dot4( vPos, rpMVPmatrixW );\n" + "}\n" + + }, + + { + "renderprogs/builtin/debug/octahedron.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2020 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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // texture 0 is octahedron cube map\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float3 texcoord0 : TEXCOORD0_centroid;\n" + " float3 texcoord1 : TEXCOORD1_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float3 globalNormal = normalize( fragment.texcoord1 );\n" + " float3 globalEye = normalize( fragment.texcoord0 );\n" + "\n" + " float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );\n" + " reflectionVector *= globalNormal;\n" + " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" + "\n" + " float2 normalizedOctCoord = octEncode( reflectionVector );\n" + " float2 normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;\n" + "\n" + " float4 envMap = tex2D( samp0, normalizedOctCoordZeroOne );\n" + "\n" + " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/debug/octahedron.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2020 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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float3 texcoord0 : TEXCOORD0;\n" + " float3 texcoord1 : TEXCOORD1;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" + "\n" + "#if defined( USE_GPU_SKINNING )\n" + "\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float3 normal;\n" + " normal.x = dot3( matX, vNormal );\n" + " normal.y = dot3( matY, vNormal );\n" + " normal.z = dot3( matZ, vNormal );\n" + " normal = normalize( normal );\n" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + "\n" + "#else\n" + "\n" + " float4 modelPosition = vertex.position;\n" + " float4 normal = vNormal;\n" + "\n" + "#endif\n" + "\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "\n" + " float4 toEye = rpLocalViewOrigin - vertex.position;\n" + "\n" + " result.texcoord0 = toEye.xyz;\n" + " result.texcoord1 = normal.xyz;\n" + "\n" + " result.color = sRGBAToLinearRGBA( rpColor );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/fog/blendLight.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "uniform sampler2D samp1 : register(s1);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float4 texcoord0 : TEXCOORD0_centroid;\n" + " float2 texcoord1 : TEXCOORD1_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float4 c = idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;\n" + "\n" + "#if defined( USE_LINEAR_RGB )\n" + " c = clamp( c, 0.0, 1.0 );\n" + "\n" + " c = float4( Linear1( c.r ), Linear1( c.g ), Linear1( c.b ), Linear1( c.a ) );\n" + "#endif\n" + "\n" + " result.color = c;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/fog/blendLight.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 binormal : BINORMAL;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float4 texcoord0 : TEXCOORD0;\n" + " float2 texcoord1 : TEXCOORD1;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" + " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" + " result.texcoord0.z = 0.0;\n" + " result.texcoord0.w = dot4( vertex.position, rpTexGen0Q );\n" + "\n" + " result.texcoord1.x = dot4( vertex.position, rpTexGen1S );\n" + " result.texcoord1.y = 0.5;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/fog/fog.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2020 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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "uniform sampler2D samp1 : register(s1);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float2 texcoord1 : TEXCOORD1_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float4 c = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;\n" + "\n" + "#if defined( USE_LINEAR_RGB )\n" + " c = clamp( c, 0.0, 1.0 );\n" + "\n" + " c = float4( Linear1( c.r ), Linear1( c.g ), Linear1( c.b ), Linear1( c.a ) );\n" + "#endif\n" + "\n" + " result.color = c;\n" + "}\n" + "\n" + "\n" + + }, + + { + "renderprogs/builtin/fog/fog.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float2 texcoord1 : TEXCOORD1;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" + " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" + "\n" + " result.texcoord1.x = dot4( vertex.position, rpTexGen1S );\n" + " result.texcoord1.y = dot4( vertex.position, rpTexGen1T );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/fog/fog_skinned.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2020 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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "uniform sampler2D samp1 : register(s1);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float2 texcoord1 : TEXCOORD1_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float4 c = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;\n" + "\n" + "#if defined( USE_LINEAR_RGB )\n" + " c = clamp( c, 0.0, 1.0 );\n" + "\n" + " c = float4( Linear1( c.r ), Linear1( c.g ), Linear1( c.b ), Linear1( c.a ) );\n" + "#endif\n" + "\n" + " result.color = c;\n" + "}\n" + "\n" + "\n" + + }, + + { + "renderprogs/builtin/fog/fog_skinned.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float2 texcoord1 : TEXCOORD1;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + " // end of skinning\n" + "\n" + " // start of fog portion\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "\n" + " result.texcoord0.x = dot4( modelPosition, rpTexGen0S );\n" + " result.texcoord0.y = dot4( modelPosition, rpTexGen0T );\n" + "\n" + " result.texcoord1.x = dot4( modelPosition, rpTexGen1S );\n" + " result.texcoord1.y = dot4( modelPosition, rpTexGen1T );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/bumpyenvironment.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" + "uniform sampler2D samp1 : register(s1); // normal map\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float3 texcoord1 : TEXCOORD1_centroid;\n" + " float3 texcoord2 : TEXCOORD2_centroid;\n" + " float3 texcoord3 : TEXCOORD3_centroid;\n" + " float3 texcoord4 : TEXCOORD4_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;\n" + " // RB begin\n" + " float3 localNormal;\n" + "#if defined(USE_NORMAL_FMT_RGB8)\n" + " localNormal = float3( bump.rg, 0.0f );\n" + "#else\n" + " localNormal = float3( bump.wy, 0.0f );\n" + "#endif\n" + " // RB end\n" + " localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );\n" + "\n" + " float3 globalNormal;\n" + " globalNormal.x = dot3( localNormal, fragment.texcoord2 );\n" + " globalNormal.y = dot3( localNormal, fragment.texcoord3 );\n" + " globalNormal.z = dot3( localNormal, fragment.texcoord4 );\n" + "\n" + " float3 globalEye = normalize( fragment.texcoord1 );\n" + "\n" + " float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );\n" + " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" + "\n" + " float4 envMap = texCUBE( samp0, reflectionVector );\n" + "\n" + " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/bumpyenvironment.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float3 texcoord1 : TEXCOORD1;\n" + " float3 texcoord2 : TEXCOORD2;\n" + " float3 texcoord3 : TEXCOORD3;\n" + " float3 texcoord4 : TEXCOORD4;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "\n" + " float4 normal = vertex.normal * 2.0 - 1.0;\n" + " float4 tangent = vertex.tangent * 2.0 - 1.0;\n" + " float3 binormal = cross( normal.xyz, tangent.xyz ) * tangent.w;\n" + "\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0 = vertex.texcoord.xy;\n" + "\n" + " float4 toEye = rpLocalViewOrigin - vertex.position;\n" + " result.texcoord1.x = dot3( toEye, rpModelMatrixX );\n" + " result.texcoord1.y = dot3( toEye, rpModelMatrixY );\n" + " result.texcoord1.z = dot3( toEye, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.x = dot3( tangent, rpModelMatrixX );\n" + " result.texcoord3.x = dot3( tangent, rpModelMatrixY );\n" + " result.texcoord4.x = dot3( tangent, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.y = dot3( binormal, rpModelMatrixX );\n" + " result.texcoord3.y = dot3( binormal, rpModelMatrixY );\n" + " result.texcoord4.y = dot3( binormal, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.z = dot3( normal, rpModelMatrixX );\n" + " result.texcoord3.z = dot3( normal, rpModelMatrixY );\n" + " result.texcoord4.z = dot3( normal, rpModelMatrixZ );\n" + "\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/legacy/bumpyenvironment_skinned.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" + "uniform sampler2D samp1 : register(s1); // normal map\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float3 texcoord1 : TEXCOORD1_centroid;\n" + " float3 texcoord2 : TEXCOORD2_centroid;\n" + " float3 texcoord3 : TEXCOORD3_centroid;\n" + " float3 texcoord4 : TEXCOORD4_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;\n" + "\n" + " // RB begin\n" + " float3 localNormal;\n" + "#if defined(GLES2)\n" + " localNormal = float3( bump.rg, 0.0f );\n" + "#else\n" + " localNormal = float3( bump.wy, 0.0f );\n" + "#endif\n" + " // RB end\n" + " localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );\n" + "\n" + " float3 globalNormal;\n" + " globalNormal.x = dot3( localNormal, fragment.texcoord2 );\n" + " globalNormal.y = dot3( localNormal, fragment.texcoord3 );\n" + " globalNormal.z = dot3( localNormal, fragment.texcoord4 );\n" + "\n" + " float3 globalEye = normalize( fragment.texcoord1 );\n" + "\n" + " float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );\n" + " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" + "\n" + " float4 envMap = texCUBE( samp0, reflectionVector );\n" + "\n" + " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/bumpyenvironment_skinned.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float3 texcoord1 : TEXCOORD1;\n" + " float3 texcoord2 : TEXCOORD2;\n" + " float3 texcoord3 : TEXCOORD3;\n" + " float3 texcoord4 : TEXCOORD4;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" + " float4 vTangent = vertex.tangent * 2.0 - 1.0;\n" + " float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;\n" + "\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float3 normal;\n" + " normal.x = dot3( matX, vNormal );\n" + " normal.y = dot3( matY, vNormal );\n" + " normal.z = dot3( matZ, vNormal );\n" + " normal = normalize( normal );\n" + "\n" + " float3 tangent;\n" + " tangent.x = dot3( matX, vTangent );\n" + " tangent.y = dot3( matY, vTangent );\n" + " tangent.z = dot3( matZ, vTangent );\n" + " tangent = normalize( tangent );\n" + "\n" + " float3 binormal;\n" + " binormal.x = dot3( matX, vBinormal );\n" + " binormal.y = dot3( matY, vBinormal );\n" + " binormal.z = dot3( matZ, vBinormal );\n" + " binormal = normalize( binormal );\n" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + "\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "\n" + " result.texcoord0 = vertex.texcoord.xy;\n" + "\n" + " float4 toEye = rpLocalViewOrigin - modelPosition;\n" + " result.texcoord1.x = dot3( toEye, rpModelMatrixX );\n" + " result.texcoord1.y = dot3( toEye, rpModelMatrixY );\n" + " result.texcoord1.z = dot3( toEye, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.x = dot3( tangent, rpModelMatrixX );\n" + " result.texcoord3.x = dot3( tangent, rpModelMatrixY );\n" + " result.texcoord4.x = dot3( tangent, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.y = dot3( binormal, rpModelMatrixX );\n" + " result.texcoord3.y = dot3( binormal, rpModelMatrixY );\n" + " result.texcoord4.y = dot3( binormal, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.z = dot3( normal, rpModelMatrixX );\n" + " result.texcoord3.z = dot3( normal, rpModelMatrixY );\n" + " result.texcoord4.z = dot3( normal, rpModelMatrixZ );\n" + "\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/legacy/environment.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float3 texcoord0 : TEXCOORD0_centroid;\n" + " float3 texcoord1 : TEXCOORD1_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float3 globalNormal = normalize( fragment.texcoord1 );\n" + " float3 globalEye = normalize( fragment.texcoord0 );\n" + "\n" + " float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );\n" + " reflectionVector *= globalNormal;\n" + " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" + "\n" + " float4 envMap = texCUBE( samp0, reflectionVector );\n" + "\n" + " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/environment.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float4 normal : NORMAL;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float3 texcoord0 : TEXCOORD0;\n" + " float3 texcoord1 : TEXCOORD1;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "\n" + " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" + "\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " float4 toEye = rpLocalViewOrigin - vertex.position;\n" + "\n" + " result.texcoord0 = toEye.xyz;\n" + " result.texcoord1 = vNormal.xyz;\n" + "\n" + " result.color = sRGBAToLinearRGBA( rpColor );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/environment_skinned.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float3 texcoord0 : TEXCOORD0_centroid;\n" + " float3 texcoord1 : TEXCOORD1_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float3 globalNormal = normalize( fragment.texcoord1 );\n" + " float3 globalEye = normalize( fragment.texcoord0 );\n" + "\n" + " float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );\n" + " reflectionVector *= globalNormal;\n" + " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" + "\n" + " float4 envMap = texCUBE( samp0, reflectionVector );\n" + "\n" + " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/environment_skinned.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float3 texcoord0 : TEXCOORD0;\n" + " float3 texcoord1 : TEXCOORD1;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" + "\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float3 vNormalSkinned;\n" + " vNormalSkinned.x = dot3( matX, vNormal );\n" + " vNormalSkinned.y = dot3( matY, vNormal );\n" + " vNormalSkinned.z = dot3( matZ, vNormal );\n" + " vNormalSkinned = normalize( vNormalSkinned );\n" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + "\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "\n" + " float4 toEye = rpLocalViewOrigin - modelPosition;\n" + "\n" + " result.texcoord0 = toEye.xyz;\n" + " result.texcoord1 = vNormalSkinned.xyz;\n" + "\n" + " result.color = rpColor;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/skybox.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform samplerCUBE samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float3 texcoord0 : TEXCOORD0_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/skybox.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float3 texcoord0 : TEXCOORD0;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0 = vertex.position.xyz - rpLocalViewOrigin.xyz;\n" + "\n" + " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/wobblesky.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform samplerCUBE samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float3 texcoord0 : TEXCOORD0_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/legacy/wobblesky.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float3 texcoord0 : TEXCOORD0;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " float3 t0 = vertex.position.xyz - rpLocalViewOrigin.xyz;\n" + " result.texcoord0.x = dot3( t0, rpWobbleSkyX );\n" + " result.texcoord0.y = dot3( t0, rpWobbleSkyY );\n" + " result.texcoord0.z = dot3( t0, rpWobbleSkyZ );\n" + "\n" + " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/lighting/ambient_lighting.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -2159,14 +4186,15 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map\n" "uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map\n" "uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map \n" - "uniform sampler2D samp3 : register(s3); // texture 4 is the light falloff texture\n" - "uniform sampler2D samp4 : register(s4); // texture 5 is the light projection texture\n" + "uniform sampler2D samp3 : register(s3); // texture 3 is the BRDF LUT\n" + "uniform sampler2D samp4 : register(s4); // texture 4 is SSAO\n" "\n" "struct PS_IN {\n" " half4 position : VPOS;\n" @@ -2210,7 +4238,7 @@ static const cgShaderDef_t cg_renderprogs[] = " // RB: added abs\n" " half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );\n" "\n" - " half3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz ) * 1.5f;\n" + " half3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz * 0.5f );\n" " half3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz );\n" "\n" " // RB: http://developer.valvesoftware.com/wiki/Half_Lambert\n" @@ -2232,11 +4260,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color.w = fragment.color.a;\n" "}\n" "\n" - + }, - + { - "renderprogs/ambient_lighting.vs.hlsl", + "renderprogs/builtin/lighting/ambient_lighting.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -2266,7 +4294,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#if defined( USE_GPU_SKINNING )\n" "uniform matrices_ubo { float4 matrices[408]; };\n" @@ -2439,11 +4468,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" - + }, - + { - "renderprogs/ambient_lighting_IBL.ps.hlsl", + "renderprogs/builtin/lighting/ambient_lighting_IBL.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -2473,8 +4502,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" - "#include \"BRDF.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "#include \"renderprogs/BRDF.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 0 is the per-surface normal map\n" @@ -2506,51 +4537,6 @@ static const cgShaderDef_t cg_renderprogs[] = "// *INDENT-ON*\n" "\n" "\n" - "\n" - "/** Efficient GPU implementation of the octahedral unit vector encoding from\n" - "\n" - " Cigolle, Donow, Evangelakos, Mara, McGuire, Meyer,\n" - " A Survey of Efficient Representations for Independent Unit Vectors, Journal of Computer Graphics Techniques (JCGT), vol. 3, no. 2, 1-30, 2014\n" - "\n" - " Available online http://jcgt.org/published/0003/02/01/\n" - "*/\n" - "\n" - "float signNotZeroFloat( float k )\n" - "{\n" - " return ( k >= 0.0 ) ? 1.0 : -1.0;\n" - "}\n" - "\n" - "\n" - "float2 signNotZero( float2 v )\n" - "{\n" - " return float2( signNotZeroFloat( v.x ), signNotZeroFloat( v.y ) );\n" - "}\n" - "\n" - "/** Assumes that v is a unit vector. The result is an octahedral vector on the [-1, +1] square. */\n" - "float2 octEncode( float3 v )\n" - "{\n" - " float l1norm = abs( v.x ) + abs( v.y ) + abs( v.z );\n" - " float2 oct = v.xy * ( 1.0 / l1norm );\n" - " if( v.z < 0.0 )\n" - " {\n" - " oct = ( 1.0 - abs( oct.yx ) ) * signNotZero( oct.xy );\n" - " }\n" - " return oct;\n" - "}\n" - "\n" - "\n" - "/** Returns a unit vector. Argument o is an octahedral vector packed via octEncode,\n" - " on the [-1, +1] square*/\n" - "float3 octDecode( float2 o )\n" - "{\n" - " float3 v = float3( o.x, o.y, 1.0 - abs( o.x ) - abs( o.y ) );\n" - " if( v.z < 0.0 )\n" - " {\n" - " v.xy = ( 1.0 - abs( v.yx ) ) * signNotZero( v.xy );\n" - " }\n" - " return normalize( v );\n" - "}\n" - "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " half4 bumpMap = tex2D( samp0, fragment.texcoord0.xy );\n" @@ -2692,11 +4678,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color.w = fragment.color.a;\n" "}\n" "\n" - + }, - + { - "renderprogs/ambient_lighting_IBL.vs.hlsl", + "renderprogs/builtin/lighting/ambient_lighting_IBL.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -2726,7 +4712,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#if defined( USE_GPU_SKINNING )\n" "uniform matrices_ubo { float4 matrices[408]; };\n" @@ -2886,6223 +4873,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" - + }, - + { - "renderprogs/AmbientOcclusion_AO.ps.hlsl", - "/**\n" - " \file AmbientOcclusion_AO.pix\n" - " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" - "\n" - " Reference implementation of the Scalable Ambient Obscurance (AmbientOcclusion) screen-space ambient obscurance algorithm.\n" - "\n" - " The optimized algorithmic structure of AmbientOcclusion was published in McGuire, Mara, and Luebke, Scalable Ambient Obscurance,\n" - " HPG 2012, and was developed at NVIDIA with support from Louis Bavoil.\n" - "\n" - " The mathematical ideas of AlchemyAO were first described in McGuire, Osman, Bukowski, and Hennessy, The\n" - " Alchemy Screen-Space Ambient Obscurance Algorithm, HPG 2011 and were developed at\n" - " Vicarious Visions.\n" - "\n" - " DX11 HLSL port by Leonardo Zide of Treyarch\n" - "\n" - "
\n" - "\n" - " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" - "\n" - " Copyright (c) 2011-2012, NVIDIA\n" - " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" - " All rights reserved.\n" - "\n" - " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" - "\n" - " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" - " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" - " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" - "\n" - " */\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "\n" - "\n" - "#define DIFFERENT_DEPTH_RESOLUTIONS 0\n" - "#define USE_DEPTH_PEEL 0\n" - "#define CS_Z_PACKED_TOGETHER 0\n" - "#define TEMPORALLY_VARY_TAPS 0\n" - "#define HIGH_QUALITY 1\n" - "#define USE_OCT16 0\n" - "#define USE_MIPMAPS 1\n" - "\n" - "// Total number of direct samples to take at each pixel\n" - "#define NUM_SAMPLES 11\n" - "\n" - "// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent\n" - "// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9\n" - "#define NUM_SPIRAL_TURNS 7\n" - "\n" - "// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower\n" - "// miplevel to maintain reasonable spatial locality in the cache\n" - "// If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing.\n" - "// If it is too high (> 5), we'll get bad performance because we're not using the MIP levels effectively\n" - "#define LOG_MAX_OFFSET (3)\n" - "\n" - "// This must be less than or equal to the MAX_MIP_LEVEL defined in SAmbientOcclusion.cpp\n" - "#define MAX_MIP_LEVEL (5)\n" - "\n" - "#define MIN_MIP_LEVEL 0\n" - "\n" - "const float DOOM_TO_METERS = 0.0254; // doom to meters\n" - "const float METERS_TO_DOOM = ( 1.0 / DOOM_TO_METERS ); // meters to doom\n" - "\n" - "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" - " This need not match the real far plane but should not be much more than it.*/\n" - "//const float FAR_PLANE_Z = -4000.0;\n" - "\n" - "/** World-space AO radius in scene units (r). e.g., 1.0m */\n" - "const float radius = 1.0 * METERS_TO_DOOM;\n" - "const float radius2 = radius * radius;\n" - "const float invRadius2 = 1.0 / radius2;\n" - "\n" - "/** Bias to avoid AO in smooth corners, e.g., 0.01m */\n" - "const float bias = 0.01 * METERS_TO_DOOM;\n" - "\n" - "/** intensity / radius^6 */\n" - "const float intensity = 0.6;\n" - "const float intensityDivR6 = intensity / ( radius* radius* radius* radius* radius* radius );\n" - "\n" - "/** The height in pixels of a 1m object if viewed from 1m away.\n" - " You can compute it from your projection matrix. The actual value is just\n" - " a scale factor on radius; you can simply hardcode this to a constant (~500)\n" - " and make your radius value unitless (...but resolution dependent.) */\n" - "const float projScale = 500.0;\n" - "\n" - "//#expect NUM_SAMPLES \"Integer number of samples to take at each pixels\"\n" - "//#expect NUM_SPIRAL_TURNS \"Integer number of turns around the circle that the spiral pattern makes. The G3D::AmbientOcclusion class provides a discrepancy-minimizing value of NUM_SPIRAL_TURNS for eac value of NUM_SAMPLES.\"\n" - "//#expect DIFFERENT_DEPTH_RESOLUTIONS \"1 if the peeled depth buffer is at a different resolution than the primary depth buffer\"\n" - "//#expect USE_DEPTH_PEEL \"1 to enable, 0 to disable\"\n" - "//#expect CS_Z_PACKED_TOGETHER \"1 to enable, 0 to disable\"\n" - "//#expect TEMPORALLY_VARY_SAMPLES \"1 to enable, 0 to disable\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register( s0 ); // view normal/roughness\n" - "uniform sampler2D samp1 : register( s1 ); // view depth\n" - "uniform sampler2D samp2 : register( s2 ); // blue noise 256\n" - "\n" - "#define CS_Z_buffer samp1\n" - "\n" - "struct PS_IN\n" - "{\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT \n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "\n" - "float BlueNoise( float2 n, float x )\n" - "{\n" - " float noise = tex2D( samp2, n.xy * rpJitterTexOffset.xy ).r;\n" - "\n" - "#if TEMPORALLY_VARY_TAPS\n" - " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" - "#else\n" - " noise = fract( noise );\n" - "#endif\n" - "\n" - " //noise = RemapNoiseTriErp( noise );\n" - " //noise = noise * 2.0 - 0.5;\n" - "\n" - " return noise;\n" - "}\n" - "\n" - "/** Used for packing Z into the GB channels */\n" - "// float CSZToKey( float z )\n" - "// {\n" - "// return clamp( z * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" - "// }\n" - "\n" - "/** Used for packing Z into the GB channels */\n" - "void packKey( float key, out float2 p )\n" - "{\n" - " // Round to the nearest 1/256.0\n" - " float temp = floor( key * 256.0 );\n" - "\n" - " // Integer part\n" - " p.x = temp * ( 1.0 / 256.0 );\n" - "\n" - " // Fractional part\n" - " p.y = key * 256.0 - temp;\n" - "}\n" - "\n" - "/** Reconstructs screen-space unit normal from screen-space position */\n" - "float3 reconstructCSFaceNormal( float3 C )\n" - "{\n" - " return normalize( cross( dFdy( C ), dFdx( C ) ) );\n" - "}\n" - "\n" - "float3 reconstructNonUnitCSFaceNormal( float3 C )\n" - "{\n" - " float3 n = cross( dFdy( C ), dFdx( C ) );\n" - " //n.z = sqrt( abs( dot( n.xy, n.xy ) - 0.25 ) );\n" - " return n;\n" - "}\n" - "\n" - "float3 reconstructCSPosition( float2 S, float z )\n" - "{\n" - " float4 P;\n" - " P.z = z * 2.0 - 1.0;\n" - " P.xy = ( S * rpWindowCoord.xy ) * 2.0 - 1.0;\n" - " P.w = 1.0;\n" - "\n" - " float4 csP;\n" - " csP.x = dot4( P, rpModelMatrixX );\n" - " csP.y = dot4( P, rpModelMatrixY );\n" - " csP.z = dot4( P, rpModelMatrixZ );\n" - " csP.w = dot4( P, rpModelMatrixW );\n" - "\n" - " csP.xyz /= csP.w;\n" - "\n" - " return csP.xyz;\n" - "}\n" - "\n" - "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" - "{\n" - "#if USE_OCT16\n" - " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" - "#else\n" - " return texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0;\n" - "#endif\n" - "}\n" - "\n" - "/** Returns a unit vector and a screen-space radius for the tap on a unit disk\n" - " (the caller should scale by the actual disk radius) */\n" - "float2 tapLocation( int sampleNumber, float spinAngle, out float ssR )\n" - "{\n" - " // Radius relative to ssR\n" - " float alpha = ( float( sampleNumber ) + 0.5 ) * ( 1.0 / float( NUM_SAMPLES ) );\n" - " float angle = alpha * ( float( NUM_SPIRAL_TURNS ) * 6.28 ) + spinAngle;\n" - "\n" - " ssR = alpha;\n" - " return float2( cos( angle ), sin( angle ) );\n" - "}\n" - "\n" - "\n" - "/** Read the camera-space position of the point at screen-space pixel ssP */\n" - "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" - "{\n" - " float3 P;\n" - " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" - "\n" - " // Offset to pixel center\n" - " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" - "\n" - " return P;\n" - "}\n" - "\n" - "void computeMipInfo( float ssR, int2 ssP, sampler2D cszBuffer, out int mipLevel, out int2 mipP )\n" - "{\n" - " // Derivation:\n" - " // mipLevel = floor(log(ssR / MAX_OFFSET));\n" - "#ifdef GL_EXT_gpu_shader5\n" - " mipLevel = clamp( findMSB( int( ssR ) ) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL );\n" - "#else\n" - " mipLevel = clamp( int( floor( log2( ssR ) ) ) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL );\n" - "#endif\n" - "\n" - " // We need to divide by 2^mipLevel to read the appropriately scaled coordinate from a MIP-map.\n" - " // Manually clamp to the texture size because texelFetch bypasses the texture unit\n" - "\n" - " // used in newer radiosity\n" - " //mipP = ssP >> mipLevel;\n" - "\n" - " mipP = clamp( ssP >> mipLevel, int2( 0 ), textureSize( cszBuffer, mipLevel ) - int2( 1 ) );\n" - "}\n" - "\n" - "/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1.\n" - " Use cszBufferScale if reading from the peeled depth buffer, which has been scaled by (1 / invCszBufferScale) from the original */\n" - "float3 getOffsetPosition( int2 issC, float2 unitOffset, float ssR, sampler2D cszBuffer, float invCszBufferScale )\n" - "{\n" - " int2 ssP = int2( ssR * unitOffset ) + issC;\n" - "\n" - " float3 P;\n" - "\n" - " int mipLevel;\n" - " int2 mipP;\n" - " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, mipP );\n" - "\n" - "#if USE_MIPMAPS\n" - " // RB: this is the key for fast ambient occlusion - use a hierarchical depth buffer\n" - " // for more information see McGuire12SAO.pdf - Scalable Ambient Obscurance\n" - " // http://graphics.cs.williams.edu/papers/SAOHPG12/\n" - " P.z = texelFetch( cszBuffer, mipP, mipLevel ).r;\n" - "#else\n" - " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" - "#endif\n" - "\n" - " // Offset to pixel center\n" - " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" - " //P = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ) * invCszBufferScale, P.z );\n" - "\n" - " return P;\n" - "}\n" - "\n" - "float fallOffFunction( float vv, float vn, float epsilon )\n" - "{\n" - " // A: From the HPG12 paper\n" - " // Note large epsilon to avoid overdarkening within cracks\n" - " // Assumes the desired result is intensity/radius^6 in main()\n" - " // return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6;\n" - "\n" - " // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]\n" - "#if HIGH_QUALITY\n" - " // Epsilon inside the sqrt for rsqrt operation\n" - " float f = max( 1.0 - vv * invRadius2, 0.0 );\n" - " return f * max( ( vn - bias ) * rsqrt( epsilon + vv ), 0.0 );\n" - "#else\n" - " // Avoid the square root from above.\n" - " // Assumes the desired result is intensity/radius^6 in main()\n" - " float f = max( radius2 - vv, 0.0 );\n" - " return f * f * f * max( ( vn - bias ) / ( epsilon + vv ), 0.0 );\n" - "#endif\n" - "\n" - " // C: Medium contrast (which looks better at high radii), no division. Note that the\n" - " // contribution still falls off with radius^2, but we've adjusted the rate in a way that is\n" - " // more computationally efficient and happens to be aesthetically pleasing. Assumes\n" - " // division by radius^6 in main()\n" - " //return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0);\n" - "\n" - " // D: Low contrast, no division operation\n" - " //return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);\n" - "}\n" - "\n" - "/** Compute the occlusion due to sample point \a Q about camera-space point \a C with unit normal \a n_C */\n" - "float aoValueFromPositionsAndNormal( float3 C, float3 n_C, float3 Q )\n" - "{\n" - " float3 v = Q - C;\n" - " //v = normalize( v );\n" - " float vv = dot( v, v );\n" - " float vn = dot( v, n_C );\n" - " const float epsilon = 0.001;\n" - "\n" - " // Without the angular adjustment term, surfaces seen head on have less AO\n" - " return fallOffFunction( vv, vn, epsilon ) * lerp( 1.0, max( 0.0, 1.5 * n_C.z ), 0.35 );\n" - "}\n" - "\n" - "\n" - "/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds\n" - " to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius\n" - "\n" - " Note that units of H() in the HPG12 paper are meters, not\n" - " unitless. The whole falloff/sampling function is therefore\n" - " unitless. In this implementation, we factor out (9 / radius).\n" - "\n" - " Four versions of the falloff function are implemented below\n" - "\n" - " When sampling from the peeled depth buffer, make sure ssDiskRadius has been premultiplied by cszBufferScale\n" - "*/\n" - "float sampleAO( int2 issC, in float3 C, in float3 n_C, in float ssDiskRadius, in int tapIndex, in float randomPatternRotationAngle, in sampler2D cszBuffer, in float invCszBufferScale )\n" - "{\n" - " // Offset on the unit disk, spun for this pixel\n" - " float ssR;\n" - " float2 unitOffset = tapLocation( tapIndex, randomPatternRotationAngle, ssR );\n" - "\n" - " // Ensure that the taps are at least 1 pixel away\n" - " ssR = max( 0.75, ssR * ssDiskRadius );\n" - "\n" - "#if (CS_Z_PACKED_TOGETHER != 0)\n" - " vec3 Q0, Q1;\n" - " getOffsetPositions( ssC, unitOffset, ssR, cszBuffer, Q0, Q1 );\n" - "\n" - " return max( aoValueFromPositionsAndNormal( C, n_C, Q0 ), aoValueFromPositionsAndNormal( C, n_C, Q1 ) );\n" - "#else\n" - " // The occluding point in camera space\n" - " vec3 Q = getOffsetPosition( issC, unitOffset, ssR, cszBuffer, invCszBufferScale );\n" - "\n" - " return aoValueFromPositionsAndNormal( C, n_C, Q );\n" - "#endif\n" - "}\n" - "\n" - "const float MIN_RADIUS = 3.0; // pixels\n" - "\n" - "#define visibility result.color.r\n" - "#define bilateralKey result.color.gb\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " result.color = float4( 1.0, 0.0, 0.0, 1.0 );\n" - "\n" - "#if 0\n" - " if( fragment.texcoord0.x < 0.5 )\n" - " {\n" - " discard;\n" - " }\n" - "#endif\n" - "\n" - " // Pixel being shaded\n" - " float2 ssC = fragment.texcoord0 * rpScreenCorrectionFactor.xy;\n" - " int2 ssP = int2( ssC.x * rpWindowCoord.z, ssC.y * rpWindowCoord.w );\n" - "\n" - " //int2 ssP = int2( gl_FragCoord.xy );\n" - "\n" - " // World space point being shaded\n" - " vec3 C = getPosition( ssP, CS_Z_buffer );\n" - "\n" - " //float z = length( C - rpGlobalEyePos.xyz );\n" - " //bilateralKey = CSZToKey( C.z );\n" - " //packKey( CSZToKey( C.z ), bilateralKey );\n" - "\n" - " //float key = CSZToKey( C.z );\n" - "\n" - "#if 0\n" - " if( key >= 1.0 )\n" - " {\n" - " visibility = 0.0;\n" - " return;\n" - " }\n" - "#endif\n" - "\n" - " visibility = 0.0;\n" - "\n" - "#if 1\n" - " float3 n_C = sampleNormal( samp0, ssP, 0 );\n" - "\n" - " if( length( n_C ) < 0.01 )\n" - " {\n" - " visibility = 1.0;\n" - " return;\n" - " }\n" - "\n" - " n_C = normalize( n_C );\n" - " //n_C = -n_C;\n" - "\n" - "#else\n" - " // Reconstruct normals from positions.\n" - " float3 n_C = reconstructNonUnitCSFaceNormal( C );\n" - " // Since n_C is computed from the cross product of camera-space edge vectors from points at adjacent pixels, its magnitude will be proportional to the square of distance from the camera\n" - " if( dot( n_C, n_C ) > ( square( C.z * C.z * 0.00006 ) ) ) // if the threshold # is too big you will see black dots where we used a bad normal at edges, too small -> white\n" - " {\n" - " // The normals from depth should be very small values before normalization,\n" - " // except at depth discontinuities, where they will be large and lead\n" - " // to 1-pixel false occlusions because they are not reliable\n" - " visibility = 1.0;\n" - " //result.color = float4( visibility, visibility, visibility, 1.0 );\n" - " return;\n" - " }\n" - " else\n" - " {\n" - " n_C = normalize( -n_C );\n" - " }\n" - "#endif\n" - "\n" - "#if 1\n" - " float randomPatternRotationAngle = BlueNoise( ssP.xy, 10.0 ) * 10.0;\n" - " //float randomPatternRotationAngle = InterleavedGradientNoise( ssP.xy ) * 10.0;\n" - "#else\n" - "\n" - " // Hash function used in the HPG12 AlchemyAO paper\n" - " float randomPatternRotationAngle = float( ( ( 3 * ssP.x ) ^ ( ssP.y + ssP.x * ssP.y ) )\n" - "#if TEMPORALLY_VARY_TAPS\n" - " + rpJitterTexOffset.z\n" - "#endif\n" - " ) * 10.0;\n" - "\n" - "#endif\n" - "\n" - " // Choose the screen-space sample radius\n" - " // proportional to the projected area of the sphere\n" - " float ssDiskRadius = -projScale * radius / C.z;\n" - "\n" - "#if 1\n" - " if( ssDiskRadius <= MIN_RADIUS )\n" - " {\n" - " // There is no way to compute AO at this radius\n" - " visibility = 1.0;\n" - " return;\n" - " }\n" - "#endif\n" - "\n" - "#if USE_DEPTH_PEEL == 1\n" - "#if DIFFERENT_DEPTH_RESOLUTIONS == 1\n" - " float unpeeledToPeeledScale = 1.0 / peeledToUnpeeledScale;\n" - "#endif\n" - "#endif\n" - "\n" - " float sum = 0.0;\n" - " for( int i = 0; i < NUM_SAMPLES; ++i )\n" - " {\n" - " sum += sampleAO( ssP, C, n_C, ssDiskRadius, i, randomPatternRotationAngle, CS_Z_buffer, 1.0 );\n" - " }\n" - "\n" - "#if HIGH_QUALITY\n" - " float A = pow( max( 0.0, 1.0 - sqrt( sum * ( 3.0 / float( NUM_SAMPLES ) ) ) ), intensity );\n" - "#else\n" - " float A = max( 0.0, 1.0 - sum * intensityDivR6 * ( 5.0 / float( NUM_SAMPLES ) ) );\n" - " // Anti-tone map to reduce contrast and drag dark region farther\n" - " // (x^0.2 + 1.2 * x^4)/2.2\n" - " //A = ( pow( A, 0.2 ) + 1.2 * A * A * A * A ) / 2.2;\n" - "#endif\n" - "\n" - " // Visualize random spin distribution\n" - " //A = mod(randomPatternRotationAngle / (2 * 3.141592653589), 1.0);\n" - "\n" - " // Fade in as the radius reaches 2 pixels\n" - " visibility = lerp( 1.0, A, saturate( ssDiskRadius - MIN_RADIUS ) );\n" - " //visibility = A;\n" - "\n" - "#if defined(BRIGHTPASS)\n" - " //result.color = float4( visibility, bilateralKey, 0.0, 1.0 );\n" - " //result.color = float4( bilateralKey, bilateralKey, bilateralKey, 1.0 );\n" - " result.color = float4( visibility, visibility, visibility, 1.0 );\n" - " //result.color = float4( n_C * 0.5 + 0.5, 1.0 );\n" - " //result.color = float4( n_C, 1.0 );\n" - " //result.color = texture( samp0, fragment.texcoord0 ).rgba;\n" - "#endif\n" - "}\n" - "\n" - - }, - - { - "renderprogs/AmbientOcclusion_AO.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN \n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - "};\n" - "\n" - "struct VS_OUT\n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position = vertex.position;\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/AmbientOcclusion_blur.ps.hlsl", - "/**\n" - " \file AmbientOcclusion_blur.pix\n" - " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" - "\n" - " \brief 7-tap 1D cross-bilateral blur using a packed depth key\n" - "\n" - " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" - "\n" - " Copyright (c) 2011-2014, NVIDIA\n" - " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" - " All rights reserved.\n" - "\n" - " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" - "\n" - " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" - " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" - " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" - "*/\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register( s0 ); // view normals\n" - "uniform sampler2D samp1 : register( s1 ); // view depth\n" - "uniform sampler2D samp2 : register( s2 ); // view AO\n" - "\n" - "#define normal_buffer samp0\n" - "#define cszBuffer samp1\n" - "#define source samp2 \n" - "\n" - "struct PS_IN\n" - "{\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT \n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "#define PEELED_LAYER 0\n" - "#define USE_OCT16 0\n" - "#define USE_NORMALS 1\n" - "\n" - "//#expect PEELED_LAYER \"binary\"\n" - "\n" - "//////////////////////////////////////////////////////////////////////////////////////////////\n" - "// Tunable Parameters:\n" - "\n" - "//#define NUM_KEY_COMPONENTS 1\n" - "\n" - "// The other parameters in this section must be passed in as macro values\n" - "\n" - "/** Increase to make depth edges crisper. Decrease to reduce flicker. */\n" - "#define EDGE_SHARPNESS (1.0)\n" - "\n" - "/** Step in 2-pixel intervals since we already blurred against neighbors in the\n" - " first AO pass. This constant can be increased while R decreases to improve\n" - " performance at the expense of some dithering artifacts.\n" - "\n" - " Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was\n" - " unobjectionable after shading was applied but eliminated most temporal incoherence\n" - " from using small numbers of sample taps.\n" - " */\n" - "#define SCALE (2)\n" - "\n" - "/** Filter radius in pixels. This will be multiplied by SCALE. */\n" - "#define R (4)\n" - "\n" - "#define MDB_WEIGHTS 0\n" - "//////////////////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "/** Type of data to read from source. This macro allows\n" - " the same blur shader to be used on different kinds of input data. */\n" - "#define VALUE_TYPE float\n" - "\n" - "/** Swizzle to use to extract the channels of source. This macro allows\n" - " the same blur shader to be used on different kinds of input data. */\n" - "#define VALUE_COMPONENTS r\n" - "\n" - "#define VALUE_IS_KEY 0\n" - "\n" - "\n" - "\n" - "\n" - "/** (1, 0) or (0, 1)*/\n" - "//uniform int2 axis;\n" - "\n" - "#if USE_OCT16\n" - " #include \n" - "#endif\n" - "\n" - "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" - "{\n" - "#if USE_OCT16\n" - " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" - "#else\n" - " return normalize( texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0 );\n" - "#endif\n" - "}\n" - "\n" - "#define aoResult result.color.VALUE_COMPONENTS\n" - "#define keyPassThrough result.color.KEY_COMPONENTS\n" - "\n" - "\n" - "\n" - "\n" - "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" - " This need not match the real far plane but should not be much more than it.*/\n" - "const float FAR_PLANE_Z = -16000.0;\n" - "\n" - "float CSZToKey( float z )\n" - "{\n" - " return clamp( z * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" - "}\n" - "\n" - "float reconstructCSZ( float d )\n" - "{\n" - " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" - "\n" - " // infinite far perspective matrix\n" - " return -3.0 / ( -1.0 * d + 1.0 );\n" - "\n" - " //d = d * 2.0 - 1.0;\n" - " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" - "}\n" - "\n" - "float3 reconstructCSPosition( float2 S, float z )\n" - "{\n" - " float4 P;\n" - " P.z = z * 2.0 - 1.0;\n" - " P.xy = ( S * rpWindowCoord.xy ) * 2.0 - 1.0;\n" - " P.w = 1.0;\n" - "\n" - " float4 csP;\n" - " csP.x = dot4( P, rpModelMatrixX );\n" - " csP.y = dot4( P, rpModelMatrixY );\n" - " csP.z = dot4( P, rpModelMatrixZ );\n" - " csP.w = dot4( P, rpModelMatrixW );\n" - "\n" - " csP.xyz /= csP.w;\n" - "\n" - " return csP.xyz;\n" - "}\n" - "\n" - "float getKey( int2 ssP )\n" - "{\n" - "#if PEELED_LAYER\n" - " float key = texelFetch( cszBuffer, ssP, 0 ).g;\n" - "#else\n" - " float key = texelFetch( cszBuffer, ssP, 0 ).r;\n" - "#endif\n" - "\n" - "#if 0\n" - " key = reconstructCSZ( key );\n" - "#else\n" - " float3 P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), key );\n" - " key = P.z;\n" - "#endif\n" - "\n" - " key = clamp( key * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" - " return key;\n" - "}\n" - "\n" - "float3 positionFromKey( float key, int2 ssC )\n" - "{\n" - " float z = key * FAR_PLANE_Z;\n" - " float3 C = reconstructCSPosition( float2( ssC ) + float2( 0.5 ), z );\n" - " return C;\n" - "}\n" - "\n" - "/** Read the camera-space position of the point at screen-space pixel ssP */\n" - "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" - "{\n" - " float3 P;\n" - " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" - "\n" - " // Offset to pixel center\n" - " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" - "\n" - " return P;\n" - "}\n" - "\n" - "float calculateBilateralWeight( float key, float tapKey, int2 tapLoc, float3 n_C, float3 C )\n" - "{\n" - " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" - " float depthWeight = max( 0.0, 1.0 - ( EDGE_SHARPNESS * 2000.0 ) * abs( tapKey - key ) );\n" - "\n" - " float k_normal = 1.0;\n" - " float k_plane = 1.0;\n" - "\n" - " // Prevents blending over creases.\n" - " float normalWeight = 1.0;\n" - " float planeWeight = 1.0;\n" - "\n" - "#if USE_NORMALS\n" - " float3 tapN_C = sampleNormal( normal_buffer, tapLoc, 0 );\n" - " depthWeight = 1.0;\n" - "\n" - " float normalError = 1.0 - dot( tapN_C, n_C ) * k_normal;\n" - " normalWeight = max( ( 1.0 - EDGE_SHARPNESS * normalError ), 0.00 );\n" - "\n" - " float lowDistanceThreshold2 = 0.001;\n" - "\n" - " //float3 tapC = positionFromKey( tapKey, tapLoc, projInfo );\n" - " float3 tapC = getPosition( tapLoc, cszBuffer );\n" - "\n" - " // Change in position in camera space\n" - " float3 dq = C - tapC;\n" - "\n" - " // How far away is this point from the original sample\n" - " // in camera space? (Max value is unbounded)\n" - " float distance2 = dot( dq, dq );\n" - "\n" - " // How far off the expected plane (on the perpendicular) is this point? Max value is unbounded.\n" - " float planeError = max( abs( dot( dq, tapN_C ) ), abs( dot( dq, n_C ) ) );\n" - "\n" - " planeWeight = ( distance2 < lowDistanceThreshold2 ) ? 1.0 :\n" - " pow( max( 0.0, 1.0 - EDGE_SHARPNESS * 2.0 * k_plane * planeError / sqrt( distance2 ) ), 2.0 );\n" - "\n" - "\n" - "#endif\n" - "\n" - " return depthWeight * normalWeight * planeWeight;\n" - "}\n" - "\n" - "\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - "//# if __VERSION__ < 330\n" - " float kernel[R + 1];\n" - "// if R == 0, we never call this shader\n" - "#if R == 1\n" - " kernel[0] = 0.5;\n" - " kernel[1] = 0.25;\n" - "#elif R == 2\n" - " kernel[0] = 0.153170;\n" - " kernel[1] = 0.144893;\n" - " kernel[2] = 0.122649;\n" - "#elif R == 3\n" - " kernel[0] = 0.153170;\n" - " kernel[1] = 0.144893;\n" - " kernel[2] = 0.122649;\n" - " kernel[3] = 0.092902;\n" - "#elif R == 4\n" - " kernel[0] = 0.153170;\n" - " kernel[1] = 0.144893;\n" - " kernel[2] = 0.122649;\n" - " kernel[3] = 0.092902;\n" - " kernel[4] = 0.062970;\n" - "#elif R == 5\n" - " kernel[0] = 0.111220;\n" - " kernel[1] = 0.107798;\n" - " kernel[2] = 0.098151;\n" - " kernel[3] = 0.083953;\n" - " kernel[4] = 0.067458;\n" - " kernel[5] = 0.050920;\n" - "#elif R == 6\n" - " kernel[0] = 0.111220;\n" - " kernel[1] = 0.107798;\n" - " kernel[2] = 0.098151;\n" - " kernel[3] = 0.083953;\n" - " kernel[4] = 0.067458;\n" - " kernel[5] = 0.050920;\n" - " kernel[6] = 0.036108;\n" - "#endif\n" - "//#endif\n" - "\n" - " int2 ssC = int2( gl_FragCoord.xy );\n" - "\n" - " //float2 ssF = fragment.texcoord0 * rpScreenCorrectionFactor.xy;\n" - " //int2 ssC = int2( ssF.x * rpWindowCoord.z, ssF.y * rpWindowCoord.w );\n" - "\n" - " float4 temp = texelFetch( source, ssC, 0 );\n" - "\n" - "#if 0\n" - " if( fragment.texcoord0.x < 0.75 )\n" - " {\n" - " result.color = temp;\n" - " return;\n" - " }\n" - "#endif\n" - "\n" - "#if 0\n" - " float key = getKey( ssC );\n" - " float3 C = positionFromKey( key, ssC );\n" - "#else\n" - " float3 C = getPosition( ssC, cszBuffer );\n" - " float key = CSZToKey( C.z );\n" - "#endif\n" - "\n" - " VALUE_TYPE sum = temp.VALUE_COMPONENTS;\n" - "\n" - " if( key == 1.0 )\n" - " {\n" - " // Sky pixel (if you aren't using depth keying, disable this test)\n" - " aoResult = sum;\n" - "#if defined(BRIGHTPASS)\n" - " result.color = float4( aoResult, aoResult, aoResult, 1.0 );\n" - "#endif\n" - " return;\n" - " }\n" - "\n" - " // Base weight for falloff. Increase this for more blurriness,\n" - " // decrease it for better edge discrimination\n" - " float BASE = kernel[0];\n" - " float totalWeight = BASE;\n" - " sum *= totalWeight;\n" - "\n" - " float3 n_C;\n" - "#if USE_NORMALS\n" - " n_C = sampleNormal( normal_buffer, ssC, 0 );\n" - "#endif\n" - "\n" - "#if MDB_WEIGHTS == 0\n" - " for( int r = -R; r <= R; ++r )\n" - " {\n" - " // We already handled the zero case above. This loop should be unrolled and the static branch optimized out,\n" - " // so the IF statement has no runtime cost\n" - " if( r != 0 )\n" - " {\n" - " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" - " temp = texelFetch( source, tapLoc, 0 );\n" - "\n" - "\n" - " float tapKey = getKey( tapLoc );\n" - " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - "\n" - " // spatial domain: offset kernel tap\n" - " float weight = 0.3 + kernel[abs( r )];\n" - "\n" - " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" - "\n" - " weight *= bilateralWeight;\n" - " sum += value * weight;\n" - " totalWeight += weight;\n" - " }\n" - " }\n" - "#else\n" - "\n" - " float lastBilateralWeight = 9999.0;\n" - " for( int r = -1; r >= -R; --r )\n" - " {\n" - " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" - " temp = texelFetch( source, tapLoc, 0 );\n" - " float tapKey = getKey( tapLoc );\n" - "\n" - " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - "\n" - " // spatial domain: offset kernel tap\n" - " float weight = 0.3 + kernel[abs( r )];\n" - "\n" - " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" - " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" - " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" - " lastBilateralWeight = bilateralWeight;\n" - " weight *= bilateralWeight;\n" - " sum += value * weight;\n" - " totalWeight += weight;\n" - " }\n" - "\n" - " lastBilateralWeight = 9999.0;\n" - " for( int r = 1; r <= R; ++r )\n" - " {\n" - " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" - " temp = texelFetch( source, tapLoc, 0 );\n" - " float tapKey = getKey( tapLoc );\n" - " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - "\n" - " // spatial domain: offset kernel tap\n" - " float weight = 0.3 + kernel[abs( r )];\n" - "\n" - " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" - " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" - " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" - " lastBilateralWeight = bilateralWeight;\n" - " weight *= bilateralWeight;\n" - " sum += value * weight;\n" - " totalWeight += weight;\n" - " }\n" - "#endif\n" - "\n" - " const float epsilon = 0.0001;\n" - " aoResult = sum / ( totalWeight + epsilon );\n" - "\n" - "#if defined(BRIGHTPASS)\n" - " result.color = float4( aoResult, aoResult, aoResult, 1.0 );\n" - "#endif\n" - "}\n" - "\n" - - }, - - { - "renderprogs/AmbientOcclusion_blur.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN \n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - "};\n" - "\n" - "struct VS_OUT\n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position = vertex.position;\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/AmbientOcclusion_minify.ps.hlsl", - "/**\n" - " \file AmbientOcclusion_minify.pix\n" - " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" - "\n" - " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" - "\n" - " Copyright (c) 2011-2012, NVIDIA\n" - " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" - " All rights reserved.\n" - "\n" - " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" - "\n" - " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" - " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" - " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" - "\n" - " */\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register( s0 ); // zbuffer\n" - "\n" - "struct PS_IN\n" - "{\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT \n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "//#extension GL_EXT_gpu_shader4 : enable\n" - "\n" - "//#expect USE_PEELED_DEPTH_BUFFER \"binary\"\n" - "\n" - "#if 0 //( USE_PEELED_DEPTH_BUFFER != 0 )\n" - " #define mask rg\n" - "#else\n" - " #define mask r\n" - "#endif\n" - "\n" - "float reconstructCSZ( float d )\n" - "{\n" - " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" - "\n" - " // infinite far perspective matrix\n" - " return -3.0 / ( -1.0 * d + 1.0 );\n" - "\n" - " //d = d * 2.0 - 1.0;\n" - " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" - "}\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "#if defined(BRIGHTPASS)\n" - " float2 ssC = fragment.texcoord0;\n" - " float depth = tex2D( samp0, ssC ).r;\n" - " //depth = reconstructCSZ( depth );\n" - " result.color.mask = depth;\n" - "#else\n" - " //int2 ssP = int2( gl_FragCoord.xy );\n" - " int2 ssP = int2( fragment.texcoord0 * rpScreenCorrectionFactor.zw );\n" - "\n" - " int previousMIPNumber = int( rpJitterTexScale.x );\n" - "\n" - " // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.\n" - " // On DX9, the bit-and can be implemented with floating-point modulo\n" - " //result.color.mask = texture( samp0, clamp( ssP * 2 + int2( ssP.y & 1, ssP.x & 1 ), int2( 0 ), textureSize( samp0, previousMIPNumber ) - int2( 1 ) ) * rpScreenCorrectionFactor.xy, previousMIPNumber ).mask;\n" - " result.color.mask = texelFetch( samp0, clamp( ssP * 2 + int2( ssP.y & 1, ssP.x & 1 ), int2( 0 ), textureSize( samp0, previousMIPNumber ) - int2( 1 ) ), previousMIPNumber ).mask;\n" - " //result.color.mask = texelFetch2D( samp0, int3( ssP * 2 + int2( ( ssP.y & 1 ) ^ 1, ( ssP.x & 1 ) ^ 1 ), 0 ) );\n" - "\n" - " // result.color.mask = texelFetch( samp0, ssP, 0 ).r;\n" - "\n" - " //float2 ssC = float2( ssP * 2 + int2( ( ssP.y & 1 ) ^ 1, ( ssP.x & 1 ) ^ 1 ) ) * rpScreenCorrectionFactor.xy;\n" - " //float2 ssC = float2( ssP ) * rpScreenCorrectionFactor.xy;\n" - " //float2 ssC = fragment.texcoord0;\n" - " //float depth = tex2D( samp0, ssC ).r;\n" - " //result.color.mask = depth;\n" - "#endif\n" - "}\n" - "\n" - - }, - - { - "renderprogs/AmbientOcclusion_minify.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN \n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - "};\n" - "\n" - "struct VS_OUT\n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position = vertex.position;\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/bink.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); // Y\n" - "uniform sampler2D samp1 : register(s1); // Cr\n" - "uniform sampler2D samp2 : register(s2); // Cb\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " const float3 crc = float3( 1.595794678, -0.813476563, 0 );\n" - " const float3 crb = float3( 0, -0.391448975, 2.017822266 );\n" - " const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );\n" - " const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );\n" - "\n" - " float Y = tex2D( samp0, fragment.texcoord0.xy ).x;\n" - " float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;\n" - " float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;\n" - "\n" - " float3 p = ( YScalar * Y );\n" - " p += ( crc * Cr ) + ( crb * Cb ) + adj;\n" - "\n" - " float4 color;\n" - " color.xyz = p;\n" - " color.w = 1.0;\n" - " color *= rpColor;\n" - "\n" - " result.color = sRGBAToLinearRGBA( color );\n" - "}\n" - - }, - - { - "renderprogs/bink.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/bink_gui.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); // Y\n" - "uniform sampler2D samp1 : register(s1); // Cr\n" - "uniform sampler2D samp2 : register(s2); // Cb\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float4 texcoord1 : TEXCOORD1_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " const float3 crc = float3( 1.595794678, -0.813476563, 0 );\n" - " const float3 crb = float3( 0, -0.391448975, 2.017822266 );\n" - " const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );\n" - " const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );\n" - "\n" - " float Y = tex2D( samp0, fragment.texcoord0.xy ).x;\n" - " float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;\n" - " float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;\n" - "\n" - " float3 p = ( YScalar * Y );\n" - " p += ( crc * Cr ) + ( crb * Cb ) + adj;\n" - "\n" - " float4 binkImage;\n" - " binkImage.xyz = p;\n" - " binkImage.w = 1.0;\n" - "\n" - " float4 color = ( binkImage * fragment.color ) + fragment.texcoord1;\n" - " result.color.xyz = color.xyz * color.w;\n" - " result.color.w = color.w;\n" - "}\n" - - }, - - { - "renderprogs/bink_gui.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float4 texcoord1 : TEXCOORD1;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0.xy = vertex.texcoord.xy;\n" - " result.texcoord1 = ( ( vertex.color2 ) * 2.0 ) - 1.0;\n" - " result.color = swizzleColor( vertex.color );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/blendLight.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "uniform sampler2D samp1 : register(s1);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float4 texcoord0 : TEXCOORD0_centroid;\n" - " float2 texcoord1 : TEXCOORD1_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 c = idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;\n" - "\n" - "#if defined( USE_LINEAR_RGB )\n" - " c = clamp( c, 0.0, 1.0 );\n" - "\n" - " c = float4( Linear1( c.r ), Linear1( c.g ), Linear1( c.b ), Linear1( c.a ) );\n" - "#endif\n" - "\n" - " result.color = c;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/blendLight.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 binormal : BINORMAL;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 texcoord0 : TEXCOORD0;\n" - " float2 texcoord1 : TEXCOORD1;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" - " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - " result.texcoord0.z = 0.0;\n" - " result.texcoord0.w = dot4( vertex.position, rpTexGen0Q );\n" - "\n" - " result.texcoord1.x = dot4( vertex.position, rpTexGen1S );\n" - " result.texcoord1.y = 0.5;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/bloodorb1_capture.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); //_accum\n" - "uniform sampler2D samp1 : register(s1); //_currentRender\n" - "uniform sampler2D samp2 : register(s2); //mask\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float2 texcoord1 : TEXCOORD1_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float4 accumSample = tex2D( samp0, fragment.texcoord0 );\n" - " float4 maskSample = tex2D( samp2, fragment.texcoord1 );\n" - " float4 currentRenderSample = tex2D( samp1, fragment.texcoord1 );\n" - "\n" - " result.color = lerp( accumSample, currentRenderSample, maskSample.a );\n" - "}\n" - - }, - - { - "renderprogs/bloodorb1_capture.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register( c128 ); //rpCenterScale\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float2 texcoord1 : TEXCOORD1;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " //center scale\n" - " const float4 centerScale = rpUser0;\n" - " result.texcoord0 = CenterScale( vertex.texcoord, centerScale.xy );\n" - "\n" - " // pass through texcoords\n" - " result.texcoord1 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/bloodorb2_capture.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); //_accum\n" - "uniform sampler2D samp1 : register(s1); //_currentRender\n" - "uniform sampler2D samp2 : register(s2); //mask\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float2 texcoord1 : TEXCOORD1_centroid;\n" - " float2 texcoord2 : TEXCOORD2_centroid;\n" - " //float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float4 redTint = float4( 1, 0.98, 0.98, 1 );\n" - " float4 accumSample = tex2D( samp0, fragment.texcoord0 ) * redTint;\n" - "\n" - " float4 maskSample = tex2D( samp2, fragment.texcoord1 );\n" - "\n" - " float4 tint = float4( 1.0, 0.8, 0.8, 1 );\n" - " float4 currentRenderSample = tex2D( samp1, fragment.texcoord2 ) * tint;\n" - "\n" - " result.color = lerp( accumSample, currentRenderSample, maskSample.a );\n" - "}\n" - - }, - - { - "renderprogs/bloodorb2_capture.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex0\n" - "uniform float4 rpUser1 : register( c129 ); //rpRotateTex0\n" - "uniform float4 rpUser2 : register( c130 ); //rpCenterScaleTex1\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float2 texcoord1 : TEXCOORD1;\n" - " float2 texcoord2 : TEXCOORD2;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " const float4 centerScaleTex0 = rpUser0;\n" - " const float4 rotateTex0 = rpUser1;\n" - " const float4 centerScaleTex1 = rpUser2;\n" - "\n" - " //center scale and rotate for _accum\n" - " float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex0.xy );\n" - " result.texcoord0 = Rotate2D( tc0, rotateTex0.xy );\n" - "\n" - " //center scale for mask\n" - " result.texcoord1 = CenterScale( vertex.texcoord, centerScaleTex1.xy );\n" - "\n" - " // pass through for currentrender\n" - " result.texcoord2 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/bloodorb3_capture.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); //_accum\n" - "uniform sampler2D samp1 : register(s1); //_currentRender\n" - "uniform sampler2D samp2 : register(s2); //mask\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float2 texcoord1 : TEXCOORD1_centroid;\n" - " float2 texcoord2 : TEXCOORD2_centroid;\n" - " float2 texcoord3 : TEXCOORD3_centroid;\n" - " float2 texcoord4 : TEXCOORD4;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float colorFactor = fragment.texcoord4.x;\n" - "\n" - " float4 color0 = float4( 1.0f - colorFactor, 1.0f - colorFactor, 1.0f, 1.0f );\n" - " float4 color1 = float4( 1.0f, 0.95f - colorFactor, 0.95f, 0.5f );\n" - " float4 color2 = float4( 0.015f, 0.015f, 0.015f, 0.01f );\n" - "\n" - " float4 accumSample0 = tex2D( samp0, fragment.texcoord0 ) * color0;\n" - " float4 accumSample1 = tex2D( samp0, fragment.texcoord1 ) * color1;\n" - " float4 accumSample2 = tex2D( samp0, fragment.texcoord2 ) * color2;\n" - " float4 maskSample = tex2D( samp2, fragment.texcoord3 );\n" - "\n" - " float4 tint = float4( 0.8, 0.5, 0.5, 1 );\n" - " float4 currentRenderSample = tex2D( samp1, fragment.texcoord3 ) * tint;\n" - "\n" - " // blend of the first 2 accumulation samples\n" - " float4 accumColor = lerp( accumSample0, accumSample1, 0.5f );\n" - " // add thrid sample\n" - " accumColor += accumSample2;\n" - "\n" - " accumColor = lerp( accumColor, currentRenderSample, maskSample.a );\n" - " result.color = accumColor;\n" - "}\n" - - }, - - { - "renderprogs/bloodorb3_capture.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex\n" - "uniform float4 rpUser1 : register( c129 ); //rpRotateTex\n" - "uniform float4 rpUser2 : register( c130 ); //rpColorFactor\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float2 texcoord1 : TEXCOORD1;\n" - " float2 texcoord2 : TEXCOORD2;\n" - " float2 texcoord3 : TEXCOORD3;\n" - " float2 texcoord4 : TEXCOORD4;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " //_accum 1\n" - " const float4 centerScaleTex = rpUser0;\n" - " const float4 rotateTex = rpUser1;\n" - " float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex.xy );\n" - " result.texcoord0 = Rotate2D( tc0, rotateTex.xy );\n" - "\n" - " // accum 2\n" - " result.texcoord1 = Rotate2D( tc0, float2( rotateTex.z, -rotateTex.w ) );\n" - "\n" - " // accum 3\n" - " result.texcoord2 = Rotate2D( tc0, rotateTex.zw );\n" - "\n" - " // pass through for currentrender\n" - " result.texcoord3 = vertex.texcoord;\n" - "\n" - " // pass through the color fator\n" - " const float4 colorFactor = rpUser2;\n" - " result.texcoord4 = colorFactor.xx;\n" - "}\n" - - }, - - { - "renderprogs/bloodorb_draw.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); //_accum\n" - "uniform sampler2D samp1 : register(s1); //_currentRender\n" - "uniform sampler2D samp2 : register(s2); //mask\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float4 accumSample = tex2D( samp0, fragment.texcoord0 );\n" - " float4 currentRenderSample = tex2D( samp1, fragment.texcoord0 );\n" - " float4 maskSample = tex2D( samp2, fragment.texcoord0 );\n" - "\n" - " result.color = lerp( accumSample, currentRenderSample, maskSample.a );\n" - "}\n" - - }, - - { - "renderprogs/bloodorb_draw.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " // pass through texcoords\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/bumpyenvironment.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" - "uniform sampler2D samp1 : register(s1); // normal map\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float3 texcoord1 : TEXCOORD1_centroid;\n" - " float3 texcoord2 : TEXCOORD2_centroid;\n" - " float3 texcoord3 : TEXCOORD3_centroid;\n" - " float3 texcoord4 : TEXCOORD4_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;\n" - " // RB begin\n" - " float3 localNormal;\n" - "#if defined(USE_NORMAL_FMT_RGB8)\n" - " localNormal = float3( bump.rg, 0.0f );\n" - "#else\n" - " localNormal = float3( bump.wy, 0.0f );\n" - "#endif\n" - " // RB end\n" - " localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );\n" - "\n" - " float3 globalNormal;\n" - " globalNormal.x = dot3( localNormal, fragment.texcoord2 );\n" - " globalNormal.y = dot3( localNormal, fragment.texcoord3 );\n" - " globalNormal.z = dot3( localNormal, fragment.texcoord4 );\n" - "\n" - " float3 globalEye = normalize( fragment.texcoord1 );\n" - "\n" - " float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );\n" - " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" - "\n" - " float4 envMap = texCUBE( samp0, reflectionVector );\n" - "\n" - " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/bumpyenvironment.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float3 texcoord1 : TEXCOORD1;\n" - " float3 texcoord2 : TEXCOORD2;\n" - " float3 texcoord3 : TEXCOORD3;\n" - " float3 texcoord4 : TEXCOORD4;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "\n" - " float4 normal = vertex.normal * 2.0 - 1.0;\n" - " float4 tangent = vertex.tangent * 2.0 - 1.0;\n" - " float3 binormal = cross( normal.xyz, tangent.xyz ) * tangent.w;\n" - "\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0 = vertex.texcoord.xy;\n" - "\n" - " float4 toEye = rpLocalViewOrigin - vertex.position;\n" - " result.texcoord1.x = dot3( toEye, rpModelMatrixX );\n" - " result.texcoord1.y = dot3( toEye, rpModelMatrixY );\n" - " result.texcoord1.z = dot3( toEye, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.x = dot3( tangent, rpModelMatrixX );\n" - " result.texcoord3.x = dot3( tangent, rpModelMatrixY );\n" - " result.texcoord4.x = dot3( tangent, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.y = dot3( binormal, rpModelMatrixX );\n" - " result.texcoord3.y = dot3( binormal, rpModelMatrixY );\n" - " result.texcoord4.y = dot3( binormal, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.z = dot3( normal, rpModelMatrixX );\n" - " result.texcoord3.z = dot3( normal, rpModelMatrixY );\n" - " result.texcoord4.z = dot3( normal, rpModelMatrixZ );\n" - "\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/bumpyenvironment_skinned.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" - "uniform sampler2D samp1 : register(s1); // normal map\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float3 texcoord1 : TEXCOORD1_centroid;\n" - " float3 texcoord2 : TEXCOORD2_centroid;\n" - " float3 texcoord3 : TEXCOORD3_centroid;\n" - " float3 texcoord4 : TEXCOORD4_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;\n" - "\n" - " // RB begin\n" - " float3 localNormal;\n" - "#if defined(GLES2)\n" - " localNormal = float3( bump.rg, 0.0f );\n" - "#else\n" - " localNormal = float3( bump.wy, 0.0f );\n" - "#endif\n" - " // RB end\n" - " localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );\n" - "\n" - " float3 globalNormal;\n" - " globalNormal.x = dot3( localNormal, fragment.texcoord2 );\n" - " globalNormal.y = dot3( localNormal, fragment.texcoord3 );\n" - " globalNormal.z = dot3( localNormal, fragment.texcoord4 );\n" - "\n" - " float3 globalEye = normalize( fragment.texcoord1 );\n" - "\n" - " float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );\n" - " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" - "\n" - " float4 envMap = texCUBE( samp0, reflectionVector );\n" - "\n" - " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/bumpyenvironment_skinned.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float3 texcoord1 : TEXCOORD1;\n" - " float3 texcoord2 : TEXCOORD2;\n" - " float3 texcoord3 : TEXCOORD3;\n" - " float3 texcoord4 : TEXCOORD4;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" - " float4 vTangent = vertex.tangent * 2.0 - 1.0;\n" - " float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;\n" - "\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / binormal / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float3 normal;\n" - " normal.x = dot3( matX, vNormal );\n" - " normal.y = dot3( matY, vNormal );\n" - " normal.z = dot3( matZ, vNormal );\n" - " normal = normalize( normal );\n" - "\n" - " float3 tangent;\n" - " tangent.x = dot3( matX, vTangent );\n" - " tangent.y = dot3( matY, vTangent );\n" - " tangent.z = dot3( matZ, vTangent );\n" - " tangent = normalize( tangent );\n" - "\n" - " float3 binormal;\n" - " binormal.x = dot3( matX, vBinormal );\n" - " binormal.y = dot3( matY, vBinormal );\n" - " binormal.z = dot3( matZ, vBinormal );\n" - " binormal = normalize( binormal );\n" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertex.position );\n" - " modelPosition.y = dot4( matY, vertex.position );\n" - " modelPosition.z = dot4( matZ, vertex.position );\n" - " modelPosition.w = 1.0;\n" - "\n" - " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" - " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" - " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" - " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - "\n" - " result.texcoord0 = vertex.texcoord.xy;\n" - "\n" - " float4 toEye = rpLocalViewOrigin - modelPosition;\n" - " result.texcoord1.x = dot3( toEye, rpModelMatrixX );\n" - " result.texcoord1.y = dot3( toEye, rpModelMatrixY );\n" - " result.texcoord1.z = dot3( toEye, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.x = dot3( tangent, rpModelMatrixX );\n" - " result.texcoord3.x = dot3( tangent, rpModelMatrixY );\n" - " result.texcoord4.x = dot3( tangent, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.y = dot3( binormal, rpModelMatrixX );\n" - " result.texcoord3.y = dot3( binormal, rpModelMatrixY );\n" - " result.texcoord4.y = dot3( binormal, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.z = dot3( normal, rpModelMatrixX );\n" - " result.texcoord3.z = dot3( normal, rpModelMatrixY );\n" - " result.texcoord4.z = dot3( normal, rpModelMatrixZ );\n" - "\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/color.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/color.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "#if defined(USE_GPU_SKINNING)\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "#endif\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "#if defined(USE_GPU_SKINNING)\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the position\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertex.position );\n" - " modelPosition.y = dot4( matY, vertex.position );\n" - " modelPosition.z = dot4( matZ, vertex.position );\n" - " modelPosition.w = 1.0;\n" - "\n" - " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" - " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" - " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" - " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - "#else\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "#endif\n" - "}\n" - - }, - - { - "renderprogs/colorProcess.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float4 color : COLOR;\n" - " float3 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 src = tex2D( samp0, fragment.texcoord0.xy );\n" - " float4 target = fragment.color * dot3( float3( 0.333, 0.333, 0.333 ), src );\n" - " result.color = lerp( src, target, fragment.texcoord0.z );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/colorProcess.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register(c128); //rpFraction\n" - "uniform float4 rpUser1 : register(c129); //rpTargetHue\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 color : COLOR0;\n" - " float3 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.color = rpUser1; // targetHue\n" - "\n" - " result.texcoord0.x = vertex.texcoord.x;\n" - " result.texcoord0.y = 1.0f - vertex.texcoord.y;\n" - "\n" - " result.texcoord0.z = rpUser0.x; // fraction\n" - "}\n" - "\n" - "\n" - - }, - - { - "renderprogs/DeepGBufferRadiosity_radiosity.ps.hlsl", - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// #version 120 // -*- c++ -*-\n" - "// #extension GL_EXT_gpu_shader4 : require\n" - "// #extension GL_ARB_gpu_shader5 : enable\n" - "\n" - "#define DIFFERENT_DEPTH_RESOLUTIONS 0\n" - "#define USE_DEPTH_PEEL 0\n" - "#define CS_Z_PACKED_TOGETHER 0\n" - "#define TEMPORALLY_VARY_TAPS 0\n" - "#define USE_OCT16 0\n" - "#define COMPUTE_PEELED_LAYER 0\n" - "#define USE_MIPMAPS 1\n" - "#define USE_TAP_NORMAL 1\n" - "\n" - "#define HIGH_QUALITY 0\n" - "\n" - "#if HIGH_QUALITY\n" - " // Total number of direct samples to take at each pixel\n" - " #define NUM_SAMPLES 39\n" - "\n" - " // This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent\n" - " // taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9\n" - " #define NUM_SPIRAL_TURNS 14\n" - "\n" - "#else\n" - "\n" - " #define NUM_SAMPLES 11\n" - " #define NUM_SPIRAL_TURNS 7\n" - "\n" - "#endif\n" - "\n" - "// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower\n" - "// miplevel to maintain reasonable spatial locality in the cache\n" - "// If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing.\n" - "// If it is too high (> 5), we'll get bad performance because we're not using the MIP levels effectively\n" - "#define LOG_MAX_OFFSET (3)\n" - "\n" - "// This must be less than or equal to the MAX_MIP_LEVEL defined in SAmbientOcclusion.cpp\n" - "#define MAX_MIP_LEVEL (5)\n" - "\n" - "#define MIN_MIP_LEVEL 0\n" - "\n" - "const float DOOM_TO_METERS = 0.0254; // doom to meters\n" - "const float METERS_TO_DOOM = ( 1.0 / DOOM_TO_METERS ); // meters to doom\n" - "\n" - "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" - " This need not match the real far plane but should not be much more than it.*/\n" - "const float FAR_PLANE_Z = -4000.0;\n" - "\n" - "/** World-space AO radius in scene units (r). e.g., 1.0m */\n" - "const float radius = 1.0 * METERS_TO_DOOM;\n" - "const float radius2 = radius * radius;\n" - "const float invRadius2 = 1.0 / radius2;\n" - "\n" - "/** Bias to avoid AO in smooth corners, e.g., 0.01m */\n" - "const float bias = 0.01 * METERS_TO_DOOM;\n" - "\n" - "/** The height in pixels of a 1m object if viewed from 1m away.\n" - " You can compute it from your projection matrix. The actual value is just\n" - " a scale factor on radius; you can simply hardcode this to a constant (~500)\n" - " and make your radius value unitless (...but resolution dependent.) */\n" - "const float projScale = 500.0;\n" - "\n" - "// #expect NUM_SAMPLES \"Integer number of samples to take at each pixel\"\n" - "// #expect NUM_SPIRAL_TURNS \"Integer number of turns around the circle that the spiral pattern makes. The DeepGBufferRadiosity class provides a discrepancy-minimizing value of NUM_SPIRAL_TURNS for each value of NUM_SAMPLES.\"\n" - "// #expect USE_MIPMAPS \"1 to enable, 0 to disable\"\n" - "// #expect USE_DEPTH_PEEL \"1 to enable, 0 to disable\"\n" - "// #expect COMPUTE_PEELED_LAYER \"1 to enable, 0 to disable\"\n" - "// #expect USE_TAP_NORMAL \"1 to enable, 0 to disable\"\n" - "// #expect MIN_MIP_LEVEL \"non-negative integer\"\n" - "// #expect USE_OCT16 \"1 to enable, 0 to disable\"\n" - "// #if (!USE_DEPTH_PEEL) && COMPUTE_PEELED_LAYER\n" - "// #error \"If computing a peeled layer, must be using depth peel!\"\n" - "// #endif\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register( s0 ); // view normals\n" - "uniform sampler2D samp1 : register( s1 ); // view depth\n" - "uniform sampler2D samp2 : register( s2 ); // colors\n" - "\n" - "#define normal_buffer samp0\n" - "#define CS_Z_buffer samp1\n" - "#define colorBuffer samp2\n" - "\n" - "struct PS_IN\n" - "{\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT \n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "\n" - "\n" - "// #if 0 //normal_notNull\n" - "// /** Same size as result buffer, do not offset by guard band when reading from it */\n" - "// uniform sampler2D normal_buffer;\n" - "// uniform float4 normal_readMultiplyFirst;\n" - "// uniform float4 normal_readAddSecond;\n" - "\n" - "// #if USE_OCT16\n" - "// #include \n" - "// #endif\n" - "\n" - "// #endif\n" - "\n" - "\n" - "\n" - "\n" - "#if USE_DEPTH_PEEL\n" - " uniform sampler2D peeledColorBuffer;\n" - " uniform sampler2D peeledNormalBuffer;\n" - "#endif\n" - "\n" - "//uniform float indirectMultiplier;\n" - "\n" - "\n" - "// Compatibility with future versions of GLSL: the shader still works if you change the\n" - "// version line at the top to something like #version 330 compatibility.\n" - "// #if __VERSION__ == 120\n" - "// # define texelFetch texelFetch2D\n" - "// # define textureSize textureSize2D\n" - "// # define result gl_FragData[0]\n" - "// # else\n" - "// out float4 result;\n" - "// #endif\n" - "\n" - "// #if COMPUTE_PEELED_LAYER\n" - "// # if __VERSION__ == 120\n" - "// # define peeledResult gl_FragData[1]\n" - "// # else\n" - "// out float4 peeledResult;\n" - "// # endif\n" - "// # define indirectPeeledResult peeledResult.rgb\n" - "// # define peeledVisibility peeledResult.a\n" - "// #endif\n" - "\n" - "#define indirectColor result.color.rgb\n" - "#define visibility result.color.a\n" - "\n" - "/////////////////////////////////////////////////////////\n" - "\n" - "float reconstructCSZ( float d )\n" - "{\n" - " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" - "\n" - " // infinite far perspective matrix\n" - " return -3.0 / ( -1.0 * d + 1.0 );\n" - "\n" - " //d = d * 2.0 - 1.0;\n" - " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" - "}\n" - "\n" - "float3 reconstructCSPosition( float2 S, float z )\n" - "{\n" - " float4 P;\n" - " P.z = z * 2.0 - 1.0;\n" - " //P.z = reconstructCSZ( z );\n" - " P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0;\n" - " P.w = 1.0;\n" - "\n" - " float4 csP;\n" - " csP.x = dot4( P, rpModelMatrixX );\n" - " csP.y = dot4( P, rpModelMatrixY );\n" - " csP.z = dot4( P, rpModelMatrixZ );\n" - " csP.w = dot4( P, rpModelMatrixW );\n" - "\n" - " csP.xyz /= csP.w;\n" - "\n" - " return csP.xyz;\n" - "}\n" - "\n" - "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" - "{\n" - "#if USE_OCT16\n" - " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" - "#else\n" - " return texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0;\n" - "#endif\n" - "}\n" - "\n" - "void sampleBothNormals( sampler2D normalBuffer, int2 ssC, int mipLevel, out float3 n_tap0, out float3 n_tap1 )\n" - "{\n" - " float4 encodedNormals = texelFetch( normalBuffer, ssC, mipLevel ) * 2.0 - 1.0;\n" - " n_tap0 = decode16( encodedNormals.xy );\n" - " n_tap1 = decode16( encodedNormals.zw );\n" - "}\n" - "\n" - "/** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */\n" - "float2 tapLocation( int sampleNumber, float spinAngle, float radialJitter, out float ssR )\n" - "{\n" - " // Radius relative to ssR\n" - " float alpha = ( float( sampleNumber ) + radialJitter ) * ( 1.0 / float( NUM_SAMPLES ) );\n" - " float angle = alpha * ( float( NUM_SPIRAL_TURNS ) * 6.28 ) + spinAngle;\n" - "\n" - " ssR = alpha;\n" - " return float2( cos( angle ), sin( angle ) );\n" - "}\n" - "\n" - "\n" - "/** Read the camera-space position of the point at screen-space pixel ssP */\n" - "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" - "{\n" - " float3 P;\n" - " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" - "\n" - " // Offset to pixel center\n" - " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" - "\n" - " return P;\n" - "}\n" - "\n" - "\n" - "void getPositions( int2 ssP, sampler2D cszBuffer, out float3 P0, out float3 P1 )\n" - "{\n" - " float2 Zs = texelFetch( cszBuffer, ssP, 0 ).rg;\n" - "\n" - " // Offset to pixel center\n" - " P0 = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), Zs.x );\n" - " P1 = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), Zs.y );\n" - "}\n" - "\n" - "\n" - "void computeMipInfo( float ssR, int2 ssP, sampler2D cszBuffer, inout int mipLevel, inout int2 mipP )\n" - "{\n" - "#if USE_MIPMAPS\n" - " // Derivation:\n" - " // mipLevel = floor(log(ssR / MAX_OFFSET));\n" - "#ifdef GL_EXT_gpu_shader5\n" - " mipLevel = clamp( findMSB( int( ssR ) ) - LOG_MAX_OFFSET, MIN_MIP_LEVEL, MAX_MIP_LEVEL );\n" - "#else\n" - " mipLevel = clamp( int( floor( log2( ssR ) ) ) - LOG_MAX_OFFSET, MIN_MIP_LEVEL, MAX_MIP_LEVEL );\n" - "#endif\n" - "\n" - " // We need to divide by 2^mipLevel to read the appropriately scaled coordinate from a MIP-map.\n" - " // Manually clamp to the texture size because texelFetch bypasses the texture unit\n" - " //mipP = ssP >> mipLevel;//clamp(ssP >> mipLevel, int2(0), textureSize(CS_Z_buffer, mipLevel) - int2(1));\n" - "\n" - " mipP = clamp( ssP >> mipLevel, int2( 0 ), textureSize( cszBuffer, mipLevel ) - int2( 1 ) );\n" - "#else\n" - " mipLevel = 0;\n" - " mipP = ssP;\n" - "#endif\n" - "}\n" - "\n" - "\n" - "/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1.\n" - " Use cszBufferScale if reading from the peeled depth buffer, which has been scaled by (1 / invCszBufferScale) from the original */\n" - "float3 getOffsetPosition( int2 ssC, float2 unitOffset, float ssR, sampler2D cszBuffer, float invCszBufferScale )\n" - "{\n" - " int2 ssP = clamp( int2( ssR * unitOffset ) + ssC, int2( 0 ), int2( g3d_sz2D_colorBuffer.xy - 1 ) );\n" - "\n" - " int mipLevel;\n" - " int2 mipP;\n" - " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, mipP );\n" - "\n" - " float3 P;\n" - "\n" - " P.z = texelFetch( cszBuffer, mipP, mipLevel ).r;\n" - "\n" - " // Offset to pixel center\n" - " P = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ) * invCszBufferScale, P.z );\n" - "\n" - " return P;\n" - "}\n" - "\n" - "\n" - "/** Read the camera-space position of the points at screen-space pixel ssP + unitOffset * ssR in both channels of the packed csz buffer. Assumes length(unitOffset) == 1. */\n" - "void getOffsetPositions( int2 ssC, float2 unitOffset, float ssR, sampler2D cszBuffer, out float3 P0, out float3 P1 )\n" - "{\n" - " int2 ssP = clamp( int2( ssR * unitOffset ) + ssC, int2( 0 ), int2( g3d_sz2D_colorBuffer.xy - 1 ) );\n" - "\n" - " int mipLevel;\n" - " int2 mipP;\n" - " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, mipP );\n" - "\n" - " float2 Zs = texelFetch( cszBuffer, mipP, mipLevel ).rg;\n" - "\n" - " // Offset to pixel center\n" - " P0 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.x );\n" - " P1 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.y );\n" - "}\n" - "\n" - "\n" - "void getOffsetPositionNormalAndLambertian\n" - "( int2 ssP,\n" - " float ssR,\n" - " sampler2D cszBuffer,\n" - " sampler2D bounceBuffer,\n" - " sampler2D normalBuffer,\n" - " inout float3 Q,\n" - " inout float3 lambertian_tap,\n" - " inout float3 n_tap )\n" - "{\n" - "\n" - "#if USE_MIPMAPS\n" - " int mipLevel;\n" - " int2 texel;\n" - " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, texel );\n" - "#else\n" - " int mipLevel = 0;\n" - " int2 texel = ssP;\n" - "#endif\n" - "\n" - " float z = texelFetch( cszBuffer, texel, mipLevel ).r;\n" - "\n" - " // FIXME mip map bounce/normal buffers FBOs\n" - "#if 0\n" - " float3 n = sampleNormal( normalBuffer, texel, mipLevel );\n" - " lambertian_tap = texelFetch( bounceBuffer, texel, mipLevel ).rgb;\n" - "#else\n" - " float3 n = sampleNormal( normalBuffer, ssP, 0 );\n" - " lambertian_tap = texelFetch( bounceBuffer, ssP, 0 ).rgb;\n" - "#endif\n" - "\n" - " //n_tap = normalize( n );\n" - " n_tap = n;\n" - "\n" - " // Offset to pixel center\n" - " Q = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), z );\n" - "}\n" - "\n" - "\n" - "void getOffsetPositionsNormalsAndLambertians\n" - "( int2 ssP,\n" - " float ssR,\n" - " sampler2D cszBuffer,\n" - " sampler2D bounceBuffer,\n" - " sampler2D peeledBounceBuffer,\n" - " sampler2D normalBuffer,\n" - " sampler2D peeledNormalBuffer,\n" - " out float3 Q0,\n" - " out float3 Q1,\n" - " out float3 lambertian_tap0,\n" - " out float3 lambertian_tap1,\n" - " out float3 n_tap0,\n" - " out float3 n_tap1 )\n" - "{\n" - "\n" - "#if USE_MIPMAPS\n" - " int mipLevel;\n" - " int2 texel;\n" - " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, texel );\n" - "#else\n" - " int mipLevel = 0;\n" - " int2 texel = ssP;\n" - "#endif\n" - "\n" - " float2 Zs = texelFetch( cszBuffer, texel, mipLevel ).rg;\n" - "#if USE_OCT16\n" - " sampleBothNormals( normalBuffer, texel, mipLevel, n_tap0, n_tap1 );\n" - "#else\n" - " n_tap0 = sampleNormal( normalBuffer, texel, mipLevel );\n" - " n_tap1 = sampleNormal( peeledNormalBuffer, texel, mipLevel );\n" - "#endif\n" - "\n" - " lambertian_tap0 = texelFetch( bounceBuffer, texel, mipLevel ).rgb;\n" - " lambertian_tap1 = texelFetch( peeledBounceBuffer, texel, mipLevel ).rgb;\n" - "\n" - " // Offset to pixel center\n" - " Q0 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.x, projInfo );\n" - " Q1 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.y, projInfo );\n" - "}\n" - "\n" - "\n" - "void iiValueFromPositionsAndNormalsAndLambertian( int2 ssP, float3 X, float3 n_X, float3 Y, float3 n_Y, float3 radiosity_Y, inout float3 E, inout float weight_Y, inout float visibilityWeight_Y )\n" - "{\n" - "\n" - " float3 YminusX = Y - X;\n" - " float3 w_i = normalize( YminusX );\n" - " weight_Y = ( ( dot( w_i, n_X ) > 0.0 )\n" - "#if USE_TAP_NORMAL\n" - " && ( dot( -w_i, n_Y ) > 0.01 )\n" - "#endif\n" - " ) ? 1.0 : 0.0; // Backface check\n" - "\n" - " // E = radiosity_Y * dot(w_i, n_X) * weight_Y * float(dot(YminusX, YminusX) < radius2);\n" - "\n" - " if( ( dot( YminusX, YminusX ) < radius2 ) && // Radius check\n" - " ( weight_Y > 0.0 ) )\n" - " {\n" - " E = radiosity_Y * dot( w_i, n_X );\n" - " }\n" - " else\n" - " {\n" - "#if USE_TAP_NORMAL == 0\n" - " weight_Y = 0;\n" - "#endif\n" - " E = float3( 0 );\n" - " }\n" - "}\n" - "\n" - "\n" - "/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds\n" - " to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius\n" - "\n" - " When sampling from the peeled depth buffer, make sure ssDiskRadius has been premultiplied by cszBufferScale\n" - "*/\n" - "void sampleIndirectLight\n" - "( in int2 ssC,\n" - " in float3 C,\n" - " in float3 n_C,\n" - " in float3 C_peeled,\n" - " in float3 n_C_peeled,\n" - " in float ssDiskRadius,\n" - " in int tapIndex,\n" - " in float randomPatternRotationAngle,\n" - " in float radialJitter,\n" - " in sampler2D cszBuffer,\n" - " in sampler2D nBuffer,\n" - " in sampler2D bounceBuffer,\n" - " inout float3 irradianceSum,\n" - " inout float numSamplesUsed,\n" - " inout float3 iiPeeled,\n" - " inout float weightSumPeeled )\n" - "{\n" - "\n" - " // Not used yet, quality optimization in progress...\n" - " float visibilityWeightPeeled0, visibilityWeightPeeled1;\n" - "\n" - " // Offset on the unit disk, spun for this pixel\n" - " float ssR;\n" - " float2 unitOffset = tapLocation( tapIndex, randomPatternRotationAngle, radialJitter, ssR );\n" - " ssR *= ssDiskRadius;\n" - " int2 ssP = int2( ssR * unitOffset ) + ssC;\n" - "\n" - "#if USE_DEPTH_PEEL\n" - " float3 E, ii_tap0, ii_tap1;\n" - " float weight, weight0, weight1;\n" - " float visibilityWeight0, visibilityWeight1;\n" - " // The occluding point in camera space\n" - " float3 Q0, lambertian_tap0, n_tap0, Q1, lambertian_tap1, n_tap1;\n" - " getOffsetPositionsNormalsAndLambertians( ssP, ssR, cszBuffer, bounceBuffer, peeledColorBuffer, nBuffer, peeledNormalBuffer, Q0, Q1, lambertian_tap0, lambertian_tap1, n_tap0, n_tap1 );\n" - " iiValueFromPositionsAndNormalsAndLambertian( ssP, C, n_C, Q0, n_tap0, lambertian_tap0, ii_tap0, weight0, visibilityWeight0 );\n" - " float adjustedWeight0 = weight0 * dot( ii_tap0, ii_tap0 ) + weight0;\n" - "\n" - " iiValueFromPositionsAndNormalsAndLambertian( ssP, C, n_C, Q1, n_tap1, lambertian_tap1, ii_tap1, weight1, visibilityWeight1 );\n" - " float adjustedWeight1 = weight1 * dot( ii_tap1, ii_tap1 ) + weight1;\n" - "\n" - " weight = ( adjustedWeight0 > adjustedWeight1 ) ? weight0 : weight1;\n" - " E = ( adjustedWeight0 > adjustedWeight1 ) ? ii_tap0 : ii_tap1;\n" - "\n" - "#if COMPUTE_PEELED_LAYER\n" - "\n" - " float weightPeeled0, weightPeeled1;\n" - " float3 ii_tapPeeled0, ii_tapPeeled1;\n" - " iiValueFromPositionsAndNormalsAndLambertian( ssP, C_peeled, n_C_peeled, Q0, n_tap0, lambertian_tap0, ii_tapPeeled0, weightPeeled0, visibilityWeightPeeled0 );\n" - " iiValueFromPositionsAndNormalsAndLambertian( ssP, C_peeled, n_C_peeled, Q1, n_tap1, lambertian_tap1, ii_tapPeeled1, weightPeeled1, visibilityWeightPeeled1 );\n" - "\n" - " float iiMag0 = dot( ii_tapPeeled0, ii_tapPeeled0 );\n" - " float iiMag1 = dot( ii_tapPeeled1, ii_tapPeeled1 );\n" - " weightSumPeeled += iiMag0 > iiMag1 ? weightPeeled0 : weightPeeled1;\n" - " iiPeeled += iiMag0 > iiMag1 ? ii_tapPeeled0 : ii_tapPeeled1;\n" - "\n" - "#endif\n" - "\n" - " numSamplesUsed += weight;\n" - "\n" - "#else\n" - "\n" - " float3 E;\n" - " float visibilityWeight;\n" - " float weight_Y;\n" - " // The occluding point in camera space\n" - " float3 Q, lambertian_tap, n_tap;\n" - " getOffsetPositionNormalAndLambertian( ssP, ssR, cszBuffer, bounceBuffer, nBuffer, Q, lambertian_tap, n_tap );\n" - " iiValueFromPositionsAndNormalsAndLambertian( ssP, C, n_C, Q, n_tap, lambertian_tap, E, weight_Y, visibilityWeight );\n" - " numSamplesUsed += weight_Y;\n" - "#endif\n" - "\n" - " irradianceSum += E;\n" - " //irradianceSum += pow( E, float3( 2.2 ) ); // RB: to linear RGB\n" - "}\n" - "\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" - "\n" - "#if 0\n" - " if( fragment.texcoord0.x < 0.5 )\n" - " {\n" - " discard;\n" - " }\n" - "#endif\n" - "\n" - " // Pixel being shaded\n" - " int2 ssC = int2( gl_FragCoord.xy );\n" - "\n" - "#if COMPUTE_PEELED_LAYER\n" - " float3 C, C_peeled;\n" - " getPositions( ssC, CS_Z_buffer, C, C_peeled );\n" - " float3 n_C_peeled = sampleNormal( peeledNormalBuffer, ssC, 0 );\n" - "#else\n" - " // World space point being shaded\n" - " float3 C = getPosition( ssC, CS_Z_buffer );\n" - " float3 C_peeled = float3( 0 );\n" - " float3 n_C_peeled = float3( 0 );\n" - "#endif\n" - "\n" - " float3 n_C = sampleNormal( normal_buffer, ssC, 0 );\n" - " //n_C = normalize( n_C );\n" - "\n" - "\n" - " // Choose the screen-space sample radius\n" - " // proportional to the projected area of the sphere\n" - " float ssDiskRadius = -projScale * radius / C.z;\n" - "\n" - " // Hash function used in the HPG12 AlchemyAO paper\n" - " float randomPatternRotationAngle = float( 3 * ssC.x ^ ssC.y + ssC.x * ssC.y ) * 10.0;\n" - "#if TEMPORALLY_VARY_TAPS\n" - " randomPatternRotationAngle += rpJitterTexOffset.x;\n" - "#endif\n" - "\n" - " float radialJitter = fract( sin( gl_FragCoord.x * 1e2 +\n" - "#if TEMPORALLY_VARY_TAPS\n" - " rpJitterTexOffset.x +\n" - "#endif\n" - " gl_FragCoord.y ) * 1e5 + sin( gl_FragCoord.y * 1e3 ) * 1e3 ) * 0.8 + 0.1;\n" - "\n" - " float numSamplesUsed = 0.0;\n" - " float3 irradianceSum = float3( 0 );\n" - " float3 ii_peeled = float3( 0 );\n" - " float peeledSum = 0.0;\n" - " for( int i = 0; i < NUM_SAMPLES; ++i )\n" - " {\n" - " sampleIndirectLight( ssC, C, n_C, C_peeled, n_C_peeled, ssDiskRadius, i, randomPatternRotationAngle, radialJitter, CS_Z_buffer, normal_buffer, colorBuffer, irradianceSum, numSamplesUsed, ii_peeled, peeledSum );\n" - " }\n" - "\n" - " const float solidAngleHemisphere = 2.0 * PI;\n" - " float3 E_X = irradianceSum * solidAngleHemisphere / ( numSamplesUsed + 0.00001 );\n" - "\n" - " indirectColor = E_X;\n" - " //indirectColor = pow( E_X, float3( 1.0 / 2.2 ) ); // RB: to sRGB\n" - "\n" - " // What is the ambient visibility of this location\n" - " visibility = 1.0 - numSamplesUsed / float( NUM_SAMPLES );\n" - " //visibility = clamp( 1 - numSamplesUsed / float( NUM_SAMPLES ), 0.0, 1.0 );\n" - " //visibility = pow( max( 0.0, 1.0 - sqrt( sum * ( 3.0 / float( NUM_SAMPLES ) ) ) ), intensity );\n" - "\n" - " //result.color = float4( visibility, visibility, visibility, 1.0 );\n" - " //result.color = float4( n_C * 0.5 + 0.5, 1.0 );\n" - " //result.color = texture( samp2, fragment.texcoord0 ).rgba;\n" - "\n" - "#if COMPUTE_PEELED_LAYER\n" - " float A_peeled = 1.0 - peeledSum / float( NUM_SAMPLES );\n" - " float3 E_X_peeled = ii_peeled * solidAngleHemisphere / ( peeledSum + 0.00001 );\n" - "\n" - " indirectPeeledResult = E_X_peeled;\n" - " peeledVisibility = A_peeled;\n" - "#endif\n" - "}\n" - "\n" - - }, - - { - "renderprogs/DeepGBufferRadiosity_radiosity.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN \n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - "};\n" - "\n" - "struct VS_OUT\n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position = vertex.position;\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/DeepGBufferRadiosity_blur.ps.hlsl", - "/**\n" - " \file AmbientOcclusion_blur.pix\n" - " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" - "\n" - " \brief 7-tap 1D cross-bilateral blur using a packed depth key\n" - "\n" - " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" - "\n" - " Copyright (c) 2011-2014, NVIDIA\n" - " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" - " All rights reserved.\n" - "\n" - " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" - "\n" - " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" - " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" - " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" - "*/\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register( s0 ); // view normals\n" - "uniform sampler2D samp1 : register( s1 ); // view depth\n" - "uniform sampler2D samp2 : register( s2 ); // view AO\n" - "\n" - "#define normal_buffer samp0\n" - "#define cszBuffer samp1\n" - "#define source samp2 \n" - "\n" - "struct PS_IN\n" - "{\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT \n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "#define PEELED_LAYER 0\n" - "#define USE_OCT16 0\n" - "#define USE_NORMALS 1\n" - "\n" - "//#expect PEELED_LAYER \"binary\"\n" - "\n" - "//////////////////////////////////////////////////////////////////////////////////////////////\n" - "// Tunable Parameters:\n" - "\n" - "//#define NUM_KEY_COMPONENTS 1\n" - "\n" - "// The other parameters in this section must be passed in as macro values\n" - "\n" - "/** Increase to make depth edges crisper. Decrease to reduce flicker. */\n" - "#define EDGE_SHARPNESS (1.0)\n" - "\n" - "/** Step in 2-pixel intervals since we already blurred against neighbors in the\n" - " first AO pass. This constant can be increased while R decreases to improve\n" - " performance at the expense of some dithering artifacts.\n" - "\n" - " Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was\n" - " unobjectionable after shading was applied but eliminated most temporal incoherence\n" - " from using small numbers of sample taps.\n" - " */\n" - "#define SCALE (2)\n" - "\n" - "/** Filter radius in pixels. This will be multiplied by SCALE. */\n" - "#define R (4)\n" - "\n" - "#define MDB_WEIGHTS 0\n" - "//////////////////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "/** Type of data to read from source. This macro allows\n" - " the same blur shader to be used on different kinds of input data. */\n" - "#define VALUE_TYPE float4\n" - "\n" - "/** Swizzle to use to extract the channels of source. This macro allows\n" - " the same blur shader to be used on different kinds of input data. */\n" - "#define VALUE_COMPONENTS rgba\n" - "\n" - "#define VALUE_IS_KEY 0\n" - "\n" - "\n" - "\n" - "\n" - "/** (1, 0) or (0, 1)*/\n" - "//uniform int2 axis;\n" - "\n" - "#if USE_OCT16\n" - " #include \n" - "#endif\n" - "\n" - "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" - "{\n" - "#if USE_OCT16\n" - " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" - "#else\n" - " return normalize( texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0 );\n" - "#endif\n" - "}\n" - "\n" - "#define blurResult result.color.VALUE_COMPONENTS\n" - "\n" - "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" - " This need not match the real far plane but should not be much more than it.*/\n" - "const float FAR_PLANE_Z = -16000.0;\n" - "\n" - "float CSZToKey( float z )\n" - "{\n" - " return clamp( z * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" - "}\n" - "\n" - "float reconstructCSZ( float d )\n" - "{\n" - " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" - "\n" - " // infinite far perspective matrix\n" - " return -3.0 / ( -1.0 * d + 1.0 );\n" - "\n" - " //d = d * 2.0 - 1.0;\n" - " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" - "}\n" - "\n" - "float3 reconstructCSPosition( float2 S, float z )\n" - "{\n" - " float4 P;\n" - " P.z = z * 2.0 - 1.0;\n" - " P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0;\n" - " P.w = 1.0;\n" - "\n" - " float4 csP;\n" - " csP.x = dot4( P, rpModelMatrixX );\n" - " csP.y = dot4( P, rpModelMatrixY );\n" - " csP.z = dot4( P, rpModelMatrixZ );\n" - " csP.w = dot4( P, rpModelMatrixW );\n" - "\n" - " csP.xyz /= csP.w;\n" - "\n" - " return csP.xyz;\n" - "}\n" - "\n" - "float getKey( int2 ssP )\n" - "{\n" - "#if PEELED_LAYER\n" - " float key = texelFetch( cszBuffer, ssP, 0 ).g;\n" - "#else\n" - " float key = texelFetch( cszBuffer, ssP, 0 ).r;\n" - "#endif\n" - "\n" - "#if 0\n" - " key = reconstructCSZ( key );\n" - "#else\n" - " float3 P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), key );\n" - " key = P.z;\n" - "#endif\n" - "\n" - " key = clamp( key * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" - " return key;\n" - "}\n" - "\n" - "float3 positionFromKey( float key, int2 ssC )\n" - "{\n" - " float z = key * FAR_PLANE_Z;\n" - " float3 C = reconstructCSPosition( float2( ssC ) + float2( 0.5 ), z );\n" - " return C;\n" - "}\n" - "\n" - "/** Read the camera-space position of the point at screen-space pixel ssP */\n" - "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" - "{\n" - " float3 P;\n" - " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" - "\n" - " // Offset to pixel center\n" - " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" - "\n" - " return P;\n" - "}\n" - "\n" - "float calculateBilateralWeight( float key, float tapKey, int2 tapLoc, float3 n_C, float3 C )\n" - "{\n" - " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" - " float depthWeight = max( 0.0, 1.0 - ( EDGE_SHARPNESS * 2000.0 ) * abs( tapKey - key ) );\n" - "\n" - " float k_normal = 1.0; //40.0;\n" - " float k_plane = 1.0; //0.5;\n" - "\n" - " // Prevents blending over creases.\n" - " float normalWeight = 1.0; //1000.0;\n" - " float planeWeight = 1.0;\n" - "\n" - "#if USE_NORMALS\n" - " float3 tapN_C = sampleNormal( normal_buffer, tapLoc, 0 );\n" - " depthWeight = 1.0;\n" - "\n" - " float normalError = ( 1.0 - dot( tapN_C, n_C ) ) * k_normal;\n" - " normalWeight = max( 1.0 - EDGE_SHARPNESS * normalError, 0.00 );\n" - "\n" - "\n" - " float lowDistanceThreshold2 = 0.001; //0.01;\n" - "\n" - " //float3 tapC = positionFromKey( tapKey, tapLoc, projInfo );\n" - " float3 tapC = getPosition( tapLoc, cszBuffer );\n" - "\n" - " // Change in position in camera space\n" - " float3 dq = C - tapC;\n" - "\n" - " // How far away is this point from the original sample\n" - " // in camera space? (Max value is unbounded)\n" - " float distance2 = dot( dq, dq );\n" - "\n" - " // How far off the expected plane (on the perpendicular) is this point? Max value is unbounded.\n" - " float planeError = max( abs( dot( dq, tapN_C ) ), abs( dot( dq, n_C ) ) );\n" - "\n" - " planeWeight = ( distance2 < lowDistanceThreshold2 ) ? 1.0 :\n" - " pow( max( 0.0, 1.0 - EDGE_SHARPNESS * 2.0 * k_plane * planeError / sqrt( distance2 ) ), 2.0 );\n" - "\n" - "\n" - "#endif\n" - "\n" - " return depthWeight * normalWeight * planeWeight;\n" - "}\n" - "\n" - "\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - "//# if __VERSION__ < 330\n" - " float kernel[R + 1];\n" - "// if R == 0, we never call this shader\n" - "#if R == 1\n" - " kernel[0] = 0.5;\n" - " kernel[1] = 0.25;\n" - "#elif R == 2\n" - " kernel[0] = 0.153170;\n" - " kernel[1] = 0.144893;\n" - " kernel[2] = 0.122649;\n" - "#elif R == 3\n" - " kernel[0] = 0.153170;\n" - " kernel[1] = 0.144893;\n" - " kernel[2] = 0.122649;\n" - " kernel[3] = 0.092902;\n" - "#elif R == 4\n" - " kernel[0] = 0.153170;\n" - " kernel[1] = 0.144893;\n" - " kernel[2] = 0.122649;\n" - " kernel[3] = 0.092902;\n" - " kernel[4] = 0.062970;\n" - "#elif R == 5\n" - " kernel[0] = 0.111220;\n" - " kernel[1] = 0.107798;\n" - " kernel[2] = 0.098151;\n" - " kernel[3] = 0.083953;\n" - " kernel[4] = 0.067458;\n" - " kernel[5] = 0.050920;\n" - "#elif R == 6\n" - " kernel[0] = 0.111220;\n" - " kernel[1] = 0.107798;\n" - " kernel[2] = 0.098151;\n" - " kernel[3] = 0.083953;\n" - " kernel[4] = 0.067458;\n" - " kernel[5] = 0.050920;\n" - " kernel[6] = 0.036108;\n" - "#endif\n" - "//#endif\n" - "\n" - " int2 ssC = int2( gl_FragCoord.xy );\n" - "\n" - " float4 temp = texelFetch( source, ssC, 0 );\n" - "\n" - "#if 0\n" - " if( fragment.texcoord0.x < 0.75 )\n" - " {\n" - " result.color = temp;\n" - " return;\n" - " }\n" - "#endif\n" - "\n" - "#if 0\n" - " float key = getKey( ssC );\n" - " float3 C = positionFromKey( key, ssC );\n" - "#else\n" - " float3 C = getPosition( ssC, cszBuffer );\n" - " float key = CSZToKey( C.z );\n" - "#endif\n" - "\n" - " VALUE_TYPE sum = temp.VALUE_COMPONENTS;\n" - "\n" - " if( key == 1.0 )\n" - " {\n" - " // Sky pixel (if you aren't using depth keying, disable this test)\n" - " blurResult = sum;\n" - " return;\n" - " }\n" - "\n" - " // Base weight for falloff. Increase this for more blurriness,\n" - " // decrease it for better edge discrimination\n" - " float BASE = kernel[0];\n" - " float totalWeight = BASE;\n" - " sum *= totalWeight;\n" - "\n" - " float3 n_C;\n" - "#if USE_NORMALS\n" - " n_C = sampleNormal( normal_buffer, ssC, 0 );\n" - "#endif\n" - "\n" - "#if MDB_WEIGHTS == 0\n" - " for( int r = -R; r <= R; ++r )\n" - " {\n" - " // We already handled the zero case above. This loop should be unrolled and the static branch optimized out,\n" - " // so the IF statement has no runtime cost\n" - " if( r != 0 )\n" - " {\n" - " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" - " temp = texelFetch( source, tapLoc, 0 );\n" - "\n" - "\n" - " float tapKey = getKey( tapLoc );\n" - " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - "\n" - " // spatial domain: offset kernel tap\n" - " float weight = 0.3 + kernel[abs( r )];\n" - "\n" - " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" - "\n" - " weight *= bilateralWeight;\n" - " sum += value * weight;\n" - " totalWeight += weight;\n" - " }\n" - " }\n" - "#else\n" - "\n" - " float lastBilateralWeight = 9999.0;\n" - " for( int r = -1; r >= -R; --r )\n" - " {\n" - " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" - " temp = texelFetch( source, tapLoc, 0 );\n" - " float tapKey = getKey( tapLoc );\n" - "\n" - " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - "\n" - " // spatial domain: offset kernel tap\n" - " float weight = 0.3 + kernel[abs( r )];\n" - "\n" - " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" - " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" - " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" - " lastBilateralWeight = bilateralWeight;\n" - " weight *= bilateralWeight;\n" - " sum += value * weight;\n" - " totalWeight += weight;\n" - " }\n" - "\n" - " lastBilateralWeight = 9999.0;\n" - " for( int r = 1; r <= R; ++r )\n" - " {\n" - " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" - " temp = texelFetch( source, tapLoc, 0 );\n" - " float tapKey = getKey( tapLoc );\n" - " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - "\n" - " // spatial domain: offset kernel tap\n" - " float weight = 0.3 + kernel[abs( r )];\n" - "\n" - " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" - " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" - " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" - " lastBilateralWeight = bilateralWeight;\n" - " weight *= bilateralWeight;\n" - " sum += value * weight;\n" - " totalWeight += weight;\n" - " }\n" - "#endif\n" - "\n" - " const float epsilon = 0.0001;\n" - " blurResult = sum / ( totalWeight + epsilon );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/DeepGBufferRadiosity_blur.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN \n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - "};\n" - "\n" - "struct VS_OUT\n" - "{\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position = vertex.position;\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/debug_shadowmap.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2DArray samp0 : register(s0);\n" - "\n" - "struct PS_IN\n" - "{\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT\n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float3 tc;\n" - " tc.xy = fragment.texcoord0.xy;\n" - " tc.z = rpScreenCorrectionFactor.x; // layer\n" - "\n" - " result.color = texture( samp0, tc );// * rpColor;\n" - "}\n" - - }, - - { - "renderprogs/debug_shadowmap.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " // compute oldschool texgen or multiply by texture matrix\n" - " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" - " {\n" - " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" - " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - " }\n" - " else\n" - " {\n" - " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" - " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" - " }\n" - "}\n" - - }, - - { - "renderprogs/depth.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" - "}\n" - - }, - - { - "renderprogs/depth.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "}\n" - - }, - - { - "renderprogs/depth_skinned.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" - "}\n" - - }, - - { - "renderprogs/depth_skinned.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / binormal / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertex.position );\n" - " modelPosition.y = dot4( matY, vertex.position );\n" - " modelPosition.z = dot4( matZ, vertex.position );\n" - " modelPosition.w = 1.0;\n" - "\n" - " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" - " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" - " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" - " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - "}\n" - - }, - - { - "renderprogs/enviroSuit.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" - "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord : TEXCOORD0_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float2 screenTexCoord = fragment.texcoord;\n" - "\n" - " // compute warp factor\n" - " float4 warpFactor = 1.0 - ( tex2D( samp1, screenTexCoord.xy ) * fragment.color );\n" - " screenTexCoord -= float2( 0.5, 0.5 );\n" - " screenTexCoord *= warpFactor.xy;\n" - " screenTexCoord += float2( 0.5, 0.5 );\n" - "\n" - " // load the screen render\n" - " result.color = tex2D( samp0, screenTexCoord );\n" - "\n" - "}\n" - - }, - - { - "renderprogs/enviroSuit.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// User Renderparms start at 128 as per renderprogs.h\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register(c128); // rpScroll\n" - "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord = vertex.texcoord.xy;\n" - "\n" - " const float4 deformMagnitude = rpUser1;\n" - " result.color = deformMagnitude;\n" - "}\n" - - }, - - { - "renderprogs/environment.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float3 texcoord0 : TEXCOORD0_centroid;\n" - " float3 texcoord1 : TEXCOORD1_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float3 globalNormal = normalize( fragment.texcoord1 );\n" - " float3 globalEye = normalize( fragment.texcoord0 );\n" - "\n" - " float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );\n" - " reflectionVector *= globalNormal;\n" - " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" - "\n" - " float4 envMap = texCUBE( samp0, reflectionVector );\n" - "\n" - " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/environment.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float4 normal : NORMAL;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float3 texcoord0 : TEXCOORD0;\n" - " float3 texcoord1 : TEXCOORD1;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "\n" - " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" - "\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " float4 toEye = rpLocalViewOrigin - vertex.position;\n" - "\n" - " result.texcoord0 = toEye.xyz;\n" - " result.texcoord1 = vNormal.xyz;\n" - "\n" - " result.color = sRGBAToLinearRGBA( rpColor );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/environment_skinned.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float3 texcoord0 : TEXCOORD0_centroid;\n" - " float3 texcoord1 : TEXCOORD1_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " float3 globalNormal = normalize( fragment.texcoord1 );\n" - " float3 globalEye = normalize( fragment.texcoord0 );\n" - "\n" - " float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );\n" - " reflectionVector *= globalNormal;\n" - " reflectionVector = ( reflectionVector * 2.0f ) - globalEye;\n" - "\n" - " float4 envMap = texCUBE( samp0, reflectionVector );\n" - "\n" - " result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/environment_skinned.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float3 texcoord0 : TEXCOORD0;\n" - " float3 texcoord1 : TEXCOORD1;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" - "\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / binormal / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float3 vNormalSkinned;\n" - " vNormalSkinned.x = dot3( matX, vNormal );\n" - " vNormalSkinned.y = dot3( matY, vNormal );\n" - " vNormalSkinned.z = dot3( matZ, vNormal );\n" - " vNormalSkinned = normalize( vNormalSkinned );\n" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertex.position );\n" - " modelPosition.y = dot4( matY, vertex.position );\n" - " modelPosition.z = dot4( matZ, vertex.position );\n" - " modelPosition.w = 1.0;\n" - "\n" - " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" - " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" - " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" - " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - "\n" - " float4 toEye = rpLocalViewOrigin - modelPosition;\n" - "\n" - " result.texcoord0 = toEye.xyz;\n" - " result.texcoord1 = vNormalSkinned.xyz;\n" - "\n" - " result.color = rpColor;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/fog.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "Copyright (C) 2020 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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "uniform sampler2D samp1 : register(s1);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float2 texcoord1 : TEXCOORD1_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 c = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;\n" - "\n" - "#if defined( USE_LINEAR_RGB )\n" - " c = clamp( c, 0.0, 1.0 );\n" - "\n" - " c = float4( Linear1( c.r ), Linear1( c.g ), Linear1( c.b ), Linear1( c.a ) );\n" - "#endif\n" - "\n" - " result.color = c;\n" - "}\n" - "\n" - "\n" - - }, - - { - "renderprogs/fog.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float2 texcoord1 : TEXCOORD1;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" - " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - "\n" - " result.texcoord1.x = dot4( vertex.position, rpTexGen1S );\n" - " result.texcoord1.y = dot4( vertex.position, rpTexGen1T );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/fog_skinned.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "Copyright (C) 2020 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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "uniform sampler2D samp1 : register(s1);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float2 texcoord1 : TEXCOORD1_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 c = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;\n" - "\n" - "#if defined( USE_LINEAR_RGB )\n" - " c = clamp( c, 0.0, 1.0 );\n" - "\n" - " c = float4( Linear1( c.r ), Linear1( c.g ), Linear1( c.b ), Linear1( c.a ) );\n" - "#endif\n" - "\n" - " result.color = c;\n" - "}\n" - "\n" - "\n" - - }, - - { - "renderprogs/fog_skinned.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float2 texcoord1 : TEXCOORD1;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / binormal / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertex.position );\n" - " modelPosition.y = dot4( matY, vertex.position );\n" - " modelPosition.z = dot4( matZ, vertex.position );\n" - " modelPosition.w = 1.0;\n" - " // end of skinning\n" - "\n" - " // start of fog portion\n" - " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" - " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" - " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" - " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - "\n" - " result.texcoord0.x = dot4( modelPosition, rpTexGen0S );\n" - " result.texcoord0.y = dot4( modelPosition, rpTexGen0T );\n" - "\n" - " result.texcoord1.x = dot4( modelPosition, rpTexGen1S );\n" - " result.texcoord1.y = dot4( modelPosition, rpTexGen1T );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/fxaa.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "#define FXAA_GREEN_AS_LUMA 1\n" - "#define FXAA_EARLY_EXIT 0\n" - "#include \"Fxaa3_11.h\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "uniform sampler2D samp1 : register(s1); // exponent bias -1\n" - "uniform sampler2D samp2 : register(s2); // exponent bias -2\n" - "\n" - "uniform float4 rpUser0 : register( c128 );\n" - "uniform float4 rpUser1 : register( c129 );\n" - "uniform float4 rpUser2 : register( c130 );\n" - "uniform float4 rpUser3 : register( c131 );\n" - "uniform float4 rpUser4 : register( c132 );\n" - "uniform float4 rpUser5 : register( c133 );\n" - "uniform float4 rpUser6 : register( c134 );\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT { \n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " const float4 FXAAQualityRCPFrame = rpUser0;\n" - " const float4 FXAAConsoleRcpFrameOpt = rpUser1;\n" - " const float4 FXAAConsoleRcpFrameOpt2 = rpUser2;\n" - " const float4 FXAAConsole360RcpFrameOpt2 = rpUser3;\n" - " const float4 FXAAQualityParms = rpUser4;\n" - " const float4 FXAAConsoleEdgeParms = rpUser5;\n" - " const float4 FXAAConsole360ConstDir = rpUser6;\n" - "\n" - " // Inputs - see more info in fxaa3_11.hfile\n" - " FxaaFloat2 fxaaPos = fragment.texcoord0;\n" - " FxaaFloat4 fxaaConsolePos;\n" - "\n" - " float2 halfPixelOffset = float2( 0.5, 0.5 ) * FXAAQualityRCPFrame.xy;\n" - " fxaaConsolePos.xy = fxaaPos.xy - ( halfPixelOffset );\n" - " fxaaConsolePos.zw = fxaaPos.xy + ( halfPixelOffset );\n" - " FxaaFloat2 fxaaQualityRcpFrame = FXAAQualityRCPFrame.xy;\n" - " FxaaFloat4 fxaaConsoleRcpFrameOpt = FXAAConsoleRcpFrameOpt;\n" - " FxaaFloat4 fxaaConsoleRcpFrameOpt2 = FXAAConsoleRcpFrameOpt2;\n" - " FxaaFloat4 fxaaConsole360RcpFrameOpt2 = FXAAConsole360RcpFrameOpt2;\n" - "\n" - " // Quality parms\n" - " FxaaFloat fxaaQualitySubpix = FXAAQualityParms.x;\n" - " FxaaFloat fxaaQualityEdgeThreshold = FXAAQualityParms.y;\n" - " FxaaFloat fxaaQualityEdgeThresholdMin = FXAAQualityParms.z;\n" - "\n" - " // Console specific Parms\n" - " FxaaFloat fxaaConsoleEdgeSharpness = FXAAConsoleEdgeParms.x;\n" - " FxaaFloat fxaaConsoleEdgeThreshold = FXAAConsoleEdgeParms.y;\n" - " FxaaFloat fxaaConsoleEdgeThresholdMin = FXAAConsoleEdgeParms.z;\n" - "\n" - " // 360 specific parms these have to come from a constant register so that the compiler\n" - " // does not unoptimize the shader\n" - " FxaaFloat4 fxaaConsole360ConstDir = FXAAConsole360ConstDir;\n" - "\n" - "\n" - " float4 colorSample = FxaaPixelShader( fxaaPos,\n" - " fxaaConsolePos,\n" - " samp0,\n" - " samp1,\n" - " samp2,\n" - " fxaaQualityRcpFrame,\n" - " fxaaConsoleRcpFrameOpt,\n" - " fxaaConsoleRcpFrameOpt2,\n" - " fxaaConsole360RcpFrameOpt2,\n" - " fxaaQualitySubpix,\n" - " fxaaQualityEdgeThreshold,\n" - " fxaaQualityEdgeThresholdMin,\n" - " fxaaConsoleEdgeSharpness,\n" - " fxaaConsoleEdgeThreshold,\n" - " fxaaConsoleEdgeThresholdMin,\n" - " fxaaConsole360ConstDir );\n" - "\n" - " result.color = colorSample;\n" - "}\n" - - }, - - { - "renderprogs/fxaa.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position = vertex.position;\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/gbuffer.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "Copyright (C) 2016 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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); // normal map\n" - "\n" - "struct PS_IN\n" - "{\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float3 texcoord1 : TEXCOORD1_centroid;\n" - " float3 texcoord2 : TEXCOORD2_centroid;\n" - " float3 texcoord3 : TEXCOORD3_centroid;\n" - " float3 texcoord4 : TEXCOORD4_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT\n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 bump = tex2D( samp0, fragment.texcoord0 ) * 2.0f - 1.0f;\n" - "\n" - " // RB begin\n" - " float3 localNormal;\n" - "#if defined(USE_NORMAL_FMT_RGB8)\n" - " localNormal = float3( bump.rg, 0.0f );\n" - "#else\n" - " localNormal = float3( bump.wy, 0.0f );\n" - "#endif\n" - " // RB end\n" - " localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );\n" - "\n" - " float3 globalNormal;\n" - "#if 1\n" - " globalNormal.x = dot3( localNormal, fragment.texcoord2 );\n" - " globalNormal.y = dot3( localNormal, fragment.texcoord3 );\n" - " globalNormal.z = dot3( localNormal, fragment.texcoord4 );\n" - "#else\n" - " // only the normal in view space\n" - " globalNormal.x = fragment.texcoord2.z;\n" - " globalNormal.y = fragment.texcoord3.z;\n" - " globalNormal.z = fragment.texcoord4.z;\n" - " //globalNormal.z = fragment.texcoord4.z * -0.001; //sqrt( abs( dot( globalNormal.xy, globalNormal.xy ) - 0.25 ) );\n" - " globalNormal = normalize( globalNormal );\n" - "#endif\n" - "\n" - " // RB: rpColor is white and only used to generate the _fa_ uniform array\n" - " result.color.rgb = ( globalNormal.xyz * 0.5 + 0.5 ) * fragment.color.rgb;// * rpColor;\n" - " //result.color.rgb = ( globalNormal.xyz );// * fragment.color.rgb;// * rpColor;\n" - " result.color.a = 1.0;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/gbuffer.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "Copyright (C) 2016 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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "#if defined( USE_GPU_SKINNING )\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "#endif\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float3 texcoord1 : TEXCOORD1;\n" - " float3 texcoord2 : TEXCOORD2;\n" - " float3 texcoord3 : TEXCOORD3;\n" - " float3 texcoord4 : TEXCOORD4;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "\n" - " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" - " float4 vTangent = vertex.tangent * 2.0 - 1.0;\n" - " float3 vBitangent = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;\n" - "\n" - "#if defined( USE_GPU_SKINNING )\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / tangent / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float3 normal;\n" - " normal.x = dot3( matX, vNormal );\n" - " normal.y = dot3( matY, vNormal );\n" - " normal.z = dot3( matZ, vNormal );\n" - " normal = normalize( normal );\n" - "\n" - " float3 tangent;\n" - " tangent.x = dot3( matX, vTangent );\n" - " tangent.y = dot3( matY, vTangent );\n" - " tangent.z = dot3( matZ, vTangent );\n" - " tangent = normalize( tangent );\n" - "\n" - " float3 bitangent;\n" - " bitangent.x = dot3( matX, vBitangent );\n" - " bitangent.y = dot3( matY, vBitangent );\n" - " bitangent.z = dot3( matZ, vBitangent );\n" - " bitangent = normalize( bitangent );\n" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertex.position );\n" - " modelPosition.y = dot4( matY, vertex.position );\n" - " modelPosition.z = dot4( matZ, vertex.position );\n" - " modelPosition.w = 1.0;\n" - "\n" - "#else\n" - " float4 modelPosition = vertex.position;\n" - " float3 normal = vNormal.xyz;\n" - " float3 tangent = vTangent.xyz;\n" - " float3 bitangent = vBitangent.xyz;\n" - "#endif\n" - "\n" - " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" - " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" - " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" - " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - "\n" - " // textures 0 takes the base coordinates by the texture matrix\n" - " result.texcoord0.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );\n" - " result.texcoord0.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );\n" - "\n" - " //float4 toEye = rpLocalViewOrigin - modelPosition;\n" - " //result.texcoord1.x = dot3( toEye, rpModelMatrixX );\n" - " //result.texcoord1.y = dot3( toEye, rpModelMatrixY );\n" - " //result.texcoord1.z = dot3( toEye, rpModelMatrixZ );\n" - "\n" - "#if 0\n" - " // rotate into world space\n" - " result.texcoord2.x = dot3( tangent, rpModelMatrixX );\n" - " result.texcoord3.x = dot3( tangent, rpModelMatrixY );\n" - " result.texcoord4.x = dot3( tangent, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.y = dot3( bitangent, rpModelMatrixX );\n" - " result.texcoord3.y = dot3( bitangent, rpModelMatrixY );\n" - " result.texcoord4.y = dot3( bitangent, rpModelMatrixZ );\n" - "\n" - " result.texcoord2.z = dot3( normal, rpModelMatrixX );\n" - " result.texcoord3.z = dot3( normal, rpModelMatrixY );\n" - " result.texcoord4.z = dot3( normal, rpModelMatrixZ );\n" - "\n" - "#else\n" - " // rotate into view space\n" - " result.texcoord2.x = dot3( tangent, rpModelViewMatrixX );\n" - " result.texcoord3.x = dot3( tangent, rpModelViewMatrixY );\n" - " result.texcoord4.x = dot3( tangent, rpModelViewMatrixZ );\n" - "\n" - " result.texcoord2.y = dot3( bitangent, rpModelViewMatrixX );\n" - " result.texcoord3.y = dot3( bitangent, rpModelViewMatrixY );\n" - " result.texcoord4.y = dot3( bitangent, rpModelViewMatrixZ );\n" - "\n" - " result.texcoord2.z = dot3( normal, rpModelViewMatrixX );\n" - " result.texcoord3.z = dot3( normal, rpModelViewMatrixY );\n" - " result.texcoord4.z = dot3( normal, rpModelViewMatrixZ );\n" - "#endif\n" - "\n" - "#if defined( USE_GPU_SKINNING )\n" - " // for joint transformation of the tangent space, we use color and\n" - " // color2 for weighting information, so hopefully there aren't any\n" - " // effects that need vertex color...\n" - " result.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );\n" - "#else\n" - " //# generate the vertex color, which can be 1.0, color, or 1.0 - color\n" - " //# for 1.0 : env[16] = 0, env[17] = 1\n" - " //# for color : env[16] = 1, env[17] = 0\n" - " //# for 1.0-color : env[16] = -1, env[17] = 1\n" - " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" - "#endif\n" - "}\n" - - }, - - { - "renderprogs/gui.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float4 texcoord1 : TEXCOORD1_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 color = ( tex2D( samp0, fragment.texcoord0 ) * fragment.color ) + fragment.texcoord1;\n" - " result.color.xyz = color.xyz * color.w;\n" - " result.color.w = color.w;\n" - "}\n" - - }, - - { - "renderprogs/gui.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float4 texcoord1 : TEXCOORD1;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0.xy = vertex.texcoord.xy;\n" - " result.texcoord1 = ( ( vertex.color2 ) * 2.0 ) - 1.0;\n" - " result.color = swizzleColor( vertex.color );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/hdr_glare_chromatic.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "Copyright (C) 2014-2015 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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN\n" - "{\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT\n" - "{\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "float linterp( float t )\n" - "{\n" - " return saturate( 1.0 - abs( 2.0 * t - 1.0 ) );\n" - "}\n" - "\n" - "float remap( float t, float a, float b )\n" - "{\n" - " return saturate( ( t - a ) / ( b - a ) );\n" - "}\n" - "\n" - "float3 spectrumoffset( float t )\n" - "{\n" - " float lo = step( t, 0.5 );\n" - " float hi = 1.0 - lo;\n" - " float w = linterp( remap( t, 1.0 / 6.0, 5.0 / 6.0 ) );\n" - " float3 ret = float3( lo, 1.0, hi ) * float3( 1.0 - w, w, 1.0 - w );\n" - "\n" - " return ret; // pow( ret, float3( 1.0 / 2.2 ) );\n" - "}\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float2 st = fragment.texcoord0;\n" - "\n" - " // base color with tone mapping applied\n" - " float4 color = tex2D( samp0, st );\n" - "\n" - " const float gaussFact[9] = float[9]( 0.13298076, 0.12579441, 0.10648267, 0.08065691, 0.05467002, 0.03315905, 0.01799699, 0.00874063, 0.00379866 );\n" - "\n" - " const float3 chromaticOffsets[9] = float3[](\n" - " float3( 0.5, 0.5, 0.5 ), // w\n" - " float3( 0.8, 0.3, 0.3 ),\n" - "// float3(1.0, 0.2, 0.2), // r\n" - " float3( 0.5, 0.2, 0.8 ),\n" - " float3( 0.2, 0.2, 1.0 ), // b\n" - " float3( 0.2, 0.3, 0.9 ),\n" - " float3( 0.2, 0.9, 0.2 ), // g\n" - " float3( 0.3, 0.5, 0.3 ),\n" - " float3( 0.3, 0.5, 0.3 ),\n" - " float3( 0.3, 0.5, 0.3 )\n" - " //float3(0.3, 0.5, 0.3)\n" - " );\n" - "\n" - " float3 sumColor = float3( 0.0 );\n" - " float3 sumSpectrum = float3( 0.0 );\n" - "\n" - " const int tap = 4;\n" - " const int samples = 9;\n" - "\n" - " float scale = 13.0; // bloom width\n" - " const float weightScale = 2.3; // bloom strength\n" - "\n" - " for( int i = 0; i < samples; i++ )\n" - " {\n" - " //float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );\n" - " //float t = log2( float( i ) / ( float( samples ) - 1.0 ) );\n" - " //float t = ( float( i ) / ( float( samples ) - 1.0 ) );\n" - "\n" - " //float3 so = spectrumoffset( t );\n" - " float3 so = chromaticOffsets[ i ];\n" - " float4 color = tex2D( samp0, st + float2( float( i ), 0 ) * rpWindowCoord.xy * scale );\n" - "\n" - " float weight = gaussFact[ i ];\n" - " sumColor += color.rgb * ( so.rgb * weight * weightScale );\n" - " }\n" - "\n" - "#if 1\n" - " for( int i = 1; i < samples; i++ )\n" - " {\n" - " //float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );\n" - "\n" - " //float3 so = spectrumoffset( t );\n" - " float3 so = chromaticOffsets[ i ];\n" - " float4 color = tex2D( samp0, st + float2( float( -i ), 0 ) * rpWindowCoord.xy * scale );\n" - "\n" - " float weight = gaussFact[ i ];\n" - " sumColor += color.rgb * ( so.rgb * weight * weightScale );\n" - " }\n" - "#endif\n" - "\n" - " result.color = float4( sumColor, 1.0 );\n" - " //result.color = float4( sumColor / float(samples), 1.0 );\n" - " //result.color = float4( sumColor / sumSpectrum, 1.0 );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/hdr_glare_chromatic.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position = vertex.position;\n" - "\n" - " //result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX );\n" - " //result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " //result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " //result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/heatHazeWithMask.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" - "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" - "uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float4 texcoord0 : TEXCOORD0_centroid;\n" - " float4 texcoord1 : TEXCOORD1_centroid;\n" - " float4 texcoord2 : TEXCOORD2_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " // load the distortion map\n" - " float4 mask = tex2D( samp2, fragment.texcoord0.xy );\n" - "\n" - " // kill the pixel if the distortion wound up being very small\n" - " mask.xy -= 0.01f;\n" - " clip( mask );\n" - "\n" - " // load the filtered normal map and convert to -1 to 1 range\n" - " float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;\n" - " float2 localNormal = bumpMap.wy;\n" - " localNormal *= mask.xy;\n" - "\n" - " // calculate the screen texcoord in the 0.0 to 1.0 range\n" - " float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );\n" - " screenTexCoord += ( localNormal * fragment.texcoord2.xy );\n" - " screenTexCoord = saturate( screenTexCoord );\n" - "\n" - " result.color = ( tex2D( samp0, screenTexCoord ) );\n" - "}\n" - - }, - - { - "renderprogs/heatHazeWithMask.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// RB: no GPU skinning with ES 2.0\n" - "#if defined(USE_GPU_SKINNING)\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "#endif\n" - "// RB end\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register(c128); // rpScroll\n" - "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 texcoord0 : TEXCOORD0;\n" - " float4 texcoord1 : TEXCOORD1;\n" - " float4 texcoord2 : TEXCOORD2;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "\n" - "#include \"skinning.inc.hlsl\"\n" - "\n" - " // texture 0 takes the texture coordinates unmodified\n" - " result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 );\n" - "\n" - " // texture 1 takes the texture coordinates and adds a scroll\n" - " const float4 textureScroll = rpUser0;\n" - " result.texcoord1 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;\n" - "\n" - " // texture 2 takes the deform magnitude and scales it by the projection distance\n" - " float4 vec = float4( 0, 1, 0, 1 );\n" - " vec.z = dot4( modelPosition, rpModelViewMatrixZ );\n" - "\n" - " // magicProjectionAdjust is a magic scalar that scales the projection since we changed from\n" - " // using the X axis to the Y axis to calculate R1. It is an approximation to closely match\n" - " // what the original game did\n" - " const float magicProjectionAdjust = 0.43f;\n" - " float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;\n" - " float w = dot4( vec, rpProjectionMatrixW );\n" - "\n" - " // don't let the recip get near zero for polygons that cross the view plane\n" - " w = max( w, 1.0 );\n" - " x /= w;\n" - " //x = x * ( 1.0f / ( w + 0.00001f ) );\n" - "\n" - " // clamp the distance so the the deformations don't get too wacky near the view\n" - " x = min( x, 0.02 );\n" - "\n" - " const float4 deformMagnitude = rpUser1;\n" - " result.texcoord2 = x * deformMagnitude;\n" - "}\n" - - }, - - { - "renderprogs/heatHazeWithMaskAndVertex.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" - "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" - "uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float4 texcoord0 : TEXCOORD0_centroid;\n" - " float4 texcoord1 : TEXCOORD1_centroid;\n" - " float4 texcoord2 : TEXCOORD2_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " // load the distortion map\n" - " float4 mask = tex2D( samp2, fragment.texcoord0.xy );\n" - "\n" - " // kill the pixel if the distortion wound up being very small\n" - " mask.xy *= fragment.color.xy;\n" - " mask.xy -= 0.01f;\n" - " clip( mask );\n" - "\n" - " // load the filtered normal map and convert to -1 to 1 range\n" - " float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;\n" - " float2 localNormal = bumpMap.wy;\n" - " localNormal *= mask.xy;\n" - "\n" - " // calculate the screen texcoord in the 0.0 to 1.0 range\n" - " float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );\n" - " screenTexCoord += ( localNormal * fragment.texcoord2.xy );\n" - " screenTexCoord = saturate( screenTexCoord );\n" - "\n" - " result.color = ( tex2D( samp0, screenTexCoord ) );\n" - "}\n" - - }, - - { - "renderprogs/heatHazeWithMaskAndVertex.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// RB: no GPU skinning with ES 2.0\n" - "#if defined(USE_GPU_SKINNING)\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "#endif\n" - "// RB end\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register(c128); // rpScroll\n" - "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 texcoord0 : TEXCOORD0;\n" - " float4 texcoord1 : TEXCOORD1;\n" - " float4 texcoord2 : TEXCOORD2;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "\n" - "#include \"skinning.inc.hlsl\"\n" - "\n" - " // texture 0 takes the texture coordinates unmodified\n" - " result.texcoord0 = float4( vertex.texcoord, 0 , 0 );\n" - "\n" - " // texture 1 takes the texture coordinates and adds a scroll\n" - " const float4 textureScroll = rpUser0;\n" - " result.texcoord1 = float4( vertex.texcoord, 0, 0 ) + textureScroll;\n" - "\n" - " // texture 2 takes the deform magnitude and scales it by the projection distance\n" - " float4 vec = float4( 0, 1, 0, 1 );\n" - " vec.z = dot4( modelPosition, rpModelViewMatrixZ );\n" - "\n" - " // magicProjectionAdjust is a magic scalar that scales the projection since we changed from\n" - " // using the X axis to the Y axis to calculate x. It is an approximation to closely match\n" - " // what the original game did\n" - " const float magicProjectionAdjust = 0.43f;\n" - " float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;\n" - " float w = dot4( vec, rpProjectionMatrixW );\n" - "\n" - " // don't let the recip get near zero for polygons that cross the view plane\n" - " w = max( w, 1.0f );\n" - " x /= w;\n" - " //x = x * ( 1.0f / w );\n" - "\n" - " // clamp the distance so the the deformations don't get too wacky near the view\n" - " x = min( x, 0.02f );\n" - "\n" - " const float4 deformMagnitude = rpUser1;\n" - " result.texcoord2 = x * deformMagnitude;\n" - " result.color = swizzleColor( vertex.color );\n" - "}\n" - - }, - - { - "renderprogs/heathaze.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" - "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float4 texcoord0 : TEXCOORD0_centroid;\n" - " float4 texcoord1 : TEXCOORD1_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " // load the filtered normal map and convert to -1 to 1 range\n" - " float4 bumpMap = ( tex2D( samp1, fragment.texcoord0.xy ) * 2.0f ) - 1.0f;\n" - " float2 localNormal = bumpMap.wy;\n" - "\n" - " // calculate the screen texcoord in the 0.0 to 1.0 range\n" - " float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );\n" - " screenTexCoord += ( localNormal * fragment.texcoord1.xy );\n" - " screenTexCoord = saturate( screenTexCoord );\n" - "\n" - " // load the screen render\n" - " result.color = ( tex2D( samp0, screenTexCoord.xy ) );\n" - "}\n" - - }, - - { - "renderprogs/heathaze.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// User Renderparms start at 128 as per renderprogs.h\n" - "\n" - "// *INDENT-OFF*\n" - "uniform float4 rpUser0 : register(c128); // rpScroll\n" - "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" - "\n" - "// RB: no GPU skinning with ES 2.0\n" - "#if defined(USE_GPU_SKINNING)\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "#endif\n" - "// RB end\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 texcoord0 : TEXCOORD0;\n" - " float4 texcoord1 : TEXCOORD1;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - "\n" - "#include \"skinning.inc.hlsl\"\n" - "\n" - " //texture 0 takes the texture coordinates and adds a scroll\n" - " const float4 textureScroll = rpUser0;\n" - " result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;\n" - "\n" - " //texture 1 takes the deform magnitude and scales it by the projection distance\n" - " float4 vec = float4( 0, 1, 0, 1 );\n" - " vec.z = dot4( modelPosition, rpModelViewMatrixZ ); // this is the modelview matrix\n" - "\n" - " // magicProjectionAdjust is a magic scalar that scales the projection since we changed from\n" - " // using the X axis to the Y axis to calculate x. It is an approximation to closely match\n" - " // what the original game did\n" - " const float magicProjectionAdjust = 0.43f;\n" - " float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;\n" - " float w = dot4( vec, rpProjectionMatrixW );\n" - "\n" - " //don't let the recip get near zero for polygons that cross the view plane\n" - " w = max( w, 1.0 );\n" - " x /= w;\n" - " //x = x * ( 1.0f / w );\n" - "\n" - " // clamp the distance so the the deformations don't get too wacky near the view\n" - " x = min( x, 0.02 );\n" - "\n" - " const float4 deformMagnitude = rpUser1;\n" - " result.texcoord1 = x * deformMagnitude;\n" - "}\n" - - }, - - { - "renderprogs/interaction.ps.hlsl", + "renderprogs/builtin/lighting/interaction.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -9132,8 +4907,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" - "#include \"BRDF.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "#include \"renderprogs/BRDF.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map\n" @@ -9208,7 +4985,7 @@ static const cgShaderDef_t cg_renderprogs[] = " const half roughness = specMapSRGB.r;\n" " const half glossiness = 1.0 - roughness;\n" "\n" - " // the vast majority of real-world materials (anything not metal or gems) have F(0°)\n" + " // the vast majority of real-world materials (anything not metal or gems) have F(0�)\n" " // values in a very narrow range (~0.02 - 0.08)\n" "\n" " // approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)\n" @@ -9274,11 +5051,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color.w = 1.0;\n" "}\n" "\n" - + }, - + { - "renderprogs/interaction.vs.hlsl", + "renderprogs/builtin/lighting/interaction.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -9308,7 +5085,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#if defined( USE_GPU_SKINNING )\n" "uniform matrices_ubo { float4 matrices[408]; };\n" @@ -9477,11 +5255,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" - + }, - + { - "renderprogs/interactionAmbient.ps.hlsl", + "renderprogs/builtin/lighting/interactionAmbient.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -9511,7 +5289,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map\n" @@ -9586,11 +5365,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color.w = 1.0;\n" "}\n" "\n" - + }, - + { - "renderprogs/interactionAmbient.vs.hlsl", + "renderprogs/builtin/lighting/interactionAmbient.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -9619,7 +5398,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "struct VS_IN {\n" @@ -9707,11 +5487,11 @@ static const cgShaderDef_t cg_renderprogs[] = " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "}\n" - + }, - + { - "renderprogs/interactionAmbient_skinned.ps.hlsl", + "renderprogs/builtin/lighting/interactionAmbient_skinned.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -9741,7 +5521,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map\n" @@ -9816,11 +5597,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color.w = 1.0;\n" "}\n" "\n" - + }, - + { - "renderprogs/interactionAmbient_skinned.vs.hlsl", + "renderprogs/builtin/lighting/interactionAmbient_skinned.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -9850,7 +5631,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" @@ -9996,11 +5778,11 @@ static const cgShaderDef_t cg_renderprogs[] = " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "}\n" - + }, - + { - "renderprogs/interactionSM.ps.hlsl", + "renderprogs/builtin/lighting/interactionSM.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -10031,8 +5813,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" - "#include \"BRDF.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "#include \"renderprogs/BRDF.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map\n" @@ -10397,7 +6181,7 @@ static const cgShaderDef_t cg_renderprogs[] = " const half roughness = specMapSRGB.r;\n" " const half glossiness = 1.0 - roughness;\n" "\n" - " // the vast majority of real-world materials (anything not metal or gems) have F(0°)\n" + " // the vast majority of real-world materials (anything not metal or gems) have F(0�)\n" " // values in a very narrow range (~0.02 - 0.08)\n" "\n" " // approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)\n" @@ -10481,11 +6265,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color.a = 1.0;\n" "}\n" "\n" - + }, - + { - "renderprogs/interactionSM.vs.hlsl", + "renderprogs/builtin/lighting/interactionSM.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -10515,7 +6299,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#if defined( USE_GPU_SKINNING )\n" "uniform matrices_ubo { float4 matrices[408]; };\n" @@ -10707,11 +6492,637 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" - + }, - + { - "renderprogs/motionBlur.ps.hlsl", + "renderprogs/builtin/lighting/shadow.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/lighting/shadow.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " float4 vPos = vertex.position - rpLocalLightOrigin;\n" + " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" + "\n" + " result.position.x = dot4( vPos, rpMVPmatrixX );\n" + " result.position.y = dot4( vPos, rpMVPmatrixY );\n" + " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" + " result.position.w = dot4( vPos, rpMVPmatrixW );\n" + "}\n" + + }, + + { + "renderprogs/builtin/lighting/shadow_skinned.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/lighting/shadow_skinned.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float4 vertexPosition = vertex.position;\n" + " vertexPosition.w = 1.0;\n" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertexPosition );\n" + " modelPosition.y = dot4( matY, vertexPosition );\n" + " modelPosition.z = dot4( matZ, vertexPosition );\n" + " modelPosition.w = vertex.position.w;\n" + "\n" + " float4 vPos = modelPosition - rpLocalLightOrigin;\n" + " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" + "\n" + " result.position.x = dot4( vPos, rpMVPmatrixX );\n" + " result.position.y = dot4( vPos, rpMVPmatrixY );\n" + " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" + " result.position.w = dot4( vPos, rpMVPmatrixW );\n" + "}\n" + + }, + + { + "renderprogs/builtin/post/fxaa.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "#define FXAA_GREEN_AS_LUMA 1\n" + "#define FXAA_EARLY_EXIT 0\n" + "#include \"Fxaa3_11.h\"\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "uniform sampler2D samp1 : register(s1); // exponent bias -1\n" + "uniform sampler2D samp2 : register(s2); // exponent bias -2\n" + "\n" + "uniform float4 rpUser0 : register( c128 );\n" + "uniform float4 rpUser1 : register( c129 );\n" + "uniform float4 rpUser2 : register( c130 );\n" + "uniform float4 rpUser3 : register( c131 );\n" + "uniform float4 rpUser4 : register( c132 );\n" + "uniform float4 rpUser5 : register( c133 );\n" + "uniform float4 rpUser6 : register( c134 );\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT { \n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " const float4 FXAAQualityRCPFrame = rpUser0;\n" + " const float4 FXAAConsoleRcpFrameOpt = rpUser1;\n" + " const float4 FXAAConsoleRcpFrameOpt2 = rpUser2;\n" + " const float4 FXAAConsole360RcpFrameOpt2 = rpUser3;\n" + " const float4 FXAAQualityParms = rpUser4;\n" + " const float4 FXAAConsoleEdgeParms = rpUser5;\n" + " const float4 FXAAConsole360ConstDir = rpUser6;\n" + "\n" + " // Inputs - see more info in fxaa3_11.hfile\n" + " FxaaFloat2 fxaaPos = fragment.texcoord0;\n" + " FxaaFloat4 fxaaConsolePos;\n" + "\n" + " float2 halfPixelOffset = float2( 0.5, 0.5 ) * FXAAQualityRCPFrame.xy;\n" + " fxaaConsolePos.xy = fxaaPos.xy - ( halfPixelOffset );\n" + " fxaaConsolePos.zw = fxaaPos.xy + ( halfPixelOffset );\n" + " FxaaFloat2 fxaaQualityRcpFrame = FXAAQualityRCPFrame.xy;\n" + " FxaaFloat4 fxaaConsoleRcpFrameOpt = FXAAConsoleRcpFrameOpt;\n" + " FxaaFloat4 fxaaConsoleRcpFrameOpt2 = FXAAConsoleRcpFrameOpt2;\n" + " FxaaFloat4 fxaaConsole360RcpFrameOpt2 = FXAAConsole360RcpFrameOpt2;\n" + "\n" + " // Quality parms\n" + " FxaaFloat fxaaQualitySubpix = FXAAQualityParms.x;\n" + " FxaaFloat fxaaQualityEdgeThreshold = FXAAQualityParms.y;\n" + " FxaaFloat fxaaQualityEdgeThresholdMin = FXAAQualityParms.z;\n" + "\n" + " // Console specific Parms\n" + " FxaaFloat fxaaConsoleEdgeSharpness = FXAAConsoleEdgeParms.x;\n" + " FxaaFloat fxaaConsoleEdgeThreshold = FXAAConsoleEdgeParms.y;\n" + " FxaaFloat fxaaConsoleEdgeThresholdMin = FXAAConsoleEdgeParms.z;\n" + "\n" + " // 360 specific parms these have to come from a constant register so that the compiler\n" + " // does not unoptimize the shader\n" + " FxaaFloat4 fxaaConsole360ConstDir = FXAAConsole360ConstDir;\n" + "\n" + "\n" + " float4 colorSample = FxaaPixelShader( fxaaPos,\n" + " fxaaConsolePos,\n" + " samp0,\n" + " samp1,\n" + " samp2,\n" + " fxaaQualityRcpFrame,\n" + " fxaaConsoleRcpFrameOpt,\n" + " fxaaConsoleRcpFrameOpt2,\n" + " fxaaConsole360RcpFrameOpt2,\n" + " fxaaQualitySubpix,\n" + " fxaaQualityEdgeThreshold,\n" + " fxaaQualityEdgeThresholdMin,\n" + " fxaaConsoleEdgeSharpness,\n" + " fxaaConsoleEdgeThreshold,\n" + " fxaaConsoleEdgeThresholdMin,\n" + " fxaaConsole360ConstDir );\n" + "\n" + " result.color = colorSample;\n" + "}\n" + + }, + + { + "renderprogs/builtin/post/fxaa.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position = vertex.position;\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/post/hdr_glare_chromatic.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2014-2015 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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_IN\n" + "{\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT\n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "float linterp( float t )\n" + "{\n" + " return saturate( 1.0 - abs( 2.0 * t - 1.0 ) );\n" + "}\n" + "\n" + "float remap( float t, float a, float b )\n" + "{\n" + " return saturate( ( t - a ) / ( b - a ) );\n" + "}\n" + "\n" + "float3 spectrumoffset( float t )\n" + "{\n" + " float lo = step( t, 0.5 );\n" + " float hi = 1.0 - lo;\n" + " float w = linterp( remap( t, 1.0 / 6.0, 5.0 / 6.0 ) );\n" + " float3 ret = float3( lo, 1.0, hi ) * float3( 1.0 - w, w, 1.0 - w );\n" + "\n" + " return ret; // pow( ret, float3( 1.0 / 2.2 ) );\n" + "}\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float2 st = fragment.texcoord0;\n" + "\n" + " // base color with tone mapping applied\n" + " float4 color = tex2D( samp0, st );\n" + "\n" + " const float gaussFact[9] = float[9]( 0.13298076, 0.12579441, 0.10648267, 0.08065691, 0.05467002, 0.03315905, 0.01799699, 0.00874063, 0.00379866 );\n" + "\n" + " const float3 chromaticOffsets[9] = float3[](\n" + " float3( 0.5, 0.5, 0.5 ), // w\n" + " float3( 0.8, 0.3, 0.3 ),\n" + "// float3(1.0, 0.2, 0.2), // r\n" + " float3( 0.5, 0.2, 0.8 ),\n" + " float3( 0.2, 0.2, 1.0 ), // b\n" + " float3( 0.2, 0.3, 0.9 ),\n" + " float3( 0.2, 0.9, 0.2 ), // g\n" + " float3( 0.3, 0.5, 0.3 ),\n" + " float3( 0.3, 0.5, 0.3 ),\n" + " float3( 0.3, 0.5, 0.3 )\n" + " //float3(0.3, 0.5, 0.3)\n" + " );\n" + "\n" + " float3 sumColor = float3( 0.0 );\n" + " float3 sumSpectrum = float3( 0.0 );\n" + "\n" + " const int tap = 4;\n" + " const int samples = 9;\n" + "\n" + " float scale = 13.0; // bloom width\n" + " const float weightScale = 2.3; // bloom strength\n" + "\n" + " for( int i = 0; i < samples; i++ )\n" + " {\n" + " //float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );\n" + " //float t = log2( float( i ) / ( float( samples ) - 1.0 ) );\n" + " //float t = ( float( i ) / ( float( samples ) - 1.0 ) );\n" + "\n" + " //float3 so = spectrumoffset( t );\n" + " float3 so = chromaticOffsets[ i ];\n" + " float4 color = tex2D( samp0, st + float2( float( i ), 0 ) * rpWindowCoord.xy * scale );\n" + "\n" + " float weight = gaussFact[ i ];\n" + " sumColor += color.rgb * ( so.rgb * weight * weightScale );\n" + " }\n" + "\n" + "#if 1\n" + " for( int i = 1; i < samples; i++ )\n" + " {\n" + " //float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );\n" + "\n" + " //float3 so = spectrumoffset( t );\n" + " float3 so = chromaticOffsets[ i ];\n" + " float4 color = tex2D( samp0, st + float2( float( -i ), 0 ) * rpWindowCoord.xy * scale );\n" + "\n" + " float weight = gaussFact[ i ];\n" + " sumColor += color.rgb * ( so.rgb * weight * weightScale );\n" + " }\n" + "#endif\n" + "\n" + " result.color = float4( sumColor, 1.0 );\n" + " //result.color = float4( sumColor / float(samples), 1.0 );\n" + " //result.color = float4( sumColor / sumSpectrum, 1.0 );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/post/hdr_glare_chromatic.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position = vertex.position;\n" + "\n" + " //result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX );\n" + " //result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " //result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " //result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/post/motionBlur.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -10741,7 +7152,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // view color\n" @@ -10812,11 +7224,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = float4( sum * invScale, 1.0 );\n" "}\n" "\n" - + }, - + { - "renderprogs/motionBlur.vs.hlsl", + "renderprogs/builtin/post/motionBlur.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -10845,7 +7257,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "struct VS_IN {\n" @@ -10864,11 +7277,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.position = vertex.position;\n" " result.texcoord0 = vertex.texcoord;\n" "}\n" - + }, - + { - "renderprogs/postprocess.ps.hlsl", + "renderprogs/builtin/post/postprocess.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -10900,7 +7313,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" @@ -11493,11 +7907,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = color;\n" "}\n" "\n" - + }, - + { - "renderprogs/postprocess.vs.hlsl", + "renderprogs/builtin/post/postprocess.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -11526,7 +7940,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "struct VS_IN {\n" @@ -11553,11 +7968,11 @@ static const cgShaderDef_t cg_renderprogs[] = " //result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" " result.texcoord0 = vertex.texcoord;\n" "}\n" - + }, - + { - "renderprogs/screen.ps.hlsl", + "renderprogs/builtin/post/screen.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -11587,7 +8002,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" @@ -11612,11 +8028,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = color;\n" "}\n" "\n" - + }, - + { - "renderprogs/screen.vs.hlsl", + "renderprogs/builtin/post/screen.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -11645,7 +8061,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "struct VS_IN {\n" @@ -11672,756 +8089,11 @@ static const cgShaderDef_t cg_renderprogs[] = " //result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" " result.texcoord0 = vertex.texcoord;\n" "}\n" - + }, - + { - "renderprogs/shadow.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/shadow.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " float4 vPos = vertex.position - rpLocalLightOrigin;\n" - " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" - "\n" - " result.position.x = dot4( vPos, rpMVPmatrixX );\n" - " result.position.y = dot4( vPos, rpMVPmatrixY );\n" - " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" - " result.position.w = dot4( vPos, rpMVPmatrixW );\n" - "}\n" - - }, - - { - "renderprogs/shadowDebug.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/shadowDebug.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " float4 vPos = vertex.position - rpLocalLightOrigin;\n" - " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" - "\n" - " result.position.x = dot4( vPos, rpMVPmatrixX );\n" - " result.position.y = dot4( vPos, rpMVPmatrixY );\n" - " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" - " result.position.w = dot4( vPos, rpMVPmatrixW );\n" - "}\n" - - }, - - { - "renderprogs/shadowDebug_skinned.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/shadowDebug_skinned.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / binormal / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float4 vertexPosition = vertex.position;\n" - " vertexPosition.w = 1.0;\n" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertexPosition );\n" - " modelPosition.y = dot4( matY, vertexPosition );\n" - " modelPosition.z = dot4( matZ, vertexPosition );\n" - " modelPosition.w = vertex.position.w;\n" - "\n" - " float4 vPos = modelPosition - rpLocalLightOrigin;\n" - " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" - "\n" - " result.position.x = dot4( vPos, rpMVPmatrixX );\n" - " result.position.y = dot4( vPos, rpMVPmatrixY );\n" - " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" - " result.position.w = dot4( vPos, rpMVPmatrixW );\n" - "}\n" - - }, - - { - "renderprogs/shadow_skinned.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/shadow_skinned.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / binormal / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float4 vertexPosition = vertex.position;\n" - " vertexPosition.w = 1.0;\n" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertexPosition );\n" - " modelPosition.y = dot4( matY, vertexPosition );\n" - " modelPosition.z = dot4( matZ, vertexPosition );\n" - " modelPosition.w = vertex.position.w;\n" - "\n" - " float4 vPos = modelPosition - rpLocalLightOrigin;\n" - " vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;\n" - "\n" - " result.position.x = dot4( vPos, rpMVPmatrixX );\n" - " result.position.y = dot4( vPos, rpMVPmatrixY );\n" - " result.position.z = dot4( vPos, rpMVPmatrixZ );\n" - " result.position.w = dot4( vPos, rpMVPmatrixW );\n" - "}\n" - - }, - - { - "renderprogs/simpleshade.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float4 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-OFF*\n" - "\n" - "static float2 screenPosToTexcoord( float2 pos, float4 bias_scale ) { return ( pos * bias_scale.zw + bias_scale.xy ); }\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" - " const float renderWidth = 1280.0f;\n" - " const float renderHeight = 720.0f;\n" - " const float4 positionToViewTexture = float4( 0.5f / renderWidth, 0.5f / renderHeight, 1.0f / renderWidth, 1.0f / renderHeight );\n" - "\n" - " float interpolatedZOverW = ( 1.0 - ( fragment.texcoord0.z / fragment.texcoord0.w ) );\n" - "\n" - " float3 pos;\n" - " pos.z = 1.0 / interpolatedZOverW;\n" - " pos.xy = pos.z * ( 2.0 * screenPosToTexcoord( fragment.position.xy, positionToViewTexture ) - 1.0 );\n" - "\n" - " float3 normal = normalize( cross( ddy( pos ), ddx( pos ) ) );\n" - "\n" - " // light is above and to the right in the eye plane\n" - " float3 L = normalize( float3( 1.0, 1.0, 0.0 ) - pos );\n" - "\n" - " result.color.xyz = _float3( dot3( normal, L ) * 0.75 );\n" - " result.color.w = 1.0;\n" - "}\n" - - }, - - { - "renderprogs/simpleshade.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " float4 position;\n" - " position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.position = position;\n" - " result.texcoord0 = position;\n" - "}\n" - - }, - - { - "renderprogs/skybox.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform samplerCUBE samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float3 texcoord0 : TEXCOORD0_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/skybox.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float3 texcoord0 : TEXCOORD0;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0 = vertex.position.xyz - rpLocalViewOrigin.xyz;\n" - "\n" - " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" - "}\n" - "\n" - - }, - - { - "renderprogs/SMAA_blending_weight_calc.ps.hlsl", + "renderprogs/builtin/post/SMAA_blending_weight_calc.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -12451,7 +8123,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#define SMAA_INCLUDE_VS 0\n" "#define SMAA_INCLUDE_PS 1\n" @@ -12507,11 +8180,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = color;\n" "}\n" "\n" - + }, - + { - "renderprogs/SMAA_blending_weight_calc.vs.hlsl", + "renderprogs/builtin/post/SMAA_blending_weight_calc.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -12541,7 +8214,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#define SMAA_INCLUDE_VS 1\n" "#define SMAA_INCLUDE_PS 0\n" @@ -12586,11 +8260,11 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " result.texcoord4.st = pixcoord;\n" "}\n" - + }, - + { - "renderprogs/SMAA_edge_detection.ps.hlsl", + "renderprogs/builtin/post/SMAA_edge_detection.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -12620,7 +8294,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#define SMAA_INCLUDE_VS 0\n" "#define SMAA_INCLUDE_PS 1\n" @@ -12667,11 +8342,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = color;\n" "}\n" "\n" - + }, - + { - "renderprogs/SMAA_edge_detection.vs.hlsl", + "renderprogs/builtin/post/SMAA_edge_detection.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -12701,7 +8376,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#define SMAA_INCLUDE_VS 1\n" "#define SMAA_INCLUDE_PS 0\n" @@ -12743,11 +8419,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.texcoord2 = offset[1];\n" " result.texcoord3 = offset[2];\n" "}\n" - + }, - + { - "renderprogs/SMAA_final.ps.hlsl", + "renderprogs/builtin/post/SMAA_final.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -12777,7 +8453,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#define SMAA_INCLUDE_VS 0\n" "#define SMAA_INCLUDE_PS 1\n" @@ -12822,11 +8499,11 @@ static const cgShaderDef_t cg_renderprogs[] = " result.color = color;\n" "}\n" "\n" - + }, - + { - "renderprogs/SMAA_final.vs.hlsl", + "renderprogs/builtin/post/SMAA_final.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -12856,7 +8533,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "#define SMAA_INCLUDE_VS 1\n" "#define SMAA_INCLUDE_PS 0\n" @@ -12891,923 +8569,11 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " result.texcoord1 = offset;\n" "}\n" - + }, - + { - "renderprogs/stereoDeGhost.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( out PS_OUT result )\n" - "{\n" - " result.color = rpColor;\n" - "}\n" - - }, - - { - "renderprogs/stereoDeGhost.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "}\n" - - }, - - { - "renderprogs/stereoInterlace.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "uniform sampler2D samp1 : register(s1);\n" - "\n" - "struct PS_IN {\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " // texcoords will run from 0 to 1 across the entire screen\n" - " if( fract( fragment.position.y * 0.5 ) < 0.5 )\n" - " {\n" - " result.color = tex2D( samp0, vec2( fragment.texcoord0 ) );\n" - " }\n" - " else\n" - " {\n" - " result.color = tex2D( samp1, vec2( fragment.texcoord0 ) );\n" - " }\n" - "}\n" - - }, - - { - "renderprogs/stereoInterlace.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/stereoWarp.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "/*\n" - "\n" - "This shader will cover a square block of pixel coordinates, but some of them might\n" - "be scissored off if the edges of the screen or the midpoint divider are visible through\n" - "the optics.\n" - "\n" - "*/\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " vec4 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " const float screenWarp_range = 1.45;\n" - "\n" - " const vec2 warpCenter = vec2( 0.5, 0.5 );\n" - " vec2 centeredTexcoord = fragment.texcoord0.xy - warpCenter;\n" - "\n" - " float radialLength = length( centeredTexcoord );\n" - " vec2 radialDir = normalize( centeredTexcoord );\n" - "\n" - " // get it down into the 0 - PI/2 range\n" - " float range = screenWarp_range;\n" - " float scaledRadialLength = radialLength * range;\n" - " float tanScaled = tan( scaledRadialLength );\n" - "\n" - " float rescaleValue = tan( 0.5 * range );\n" - "\n" - " // If radialLength was 0.5, we want rescaled to also come out\n" - " // as 0.5, so the edges of the rendered image are at the edges\n" - " // of the warped image.\n" - " float rescaled = tanScaled / rescaleValue;\n" - "\n" - " vec2 warped = warpCenter + vec2( 0.5, 0.5 ) * radialDir * rescaled;\n" - "\n" - " result.color = tex2D( samp0, warped );\n" - "}\n" - "\n" - - }, - - { - "renderprogs/stereoWarp.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float4 texcoord : TEXCOORD0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 texcoord0: TEXCOORD0; // 0 to 1 box\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - " result.texcoord0 = vertex.texcoord;\n" - "}\n" - - }, - - { - "renderprogs/texture.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " result.color = tex2D( samp0, fragment.texcoord0 ) * rpColor;\n" - " //result.color = textureLod( samp0, fragment.texcoord0, 2.0 ) * rpColor;\n" - " //result.color = float4( 0.0, 1.0, 0.0, 1.0 ) * rpColor;\n" - "}\n" - - }, - - { - "renderprogs/texture.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " // compute oldschool texgen or multiply by texture matrix\n" - " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" - " {\n" - " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" - " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - " }\n" - " else\n" - " {\n" - " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" - " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" - " }\n" - "}\n" - - }, - - { - "renderprogs/texture_color.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;\n" - " clip( color.a - rpAlphaTest.x );\n" - " result.color = sRGBAToLinearRGBA( color );\n" - "}\n" - - }, - - { - "renderprogs/texture_color.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " // compute oldschool texgen or multiply by texture matrix\n" - " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" - " {\n" - " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" - " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - " }\n" - " else\n" - " {\n" - " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" - " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" - " }\n" - "\n" - " float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" - " result.color = vertexColor * rpColor;\n" - "}\n" - - }, - - { - "renderprogs/texture_color_skinned.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "uniform sampler2D samp0 : register(s0);\n" - "\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float2 texcoord0 : TEXCOORD0_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - " float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;\n" - " clip( color.a - rpAlphaTest.x );\n" - " result.color = sRGBAToLinearRGBA( color );\n" - "}\n" - - }, - - { - "renderprogs/texture_color_skinned.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\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" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "uniform matrices_ubo { float4 matrices[408]; };\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - " float4 color2 : COLOR1;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float2 texcoord0 : TEXCOORD0;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " //--------------------------------------------------------------\n" - " // GPU transformation of the normal / binormal / bitangent\n" - " //\n" - " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" - " //--------------------------------------------------------------\n" - " const float w0 = vertex.color2.x;\n" - " const float w1 = vertex.color2.y;\n" - " const float w2 = vertex.color2.z;\n" - " const float w3 = vertex.color2.w;\n" - "\n" - " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" - "\n" - " float4 modelPosition;\n" - " modelPosition.x = dot4( matX, vertex.position );\n" - " modelPosition.y = dot4( matY, vertex.position );\n" - " modelPosition.z = dot4( matZ, vertex.position );\n" - " modelPosition.w = 1.0;\n" - "\n" - " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" - " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" - " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" - " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" - "\n" - " // compute oldschool texgen or multiply by texture matrix\n" - " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" - " {\n" - " result.texcoord0.x = dot4( modelPosition, rpTexGen0S );\n" - " result.texcoord0.y = dot4( modelPosition, rpTexGen0T );\n" - " }\n" - " else\n" - " {\n" - " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" - " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" - " }\n" - "\n" - " float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" - " result.color = vertexColor * rpColor;\n" - "}\n" - - }, - - { - "renderprogs/texture_color_texgen.ps.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "uniform sampler2D samp0 :\n" - "register( s0 );\n" - "\n" - "// *INDENT-OFF*\n" - "struct PS_IN {\n" - " float4 position : VPOS;\n" - " float4 texcoord0 : TEXCOORD0_centroid;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct PS_OUT {\n" - " float4 color : COLOR;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( PS_IN fragment, out PS_OUT result )\n" - "{\n" - "\n" - " // we always do a projective texture lookup so that we can support texgen\n" - " // materials without a separate shader. Basic materials will have texture\n" - " // coordinates with w = 1 which will result in a NOP projection when tex2Dproj\n" - " // gets called.\n" - " float4 texSample = idtex2Dproj( samp0, fragment.texcoord0 );\n" - "\n" - " result.color = sRGBAToLinearRGBA( texSample ) * fragment.color;\n" - "}\n" - - }, - - { - "renderprogs/texture_color_texgen.vs.hlsl", - "/*\n" - "===========================================================================\n" - "\n" - "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" - "\n" - "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation, either version 3 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with Doom 3 BFG Edition Source Code. If not, see .\n" - "\n" - "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" - "\n" - "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" - "\n" - "===========================================================================\n" - "*/\n" - "\n" - "#include \"global.inc.hlsl\"\n" - "\n" - "// *INDENT-OFF*\n" - "struct VS_IN {\n" - " float4 position : POSITION;\n" - " float2 texcoord : TEXCOORD0;\n" - " float4 normal : NORMAL;\n" - " float4 tangent : TANGENT;\n" - " float4 color : COLOR0;\n" - "};\n" - "\n" - "struct VS_OUT {\n" - " float4 position : POSITION;\n" - " float4 texcoord0 : TEXCOORD0;\n" - " float4 color : COLOR0;\n" - "};\n" - "// *INDENT-ON*\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result )\n" - "{\n" - " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" - " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" - " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" - " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" - "\n" - " float4 tc0;\n" - " tc0.x = dot4( vertex.position, rpTexGen0S );\n" - " tc0.y = dot4( vertex.position, rpTexGen0T );\n" - "\n" - " tc0.z = 0.0f;\n" - " tc0.w = dot4( vertex.position, rpTexGen0Q );\n" - "\n" - " // multiply the texture matrix in\n" - " result.texcoord0.x = dot4( tc0, rpTextureMatrixS );\n" - " result.texcoord0.y = dot4( tc0, rpTextureMatrixT );\n" - " result.texcoord0.zw = tc0.zw;\n" - "\n" - " // compute vertex modulation\n" - " float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" - " result.color = vertexColor * rpColor;\n" - "}\n" - - }, - - { - "renderprogs/tonemap.ps.hlsl", + "renderprogs/builtin/post/tonemap.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -13837,7 +8603,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 0 is _currentRender\n" @@ -14078,11 +8845,11 @@ static const cgShaderDef_t cg_renderprogs[] = "#endif\n" "}\n" "\n" - + }, - + { - "renderprogs/tonemap.vs.hlsl", + "renderprogs/builtin/post/tonemap.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -14111,7 +8878,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "struct VS_IN {\n" @@ -14138,11 +8906,2407 @@ static const cgShaderDef_t cg_renderprogs[] = " //result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" " result.texcoord0 = vertex.texcoord;\n" "}\n" - + }, - + { - "renderprogs/vertex_color.ps.hlsl", + "renderprogs/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl", + "/**\n" + " \file AmbientOcclusion_AO.pix\n" + " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" + "\n" + " Reference implementation of the Scalable Ambient Obscurance (AmbientOcclusion) screen-space ambient obscurance algorithm.\n" + "\n" + " The optimized algorithmic structure of AmbientOcclusion was published in McGuire, Mara, and Luebke, Scalable Ambient Obscurance,\n" + " HPG 2012, and was developed at NVIDIA with support from Louis Bavoil.\n" + "\n" + " The mathematical ideas of AlchemyAO were first described in McGuire, Osman, Bukowski, and Hennessy, The\n" + " Alchemy Screen-Space Ambient Obscurance Algorithm, HPG 2011 and were developed at\n" + " Vicarious Visions.\n" + "\n" + " DX11 HLSL port by Leonardo Zide of Treyarch\n" + "\n" + "
\n" + "\n" + " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" + "\n" + " Copyright (c) 2011-2012, NVIDIA\n" + " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" + " All rights reserved.\n" + "\n" + " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" + "\n" + " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" + " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" + " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + "\n" + " */\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "\n" + "\n" + "#define DIFFERENT_DEPTH_RESOLUTIONS 0\n" + "#define USE_DEPTH_PEEL 0\n" + "#define CS_Z_PACKED_TOGETHER 0\n" + "#define TEMPORALLY_VARY_TAPS 0\n" + "#define HIGH_QUALITY 1\n" + "#define USE_OCT16 0\n" + "#define USE_MIPMAPS 1\n" + "\n" + "// Total number of direct samples to take at each pixel\n" + "#define NUM_SAMPLES 11\n" + "\n" + "// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent\n" + "// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9\n" + "#define NUM_SPIRAL_TURNS 7\n" + "\n" + "// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower\n" + "// miplevel to maintain reasonable spatial locality in the cache\n" + "// If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing.\n" + "// If it is too high (> 5), we'll get bad performance because we're not using the MIP levels effectively\n" + "#define LOG_MAX_OFFSET (3)\n" + "\n" + "// This must be less than or equal to the MAX_MIP_LEVEL defined in SAmbientOcclusion.cpp\n" + "#define MAX_MIP_LEVEL (5)\n" + "\n" + "#define MIN_MIP_LEVEL 0\n" + "\n" + "const float DOOM_TO_METERS = 0.0254; // doom to meters\n" + "const float METERS_TO_DOOM = ( 1.0 / DOOM_TO_METERS ); // meters to doom\n" + "\n" + "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" + " This need not match the real far plane but should not be much more than it.*/\n" + "//const float FAR_PLANE_Z = -4000.0;\n" + "\n" + "/** World-space AO radius in scene units (r). e.g., 1.0m */\n" + "const float radius = 1.0 * METERS_TO_DOOM;\n" + "const float radius2 = radius * radius;\n" + "const float invRadius2 = 1.0 / radius2;\n" + "\n" + "/** Bias to avoid AO in smooth corners, e.g., 0.01m */\n" + "const float bias = 0.01 * METERS_TO_DOOM;\n" + "\n" + "/** intensity / radius^6 */\n" + "const float intensity = 0.6;\n" + "const float intensityDivR6 = intensity / ( radius* radius* radius* radius* radius* radius );\n" + "\n" + "/** The height in pixels of a 1m object if viewed from 1m away.\n" + " You can compute it from your projection matrix. The actual value is just\n" + " a scale factor on radius; you can simply hardcode this to a constant (~500)\n" + " and make your radius value unitless (...but resolution dependent.) */\n" + "const float projScale = 500.0;\n" + "\n" + "//#expect NUM_SAMPLES \"Integer number of samples to take at each pixels\"\n" + "//#expect NUM_SPIRAL_TURNS \"Integer number of turns around the circle that the spiral pattern makes. The G3D::AmbientOcclusion class provides a discrepancy-minimizing value of NUM_SPIRAL_TURNS for eac value of NUM_SAMPLES.\"\n" + "//#expect DIFFERENT_DEPTH_RESOLUTIONS \"1 if the peeled depth buffer is at a different resolution than the primary depth buffer\"\n" + "//#expect USE_DEPTH_PEEL \"1 to enable, 0 to disable\"\n" + "//#expect CS_Z_PACKED_TOGETHER \"1 to enable, 0 to disable\"\n" + "//#expect TEMPORALLY_VARY_SAMPLES \"1 to enable, 0 to disable\"\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register( s0 ); // view normal/roughness\n" + "uniform sampler2D samp1 : register( s1 ); // view depth\n" + "uniform sampler2D samp2 : register( s2 ); // blue noise 256\n" + "\n" + "#define CS_Z_buffer samp1\n" + "\n" + "struct PS_IN\n" + "{\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT \n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "\n" + "float BlueNoise( float2 n, float x )\n" + "{\n" + " float noise = tex2D( samp2, n.xy * rpJitterTexOffset.xy ).r;\n" + "\n" + "#if TEMPORALLY_VARY_TAPS\n" + " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" + "#else\n" + " noise = fract( noise );\n" + "#endif\n" + "\n" + " //noise = RemapNoiseTriErp( noise );\n" + " //noise = noise * 2.0 - 0.5;\n" + "\n" + " return noise;\n" + "}\n" + "\n" + "/** Used for packing Z into the GB channels */\n" + "// float CSZToKey( float z )\n" + "// {\n" + "// return clamp( z * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" + "// }\n" + "\n" + "/** Used for packing Z into the GB channels */\n" + "void packKey( float key, out float2 p )\n" + "{\n" + " // Round to the nearest 1/256.0\n" + " float temp = floor( key * 256.0 );\n" + "\n" + " // Integer part\n" + " p.x = temp * ( 1.0 / 256.0 );\n" + "\n" + " // Fractional part\n" + " p.y = key * 256.0 - temp;\n" + "}\n" + "\n" + "/** Reconstructs screen-space unit normal from screen-space position */\n" + "float3 reconstructCSFaceNormal( float3 C )\n" + "{\n" + " return normalize( cross( dFdy( C ), dFdx( C ) ) );\n" + "}\n" + "\n" + "float3 reconstructNonUnitCSFaceNormal( float3 C )\n" + "{\n" + " float3 n = cross( dFdy( C ), dFdx( C ) );\n" + " //n.z = sqrt( abs( dot( n.xy, n.xy ) - 0.25 ) );\n" + " return n;\n" + "}\n" + "\n" + "float3 reconstructCSPosition( float2 S, float z )\n" + "{\n" + " float4 P;\n" + " P.z = z * 2.0 - 1.0;\n" + " P.xy = ( S * rpWindowCoord.xy ) * 2.0 - 1.0;\n" + " P.w = 1.0;\n" + "\n" + " float4 csP;\n" + " csP.x = dot4( P, rpModelMatrixX );\n" + " csP.y = dot4( P, rpModelMatrixY );\n" + " csP.z = dot4( P, rpModelMatrixZ );\n" + " csP.w = dot4( P, rpModelMatrixW );\n" + "\n" + " csP.xyz /= csP.w;\n" + "\n" + " return csP.xyz;\n" + "}\n" + "\n" + "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" + "{\n" + "#if USE_OCT16\n" + " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" + "#else\n" + " return texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0;\n" + "#endif\n" + "}\n" + "\n" + "/** Returns a unit vector and a screen-space radius for the tap on a unit disk\n" + " (the caller should scale by the actual disk radius) */\n" + "float2 tapLocation( int sampleNumber, float spinAngle, out float ssR )\n" + "{\n" + " // Radius relative to ssR\n" + " float alpha = ( float( sampleNumber ) + 0.5 ) * ( 1.0 / float( NUM_SAMPLES ) );\n" + " float angle = alpha * ( float( NUM_SPIRAL_TURNS ) * 6.28 ) + spinAngle;\n" + "\n" + " ssR = alpha;\n" + " return float2( cos( angle ), sin( angle ) );\n" + "}\n" + "\n" + "\n" + "/** Read the camera-space position of the point at screen-space pixel ssP */\n" + "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" + "{\n" + " float3 P;\n" + " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" + "\n" + " // Offset to pixel center\n" + " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" + "\n" + " return P;\n" + "}\n" + "\n" + "void computeMipInfo( float ssR, int2 ssP, sampler2D cszBuffer, out int mipLevel, out int2 mipP )\n" + "{\n" + " // Derivation:\n" + " // mipLevel = floor(log(ssR / MAX_OFFSET));\n" + "#ifdef GL_EXT_gpu_shader5\n" + " mipLevel = clamp( findMSB( int( ssR ) ) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL );\n" + "#else\n" + " mipLevel = clamp( int( floor( log2( ssR ) ) ) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL );\n" + "#endif\n" + "\n" + " // We need to divide by 2^mipLevel to read the appropriately scaled coordinate from a MIP-map.\n" + " // Manually clamp to the texture size because texelFetch bypasses the texture unit\n" + "\n" + " // used in newer radiosity\n" + " //mipP = ssP >> mipLevel;\n" + "\n" + " mipP = clamp( ssP >> mipLevel, int2( 0 ), textureSize( cszBuffer, mipLevel ) - int2( 1 ) );\n" + "}\n" + "\n" + "/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1.\n" + " Use cszBufferScale if reading from the peeled depth buffer, which has been scaled by (1 / invCszBufferScale) from the original */\n" + "float3 getOffsetPosition( int2 issC, float2 unitOffset, float ssR, sampler2D cszBuffer, float invCszBufferScale )\n" + "{\n" + " int2 ssP = int2( ssR * unitOffset ) + issC;\n" + "\n" + " float3 P;\n" + "\n" + " int mipLevel;\n" + " int2 mipP;\n" + " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, mipP );\n" + "\n" + "#if USE_MIPMAPS\n" + " // RB: this is the key for fast ambient occlusion - use a hierarchical depth buffer\n" + " // for more information see McGuire12SAO.pdf - Scalable Ambient Obscurance\n" + " // http://graphics.cs.williams.edu/papers/SAOHPG12/\n" + " P.z = texelFetch( cszBuffer, mipP, mipLevel ).r;\n" + "#else\n" + " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" + "#endif\n" + "\n" + " // Offset to pixel center\n" + " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" + " //P = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ) * invCszBufferScale, P.z );\n" + "\n" + " return P;\n" + "}\n" + "\n" + "float fallOffFunction( float vv, float vn, float epsilon )\n" + "{\n" + " // A: From the HPG12 paper\n" + " // Note large epsilon to avoid overdarkening within cracks\n" + " // Assumes the desired result is intensity/radius^6 in main()\n" + " // return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6;\n" + "\n" + " // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]\n" + "#if HIGH_QUALITY\n" + " // Epsilon inside the sqrt for rsqrt operation\n" + " float f = max( 1.0 - vv * invRadius2, 0.0 );\n" + " return f * max( ( vn - bias ) * rsqrt( epsilon + vv ), 0.0 );\n" + "#else\n" + " // Avoid the square root from above.\n" + " // Assumes the desired result is intensity/radius^6 in main()\n" + " float f = max( radius2 - vv, 0.0 );\n" + " return f * f * f * max( ( vn - bias ) / ( epsilon + vv ), 0.0 );\n" + "#endif\n" + "\n" + " // C: Medium contrast (which looks better at high radii), no division. Note that the\n" + " // contribution still falls off with radius^2, but we've adjusted the rate in a way that is\n" + " // more computationally efficient and happens to be aesthetically pleasing. Assumes\n" + " // division by radius^6 in main()\n" + " //return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0);\n" + "\n" + " // D: Low contrast, no division operation\n" + " //return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);\n" + "}\n" + "\n" + "/** Compute the occlusion due to sample point \a Q about camera-space point \a C with unit normal \a n_C */\n" + "float aoValueFromPositionsAndNormal( float3 C, float3 n_C, float3 Q )\n" + "{\n" + " float3 v = Q - C;\n" + " //v = normalize( v );\n" + " float vv = dot( v, v );\n" + " float vn = dot( v, n_C );\n" + " const float epsilon = 0.001;\n" + "\n" + " // Without the angular adjustment term, surfaces seen head on have less AO\n" + " return fallOffFunction( vv, vn, epsilon ) * lerp( 1.0, max( 0.0, 1.5 * n_C.z ), 0.35 );\n" + "}\n" + "\n" + "\n" + "/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds\n" + " to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius\n" + "\n" + " Note that units of H() in the HPG12 paper are meters, not\n" + " unitless. The whole falloff/sampling function is therefore\n" + " unitless. In this implementation, we factor out (9 / radius).\n" + "\n" + " Four versions of the falloff function are implemented below\n" + "\n" + " When sampling from the peeled depth buffer, make sure ssDiskRadius has been premultiplied by cszBufferScale\n" + "*/\n" + "float sampleAO( int2 issC, in float3 C, in float3 n_C, in float ssDiskRadius, in int tapIndex, in float randomPatternRotationAngle, in sampler2D cszBuffer, in float invCszBufferScale )\n" + "{\n" + " // Offset on the unit disk, spun for this pixel\n" + " float ssR;\n" + " float2 unitOffset = tapLocation( tapIndex, randomPatternRotationAngle, ssR );\n" + "\n" + " // Ensure that the taps are at least 1 pixel away\n" + " ssR = max( 0.75, ssR * ssDiskRadius );\n" + "\n" + "#if (CS_Z_PACKED_TOGETHER != 0)\n" + " vec3 Q0, Q1;\n" + " getOffsetPositions( ssC, unitOffset, ssR, cszBuffer, Q0, Q1 );\n" + "\n" + " return max( aoValueFromPositionsAndNormal( C, n_C, Q0 ), aoValueFromPositionsAndNormal( C, n_C, Q1 ) );\n" + "#else\n" + " // The occluding point in camera space\n" + " vec3 Q = getOffsetPosition( issC, unitOffset, ssR, cszBuffer, invCszBufferScale );\n" + "\n" + " return aoValueFromPositionsAndNormal( C, n_C, Q );\n" + "#endif\n" + "}\n" + "\n" + "const float MIN_RADIUS = 3.0; // pixels\n" + "\n" + "#define visibility result.color.r\n" + "#define bilateralKey result.color.gb\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " result.color = float4( 1.0, 0.0, 0.0, 1.0 );\n" + "\n" + "#if 0\n" + " if( fragment.texcoord0.x < 0.5 )\n" + " {\n" + " discard;\n" + " }\n" + "#endif\n" + "\n" + " // Pixel being shaded\n" + " float2 ssC = fragment.texcoord0 * rpScreenCorrectionFactor.xy;\n" + " int2 ssP = int2( ssC.x * rpWindowCoord.z, ssC.y * rpWindowCoord.w );\n" + "\n" + " //int2 ssP = int2( gl_FragCoord.xy );\n" + "\n" + " // World space point being shaded\n" + " vec3 C = getPosition( ssP, CS_Z_buffer );\n" + "\n" + " //float z = length( C - rpGlobalEyePos.xyz );\n" + " //bilateralKey = CSZToKey( C.z );\n" + " //packKey( CSZToKey( C.z ), bilateralKey );\n" + "\n" + " //float key = CSZToKey( C.z );\n" + "\n" + "#if 0\n" + " if( key >= 1.0 )\n" + " {\n" + " visibility = 0.0;\n" + " return;\n" + " }\n" + "#endif\n" + "\n" + " visibility = 0.0;\n" + "\n" + "#if 1\n" + " float3 n_C = sampleNormal( samp0, ssP, 0 );\n" + "\n" + " if( length( n_C ) < 0.01 )\n" + " {\n" + " visibility = 1.0;\n" + " return;\n" + " }\n" + "\n" + " n_C = normalize( n_C );\n" + " //n_C = -n_C;\n" + "\n" + "#else\n" + " // Reconstruct normals from positions.\n" + " float3 n_C = reconstructNonUnitCSFaceNormal( C );\n" + " // Since n_C is computed from the cross product of camera-space edge vectors from points at adjacent pixels, its magnitude will be proportional to the square of distance from the camera\n" + " if( dot( n_C, n_C ) > ( square( C.z * C.z * 0.00006 ) ) ) // if the threshold # is too big you will see black dots where we used a bad normal at edges, too small -> white\n" + " {\n" + " // The normals from depth should be very small values before normalization,\n" + " // except at depth discontinuities, where they will be large and lead\n" + " // to 1-pixel false occlusions because they are not reliable\n" + " visibility = 1.0;\n" + " //result.color = float4( visibility, visibility, visibility, 1.0 );\n" + " return;\n" + " }\n" + " else\n" + " {\n" + " n_C = normalize( -n_C );\n" + " }\n" + "#endif\n" + "\n" + "#if 1\n" + " float randomPatternRotationAngle = BlueNoise( ssP.xy, 10.0 ) * 10.0;\n" + " //float randomPatternRotationAngle = InterleavedGradientNoise( ssP.xy ) * 10.0;\n" + "#else\n" + "\n" + " // Hash function used in the HPG12 AlchemyAO paper\n" + " float randomPatternRotationAngle = float( ( ( 3 * ssP.x ) ^ ( ssP.y + ssP.x * ssP.y ) )\n" + "#if TEMPORALLY_VARY_TAPS\n" + " + rpJitterTexOffset.z\n" + "#endif\n" + " ) * 10.0;\n" + "\n" + "#endif\n" + "\n" + " // Choose the screen-space sample radius\n" + " // proportional to the projected area of the sphere\n" + " float ssDiskRadius = -projScale * radius / C.z;\n" + "\n" + "#if 1\n" + " if( ssDiskRadius <= MIN_RADIUS )\n" + " {\n" + " // There is no way to compute AO at this radius\n" + " visibility = 1.0;\n" + " return;\n" + " }\n" + "#endif\n" + "\n" + "#if USE_DEPTH_PEEL == 1\n" + "#if DIFFERENT_DEPTH_RESOLUTIONS == 1\n" + " float unpeeledToPeeledScale = 1.0 / peeledToUnpeeledScale;\n" + "#endif\n" + "#endif\n" + "\n" + " float sum = 0.0;\n" + " for( int i = 0; i < NUM_SAMPLES; ++i )\n" + " {\n" + " sum += sampleAO( ssP, C, n_C, ssDiskRadius, i, randomPatternRotationAngle, CS_Z_buffer, 1.0 );\n" + " }\n" + "\n" + "#if HIGH_QUALITY\n" + " float A = pow( max( 0.0, 1.0 - sqrt( sum * ( 3.0 / float( NUM_SAMPLES ) ) ) ), intensity );\n" + "#else\n" + " float A = max( 0.0, 1.0 - sum * intensityDivR6 * ( 5.0 / float( NUM_SAMPLES ) ) );\n" + " // Anti-tone map to reduce contrast and drag dark region farther\n" + " // (x^0.2 + 1.2 * x^4)/2.2\n" + " //A = ( pow( A, 0.2 ) + 1.2 * A * A * A * A ) / 2.2;\n" + "#endif\n" + "\n" + " // Visualize random spin distribution\n" + " //A = mod(randomPatternRotationAngle / (2 * 3.141592653589), 1.0);\n" + "\n" + " // Fade in as the radius reaches 2 pixels\n" + " visibility = lerp( 1.0, A, saturate( ssDiskRadius - MIN_RADIUS ) );\n" + " //visibility = A;\n" + "\n" + "#if defined(BRIGHTPASS)\n" + " //result.color = float4( visibility, bilateralKey, 0.0, 1.0 );\n" + " //result.color = float4( bilateralKey, bilateralKey, bilateralKey, 1.0 );\n" + " result.color = float4( visibility, visibility, visibility, 1.0 );\n" + " //result.color = float4( n_C * 0.5 + 0.5, 1.0 );\n" + " //result.color = float4( n_C, 1.0 );\n" + " //result.color = texture( samp0, fragment.texcoord0 ).rgba;\n" + "#endif\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN \n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + "};\n" + "\n" + "struct VS_OUT\n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position = vertex.position;\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl", + "/**\n" + " \file AmbientOcclusion_blur.pix\n" + " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" + "\n" + " \brief 7-tap 1D cross-bilateral blur using a packed depth key\n" + "\n" + " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" + "\n" + " Copyright (c) 2011-2014, NVIDIA\n" + " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" + " All rights reserved.\n" + "\n" + " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" + "\n" + " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" + " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" + " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + "*/\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register( s0 ); // view normals\n" + "uniform sampler2D samp1 : register( s1 ); // view depth\n" + "uniform sampler2D samp2 : register( s2 ); // view AO\n" + "\n" + "#define normal_buffer samp0\n" + "#define cszBuffer samp1\n" + "#define source samp2 \n" + "\n" + "struct PS_IN\n" + "{\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT \n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "#define PEELED_LAYER 0\n" + "#define USE_OCT16 0\n" + "#define USE_NORMALS 1\n" + "\n" + "//#expect PEELED_LAYER \"binary\"\n" + "\n" + "//////////////////////////////////////////////////////////////////////////////////////////////\n" + "// Tunable Parameters:\n" + "\n" + "//#define NUM_KEY_COMPONENTS 1\n" + "\n" + "// The other parameters in this section must be passed in as macro values\n" + "\n" + "/** Increase to make depth edges crisper. Decrease to reduce flicker. */\n" + "#define EDGE_SHARPNESS (1.0)\n" + "\n" + "/** Step in 2-pixel intervals since we already blurred against neighbors in the\n" + " first AO pass. This constant can be increased while R decreases to improve\n" + " performance at the expense of some dithering artifacts.\n" + "\n" + " Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was\n" + " unobjectionable after shading was applied but eliminated most temporal incoherence\n" + " from using small numbers of sample taps.\n" + " */\n" + "#define SCALE (2)\n" + "\n" + "/** Filter radius in pixels. This will be multiplied by SCALE. */\n" + "#define R (4)\n" + "\n" + "#define MDB_WEIGHTS 0\n" + "//////////////////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "/** Type of data to read from source. This macro allows\n" + " the same blur shader to be used on different kinds of input data. */\n" + "#define VALUE_TYPE float\n" + "\n" + "/** Swizzle to use to extract the channels of source. This macro allows\n" + " the same blur shader to be used on different kinds of input data. */\n" + "#define VALUE_COMPONENTS r\n" + "\n" + "#define VALUE_IS_KEY 0\n" + "\n" + "\n" + "\n" + "\n" + "/** (1, 0) or (0, 1)*/\n" + "//uniform int2 axis;\n" + "\n" + "#if USE_OCT16\n" + " #include \n" + "#endif\n" + "\n" + "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" + "{\n" + "#if USE_OCT16\n" + " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" + "#else\n" + " return normalize( texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0 );\n" + "#endif\n" + "}\n" + "\n" + "#define aoResult result.color.VALUE_COMPONENTS\n" + "#define keyPassThrough result.color.KEY_COMPONENTS\n" + "\n" + "\n" + "\n" + "\n" + "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" + " This need not match the real far plane but should not be much more than it.*/\n" + "const float FAR_PLANE_Z = -16000.0;\n" + "\n" + "float CSZToKey( float z )\n" + "{\n" + " return clamp( z * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" + "}\n" + "\n" + "float reconstructCSZ( float d )\n" + "{\n" + " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" + "\n" + " // infinite far perspective matrix\n" + " return -3.0 / ( -1.0 * d + 1.0 );\n" + "\n" + " //d = d * 2.0 - 1.0;\n" + " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" + "}\n" + "\n" + "float3 reconstructCSPosition( float2 S, float z )\n" + "{\n" + " float4 P;\n" + " P.z = z * 2.0 - 1.0;\n" + " P.xy = ( S * rpWindowCoord.xy ) * 2.0 - 1.0;\n" + " P.w = 1.0;\n" + "\n" + " float4 csP;\n" + " csP.x = dot4( P, rpModelMatrixX );\n" + " csP.y = dot4( P, rpModelMatrixY );\n" + " csP.z = dot4( P, rpModelMatrixZ );\n" + " csP.w = dot4( P, rpModelMatrixW );\n" + "\n" + " csP.xyz /= csP.w;\n" + "\n" + " return csP.xyz;\n" + "}\n" + "\n" + "float getKey( int2 ssP )\n" + "{\n" + "#if PEELED_LAYER\n" + " float key = texelFetch( cszBuffer, ssP, 0 ).g;\n" + "#else\n" + " float key = texelFetch( cszBuffer, ssP, 0 ).r;\n" + "#endif\n" + "\n" + "#if 0\n" + " key = reconstructCSZ( key );\n" + "#else\n" + " float3 P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), key );\n" + " key = P.z;\n" + "#endif\n" + "\n" + " key = clamp( key * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" + " return key;\n" + "}\n" + "\n" + "float3 positionFromKey( float key, int2 ssC )\n" + "{\n" + " float z = key * FAR_PLANE_Z;\n" + " float3 C = reconstructCSPosition( float2( ssC ) + float2( 0.5 ), z );\n" + " return C;\n" + "}\n" + "\n" + "/** Read the camera-space position of the point at screen-space pixel ssP */\n" + "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" + "{\n" + " float3 P;\n" + " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" + "\n" + " // Offset to pixel center\n" + " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" + "\n" + " return P;\n" + "}\n" + "\n" + "float calculateBilateralWeight( float key, float tapKey, int2 tapLoc, float3 n_C, float3 C )\n" + "{\n" + " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" + " float depthWeight = max( 0.0, 1.0 - ( EDGE_SHARPNESS * 2000.0 ) * abs( tapKey - key ) );\n" + "\n" + " float k_normal = 1.0;\n" + " float k_plane = 1.0;\n" + "\n" + " // Prevents blending over creases.\n" + " float normalWeight = 1.0;\n" + " float planeWeight = 1.0;\n" + "\n" + "#if USE_NORMALS\n" + " float3 tapN_C = sampleNormal( normal_buffer, tapLoc, 0 );\n" + " depthWeight = 1.0;\n" + "\n" + " float normalError = 1.0 - dot( tapN_C, n_C ) * k_normal;\n" + " normalWeight = max( ( 1.0 - EDGE_SHARPNESS * normalError ), 0.00 );\n" + "\n" + " float lowDistanceThreshold2 = 0.001;\n" + "\n" + " //float3 tapC = positionFromKey( tapKey, tapLoc, projInfo );\n" + " float3 tapC = getPosition( tapLoc, cszBuffer );\n" + "\n" + " // Change in position in camera space\n" + " float3 dq = C - tapC;\n" + "\n" + " // How far away is this point from the original sample\n" + " // in camera space? (Max value is unbounded)\n" + " float distance2 = dot( dq, dq );\n" + "\n" + " // How far off the expected plane (on the perpendicular) is this point? Max value is unbounded.\n" + " float planeError = max( abs( dot( dq, tapN_C ) ), abs( dot( dq, n_C ) ) );\n" + "\n" + " planeWeight = ( distance2 < lowDistanceThreshold2 ) ? 1.0 :\n" + " pow( max( 0.0, 1.0 - EDGE_SHARPNESS * 2.0 * k_plane * planeError / sqrt( distance2 ) ), 2.0 );\n" + "\n" + "\n" + "#endif\n" + "\n" + " return depthWeight * normalWeight * planeWeight;\n" + "}\n" + "\n" + "\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + "//# if __VERSION__ < 330\n" + " float kernel[R + 1];\n" + "// if R == 0, we never call this shader\n" + "#if R == 1\n" + " kernel[0] = 0.5;\n" + " kernel[1] = 0.25;\n" + "#elif R == 2\n" + " kernel[0] = 0.153170;\n" + " kernel[1] = 0.144893;\n" + " kernel[2] = 0.122649;\n" + "#elif R == 3\n" + " kernel[0] = 0.153170;\n" + " kernel[1] = 0.144893;\n" + " kernel[2] = 0.122649;\n" + " kernel[3] = 0.092902;\n" + "#elif R == 4\n" + " kernel[0] = 0.153170;\n" + " kernel[1] = 0.144893;\n" + " kernel[2] = 0.122649;\n" + " kernel[3] = 0.092902;\n" + " kernel[4] = 0.062970;\n" + "#elif R == 5\n" + " kernel[0] = 0.111220;\n" + " kernel[1] = 0.107798;\n" + " kernel[2] = 0.098151;\n" + " kernel[3] = 0.083953;\n" + " kernel[4] = 0.067458;\n" + " kernel[5] = 0.050920;\n" + "#elif R == 6\n" + " kernel[0] = 0.111220;\n" + " kernel[1] = 0.107798;\n" + " kernel[2] = 0.098151;\n" + " kernel[3] = 0.083953;\n" + " kernel[4] = 0.067458;\n" + " kernel[5] = 0.050920;\n" + " kernel[6] = 0.036108;\n" + "#endif\n" + "//#endif\n" + "\n" + " int2 ssC = int2( gl_FragCoord.xy );\n" + "\n" + " //float2 ssF = fragment.texcoord0 * rpScreenCorrectionFactor.xy;\n" + " //int2 ssC = int2( ssF.x * rpWindowCoord.z, ssF.y * rpWindowCoord.w );\n" + "\n" + " float4 temp = texelFetch( source, ssC, 0 );\n" + "\n" + "#if 0\n" + " if( fragment.texcoord0.x < 0.75 )\n" + " {\n" + " result.color = temp;\n" + " return;\n" + " }\n" + "#endif\n" + "\n" + "#if 0\n" + " float key = getKey( ssC );\n" + " float3 C = positionFromKey( key, ssC );\n" + "#else\n" + " float3 C = getPosition( ssC, cszBuffer );\n" + " float key = CSZToKey( C.z );\n" + "#endif\n" + "\n" + " VALUE_TYPE sum = temp.VALUE_COMPONENTS;\n" + "\n" + " if( key == 1.0 )\n" + " {\n" + " // Sky pixel (if you aren't using depth keying, disable this test)\n" + " aoResult = sum;\n" + "#if defined(BRIGHTPASS)\n" + " result.color = float4( aoResult, aoResult, aoResult, 1.0 );\n" + "#endif\n" + " return;\n" + " }\n" + "\n" + " // Base weight for falloff. Increase this for more blurriness,\n" + " // decrease it for better edge discrimination\n" + " float BASE = kernel[0];\n" + " float totalWeight = BASE;\n" + " sum *= totalWeight;\n" + "\n" + " float3 n_C;\n" + "#if USE_NORMALS\n" + " n_C = sampleNormal( normal_buffer, ssC, 0 );\n" + "#endif\n" + "\n" + "#if MDB_WEIGHTS == 0\n" + " for( int r = -R; r <= R; ++r )\n" + " {\n" + " // We already handled the zero case above. This loop should be unrolled and the static branch optimized out,\n" + " // so the IF statement has no runtime cost\n" + " if( r != 0 )\n" + " {\n" + " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" + " temp = texelFetch( source, tapLoc, 0 );\n" + "\n" + "\n" + " float tapKey = getKey( tapLoc );\n" + " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" + "\n" + " // spatial domain: offset kernel tap\n" + " float weight = 0.3 + kernel[abs( r )];\n" + "\n" + " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" + "\n" + " weight *= bilateralWeight;\n" + " sum += value * weight;\n" + " totalWeight += weight;\n" + " }\n" + " }\n" + "#else\n" + "\n" + " float lastBilateralWeight = 9999.0;\n" + " for( int r = -1; r >= -R; --r )\n" + " {\n" + " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" + " temp = texelFetch( source, tapLoc, 0 );\n" + " float tapKey = getKey( tapLoc );\n" + "\n" + " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" + "\n" + " // spatial domain: offset kernel tap\n" + " float weight = 0.3 + kernel[abs( r )];\n" + "\n" + " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" + " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" + " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" + " lastBilateralWeight = bilateralWeight;\n" + " weight *= bilateralWeight;\n" + " sum += value * weight;\n" + " totalWeight += weight;\n" + " }\n" + "\n" + " lastBilateralWeight = 9999.0;\n" + " for( int r = 1; r <= R; ++r )\n" + " {\n" + " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" + " temp = texelFetch( source, tapLoc, 0 );\n" + " float tapKey = getKey( tapLoc );\n" + " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" + "\n" + " // spatial domain: offset kernel tap\n" + " float weight = 0.3 + kernel[abs( r )];\n" + "\n" + " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" + " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" + " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" + " lastBilateralWeight = bilateralWeight;\n" + " weight *= bilateralWeight;\n" + " sum += value * weight;\n" + " totalWeight += weight;\n" + " }\n" + "#endif\n" + "\n" + " const float epsilon = 0.0001;\n" + " aoResult = sum / ( totalWeight + epsilon );\n" + "\n" + "#if defined(BRIGHTPASS)\n" + " result.color = float4( aoResult, aoResult, aoResult, 1.0 );\n" + "#endif\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN \n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + "};\n" + "\n" + "struct VS_OUT\n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position = vertex.position;\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/SSAO/AmbientOcclusion_minify.ps.hlsl", + "/**\n" + " \file AmbientOcclusion_minify.pix\n" + " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" + "\n" + " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" + "\n" + " Copyright (c) 2011-2012, NVIDIA\n" + " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" + " All rights reserved.\n" + "\n" + " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" + "\n" + " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" + " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" + " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + "\n" + " */\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register( s0 ); // zbuffer\n" + "\n" + "struct PS_IN\n" + "{\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT \n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "//#extension GL_EXT_gpu_shader4 : enable\n" + "\n" + "//#expect USE_PEELED_DEPTH_BUFFER \"binary\"\n" + "\n" + "#if 0 //( USE_PEELED_DEPTH_BUFFER != 0 )\n" + " #define mask rg\n" + "#else\n" + " #define mask r\n" + "#endif\n" + "\n" + "float reconstructCSZ( float d )\n" + "{\n" + " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" + "\n" + " // infinite far perspective matrix\n" + " return -3.0 / ( -1.0 * d + 1.0 );\n" + "\n" + " //d = d * 2.0 - 1.0;\n" + " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" + "}\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "#if defined(BRIGHTPASS)\n" + " float2 ssC = fragment.texcoord0;\n" + " float depth = tex2D( samp0, ssC ).r;\n" + " //depth = reconstructCSZ( depth );\n" + " result.color.mask = depth;\n" + "#else\n" + " //int2 ssP = int2( gl_FragCoord.xy );\n" + " int2 ssP = int2( fragment.texcoord0 * rpScreenCorrectionFactor.zw );\n" + "\n" + " int previousMIPNumber = int( rpJitterTexScale.x );\n" + "\n" + " // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.\n" + " // On DX9, the bit-and can be implemented with floating-point modulo\n" + " //result.color.mask = texture( samp0, clamp( ssP * 2 + int2( ssP.y & 1, ssP.x & 1 ), int2( 0 ), textureSize( samp0, previousMIPNumber ) - int2( 1 ) ) * rpScreenCorrectionFactor.xy, previousMIPNumber ).mask;\n" + " result.color.mask = texelFetch( samp0, clamp( ssP * 2 + int2( ssP.y & 1, ssP.x & 1 ), int2( 0 ), textureSize( samp0, previousMIPNumber ) - int2( 1 ) ), previousMIPNumber ).mask;\n" + " //result.color.mask = texelFetch2D( samp0, int3( ssP * 2 + int2( ( ssP.y & 1 ) ^ 1, ( ssP.x & 1 ) ^ 1 ), 0 ) );\n" + "\n" + " // result.color.mask = texelFetch( samp0, ssP, 0 ).r;\n" + "\n" + " //float2 ssC = float2( ssP * 2 + int2( ( ssP.y & 1 ) ^ 1, ( ssP.x & 1 ) ^ 1 ) ) * rpScreenCorrectionFactor.xy;\n" + " //float2 ssC = float2( ssP ) * rpScreenCorrectionFactor.xy;\n" + " //float2 ssC = fragment.texcoord0;\n" + " //float depth = tex2D( samp0, ssC ).r;\n" + " //result.color.mask = depth;\n" + "#endif\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/SSAO/AmbientOcclusion_minify.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN \n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + "};\n" + "\n" + "struct VS_OUT\n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position = vertex.position;\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl", + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// #version 120 // -*- c++ -*-\n" + "// #extension GL_EXT_gpu_shader4 : require\n" + "// #extension GL_ARB_gpu_shader5 : enable\n" + "\n" + "#define DIFFERENT_DEPTH_RESOLUTIONS 0\n" + "#define USE_DEPTH_PEEL 0\n" + "#define CS_Z_PACKED_TOGETHER 0\n" + "#define TEMPORALLY_VARY_TAPS 0\n" + "#define USE_OCT16 0\n" + "#define COMPUTE_PEELED_LAYER 0\n" + "#define USE_MIPMAPS 1\n" + "#define USE_TAP_NORMAL 1\n" + "\n" + "#define HIGH_QUALITY 0\n" + "\n" + "#if HIGH_QUALITY\n" + " // Total number of direct samples to take at each pixel\n" + " #define NUM_SAMPLES 39\n" + "\n" + " // This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent\n" + " // taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9\n" + " #define NUM_SPIRAL_TURNS 14\n" + "\n" + "#else\n" + "\n" + " #define NUM_SAMPLES 11\n" + " #define NUM_SPIRAL_TURNS 7\n" + "\n" + "#endif\n" + "\n" + "// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower\n" + "// miplevel to maintain reasonable spatial locality in the cache\n" + "// If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing.\n" + "// If it is too high (> 5), we'll get bad performance because we're not using the MIP levels effectively\n" + "#define LOG_MAX_OFFSET (3)\n" + "\n" + "// This must be less than or equal to the MAX_MIP_LEVEL defined in SAmbientOcclusion.cpp\n" + "#define MAX_MIP_LEVEL (5)\n" + "\n" + "#define MIN_MIP_LEVEL 0\n" + "\n" + "const float DOOM_TO_METERS = 0.0254; // doom to meters\n" + "const float METERS_TO_DOOM = ( 1.0 / DOOM_TO_METERS ); // meters to doom\n" + "\n" + "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" + " This need not match the real far plane but should not be much more than it.*/\n" + "const float FAR_PLANE_Z = -4000.0;\n" + "\n" + "/** World-space AO radius in scene units (r). e.g., 1.0m */\n" + "const float radius = 1.0 * METERS_TO_DOOM;\n" + "const float radius2 = radius * radius;\n" + "const float invRadius2 = 1.0 / radius2;\n" + "\n" + "/** Bias to avoid AO in smooth corners, e.g., 0.01m */\n" + "const float bias = 0.01 * METERS_TO_DOOM;\n" + "\n" + "/** The height in pixels of a 1m object if viewed from 1m away.\n" + " You can compute it from your projection matrix. The actual value is just\n" + " a scale factor on radius; you can simply hardcode this to a constant (~500)\n" + " and make your radius value unitless (...but resolution dependent.) */\n" + "const float projScale = 500.0;\n" + "\n" + "// #expect NUM_SAMPLES \"Integer number of samples to take at each pixel\"\n" + "// #expect NUM_SPIRAL_TURNS \"Integer number of turns around the circle that the spiral pattern makes. The DeepGBufferRadiosity class provides a discrepancy-minimizing value of NUM_SPIRAL_TURNS for each value of NUM_SAMPLES.\"\n" + "// #expect USE_MIPMAPS \"1 to enable, 0 to disable\"\n" + "// #expect USE_DEPTH_PEEL \"1 to enable, 0 to disable\"\n" + "// #expect COMPUTE_PEELED_LAYER \"1 to enable, 0 to disable\"\n" + "// #expect USE_TAP_NORMAL \"1 to enable, 0 to disable\"\n" + "// #expect MIN_MIP_LEVEL \"non-negative integer\"\n" + "// #expect USE_OCT16 \"1 to enable, 0 to disable\"\n" + "// #if (!USE_DEPTH_PEEL) && COMPUTE_PEELED_LAYER\n" + "// #error \"If computing a peeled layer, must be using depth peel!\"\n" + "// #endif\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register( s0 ); // view normals\n" + "uniform sampler2D samp1 : register( s1 ); // view depth\n" + "uniform sampler2D samp2 : register( s2 ); // colors\n" + "\n" + "#define normal_buffer samp0\n" + "#define CS_Z_buffer samp1\n" + "#define colorBuffer samp2\n" + "\n" + "struct PS_IN\n" + "{\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT \n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "\n" + "\n" + "// #if 0 //normal_notNull\n" + "// /** Same size as result buffer, do not offset by guard band when reading from it */\n" + "// uniform sampler2D normal_buffer;\n" + "// uniform float4 normal_readMultiplyFirst;\n" + "// uniform float4 normal_readAddSecond;\n" + "\n" + "// #if USE_OCT16\n" + "// #include \n" + "// #endif\n" + "\n" + "// #endif\n" + "\n" + "\n" + "\n" + "\n" + "#if USE_DEPTH_PEEL\n" + " uniform sampler2D peeledColorBuffer;\n" + " uniform sampler2D peeledNormalBuffer;\n" + "#endif\n" + "\n" + "//uniform float indirectMultiplier;\n" + "\n" + "\n" + "// Compatibility with future versions of GLSL: the shader still works if you change the\n" + "// version line at the top to something like #version 330 compatibility.\n" + "// #if __VERSION__ == 120\n" + "// # define texelFetch texelFetch2D\n" + "// # define textureSize textureSize2D\n" + "// # define result gl_FragData[0]\n" + "// # else\n" + "// out float4 result;\n" + "// #endif\n" + "\n" + "// #if COMPUTE_PEELED_LAYER\n" + "// # if __VERSION__ == 120\n" + "// # define peeledResult gl_FragData[1]\n" + "// # else\n" + "// out float4 peeledResult;\n" + "// # endif\n" + "// # define indirectPeeledResult peeledResult.rgb\n" + "// # define peeledVisibility peeledResult.a\n" + "// #endif\n" + "\n" + "#define indirectColor result.color.rgb\n" + "#define visibility result.color.a\n" + "\n" + "/////////////////////////////////////////////////////////\n" + "\n" + "float reconstructCSZ( float d )\n" + "{\n" + " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" + "\n" + " // infinite far perspective matrix\n" + " return -3.0 / ( -1.0 * d + 1.0 );\n" + "\n" + " //d = d * 2.0 - 1.0;\n" + " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" + "}\n" + "\n" + "float3 reconstructCSPosition( float2 S, float z )\n" + "{\n" + " float4 P;\n" + " P.z = z * 2.0 - 1.0;\n" + " //P.z = reconstructCSZ( z );\n" + " P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0;\n" + " P.w = 1.0;\n" + "\n" + " float4 csP;\n" + " csP.x = dot4( P, rpModelMatrixX );\n" + " csP.y = dot4( P, rpModelMatrixY );\n" + " csP.z = dot4( P, rpModelMatrixZ );\n" + " csP.w = dot4( P, rpModelMatrixW );\n" + "\n" + " csP.xyz /= csP.w;\n" + "\n" + " return csP.xyz;\n" + "}\n" + "\n" + "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" + "{\n" + "#if USE_OCT16\n" + " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" + "#else\n" + " return texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0;\n" + "#endif\n" + "}\n" + "\n" + "void sampleBothNormals( sampler2D normalBuffer, int2 ssC, int mipLevel, out float3 n_tap0, out float3 n_tap1 )\n" + "{\n" + " float4 encodedNormals = texelFetch( normalBuffer, ssC, mipLevel ) * 2.0 - 1.0;\n" + " n_tap0 = decode16( encodedNormals.xy );\n" + " n_tap1 = decode16( encodedNormals.zw );\n" + "}\n" + "\n" + "/** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */\n" + "float2 tapLocation( int sampleNumber, float spinAngle, float radialJitter, out float ssR )\n" + "{\n" + " // Radius relative to ssR\n" + " float alpha = ( float( sampleNumber ) + radialJitter ) * ( 1.0 / float( NUM_SAMPLES ) );\n" + " float angle = alpha * ( float( NUM_SPIRAL_TURNS ) * 6.28 ) + spinAngle;\n" + "\n" + " ssR = alpha;\n" + " return float2( cos( angle ), sin( angle ) );\n" + "}\n" + "\n" + "\n" + "/** Read the camera-space position of the point at screen-space pixel ssP */\n" + "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" + "{\n" + " float3 P;\n" + " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" + "\n" + " // Offset to pixel center\n" + " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" + "\n" + " return P;\n" + "}\n" + "\n" + "\n" + "void getPositions( int2 ssP, sampler2D cszBuffer, out float3 P0, out float3 P1 )\n" + "{\n" + " float2 Zs = texelFetch( cszBuffer, ssP, 0 ).rg;\n" + "\n" + " // Offset to pixel center\n" + " P0 = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), Zs.x );\n" + " P1 = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), Zs.y );\n" + "}\n" + "\n" + "\n" + "void computeMipInfo( float ssR, int2 ssP, sampler2D cszBuffer, inout int mipLevel, inout int2 mipP )\n" + "{\n" + "#if USE_MIPMAPS\n" + " // Derivation:\n" + " // mipLevel = floor(log(ssR / MAX_OFFSET));\n" + "#ifdef GL_EXT_gpu_shader5\n" + " mipLevel = clamp( findMSB( int( ssR ) ) - LOG_MAX_OFFSET, MIN_MIP_LEVEL, MAX_MIP_LEVEL );\n" + "#else\n" + " mipLevel = clamp( int( floor( log2( ssR ) ) ) - LOG_MAX_OFFSET, MIN_MIP_LEVEL, MAX_MIP_LEVEL );\n" + "#endif\n" + "\n" + " // We need to divide by 2^mipLevel to read the appropriately scaled coordinate from a MIP-map.\n" + " // Manually clamp to the texture size because texelFetch bypasses the texture unit\n" + " //mipP = ssP >> mipLevel;//clamp(ssP >> mipLevel, int2(0), textureSize(CS_Z_buffer, mipLevel) - int2(1));\n" + "\n" + " mipP = clamp( ssP >> mipLevel, int2( 0 ), textureSize( cszBuffer, mipLevel ) - int2( 1 ) );\n" + "#else\n" + " mipLevel = 0;\n" + " mipP = ssP;\n" + "#endif\n" + "}\n" + "\n" + "\n" + "/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1.\n" + " Use cszBufferScale if reading from the peeled depth buffer, which has been scaled by (1 / invCszBufferScale) from the original */\n" + "float3 getOffsetPosition( int2 ssC, float2 unitOffset, float ssR, sampler2D cszBuffer, float invCszBufferScale )\n" + "{\n" + " int2 ssP = clamp( int2( ssR * unitOffset ) + ssC, int2( 0 ), int2( g3d_sz2D_colorBuffer.xy - 1 ) );\n" + "\n" + " int mipLevel;\n" + " int2 mipP;\n" + " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, mipP );\n" + "\n" + " float3 P;\n" + "\n" + " P.z = texelFetch( cszBuffer, mipP, mipLevel ).r;\n" + "\n" + " // Offset to pixel center\n" + " P = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ) * invCszBufferScale, P.z );\n" + "\n" + " return P;\n" + "}\n" + "\n" + "\n" + "/** Read the camera-space position of the points at screen-space pixel ssP + unitOffset * ssR in both channels of the packed csz buffer. Assumes length(unitOffset) == 1. */\n" + "void getOffsetPositions( int2 ssC, float2 unitOffset, float ssR, sampler2D cszBuffer, out float3 P0, out float3 P1 )\n" + "{\n" + " int2 ssP = clamp( int2( ssR * unitOffset ) + ssC, int2( 0 ), int2( g3d_sz2D_colorBuffer.xy - 1 ) );\n" + "\n" + " int mipLevel;\n" + " int2 mipP;\n" + " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, mipP );\n" + "\n" + " float2 Zs = texelFetch( cszBuffer, mipP, mipLevel ).rg;\n" + "\n" + " // Offset to pixel center\n" + " P0 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.x );\n" + " P1 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.y );\n" + "}\n" + "\n" + "\n" + "void getOffsetPositionNormalAndLambertian\n" + "( int2 ssP,\n" + " float ssR,\n" + " sampler2D cszBuffer,\n" + " sampler2D bounceBuffer,\n" + " sampler2D normalBuffer,\n" + " inout float3 Q,\n" + " inout float3 lambertian_tap,\n" + " inout float3 n_tap )\n" + "{\n" + "\n" + "#if USE_MIPMAPS\n" + " int mipLevel;\n" + " int2 texel;\n" + " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, texel );\n" + "#else\n" + " int mipLevel = 0;\n" + " int2 texel = ssP;\n" + "#endif\n" + "\n" + " float z = texelFetch( cszBuffer, texel, mipLevel ).r;\n" + "\n" + " // FIXME mip map bounce/normal buffers FBOs\n" + "#if 0\n" + " float3 n = sampleNormal( normalBuffer, texel, mipLevel );\n" + " lambertian_tap = texelFetch( bounceBuffer, texel, mipLevel ).rgb;\n" + "#else\n" + " float3 n = sampleNormal( normalBuffer, ssP, 0 );\n" + " lambertian_tap = texelFetch( bounceBuffer, ssP, 0 ).rgb;\n" + "#endif\n" + "\n" + " //n_tap = normalize( n );\n" + " n_tap = n;\n" + "\n" + " // Offset to pixel center\n" + " Q = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), z );\n" + "}\n" + "\n" + "\n" + "void getOffsetPositionsNormalsAndLambertians\n" + "( int2 ssP,\n" + " float ssR,\n" + " sampler2D cszBuffer,\n" + " sampler2D bounceBuffer,\n" + " sampler2D peeledBounceBuffer,\n" + " sampler2D normalBuffer,\n" + " sampler2D peeledNormalBuffer,\n" + " out float3 Q0,\n" + " out float3 Q1,\n" + " out float3 lambertian_tap0,\n" + " out float3 lambertian_tap1,\n" + " out float3 n_tap0,\n" + " out float3 n_tap1 )\n" + "{\n" + "\n" + "#if USE_MIPMAPS\n" + " int mipLevel;\n" + " int2 texel;\n" + " computeMipInfo( ssR, ssP, cszBuffer, mipLevel, texel );\n" + "#else\n" + " int mipLevel = 0;\n" + " int2 texel = ssP;\n" + "#endif\n" + "\n" + " float2 Zs = texelFetch( cszBuffer, texel, mipLevel ).rg;\n" + "#if USE_OCT16\n" + " sampleBothNormals( normalBuffer, texel, mipLevel, n_tap0, n_tap1 );\n" + "#else\n" + " n_tap0 = sampleNormal( normalBuffer, texel, mipLevel );\n" + " n_tap1 = sampleNormal( peeledNormalBuffer, texel, mipLevel );\n" + "#endif\n" + "\n" + " lambertian_tap0 = texelFetch( bounceBuffer, texel, mipLevel ).rgb;\n" + " lambertian_tap1 = texelFetch( peeledBounceBuffer, texel, mipLevel ).rgb;\n" + "\n" + " // Offset to pixel center\n" + " Q0 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.x, projInfo );\n" + " Q1 = reconstructCSPosition( ( float2( ssP ) + float2( 0.5 ) ), Zs.y, projInfo );\n" + "}\n" + "\n" + "\n" + "void iiValueFromPositionsAndNormalsAndLambertian( int2 ssP, float3 X, float3 n_X, float3 Y, float3 n_Y, float3 radiosity_Y, inout float3 E, inout float weight_Y, inout float visibilityWeight_Y )\n" + "{\n" + "\n" + " float3 YminusX = Y - X;\n" + " float3 w_i = normalize( YminusX );\n" + " weight_Y = ( ( dot( w_i, n_X ) > 0.0 )\n" + "#if USE_TAP_NORMAL\n" + " && ( dot( -w_i, n_Y ) > 0.01 )\n" + "#endif\n" + " ) ? 1.0 : 0.0; // Backface check\n" + "\n" + " // E = radiosity_Y * dot(w_i, n_X) * weight_Y * float(dot(YminusX, YminusX) < radius2);\n" + "\n" + " if( ( dot( YminusX, YminusX ) < radius2 ) && // Radius check\n" + " ( weight_Y > 0.0 ) )\n" + " {\n" + " E = radiosity_Y * dot( w_i, n_X );\n" + " }\n" + " else\n" + " {\n" + "#if USE_TAP_NORMAL == 0\n" + " weight_Y = 0;\n" + "#endif\n" + " E = float3( 0 );\n" + " }\n" + "}\n" + "\n" + "\n" + "/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds\n" + " to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius\n" + "\n" + " When sampling from the peeled depth buffer, make sure ssDiskRadius has been premultiplied by cszBufferScale\n" + "*/\n" + "void sampleIndirectLight\n" + "( in int2 ssC,\n" + " in float3 C,\n" + " in float3 n_C,\n" + " in float3 C_peeled,\n" + " in float3 n_C_peeled,\n" + " in float ssDiskRadius,\n" + " in int tapIndex,\n" + " in float randomPatternRotationAngle,\n" + " in float radialJitter,\n" + " in sampler2D cszBuffer,\n" + " in sampler2D nBuffer,\n" + " in sampler2D bounceBuffer,\n" + " inout float3 irradianceSum,\n" + " inout float numSamplesUsed,\n" + " inout float3 iiPeeled,\n" + " inout float weightSumPeeled )\n" + "{\n" + "\n" + " // Not used yet, quality optimization in progress...\n" + " float visibilityWeightPeeled0, visibilityWeightPeeled1;\n" + "\n" + " // Offset on the unit disk, spun for this pixel\n" + " float ssR;\n" + " float2 unitOffset = tapLocation( tapIndex, randomPatternRotationAngle, radialJitter, ssR );\n" + " ssR *= ssDiskRadius;\n" + " int2 ssP = int2( ssR * unitOffset ) + ssC;\n" + "\n" + "#if USE_DEPTH_PEEL\n" + " float3 E, ii_tap0, ii_tap1;\n" + " float weight, weight0, weight1;\n" + " float visibilityWeight0, visibilityWeight1;\n" + " // The occluding point in camera space\n" + " float3 Q0, lambertian_tap0, n_tap0, Q1, lambertian_tap1, n_tap1;\n" + " getOffsetPositionsNormalsAndLambertians( ssP, ssR, cszBuffer, bounceBuffer, peeledColorBuffer, nBuffer, peeledNormalBuffer, Q0, Q1, lambertian_tap0, lambertian_tap1, n_tap0, n_tap1 );\n" + " iiValueFromPositionsAndNormalsAndLambertian( ssP, C, n_C, Q0, n_tap0, lambertian_tap0, ii_tap0, weight0, visibilityWeight0 );\n" + " float adjustedWeight0 = weight0 * dot( ii_tap0, ii_tap0 ) + weight0;\n" + "\n" + " iiValueFromPositionsAndNormalsAndLambertian( ssP, C, n_C, Q1, n_tap1, lambertian_tap1, ii_tap1, weight1, visibilityWeight1 );\n" + " float adjustedWeight1 = weight1 * dot( ii_tap1, ii_tap1 ) + weight1;\n" + "\n" + " weight = ( adjustedWeight0 > adjustedWeight1 ) ? weight0 : weight1;\n" + " E = ( adjustedWeight0 > adjustedWeight1 ) ? ii_tap0 : ii_tap1;\n" + "\n" + "#if COMPUTE_PEELED_LAYER\n" + "\n" + " float weightPeeled0, weightPeeled1;\n" + " float3 ii_tapPeeled0, ii_tapPeeled1;\n" + " iiValueFromPositionsAndNormalsAndLambertian( ssP, C_peeled, n_C_peeled, Q0, n_tap0, lambertian_tap0, ii_tapPeeled0, weightPeeled0, visibilityWeightPeeled0 );\n" + " iiValueFromPositionsAndNormalsAndLambertian( ssP, C_peeled, n_C_peeled, Q1, n_tap1, lambertian_tap1, ii_tapPeeled1, weightPeeled1, visibilityWeightPeeled1 );\n" + "\n" + " float iiMag0 = dot( ii_tapPeeled0, ii_tapPeeled0 );\n" + " float iiMag1 = dot( ii_tapPeeled1, ii_tapPeeled1 );\n" + " weightSumPeeled += iiMag0 > iiMag1 ? weightPeeled0 : weightPeeled1;\n" + " iiPeeled += iiMag0 > iiMag1 ? ii_tapPeeled0 : ii_tapPeeled1;\n" + "\n" + "#endif\n" + "\n" + " numSamplesUsed += weight;\n" + "\n" + "#else\n" + "\n" + " float3 E;\n" + " float visibilityWeight;\n" + " float weight_Y;\n" + " // The occluding point in camera space\n" + " float3 Q, lambertian_tap, n_tap;\n" + " getOffsetPositionNormalAndLambertian( ssP, ssR, cszBuffer, bounceBuffer, nBuffer, Q, lambertian_tap, n_tap );\n" + " iiValueFromPositionsAndNormalsAndLambertian( ssP, C, n_C, Q, n_tap, lambertian_tap, E, weight_Y, visibilityWeight );\n" + " numSamplesUsed += weight_Y;\n" + "#endif\n" + "\n" + " irradianceSum += E;\n" + " //irradianceSum += pow( E, float3( 2.2 ) ); // RB: to linear RGB\n" + "}\n" + "\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" + "\n" + "#if 0\n" + " if( fragment.texcoord0.x < 0.5 )\n" + " {\n" + " discard;\n" + " }\n" + "#endif\n" + "\n" + " // Pixel being shaded\n" + " int2 ssC = int2( gl_FragCoord.xy );\n" + "\n" + "#if COMPUTE_PEELED_LAYER\n" + " float3 C, C_peeled;\n" + " getPositions( ssC, CS_Z_buffer, C, C_peeled );\n" + " float3 n_C_peeled = sampleNormal( peeledNormalBuffer, ssC, 0 );\n" + "#else\n" + " // World space point being shaded\n" + " float3 C = getPosition( ssC, CS_Z_buffer );\n" + " float3 C_peeled = float3( 0 );\n" + " float3 n_C_peeled = float3( 0 );\n" + "#endif\n" + "\n" + " float3 n_C = sampleNormal( normal_buffer, ssC, 0 );\n" + " //n_C = normalize( n_C );\n" + "\n" + "\n" + " // Choose the screen-space sample radius\n" + " // proportional to the projected area of the sphere\n" + " float ssDiskRadius = -projScale * radius / C.z;\n" + "\n" + " // Hash function used in the HPG12 AlchemyAO paper\n" + " float randomPatternRotationAngle = float( 3 * ssC.x ^ ssC.y + ssC.x * ssC.y ) * 10.0;\n" + "#if TEMPORALLY_VARY_TAPS\n" + " randomPatternRotationAngle += rpJitterTexOffset.x;\n" + "#endif\n" + "\n" + " float radialJitter = fract( sin( gl_FragCoord.x * 1e2 +\n" + "#if TEMPORALLY_VARY_TAPS\n" + " rpJitterTexOffset.x +\n" + "#endif\n" + " gl_FragCoord.y ) * 1e5 + sin( gl_FragCoord.y * 1e3 ) * 1e3 ) * 0.8 + 0.1;\n" + "\n" + " float numSamplesUsed = 0.0;\n" + " float3 irradianceSum = float3( 0 );\n" + " float3 ii_peeled = float3( 0 );\n" + " float peeledSum = 0.0;\n" + " for( int i = 0; i < NUM_SAMPLES; ++i )\n" + " {\n" + " sampleIndirectLight( ssC, C, n_C, C_peeled, n_C_peeled, ssDiskRadius, i, randomPatternRotationAngle, radialJitter, CS_Z_buffer, normal_buffer, colorBuffer, irradianceSum, numSamplesUsed, ii_peeled, peeledSum );\n" + " }\n" + "\n" + " const float solidAngleHemisphere = 2.0 * PI;\n" + " float3 E_X = irradianceSum * solidAngleHemisphere / ( numSamplesUsed + 0.00001 );\n" + "\n" + " indirectColor = E_X;\n" + " //indirectColor = pow( E_X, float3( 1.0 / 2.2 ) ); // RB: to sRGB\n" + "\n" + " // What is the ambient visibility of this location\n" + " visibility = 1.0 - numSamplesUsed / float( NUM_SAMPLES );\n" + " //visibility = clamp( 1 - numSamplesUsed / float( NUM_SAMPLES ), 0.0, 1.0 );\n" + " //visibility = pow( max( 0.0, 1.0 - sqrt( sum * ( 3.0 / float( NUM_SAMPLES ) ) ) ), intensity );\n" + "\n" + " //result.color = float4( visibility, visibility, visibility, 1.0 );\n" + " //result.color = float4( n_C * 0.5 + 0.5, 1.0 );\n" + " //result.color = texture( samp2, fragment.texcoord0 ).rgba;\n" + "\n" + "#if COMPUTE_PEELED_LAYER\n" + " float A_peeled = 1.0 - peeledSum / float( NUM_SAMPLES );\n" + " float3 E_X_peeled = ii_peeled * solidAngleHemisphere / ( peeledSum + 0.00001 );\n" + "\n" + " indirectPeeledResult = E_X_peeled;\n" + " peeledVisibility = A_peeled;\n" + "#endif\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN \n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + "};\n" + "\n" + "struct VS_OUT\n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position = vertex.position;\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl", + "/**\n" + " \file AmbientOcclusion_blur.pix\n" + " \author Morgan McGuire and Michael Mara, NVIDIA Research\n" + "\n" + " \brief 7-tap 1D cross-bilateral blur using a packed depth key\n" + "\n" + " Open Source under the \"BSD\" license: http://www.opensource.org/licenses/bsd-license.php\n" + "\n" + " Copyright (c) 2011-2014, NVIDIA\n" + " Copyright (c) 2016 Robert Beckebans ( id Tech 4.x integration )\n" + " All rights reserved.\n" + "\n" + " Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n" + "\n" + " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n" + " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" + " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + "*/\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register( s0 ); // view normals\n" + "uniform sampler2D samp1 : register( s1 ); // view depth\n" + "uniform sampler2D samp2 : register( s2 ); // view AO\n" + "\n" + "#define normal_buffer samp0\n" + "#define cszBuffer samp1\n" + "#define source samp2 \n" + "\n" + "struct PS_IN\n" + "{\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT \n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "#define PEELED_LAYER 0\n" + "#define USE_OCT16 0\n" + "#define USE_NORMALS 1\n" + "\n" + "//#expect PEELED_LAYER \"binary\"\n" + "\n" + "//////////////////////////////////////////////////////////////////////////////////////////////\n" + "// Tunable Parameters:\n" + "\n" + "//#define NUM_KEY_COMPONENTS 1\n" + "\n" + "// The other parameters in this section must be passed in as macro values\n" + "\n" + "/** Increase to make depth edges crisper. Decrease to reduce flicker. */\n" + "#define EDGE_SHARPNESS (1.0)\n" + "\n" + "/** Step in 2-pixel intervals since we already blurred against neighbors in the\n" + " first AO pass. This constant can be increased while R decreases to improve\n" + " performance at the expense of some dithering artifacts.\n" + "\n" + " Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was\n" + " unobjectionable after shading was applied but eliminated most temporal incoherence\n" + " from using small numbers of sample taps.\n" + " */\n" + "#define SCALE (2)\n" + "\n" + "/** Filter radius in pixels. This will be multiplied by SCALE. */\n" + "#define R (4)\n" + "\n" + "#define MDB_WEIGHTS 0\n" + "//////////////////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "/** Type of data to read from source. This macro allows\n" + " the same blur shader to be used on different kinds of input data. */\n" + "#define VALUE_TYPE float4\n" + "\n" + "/** Swizzle to use to extract the channels of source. This macro allows\n" + " the same blur shader to be used on different kinds of input data. */\n" + "#define VALUE_COMPONENTS rgba\n" + "\n" + "#define VALUE_IS_KEY 0\n" + "\n" + "\n" + "\n" + "\n" + "/** (1, 0) or (0, 1)*/\n" + "//uniform int2 axis;\n" + "\n" + "#if USE_OCT16\n" + " #include \n" + "#endif\n" + "\n" + "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" + "{\n" + "#if USE_OCT16\n" + " return decode16( texelFetch( normalBuffer, ssC, mipLevel ).xy * 2.0 - 1.0 );\n" + "#else\n" + " return normalize( texelFetch( normalBuffer, ssC, mipLevel ).xyz * 2.0 - 1.0 );\n" + "#endif\n" + "}\n" + "\n" + "#define blurResult result.color.VALUE_COMPONENTS\n" + "\n" + "/** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling.\n" + " This need not match the real far plane but should not be much more than it.*/\n" + "const float FAR_PLANE_Z = -16000.0;\n" + "\n" + "float CSZToKey( float z )\n" + "{\n" + " return clamp( z * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" + "}\n" + "\n" + "float reconstructCSZ( float d )\n" + "{\n" + " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" + "\n" + " // infinite far perspective matrix\n" + " return -3.0 / ( -1.0 * d + 1.0 );\n" + "\n" + " //d = d * 2.0 - 1.0;\n" + " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" + "}\n" + "\n" + "float3 reconstructCSPosition( float2 S, float z )\n" + "{\n" + " float4 P;\n" + " P.z = z * 2.0 - 1.0;\n" + " P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0;\n" + " P.w = 1.0;\n" + "\n" + " float4 csP;\n" + " csP.x = dot4( P, rpModelMatrixX );\n" + " csP.y = dot4( P, rpModelMatrixY );\n" + " csP.z = dot4( P, rpModelMatrixZ );\n" + " csP.w = dot4( P, rpModelMatrixW );\n" + "\n" + " csP.xyz /= csP.w;\n" + "\n" + " return csP.xyz;\n" + "}\n" + "\n" + "float getKey( int2 ssP )\n" + "{\n" + "#if PEELED_LAYER\n" + " float key = texelFetch( cszBuffer, ssP, 0 ).g;\n" + "#else\n" + " float key = texelFetch( cszBuffer, ssP, 0 ).r;\n" + "#endif\n" + "\n" + "#if 0\n" + " key = reconstructCSZ( key );\n" + "#else\n" + " float3 P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), key );\n" + " key = P.z;\n" + "#endif\n" + "\n" + " key = clamp( key * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" + " return key;\n" + "}\n" + "\n" + "float3 positionFromKey( float key, int2 ssC )\n" + "{\n" + " float z = key * FAR_PLANE_Z;\n" + " float3 C = reconstructCSPosition( float2( ssC ) + float2( 0.5 ), z );\n" + " return C;\n" + "}\n" + "\n" + "/** Read the camera-space position of the point at screen-space pixel ssP */\n" + "float3 getPosition( int2 ssP, sampler2D cszBuffer )\n" + "{\n" + " float3 P;\n" + " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" + "\n" + " // Offset to pixel center\n" + " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" + "\n" + " return P;\n" + "}\n" + "\n" + "float calculateBilateralWeight( float key, float tapKey, int2 tapLoc, float3 n_C, float3 C )\n" + "{\n" + " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" + " float depthWeight = max( 0.0, 1.0 - ( EDGE_SHARPNESS * 2000.0 ) * abs( tapKey - key ) );\n" + "\n" + " float k_normal = 1.0; //40.0;\n" + " float k_plane = 1.0; //0.5;\n" + "\n" + " // Prevents blending over creases.\n" + " float normalWeight = 1.0; //1000.0;\n" + " float planeWeight = 1.0;\n" + "\n" + "#if USE_NORMALS\n" + " float3 tapN_C = sampleNormal( normal_buffer, tapLoc, 0 );\n" + " depthWeight = 1.0;\n" + "\n" + " float normalError = ( 1.0 - dot( tapN_C, n_C ) ) * k_normal;\n" + " normalWeight = max( 1.0 - EDGE_SHARPNESS * normalError, 0.00 );\n" + "\n" + "\n" + " float lowDistanceThreshold2 = 0.001; //0.01;\n" + "\n" + " //float3 tapC = positionFromKey( tapKey, tapLoc, projInfo );\n" + " float3 tapC = getPosition( tapLoc, cszBuffer );\n" + "\n" + " // Change in position in camera space\n" + " float3 dq = C - tapC;\n" + "\n" + " // How far away is this point from the original sample\n" + " // in camera space? (Max value is unbounded)\n" + " float distance2 = dot( dq, dq );\n" + "\n" + " // How far off the expected plane (on the perpendicular) is this point? Max value is unbounded.\n" + " float planeError = max( abs( dot( dq, tapN_C ) ), abs( dot( dq, n_C ) ) );\n" + "\n" + " planeWeight = ( distance2 < lowDistanceThreshold2 ) ? 1.0 :\n" + " pow( max( 0.0, 1.0 - EDGE_SHARPNESS * 2.0 * k_plane * planeError / sqrt( distance2 ) ), 2.0 );\n" + "\n" + "\n" + "#endif\n" + "\n" + " return depthWeight * normalWeight * planeWeight;\n" + "}\n" + "\n" + "\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + "//# if __VERSION__ < 330\n" + " float kernel[R + 1];\n" + "// if R == 0, we never call this shader\n" + "#if R == 1\n" + " kernel[0] = 0.5;\n" + " kernel[1] = 0.25;\n" + "#elif R == 2\n" + " kernel[0] = 0.153170;\n" + " kernel[1] = 0.144893;\n" + " kernel[2] = 0.122649;\n" + "#elif R == 3\n" + " kernel[0] = 0.153170;\n" + " kernel[1] = 0.144893;\n" + " kernel[2] = 0.122649;\n" + " kernel[3] = 0.092902;\n" + "#elif R == 4\n" + " kernel[0] = 0.153170;\n" + " kernel[1] = 0.144893;\n" + " kernel[2] = 0.122649;\n" + " kernel[3] = 0.092902;\n" + " kernel[4] = 0.062970;\n" + "#elif R == 5\n" + " kernel[0] = 0.111220;\n" + " kernel[1] = 0.107798;\n" + " kernel[2] = 0.098151;\n" + " kernel[3] = 0.083953;\n" + " kernel[4] = 0.067458;\n" + " kernel[5] = 0.050920;\n" + "#elif R == 6\n" + " kernel[0] = 0.111220;\n" + " kernel[1] = 0.107798;\n" + " kernel[2] = 0.098151;\n" + " kernel[3] = 0.083953;\n" + " kernel[4] = 0.067458;\n" + " kernel[5] = 0.050920;\n" + " kernel[6] = 0.036108;\n" + "#endif\n" + "//#endif\n" + "\n" + " int2 ssC = int2( gl_FragCoord.xy );\n" + "\n" + " float4 temp = texelFetch( source, ssC, 0 );\n" + "\n" + "#if 0\n" + " if( fragment.texcoord0.x < 0.75 )\n" + " {\n" + " result.color = temp;\n" + " return;\n" + " }\n" + "#endif\n" + "\n" + "#if 0\n" + " float key = getKey( ssC );\n" + " float3 C = positionFromKey( key, ssC );\n" + "#else\n" + " float3 C = getPosition( ssC, cszBuffer );\n" + " float key = CSZToKey( C.z );\n" + "#endif\n" + "\n" + " VALUE_TYPE sum = temp.VALUE_COMPONENTS;\n" + "\n" + " if( key == 1.0 )\n" + " {\n" + " // Sky pixel (if you aren't using depth keying, disable this test)\n" + " blurResult = sum;\n" + " return;\n" + " }\n" + "\n" + " // Base weight for falloff. Increase this for more blurriness,\n" + " // decrease it for better edge discrimination\n" + " float BASE = kernel[0];\n" + " float totalWeight = BASE;\n" + " sum *= totalWeight;\n" + "\n" + " float3 n_C;\n" + "#if USE_NORMALS\n" + " n_C = sampleNormal( normal_buffer, ssC, 0 );\n" + "#endif\n" + "\n" + "#if MDB_WEIGHTS == 0\n" + " for( int r = -R; r <= R; ++r )\n" + " {\n" + " // We already handled the zero case above. This loop should be unrolled and the static branch optimized out,\n" + " // so the IF statement has no runtime cost\n" + " if( r != 0 )\n" + " {\n" + " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" + " temp = texelFetch( source, tapLoc, 0 );\n" + "\n" + "\n" + " float tapKey = getKey( tapLoc );\n" + " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" + "\n" + " // spatial domain: offset kernel tap\n" + " float weight = 0.3 + kernel[abs( r )];\n" + "\n" + " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" + "\n" + " weight *= bilateralWeight;\n" + " sum += value * weight;\n" + " totalWeight += weight;\n" + " }\n" + " }\n" + "#else\n" + "\n" + " float lastBilateralWeight = 9999.0;\n" + " for( int r = -1; r >= -R; --r )\n" + " {\n" + " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" + " temp = texelFetch( source, tapLoc, 0 );\n" + " float tapKey = getKey( tapLoc );\n" + "\n" + " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" + "\n" + " // spatial domain: offset kernel tap\n" + " float weight = 0.3 + kernel[abs( r )];\n" + "\n" + " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" + " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" + " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" + " lastBilateralWeight = bilateralWeight;\n" + " weight *= bilateralWeight;\n" + " sum += value * weight;\n" + " totalWeight += weight;\n" + " }\n" + "\n" + " lastBilateralWeight = 9999.0;\n" + " for( int r = 1; r <= R; ++r )\n" + " {\n" + " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" + " temp = texelFetch( source, tapLoc, 0 );\n" + " float tapKey = getKey( tapLoc );\n" + " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" + "\n" + " // spatial domain: offset kernel tap\n" + " float weight = 0.3 + kernel[abs( r )];\n" + "\n" + " // range domain (the \"bilateral\" weight). As depth difference increases, decrease weight.\n" + " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" + " bilateralWeight = min( lastBilateralWeight, bilateralWeight );\n" + " lastBilateralWeight = bilateralWeight;\n" + " weight *= bilateralWeight;\n" + " sum += value * weight;\n" + " totalWeight += weight;\n" + " }\n" + "#endif\n" + "\n" + " const float epsilon = 0.0001;\n" + " blurResult = sum / ( totalWeight + epsilon );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN \n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + "};\n" + "\n" + "struct VS_OUT\n" + "{\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position = vertex.position;\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/video/bink.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // Y\n" + "uniform sampler2D samp1 : register(s1); // Cr\n" + "uniform sampler2D samp2 : register(s2); // Cb\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " const float3 crc = float3( 1.595794678, -0.813476563, 0 );\n" + " const float3 crb = float3( 0, -0.391448975, 2.017822266 );\n" + " const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );\n" + " const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );\n" + "\n" + " float Y = tex2D( samp0, fragment.texcoord0.xy ).x;\n" + " float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;\n" + " float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;\n" + "\n" + " float3 p = ( YScalar * Y );\n" + " p += ( crc * Cr ) + ( crb * Cb ) + adj;\n" + "\n" + " float4 color;\n" + " color.xyz = p;\n" + " color.w = 1.0;\n" + " color *= rpColor;\n" + "\n" + " result.color = sRGBAToLinearRGBA( color );\n" + "}\n" + + }, + + { + "renderprogs/builtin/video/bink.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/video/bink_gui.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // Y\n" + "uniform sampler2D samp1 : register(s1); // Cr\n" + "uniform sampler2D samp2 : register(s2); // Cb\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float4 texcoord1 : TEXCOORD1_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " const float3 crc = float3( 1.595794678, -0.813476563, 0 );\n" + " const float3 crb = float3( 0, -0.391448975, 2.017822266 );\n" + " const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );\n" + " const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );\n" + "\n" + " float Y = tex2D( samp0, fragment.texcoord0.xy ).x;\n" + " float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;\n" + " float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;\n" + "\n" + " float3 p = ( YScalar * Y );\n" + " p += ( crc * Cr ) + ( crb * Cb ) + adj;\n" + "\n" + " float4 binkImage;\n" + " binkImage.xyz = p;\n" + " binkImage.w = 1.0;\n" + "\n" + " float4 color = ( binkImage * fragment.color ) + fragment.texcoord1;\n" + " result.color.xyz = color.xyz * color.w;\n" + " result.color.w = color.w;\n" + "}\n" + + }, + + { + "renderprogs/builtin/video/bink_gui.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -14172,7 +11336,1806 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float4 texcoord1 : TEXCOORD1;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0.xy = vertex.texcoord.xy;\n" + " result.texcoord1 = ( ( vertex.color2 ) * 2.0 ) - 1.0;\n" + " result.color = swizzleColor( vertex.color );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/VR/stereoDeGhost.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/VR/stereoDeGhost.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "}\n" + + }, + + { + "renderprogs/builtin/VR/stereoInterlace.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "uniform sampler2D samp1 : register(s1);\n" + "\n" + "struct PS_IN {\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " // texcoords will run from 0 to 1 across the entire screen\n" + " if( fract( fragment.position.y * 0.5 ) < 0.5 )\n" + " {\n" + " result.color = tex2D( samp0, vec2( fragment.texcoord0 ) );\n" + " }\n" + " else\n" + " {\n" + " result.color = tex2D( samp1, vec2( fragment.texcoord0 ) );\n" + " }\n" + "}\n" + + }, + + { + "renderprogs/builtin/VR/stereoInterlace.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/VR/stereoWarp.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "/*\n" + "\n" + "This shader will cover a square block of pixel coordinates, but some of them might\n" + "be scissored off if the edges of the screen or the midpoint divider are visible through\n" + "the optics.\n" + "\n" + "*/\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " vec4 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " const float screenWarp_range = 1.45;\n" + "\n" + " const vec2 warpCenter = vec2( 0.5, 0.5 );\n" + " vec2 centeredTexcoord = fragment.texcoord0.xy - warpCenter;\n" + "\n" + " float radialLength = length( centeredTexcoord );\n" + " vec2 radialDir = normalize( centeredTexcoord );\n" + "\n" + " // get it down into the 0 - PI/2 range\n" + " float range = screenWarp_range;\n" + " float scaledRadialLength = radialLength * range;\n" + " float tanScaled = tan( scaledRadialLength );\n" + "\n" + " float rescaleValue = tan( 0.5 * range );\n" + "\n" + " // If radialLength was 0.5, we want rescaled to also come out\n" + " // as 0.5, so the edges of the rendered image are at the edges\n" + " // of the warped image.\n" + " float rescaled = tanScaled / rescaleValue;\n" + "\n" + " vec2 warped = warpCenter + vec2( 0.5, 0.5 ) * radialDir * rescaled;\n" + "\n" + " result.color = tex2D( samp0, warped );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/VR/stereoWarp.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float4 texcoord : TEXCOORD0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float4 texcoord0: TEXCOORD0; // 0 to 1 box\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + " result.texcoord0 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/builtin/color.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/color.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "#if defined(USE_GPU_SKINNING)\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "#endif\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "#if defined(USE_GPU_SKINNING)\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the position\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + "\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "#else\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "#endif\n" + "}\n" + + }, + + { + "renderprogs/builtin/depth.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" + "}\n" + + }, + + { + "renderprogs/builtin/depth.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "}\n" + + }, + + { + "renderprogs/builtin/depth_skinned.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( out PS_OUT result )\n" + "{\n" + " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" + "}\n" + + }, + + { + "renderprogs/builtin/depth_skinned.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + "\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "}\n" + + }, + + { + "renderprogs/builtin/gbuffer.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2016 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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // normal map\n" + "\n" + "struct PS_IN\n" + "{\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float3 texcoord1 : TEXCOORD1_centroid;\n" + " float3 texcoord2 : TEXCOORD2_centroid;\n" + " float3 texcoord3 : TEXCOORD3_centroid;\n" + " float3 texcoord4 : TEXCOORD4_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT\n" + "{\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float4 bump = tex2D( samp0, fragment.texcoord0 ) * 2.0f - 1.0f;\n" + "\n" + " // RB begin\n" + " float3 localNormal;\n" + "#if defined(USE_NORMAL_FMT_RGB8)\n" + " localNormal = float3( bump.rg, 0.0f );\n" + "#else\n" + " localNormal = float3( bump.wy, 0.0f );\n" + "#endif\n" + " // RB end\n" + " localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );\n" + "\n" + " float3 globalNormal;\n" + "#if 1\n" + " globalNormal.x = dot3( localNormal, fragment.texcoord2 );\n" + " globalNormal.y = dot3( localNormal, fragment.texcoord3 );\n" + " globalNormal.z = dot3( localNormal, fragment.texcoord4 );\n" + "#else\n" + " // only the normal in view space\n" + " globalNormal.x = fragment.texcoord2.z;\n" + " globalNormal.y = fragment.texcoord3.z;\n" + " globalNormal.z = fragment.texcoord4.z;\n" + " //globalNormal.z = fragment.texcoord4.z * -0.001; //sqrt( abs( dot( globalNormal.xy, globalNormal.xy ) - 0.25 ) );\n" + " globalNormal = normalize( globalNormal );\n" + "#endif\n" + "\n" + " // RB: rpColor is white and only used to generate the _fa_ uniform array\n" + " result.color.rgb = ( globalNormal.xyz * 0.5 + 0.5 ) * fragment.color.rgb;// * rpColor;\n" + " //result.color.rgb = ( globalNormal.xyz );// * fragment.color.rgb;// * rpColor;\n" + " result.color.a = 1.0;\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/gbuffer.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2016 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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "#if defined( USE_GPU_SKINNING )\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "#endif\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float3 texcoord1 : TEXCOORD1;\n" + " float3 texcoord2 : TEXCOORD2;\n" + " float3 texcoord3 : TEXCOORD3;\n" + " float3 texcoord4 : TEXCOORD4;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "\n" + " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" + " float4 vTangent = vertex.tangent * 2.0 - 1.0;\n" + " float3 vBitangent = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;\n" + "\n" + "#if defined( USE_GPU_SKINNING )\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / tangent / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float3 normal;\n" + " normal.x = dot3( matX, vNormal );\n" + " normal.y = dot3( matY, vNormal );\n" + " normal.z = dot3( matZ, vNormal );\n" + " normal = normalize( normal );\n" + "\n" + " float3 tangent;\n" + " tangent.x = dot3( matX, vTangent );\n" + " tangent.y = dot3( matY, vTangent );\n" + " tangent.z = dot3( matZ, vTangent );\n" + " tangent = normalize( tangent );\n" + "\n" + " float3 bitangent;\n" + " bitangent.x = dot3( matX, vBitangent );\n" + " bitangent.y = dot3( matY, vBitangent );\n" + " bitangent.z = dot3( matZ, vBitangent );\n" + " bitangent = normalize( bitangent );\n" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + "\n" + "#else\n" + " float4 modelPosition = vertex.position;\n" + " float3 normal = vNormal.xyz;\n" + " float3 tangent = vTangent.xyz;\n" + " float3 bitangent = vBitangent.xyz;\n" + "#endif\n" + "\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "\n" + " // textures 0 takes the base coordinates by the texture matrix\n" + " result.texcoord0.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );\n" + " result.texcoord0.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );\n" + "\n" + " //float4 toEye = rpLocalViewOrigin - modelPosition;\n" + " //result.texcoord1.x = dot3( toEye, rpModelMatrixX );\n" + " //result.texcoord1.y = dot3( toEye, rpModelMatrixY );\n" + " //result.texcoord1.z = dot3( toEye, rpModelMatrixZ );\n" + "\n" + "#if 0\n" + " // rotate into world space\n" + " result.texcoord2.x = dot3( tangent, rpModelMatrixX );\n" + " result.texcoord3.x = dot3( tangent, rpModelMatrixY );\n" + " result.texcoord4.x = dot3( tangent, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.y = dot3( bitangent, rpModelMatrixX );\n" + " result.texcoord3.y = dot3( bitangent, rpModelMatrixY );\n" + " result.texcoord4.y = dot3( bitangent, rpModelMatrixZ );\n" + "\n" + " result.texcoord2.z = dot3( normal, rpModelMatrixX );\n" + " result.texcoord3.z = dot3( normal, rpModelMatrixY );\n" + " result.texcoord4.z = dot3( normal, rpModelMatrixZ );\n" + "\n" + "#else\n" + " // rotate into view space\n" + " result.texcoord2.x = dot3( tangent, rpModelViewMatrixX );\n" + " result.texcoord3.x = dot3( tangent, rpModelViewMatrixY );\n" + " result.texcoord4.x = dot3( tangent, rpModelViewMatrixZ );\n" + "\n" + " result.texcoord2.y = dot3( bitangent, rpModelViewMatrixX );\n" + " result.texcoord3.y = dot3( bitangent, rpModelViewMatrixY );\n" + " result.texcoord4.y = dot3( bitangent, rpModelViewMatrixZ );\n" + "\n" + " result.texcoord2.z = dot3( normal, rpModelViewMatrixX );\n" + " result.texcoord3.z = dot3( normal, rpModelViewMatrixY );\n" + " result.texcoord4.z = dot3( normal, rpModelViewMatrixZ );\n" + "#endif\n" + "\n" + "#if defined( USE_GPU_SKINNING )\n" + " // for joint transformation of the tangent space, we use color and\n" + " // color2 for weighting information, so hopefully there aren't any\n" + " // effects that need vertex color...\n" + " result.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );\n" + "#else\n" + " //# generate the vertex color, which can be 1.0, color, or 1.0 - color\n" + " //# for 1.0 : env[16] = 0, env[17] = 1\n" + " //# for color : env[16] = 1, env[17] = 0\n" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" + " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" + "#endif\n" + "}\n" + + }, + + { + "renderprogs/builtin/gui.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float4 texcoord1 : TEXCOORD1_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float4 color = ( tex2D( samp0, fragment.texcoord0 ) * fragment.color ) + fragment.texcoord1;\n" + " result.color.xyz = color.xyz * color.w;\n" + " result.color.w = color.w;\n" + "}\n" + + }, + + { + "renderprogs/builtin/gui.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float4 texcoord1 : TEXCOORD1;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord0.xy = vertex.texcoord.xy;\n" + " result.texcoord1 = ( ( vertex.color2 ) * 2.0 ) - 1.0;\n" + " result.color = swizzleColor( vertex.color );\n" + "}\n" + "\n" + + }, + + { + "renderprogs/builtin/texture.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " result.color = tex2D( samp0, fragment.texcoord0 ) * rpColor;\n" + " //result.color = textureLod( samp0, fragment.texcoord0, 2.0 ) * rpColor;\n" + " //result.color = float4( 0.0, 1.0, 0.0, 1.0 ) * rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/texture.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " // compute oldschool texgen or multiply by texture matrix\n" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" + " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" + " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" + " }\n" + " else\n" + " {\n" + " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" + " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" + " }\n" + "}\n" + + }, + + { + "renderprogs/builtin/texture_color.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;\n" + " clip( color.a - rpAlphaTest.x );\n" + " result.color = sRGBAToLinearRGBA( color );\n" + "}\n" + + }, + + { + "renderprogs/builtin/texture_color.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " // compute oldschool texgen or multiply by texture matrix\n" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" + " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" + " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" + " }\n" + " else\n" + " {\n" + " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" + " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" + " }\n" + "\n" + " float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" + " result.color = vertexColor * rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/texture_color_skinned.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;\n" + " clip( color.a - rpAlphaTest.x );\n" + " result.color = sRGBAToLinearRGBA( color );\n" + "}\n" + + }, + + { + "renderprogs/builtin/texture_color_skinned.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " //--------------------------------------------------------------\n" + " // GPU transformation of the normal / binormal / bitangent\n" + " //\n" + " // multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )\n" + " //--------------------------------------------------------------\n" + " const float w0 = vertex.color2.x;\n" + " const float w1 = vertex.color2.y;\n" + " const float w2 = vertex.color2.z;\n" + " const float w3 = vertex.color2.w;\n" + "\n" + " float4 matX, matY, matZ; // must be float4 for vec4\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 = 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 = 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 = 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" + "\n" + " float4 modelPosition;\n" + " modelPosition.x = dot4( matX, vertex.position );\n" + " modelPosition.y = dot4( matY, vertex.position );\n" + " modelPosition.z = dot4( matZ, vertex.position );\n" + " modelPosition.w = 1.0;\n" + "\n" + " result.position.x = dot4( modelPosition, rpMVPmatrixX );\n" + " result.position.y = dot4( modelPosition, rpMVPmatrixY );\n" + " result.position.z = dot4( modelPosition, rpMVPmatrixZ );\n" + " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" + "\n" + " // compute oldschool texgen or multiply by texture matrix\n" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" + " result.texcoord0.x = dot4( modelPosition, rpTexGen0S );\n" + " result.texcoord0.y = dot4( modelPosition, rpTexGen0T );\n" + " }\n" + " else\n" + " {\n" + " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" + " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" + " }\n" + "\n" + " float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" + " result.color = vertexColor * rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/texture_color_texgen.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "uniform sampler2D samp0 :\n" + "register( s0 );\n" + "\n" + "// *INDENT-OFF*\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float4 texcoord0 : TEXCOORD0_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " // we always do a projective texture lookup so that we can support texgen\n" + " // materials without a separate shader. Basic materials will have texture\n" + " // coordinates with w = 1 which will result in a NOP projection when tex2Dproj\n" + " // gets called.\n" + " float4 texSample = idtex2Dproj( samp0, fragment.texcoord0 );\n" + "\n" + " result.color = sRGBAToLinearRGBA( texSample ) * fragment.color;\n" + "}\n" + + }, + + { + "renderprogs/builtin/texture_color_texgen.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float4 texcoord0 : TEXCOORD0;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " float4 tc0;\n" + " tc0.x = dot4( vertex.position, rpTexGen0S );\n" + " tc0.y = dot4( vertex.position, rpTexGen0T );\n" + "\n" + " tc0.z = 0.0f;\n" + " tc0.w = dot4( vertex.position, rpTexGen0Q );\n" + "\n" + " // multiply the texture matrix in\n" + " result.texcoord0.x = dot4( tc0, rpTextureMatrixS );\n" + " result.texcoord0.y = dot4( tc0, rpTextureMatrixT );\n" + " result.texcoord0.zw = tc0.zw;\n" + "\n" + " // compute vertex modulation\n" + " float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" + " result.color = vertexColor * rpColor;\n" + "}\n" + + }, + + { + "renderprogs/builtin/vertex_color.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" @@ -14192,11 +13155,11 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " result.color = sRGBAToLinearRGBA( fragment.color );\n" "}\n" - + }, - + { - "renderprogs/vertex_color.vs.hlsl", + "renderprogs/builtin/vertex_color.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -14226,7 +13189,8 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "struct VS_IN\n" @@ -14254,11 +13218,11 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " result.color = swizzleColor( vertex.color );\n" "}\n" - + }, - + { - "renderprogs/wobblesky.ps.hlsl", + "renderprogs/bloodorb1_capture.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -14287,15 +13251,18 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" - "uniform samplerCUBE samp0 : register(s0);\n" + "uniform sampler2D samp0 : register(s0); //_accum\n" + "uniform sampler2D samp1 : register(s1); //_currentRender\n" + "uniform sampler2D samp2 : register(s2); //mask\n" "\n" "struct PS_IN {\n" " float4 position : VPOS;\n" - " float3 texcoord0 : TEXCOORD0_centroid;\n" - " float4 color : COLOR0;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float2 texcoord1 : TEXCOORD1_centroid;\n" "};\n" "\n" "struct PS_OUT {\n" @@ -14305,14 +13272,18 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" - " result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n" - "}\n" "\n" - + " float4 accumSample = tex2D( samp0, fragment.texcoord0 );\n" + " float4 maskSample = tex2D( samp2, fragment.texcoord1 );\n" + " float4 currentRenderSample = tex2D( samp1, fragment.texcoord1 );\n" + "\n" + " result.color = lerp( accumSample, currentRenderSample, maskSample.a );\n" + "}\n" + }, - + { - "renderprogs/wobblesky.vs.hlsl", + "renderprogs/bloodorb1_capture.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -14341,7 +13312,445 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register( c128 ); //rpCenterScale\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float2 texcoord1 : TEXCOORD1;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " //center scale\n" + " const float4 centerScale = rpUser0;\n" + " result.texcoord0 = CenterScale( vertex.texcoord, centerScale.xy );\n" + "\n" + " // pass through texcoords\n" + " result.texcoord1 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/bloodorb2_capture.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); //_accum\n" + "uniform sampler2D samp1 : register(s1); //_currentRender\n" + "uniform sampler2D samp2 : register(s2); //mask\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float2 texcoord1 : TEXCOORD1_centroid;\n" + " float2 texcoord2 : TEXCOORD2_centroid;\n" + " //float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float4 redTint = float4( 1, 0.98, 0.98, 1 );\n" + " float4 accumSample = tex2D( samp0, fragment.texcoord0 ) * redTint;\n" + "\n" + " float4 maskSample = tex2D( samp2, fragment.texcoord1 );\n" + "\n" + " float4 tint = float4( 1.0, 0.8, 0.8, 1 );\n" + " float4 currentRenderSample = tex2D( samp1, fragment.texcoord2 ) * tint;\n" + "\n" + " result.color = lerp( accumSample, currentRenderSample, maskSample.a );\n" + "}\n" + + }, + + { + "renderprogs/bloodorb2_capture.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex0\n" + "uniform float4 rpUser1 : register( c129 ); //rpRotateTex0\n" + "uniform float4 rpUser2 : register( c130 ); //rpCenterScaleTex1\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float2 texcoord1 : TEXCOORD1;\n" + " float2 texcoord2 : TEXCOORD2;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " const float4 centerScaleTex0 = rpUser0;\n" + " const float4 rotateTex0 = rpUser1;\n" + " const float4 centerScaleTex1 = rpUser2;\n" + "\n" + " //center scale and rotate for _accum\n" + " float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex0.xy );\n" + " result.texcoord0 = Rotate2D( tc0, rotateTex0.xy );\n" + "\n" + " //center scale for mask\n" + " result.texcoord1 = CenterScale( vertex.texcoord, centerScaleTex1.xy );\n" + "\n" + " // pass through for currentrender\n" + " result.texcoord2 = vertex.texcoord;\n" + "}\n" + + }, + + { + "renderprogs/bloodorb3_capture.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); //_accum\n" + "uniform sampler2D samp1 : register(s1); //_currentRender\n" + "uniform sampler2D samp2 : register(s2); //mask\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + " float2 texcoord1 : TEXCOORD1_centroid;\n" + " float2 texcoord2 : TEXCOORD2_centroid;\n" + " float2 texcoord3 : TEXCOORD3_centroid;\n" + " float2 texcoord4 : TEXCOORD4;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + " float colorFactor = fragment.texcoord4.x;\n" + "\n" + " float4 color0 = float4( 1.0f - colorFactor, 1.0f - colorFactor, 1.0f, 1.0f );\n" + " float4 color1 = float4( 1.0f, 0.95f - colorFactor, 0.95f, 0.5f );\n" + " float4 color2 = float4( 0.015f, 0.015f, 0.015f, 0.01f );\n" + "\n" + " float4 accumSample0 = tex2D( samp0, fragment.texcoord0 ) * color0;\n" + " float4 accumSample1 = tex2D( samp0, fragment.texcoord1 ) * color1;\n" + " float4 accumSample2 = tex2D( samp0, fragment.texcoord2 ) * color2;\n" + " float4 maskSample = tex2D( samp2, fragment.texcoord3 );\n" + "\n" + " float4 tint = float4( 0.8, 0.5, 0.5, 1 );\n" + " float4 currentRenderSample = tex2D( samp1, fragment.texcoord3 ) * tint;\n" + "\n" + " // blend of the first 2 accumulation samples\n" + " float4 accumColor = lerp( accumSample0, accumSample1, 0.5f );\n" + " // add thrid sample\n" + " accumColor += accumSample2;\n" + "\n" + " accumColor = lerp( accumColor, currentRenderSample, maskSample.a );\n" + " result.color = accumColor;\n" + "}\n" + + }, + + { + "renderprogs/bloodorb3_capture.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex\n" + "uniform float4 rpUser1 : register( c129 ); //rpRotateTex\n" + "uniform float4 rpUser2 : register( c130 ); //rpColorFactor\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord0 : TEXCOORD0;\n" + " float2 texcoord1 : TEXCOORD1;\n" + " float2 texcoord2 : TEXCOORD2;\n" + " float2 texcoord3 : TEXCOORD3;\n" + " float2 texcoord4 : TEXCOORD4;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " //_accum 1\n" + " const float4 centerScaleTex = rpUser0;\n" + " const float4 rotateTex = rpUser1;\n" + " float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex.xy );\n" + " result.texcoord0 = Rotate2D( tc0, rotateTex.xy );\n" + "\n" + " // accum 2\n" + " result.texcoord1 = Rotate2D( tc0, float2( rotateTex.z, -rotateTex.w ) );\n" + "\n" + " // accum 3\n" + " result.texcoord2 = Rotate2D( tc0, rotateTex.zw );\n" + "\n" + " // pass through for currentrender\n" + " result.texcoord3 = vertex.texcoord;\n" + "\n" + " // pass through the color fator\n" + " const float4 colorFactor = rpUser2;\n" + " result.texcoord4 = colorFactor.xx;\n" + "}\n" + + }, + + { + "renderprogs/bloodorb_draw.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); //_accum\n" + "uniform sampler2D samp1 : register(s1); //_currentRender\n" + "uniform sampler2D samp2 : register(s2); //mask\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float4 accumSample = tex2D( samp0, fragment.texcoord0 );\n" + " float4 currentRenderSample = tex2D( samp1, fragment.texcoord0 );\n" + " float4 maskSample = tex2D( samp2, fragment.texcoord0 );\n" + "\n" + " result.color = lerp( accumSample, currentRenderSample, maskSample.a );\n" + "}\n" + + }, + + { + "renderprogs/bloodorb_draw.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" "struct VS_IN {\n" @@ -14354,8 +13763,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "struct VS_OUT {\n" " float4 position : POSITION;\n" - " float3 texcoord0 : TEXCOORD0;\n" - " float4 color : COLOR0;\n" + " float2 texcoord0 : TEXCOORD0;\n" "};\n" "// *INDENT-ON*\n" "\n" @@ -14366,19 +13774,14 @@ static const cgShaderDef_t cg_renderprogs[] = " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" "\n" - " float3 t0 = vertex.position.xyz - rpLocalViewOrigin.xyz;\n" - " result.texcoord0.x = dot3( t0, rpWobbleSkyX );\n" - " result.texcoord0.y = dot3( t0, rpWobbleSkyY );\n" - " result.texcoord0.z = dot3( t0, rpWobbleSkyZ );\n" - "\n" - " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" + " // pass through texcoords\n" + " result.texcoord0 = vertex.texcoord;\n" "}\n" - "\n" - + }, - + { - "renderprogs/zcullReconstruct.ps.hlsl", + "renderprogs/colorProcess.ps.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -14407,25 +13810,35 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" - "struct PS_OUT { \n" - " float depth : DEPTH;\n" + "uniform sampler2D samp0 : register(s0);\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float4 color : COLOR;\n" + " float3 texcoord0 : TEXCOORD0_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" "// *INDENT-ON*\n" "\n" - "void main( out PS_OUT result )\n" + "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" - " result.depth = 1;\n" - " result.color = float4( 0.0, 0.0, 0.0, 0.0 );\n" + " float4 src = tex2D( samp0, fragment.texcoord0.xy );\n" + " float4 target = fragment.color * dot3( float3( 0.333, 0.333, 0.333 ), src );\n" + " result.color = lerp( src, target, fragment.texcoord0.z );\n" "}\n" - + "\n" + }, - + { - "renderprogs/zcullReconstruct.vs.hlsl", + "renderprogs/colorProcess.vs.hlsl", "/*\n" "===========================================================================\n" "\n" @@ -14454,26 +13867,700 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" - "#include \"global.inc.hlsl\"\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" "\n" "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register(c128); //rpFraction\n" + "uniform float4 rpUser1 : register(c129); //rpTargetHue\n" + "\n" "struct VS_IN {\n" - " float4 position : POSITION;\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" "};\n" "\n" "struct VS_OUT {\n" - " float4 position : POSITION;\n" + " float4 position : POSITION;\n" + " float4 color : COLOR0;\n" + " float3 texcoord0 : TEXCOORD0;\n" "};\n" "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" - " result.position = vertex.position;\n" - " result.position.z = -1.0;\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.color = rpUser1; // targetHue\n" + "\n" + " result.texcoord0.x = vertex.texcoord.x;\n" + " result.texcoord0.y = 1.0f - vertex.texcoord.y;\n" + "\n" + " result.texcoord0.z = rpUser0.x; // fraction\n" "}\n" - + "\n" + "\n" + }, - + + { + "renderprogs/enviroSuit.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" + "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float2 texcoord : TEXCOORD0_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " float2 screenTexCoord = fragment.texcoord;\n" + "\n" + " // compute warp factor\n" + " float4 warpFactor = 1.0 - ( tex2D( samp1, screenTexCoord.xy ) * fragment.color );\n" + " screenTexCoord -= float2( 0.5, 0.5 );\n" + " screenTexCoord *= warpFactor.xy;\n" + " screenTexCoord += float2( 0.5, 0.5 );\n" + "\n" + " // load the screen render\n" + " result.color = tex2D( samp0, screenTexCoord );\n" + "\n" + "}\n" + + }, + + { + "renderprogs/enviroSuit.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// User Renderparms start at 128 as per renderprogs.h\n" + "\n" + "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register(c128); // rpScroll\n" + "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "\n" + " result.position.x = dot4( vertex.position, rpMVPmatrixX );\n" + " result.position.y = dot4( vertex.position, rpMVPmatrixY );\n" + " result.position.z = dot4( vertex.position, rpMVPmatrixZ );\n" + " result.position.w = dot4( vertex.position, rpMVPmatrixW );\n" + "\n" + " result.texcoord = vertex.texcoord.xy;\n" + "\n" + " const float4 deformMagnitude = rpUser1;\n" + " result.color = deformMagnitude;\n" + "}\n" + + }, + + { + "renderprogs/heatHazeWithMask.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" + "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" + "uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float4 texcoord0 : TEXCOORD0_centroid;\n" + " float4 texcoord1 : TEXCOORD1_centroid;\n" + " float4 texcoord2 : TEXCOORD2_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " // load the distortion map\n" + " float4 mask = tex2D( samp2, fragment.texcoord0.xy );\n" + "\n" + " // kill the pixel if the distortion wound up being very small\n" + " mask.xy -= 0.01f;\n" + " clip( mask );\n" + "\n" + " // load the filtered normal map and convert to -1 to 1 range\n" + " float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;\n" + " float2 localNormal = bumpMap.wy;\n" + " localNormal *= mask.xy;\n" + "\n" + " // calculate the screen texcoord in the 0.0 to 1.0 range\n" + " float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );\n" + " screenTexCoord += ( localNormal * fragment.texcoord2.xy );\n" + " screenTexCoord = saturate( screenTexCoord );\n" + "\n" + " result.color = ( tex2D( samp0, screenTexCoord ) );\n" + "}\n" + + }, + + { + "renderprogs/heatHazeWithMask.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// RB: no GPU skinning with ES 2.0\n" + "#if defined(USE_GPU_SKINNING)\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "#endif\n" + "// RB end\n" + "\n" + "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register(c128); // rpScroll\n" + "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float4 texcoord0 : TEXCOORD0;\n" + " float4 texcoord1 : TEXCOORD1;\n" + " float4 texcoord2 : TEXCOORD2;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "\n" + "#include \"renderprogs/skinning.inc.hlsl\"\n" + "\n" + "\n" + " // texture 0 takes the texture coordinates unmodified\n" + " result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 );\n" + "\n" + " // texture 1 takes the texture coordinates and adds a scroll\n" + " const float4 textureScroll = rpUser0;\n" + " result.texcoord1 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;\n" + "\n" + " // texture 2 takes the deform magnitude and scales it by the projection distance\n" + " float4 vec = float4( 0, 1, 0, 1 );\n" + " vec.z = dot4( modelPosition, rpModelViewMatrixZ );\n" + "\n" + " // magicProjectionAdjust is a magic scalar that scales the projection since we changed from\n" + " // using the X axis to the Y axis to calculate R1. It is an approximation to closely match\n" + " // what the original game did\n" + " const float magicProjectionAdjust = 0.43f;\n" + " float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;\n" + " float w = dot4( vec, rpProjectionMatrixW );\n" + "\n" + " // don't let the recip get near zero for polygons that cross the view plane\n" + " w = max( w, 1.0 );\n" + " x /= w;\n" + " //x = x * ( 1.0f / ( w + 0.00001f ) );\n" + "\n" + " // clamp the distance so the the deformations don't get too wacky near the view\n" + " x = min( x, 0.02 );\n" + "\n" + " const float4 deformMagnitude = rpUser1;\n" + " result.texcoord2 = x * deformMagnitude;\n" + "}\n" + + }, + + { + "renderprogs/heatHazeWithMaskAndVertex.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" + "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" + "uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float4 texcoord0 : TEXCOORD0_centroid;\n" + " float4 texcoord1 : TEXCOORD1_centroid;\n" + " float4 texcoord2 : TEXCOORD2_centroid;\n" + " float4 color : COLOR0;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " // load the distortion map\n" + " float4 mask = tex2D( samp2, fragment.texcoord0.xy );\n" + "\n" + " // kill the pixel if the distortion wound up being very small\n" + " mask.xy *= fragment.color.xy;\n" + " mask.xy -= 0.01f;\n" + " clip( mask );\n" + "\n" + " // load the filtered normal map and convert to -1 to 1 range\n" + " float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;\n" + " float2 localNormal = bumpMap.wy;\n" + " localNormal *= mask.xy;\n" + "\n" + " // calculate the screen texcoord in the 0.0 to 1.0 range\n" + " float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );\n" + " screenTexCoord += ( localNormal * fragment.texcoord2.xy );\n" + " screenTexCoord = saturate( screenTexCoord );\n" + "\n" + " result.color = ( tex2D( samp0, screenTexCoord ) );\n" + "}\n" + + }, + + { + "renderprogs/heatHazeWithMaskAndVertex.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// RB: no GPU skinning with ES 2.0\n" + "#if defined(USE_GPU_SKINNING)\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "#endif\n" + "// RB end\n" + "\n" + "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register(c128); // rpScroll\n" + "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float4 texcoord0 : TEXCOORD0;\n" + " float4 texcoord1 : TEXCOORD1;\n" + " float4 texcoord2 : TEXCOORD2;\n" + " float4 color : COLOR0;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "\n" + "#include \"renderprogs/skinning.inc.hlsl\"\n" + "\n" + "\n" + " // texture 0 takes the texture coordinates unmodified\n" + " result.texcoord0 = float4( vertex.texcoord, 0 , 0 );\n" + "\n" + " // texture 1 takes the texture coordinates and adds a scroll\n" + " const float4 textureScroll = rpUser0;\n" + " result.texcoord1 = float4( vertex.texcoord, 0, 0 ) + textureScroll;\n" + "\n" + " // texture 2 takes the deform magnitude and scales it by the projection distance\n" + " float4 vec = float4( 0, 1, 0, 1 );\n" + " vec.z = dot4( modelPosition, rpModelViewMatrixZ );\n" + "\n" + " // magicProjectionAdjust is a magic scalar that scales the projection since we changed from\n" + " // using the X axis to the Y axis to calculate x. It is an approximation to closely match\n" + " // what the original game did\n" + " const float magicProjectionAdjust = 0.43f;\n" + " float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;\n" + " float w = dot4( vec, rpProjectionMatrixW );\n" + "\n" + " // don't let the recip get near zero for polygons that cross the view plane\n" + " w = max( w, 1.0f );\n" + " x /= w;\n" + " //x = x * ( 1.0f / w );\n" + "\n" + " // clamp the distance so the the deformations don't get too wacky near the view\n" + " x = min( x, 0.02f );\n" + "\n" + " const float4 deformMagnitude = rpUser1;\n" + " result.texcoord2 = x * deformMagnitude;\n" + " result.color = swizzleColor( vertex.color );\n" + "}\n" + + }, + + { + "renderprogs/heathaze.ps.hlsl", + "/*\n" + "===========================================================================\n" + "\n" + "Doom 3 BFG Edition GPL Source Code\n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\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" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// *INDENT-OFF*\n" + "uniform sampler2D samp0 : register(s0); // texture 0 is _current Render\n" + "uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map\n" + "\n" + "struct PS_IN {\n" + " float4 position : VPOS;\n" + " float4 texcoord0 : TEXCOORD0_centroid;\n" + " float4 texcoord1 : TEXCOORD1_centroid;\n" + "};\n" + "\n" + "struct PS_OUT {\n" + " float4 color : COLOR;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" + "\n" + " // load the filtered normal map and convert to -1 to 1 range\n" + " float4 bumpMap = ( tex2D( samp1, fragment.texcoord0.xy ) * 2.0f ) - 1.0f;\n" + " float2 localNormal = bumpMap.wy;\n" + "\n" + " // calculate the screen texcoord in the 0.0 to 1.0 range\n" + " float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );\n" + " screenTexCoord += ( localNormal * fragment.texcoord1.xy );\n" + " screenTexCoord = saturate( screenTexCoord );\n" + "\n" + " // load the screen render\n" + " result.color = ( tex2D( samp0, screenTexCoord.xy ) );\n" + "}\n" + + }, + + { + "renderprogs/heathaze.vs.hlsl", + "/*\n" + "===========================================================================\n" + "\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" + "\n" + "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\").\n" + "\n" + "Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with Doom 3 BFG Edition Source Code. If not, see .\n" + "\n" + "In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n" + "\n" + "If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n" + "\n" + "===========================================================================\n" + "*/\n" + "\n" + "#include \"renderprogs/global.inc.hlsl\"\n" + "\n" + "\n" + "// User Renderparms start at 128 as per renderprogs.h\n" + "\n" + "// *INDENT-OFF*\n" + "uniform float4 rpUser0 : register(c128); // rpScroll\n" + "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" + "\n" + "// RB: no GPU skinning with ES 2.0\n" + "#if defined(USE_GPU_SKINNING)\n" + "uniform matrices_ubo { float4 matrices[408]; };\n" + "#endif\n" + "// RB end\n" + "\n" + "struct VS_IN {\n" + " float4 position : POSITION;\n" + " float2 texcoord : TEXCOORD0;\n" + " float4 normal : NORMAL;\n" + " float4 tangent : TANGENT;\n" + " float4 color : COLOR0;\n" + " float4 color2 : COLOR1;\n" + "};\n" + "\n" + "struct VS_OUT {\n" + " float4 position : POSITION;\n" + " float4 texcoord0 : TEXCOORD0;\n" + " float4 texcoord1 : TEXCOORD1;\n" + "};\n" + "// *INDENT-ON*\n" + "\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" + "\n" + "#include \"renderprogs/skinning.inc.hlsl\"\n" + "\n" + "\n" + " //texture 0 takes the texture coordinates and adds a scroll\n" + " const float4 textureScroll = rpUser0;\n" + " result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;\n" + "\n" + " //texture 1 takes the deform magnitude and scales it by the projection distance\n" + " float4 vec = float4( 0, 1, 0, 1 );\n" + " vec.z = dot4( modelPosition, rpModelViewMatrixZ ); // this is the modelview matrix\n" + "\n" + " // magicProjectionAdjust is a magic scalar that scales the projection since we changed from\n" + " // using the X axis to the Y axis to calculate x. It is an approximation to closely match\n" + " // what the original game did\n" + " const float magicProjectionAdjust = 0.43f;\n" + " float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;\n" + " float w = dot4( vec, rpProjectionMatrixW );\n" + "\n" + " //don't let the recip get near zero for polygons that cross the view plane\n" + " w = max( w, 1.0 );\n" + " x /= w;\n" + " //x = x * ( 1.0f / w );\n" + "\n" + " // clamp the distance so the the deformations don't get too wacky near the view\n" + " x = min( x, 0.02 );\n" + "\n" + " const float4 deformMagnitude = rpUser1;\n" + " result.texcoord1 = x * deformMagnitude;\n" + "}\n" + + }, + {0, 0}, - + };