From 3f9b85d4343a7d2e263c31325cd396745aa474af Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Fri, 1 May 2020 21:11:13 +0200 Subject: [PATCH] Fixed textureLod with Vulkan and tweaked IBL to use r_lightScale --- base/renderprogs/ambient_lighting_IBL.ps.hlsl | 21 +- neo/renderer/RenderBackend.cpp | 2 +- neo/renderer/RenderProgs_embedded.h | 3797 +++++++++-------- neo/renderer/RenderSystem_init.cpp | 4 +- neo/renderer/Vulkan/Image_VK.cpp | 4 + 5 files changed, 2124 insertions(+), 1704 deletions(-) diff --git a/base/renderprogs/ambient_lighting_IBL.ps.hlsl b/base/renderprogs/ambient_lighting_IBL.ps.hlsl index 75637590..96c0b1db 100644 --- a/base/renderprogs/ambient_lighting_IBL.ps.hlsl +++ b/base/renderprogs/ambient_lighting_IBL.ps.hlsl @@ -31,14 +31,14 @@ If you have questions concerning this license or the applicable additional terms #include "BRDF.inc.hlsl" // *INDENT-OFF* -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 samp0 : register(s0); // texture 0 is the per-surface normal map +uniform sampler2D samp1 : register(s1); // texture 1 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 BRDF LUT -uniform sampler2D samp4 : register(s4); // texture 5 is SSAO +uniform sampler2D samp3 : register(s3); // texture 3 is the BRDF LUT +uniform sampler2D samp4 : register(s4); // texture 4 is SSAO -uniform samplerCUBE samp7 : register(s7); // texture 6 is the irradiance cube map -uniform samplerCUBE samp8 : register(s8); // texture 7 is the radiance cube map +uniform samplerCUBE samp7 : register(s7); // texture 7 is the irradiance cube map +uniform samplerCUBE samp8 : register(s8); // texture 8 is the radiance cube map struct PS_IN { @@ -169,13 +169,14 @@ void main( PS_IN fragment, out PS_OUT result ) // evaluate diffuse IBL float3 irradiance = texCUBE( samp7, globalNormal ).rgb; - float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 3.0 ); + float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 1.0 ); // evaluate specular IBL - // should be 4.0 + // should be 8 = numMips - 1, 256^2 = 9 mips const float MAX_REFLECTION_LOD = 10.0; - float mip = clamp( ( roughness * MAX_REFLECTION_LOD ) + 0.0, 0.0, 10.0 ); + float mip = clamp( ( roughness * MAX_REFLECTION_LOD ), 0.0, MAX_REFLECTION_LOD ); + //float mip = 0.0; float3 radiance = textureLod( samp8, reflectionVector, mip ).rgb; float2 envBRDF = texture( samp3, float2( max( vDotN, 0.0 ), roughness ) ).rg; @@ -187,7 +188,7 @@ void main( PS_IN fragment, out PS_OUT result ) #endif float specAO = ComputeSpecularAO( vDotN, ao, roughness ); - float3 specularLight = radiance * ( kS * envBRDF.x + float3( envBRDF.y ) ) * specAO * ( rpSpecularModifier.xyz * 0.75 ); + float3 specularLight = radiance * ( kS * envBRDF.x + float3( envBRDF.y ) ) * specAO * ( rpSpecularModifier.xyz * 0.5 ); #if 0 // Marmoset Horizon Fade trick diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp index 8047ca2b..b4e4e2c1 100644 --- a/neo/renderer/RenderBackend.cpp +++ b/neo/renderer/RenderBackend.cpp @@ -2129,7 +2129,7 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr GL_Color( colorWhite ); - const float lightScale = 1.0f; //r_lightScale.GetFloat(); + const float lightScale = r_useHDR.GetBool() ? r_lightScale.GetFloat() * 0.666f : r_lightScale.GetFloat(); const idVec4 lightColor = colorWhite * lightScale; // apply the world-global overbright and the 2x factor for specular diff --git a/neo/renderer/RenderProgs_embedded.h b/neo/renderer/RenderProgs_embedded.h index 4ff42722..776c27d3 100644 --- a/neo/renderer/RenderProgs_embedded.h +++ b/neo/renderer/RenderProgs_embedded.h @@ -16,10 +16,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 2013-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" + "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" @@ -41,6 +41,7 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "*/\n" "\n" + "// *INDENT-OFF*\n" "uniform float4 rpScreenCorrectionFactor : register(c0);\n" "uniform float4 rpWindowCoord : register(c1);\n" "uniform float4 rpDiffuseModifier : register(c2);\n" @@ -133,9 +134,11 @@ static const cgShaderDef_t cg_renderprogs[] = "static float dot4( float4 a, float4 b ) { return dot( a, b ); }\n" "static float dot4( float2 a, float4 b ) { return dot( float4( a, 0, 1 ), b ); }\n" "\n" + "// *INDENT-ON*\n" + "\n" "// RB begin\n" "#ifndef PI\n" - "#define PI 3.14159265358979323846\n" + " #define PI 3.14159265358979323846\n" "#endif\n" "\n" "#define DEG2RAD( a ) ( ( a ) * PI / 180.0f )\n" @@ -188,16 +191,17 @@ static const cgShaderDef_t cg_renderprogs[] = "// ----------------------\n" "// YCoCg Color Conversion\n" "// ----------------------\n" - "static const half4 matrixRGB1toCoCg1YX = half4( 0.50, 0.0, -0.50, 0.50196078 ); // Co\n" + "static const half4 matrixRGB1toCoCg1YX = half4( 0.50, 0.0, -0.50, 0.50196078 ); // Co\n" "static const half4 matrixRGB1toCoCg1YY = half4( -0.25, 0.5, -0.25, 0.50196078 ); // Cg\n" - "static const half4 matrixRGB1toCoCg1YZ = half4( 0.0, 0.0, 0.0, 1.0 ); // 1.0\n" - "static const half4 matrixRGB1toCoCg1YW = half4( 0.25, 0.5, 0.25, 0.0 ); // Y\n" + "static const half4 matrixRGB1toCoCg1YZ = half4( 0.0, 0.0, 0.0, 1.0 ); // 1.0\n" + "static const half4 matrixRGB1toCoCg1YW = half4( 0.25, 0.5, 0.25, 0.0 ); // Y\n" "\n" - "static const half4 matrixCoCg1YtoRGB1X = half4( 1.0, -1.0, 0.0, 1.0 );\n" - "static const half4 matrixCoCg1YtoRGB1Y = half4( 0.0, 1.0, -0.50196078, 1.0 ); // -0.5 * 256.0 / 255.0\n" + "static const half4 matrixCoCg1YtoRGB1X = half4( 1.0, -1.0, 0.0, 1.0 );\n" + "static const half4 matrixCoCg1YtoRGB1Y = half4( 0.0, 1.0, -0.50196078, 1.0 ); // -0.5 * 256.0 / 255.0\n" "static const half4 matrixCoCg1YtoRGB1Z = half4( -1.0, -1.0, 1.00392156, 1.0 ); // +1.0 * 256.0 / 255.0\n" "\n" - "static half3 ConvertYCoCgToRGB( half4 YCoCg ) {\n" + "static half3 ConvertYCoCgToRGB( half4 YCoCg )\n" + "{\n" " half3 rgbColor;\n" "\n" " YCoCg.z = ( YCoCg.z * 31.875 ) + 1.0; //z = z * 255.0/8.0 + 1.0\n" @@ -209,7 +213,8 @@ static const cgShaderDef_t cg_renderprogs[] = " return rgbColor;\n" "}\n" "\n" - "static float2 CenterScale( float2 inTC, float2 centerScale ) {\n" + "static float2 CenterScale( float2 inTC, float2 centerScale )\n" + "{\n" " float scaleX = centerScale.x;\n" " float scaleY = centerScale.y;\n" " float4 tc0 = float4( scaleX, 0, 0, 0.5 - ( 0.5f * scaleX ) );\n" @@ -221,7 +226,8 @@ static const cgShaderDef_t cg_renderprogs[] = " return finalTC;\n" "}\n" "\n" - "static float2 Rotate2D( float2 inTC, float2 cs ) {\n" + "static float2 Rotate2D( float2 inTC, float2 cs )\n" + "{\n" " float sinValue = cs.y;\n" " float cosValue = cs.x;\n" "\n" @@ -235,8 +241,9 @@ static const cgShaderDef_t cg_renderprogs[] = "}\n" "\n" "// better noise function available at https://github.com/ashima/webgl-noise\n" - "float rand( float2 co ) {\n" - " return frac( sin( dot( co.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 );\n" + "float rand( float2 co )\n" + "{\n" + " return frac( sin( dot( co.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 );\n" "}\n" "\n" "#define square( x ) ( x * x )\n" @@ -252,13 +259,19 @@ static const cgShaderDef_t cg_renderprogs[] = "#define _float4( x ) float4( x )\n" "\n" "#define VPOS WPOS\n" - "static float4 idtex2Dproj( sampler2D samp, float4 texCoords ) { return tex2Dproj( samp, texCoords.xyw ); }\n" - "static float4 swizzleColor( float4 c )\n" - "{ \n" - " return c;\n" - " //return sRGBAToLinearRGBA( c ); \n" + "static float4 idtex2Dproj( sampler2D samp, float4 texCoords )\n" + "{\n" + " return tex2Dproj( samp, texCoords.xyw );\n" + "}\n" + "static float4 swizzleColor( float4 c )\n" + "{\n" + " return c;\n" + " //return sRGBAToLinearRGBA( c );\n" + "}\n" + "static float2 vposToScreenPosTexCoord( float2 vpos )\n" + "{\n" + " return vpos.xy * rpWindowCoord.xy;\n" "}\n" - "static float2 vposToScreenPosTexCoord( float2 vpos ) { return vpos.xy * rpWindowCoord.xy; }\n" "\n" "#define BRANCH\n" "#define IFANY\n" @@ -279,7 +292,7 @@ static const cgShaderDef_t cg_renderprogs[] = "// http://advances.realtimerendering.com/s2014/index.html\n" "float InterleavedGradientNoise( float2 uv )\n" "{\n" - " \n" + "\n" " const float3 magic = float3( 0.06711056, 0.00583715, 52.9829189 );\n" " float rnd = fract( magic.z * fract( dot( uv, magic.xy ) ) );\n" "\n" @@ -296,10 +309,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -325,7 +338,8 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "// RB: no GPU skinning with ES 2.0\n" "#if defined(USE_GPU_SKINNING)\n" - "BRANCH if ( rpEnableSkinning.x > 0.0 ) {\n" + "BRANCH if( rpEnableSkinning.x > 0.0 )\n" + "{\n" " //--------------------------------------------------------------\n" " // GPU transformation of the normal / binormal / bitangent\n" " //\n" @@ -337,25 +351,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" " modelPosition.x = dot4( matX, vertex.position );\n" " modelPosition.y = dot4( matY, vertex.position );\n" @@ -404,14 +418,14 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "\n" "/**\n" - " * \n" + " *\n" " * E N H A N C E D\n" " * S U B P I X E L M O R P H O L O G I C A L A N T I A L I A S I N G\n" " *\n" " * http://www.iryoku.com/smaa/\n" " *\n" " * Hi, welcome aboard!\n" - " * \n" + " *\n" " * Here you'll find instructions to get the shader up and running as fast as\n" " * possible.\n" " *\n" @@ -500,14 +514,14 @@ static const cgShaderDef_t cg_renderprogs[] = " * this last pass are not possible, the technique will work anyway, but\n" " * will perform antialiasing in gamma space.\n" " *\n" - " * IMPORTANT: for best results the input read for the color/luma edge \n" + " * IMPORTANT: for best results the input read for the color/luma edge\n" " * detection should *NOT* be sRGB.\n" " *\n" " * 6. Before including SMAA.h you'll have to setup the render target metrics,\n" " * the target and any optional configuration defines. Optionally you can\n" " * use a preset.\n" " *\n" - " * You have the following targets available: \n" + " * You have the following targets available:\n" " * SMAA_HLSL_3\n" " * SMAA_HLSL_4\n" " * SMAA_HLSL_4_1\n" @@ -672,25 +686,25 @@ static const cgShaderDef_t cg_renderprogs[] = " */\n" "\n" "#if defined(SMAA_PRESET_LOW)\n" - "#define SMAA_THRESHOLD 0.15\n" - "#define SMAA_MAX_SEARCH_STEPS 4\n" - "#define SMAA_DISABLE_DIAG_DETECTION\n" - "#define SMAA_DISABLE_CORNER_DETECTION\n" + " #define SMAA_THRESHOLD 0.15\n" + " #define SMAA_MAX_SEARCH_STEPS 4\n" + " #define SMAA_DISABLE_DIAG_DETECTION\n" + " #define SMAA_DISABLE_CORNER_DETECTION\n" "#elif defined(SMAA_PRESET_MEDIUM)\n" - "#define SMAA_THRESHOLD 0.1\n" - "#define SMAA_MAX_SEARCH_STEPS 8\n" - "#define SMAA_DISABLE_DIAG_DETECTION\n" - "#define SMAA_DISABLE_CORNER_DETECTION\n" + " #define SMAA_THRESHOLD 0.1\n" + " #define SMAA_MAX_SEARCH_STEPS 8\n" + " #define SMAA_DISABLE_DIAG_DETECTION\n" + " #define SMAA_DISABLE_CORNER_DETECTION\n" "#elif defined(SMAA_PRESET_HIGH)\n" - "#define SMAA_THRESHOLD 0.1\n" - "#define SMAA_MAX_SEARCH_STEPS 16\n" - "#define SMAA_MAX_SEARCH_STEPS_DIAG 8\n" - "#define SMAA_CORNER_ROUNDING 25\n" + " #define SMAA_THRESHOLD 0.1\n" + " #define SMAA_MAX_SEARCH_STEPS 16\n" + " #define SMAA_MAX_SEARCH_STEPS_DIAG 8\n" + " #define SMAA_CORNER_ROUNDING 25\n" "#elif defined(SMAA_PRESET_ULTRA)\n" - "#define SMAA_THRESHOLD 0.05\n" - "#define SMAA_MAX_SEARCH_STEPS 32\n" - "#define SMAA_MAX_SEARCH_STEPS_DIAG 16\n" - "#define SMAA_CORNER_ROUNDING 25\n" + " #define SMAA_THRESHOLD 0.05\n" + " #define SMAA_MAX_SEARCH_STEPS 32\n" + " #define SMAA_MAX_SEARCH_STEPS_DIAG 16\n" + " #define SMAA_CORNER_ROUNDING 25\n" "#endif\n" "\n" "//-----------------------------------------------------------------------------\n" @@ -699,7 +713,7 @@ static const cgShaderDef_t cg_renderprogs[] = "/**\n" " * SMAA_THRESHOLD specifies the threshold or sensitivity to edges.\n" " * Lowering this value you will be able to detect more edges at the expense of\n" - " * performance. \n" + " * performance.\n" " *\n" " * Range: [0, 0.5]\n" " * 0.1 is a reasonable value, and allows to catch most visible edges.\n" @@ -709,16 +723,16 @@ static const cgShaderDef_t cg_renderprogs[] = " * contrast edges are properly filtered by just 2x.\n" " */\n" "#ifndef SMAA_THRESHOLD\n" - "#define SMAA_THRESHOLD 0.1\n" + " #define SMAA_THRESHOLD 0.1\n" "#endif\n" "\n" "/**\n" " * SMAA_DEPTH_THRESHOLD specifies the threshold for depth edge detection.\n" - " * \n" + " *\n" " * Range: depends on the depth range of the scene.\n" " */\n" "#ifndef SMAA_DEPTH_THRESHOLD\n" - "#define SMAA_DEPTH_THRESHOLD (0.1 * SMAA_THRESHOLD)\n" + " #define SMAA_DEPTH_THRESHOLD (0.1 * SMAA_THRESHOLD)\n" "#endif\n" "\n" "/**\n" @@ -732,7 +746,7 @@ static const cgShaderDef_t cg_renderprogs[] = " * Range: [0, 112]\n" " */\n" "#ifndef SMAA_MAX_SEARCH_STEPS\n" - "#define SMAA_MAX_SEARCH_STEPS 16\n" + " #define SMAA_MAX_SEARCH_STEPS 16\n" "#endif\n" "\n" "/**\n" @@ -742,13 +756,13 @@ static const cgShaderDef_t cg_renderprogs[] = " *\n" " * Range: [0, 20]\n" " *\n" - " * On high-end machines it is cheap (between a 0.8x and 0.9x slower for 16 \n" + " * On high-end machines it is cheap (between a 0.8x and 0.9x slower for 16\n" " * steps), but it can have a significant impact on older machines.\n" " *\n" " * Define SMAA_DISABLE_DIAG_DETECTION to disable diagonal processing.\n" " */\n" "#ifndef SMAA_MAX_SEARCH_STEPS_DIAG\n" - "#define SMAA_MAX_SEARCH_STEPS_DIAG 8\n" + " #define SMAA_MAX_SEARCH_STEPS_DIAG 8\n" "#endif\n" "\n" "/**\n" @@ -759,7 +773,7 @@ static const cgShaderDef_t cg_renderprogs[] = " * Define SMAA_DISABLE_CORNER_DETECTION to disable corner processing.\n" " */\n" "#ifndef SMAA_CORNER_ROUNDING\n" - "#define SMAA_CORNER_ROUNDING 25\n" + " #define SMAA_CORNER_ROUNDING 25\n" "#endif\n" "\n" "/**\n" @@ -771,7 +785,7 @@ static const cgShaderDef_t cg_renderprogs[] = " * perceptually contrast in the other neighbors.\n" " */\n" "#ifndef SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR\n" - "#define SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR 2.0\n" + " #define SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR 2.0\n" "#endif\n" "\n" "/**\n" @@ -784,22 +798,22 @@ static const cgShaderDef_t cg_renderprogs[] = " * It locally decreases the luma or color threshold if an edge is found in an\n" " * additional buffer (so the global threshold can be higher).\n" " *\n" - " * This method was developed by Playstation EDGE MLAA team, and used in \n" + " * This method was developed by Playstation EDGE MLAA team, and used in\n" " * Killzone 3, by using the light accumulation buffer. More information here:\n" - " * http://iryoku.com/aacourse/downloads/06-MLAA-on-PS3.pptx \n" + " * http://iryoku.com/aacourse/downloads/06-MLAA-on-PS3.pptx\n" " */\n" "#ifndef SMAA_PREDICATION\n" - "#define SMAA_PREDICATION 0\n" + " #define SMAA_PREDICATION 0\n" "#endif\n" "\n" "/**\n" - " * Threshold to be used in the additional predication buffer. \n" + " * Threshold to be used in the additional predication buffer.\n" " *\n" " * Range: depends on the input, so you'll have to find the magic number that\n" " * works for you.\n" " */\n" "#ifndef SMAA_PREDICATION_THRESHOLD\n" - "#define SMAA_PREDICATION_THRESHOLD 0.01\n" + " #define SMAA_PREDICATION_THRESHOLD 0.01\n" "#endif\n" "\n" "/**\n" @@ -809,7 +823,7 @@ static const cgShaderDef_t cg_renderprogs[] = " * Range: [1, 5]\n" " */\n" "#ifndef SMAA_PREDICATION_SCALE\n" - "#define SMAA_PREDICATION_SCALE 2.0\n" + " #define SMAA_PREDICATION_SCALE 2.0\n" "#endif\n" "\n" "/**\n" @@ -818,7 +832,7 @@ static const cgShaderDef_t cg_renderprogs[] = " * Range: [0, 1]\n" " */\n" "#ifndef SMAA_PREDICATION_STRENGTH\n" - "#define SMAA_PREDICATION_STRENGTH 0.4\n" + " #define SMAA_PREDICATION_STRENGTH 0.4\n" "#endif\n" "\n" "/**\n" @@ -833,7 +847,7 @@ static const cgShaderDef_t cg_renderprogs[] = " * alternative.\n" " */\n" "#ifndef SMAA_REPROJECTION\n" - "#define SMAA_REPROJECTION 0\n" + " #define SMAA_REPROJECTION 0\n" "#endif\n" "\n" "/**\n" @@ -848,7 +862,7 @@ static const cgShaderDef_t cg_renderprogs[] = " * Range: [0, 80]\n" " */\n" "#ifndef SMAA_REPROJECTION_WEIGHT_SCALE\n" - "#define SMAA_REPROJECTION_WEIGHT_SCALE 30.0\n" + " #define SMAA_REPROJECTION_WEIGHT_SCALE 30.0\n" "#endif\n" "\n" "/**\n" @@ -856,29 +870,29 @@ static const cgShaderDef_t cg_renderprogs[] = " * to be compiled separately.\n" " */\n" "#ifndef SMAA_INCLUDE_VS\n" - "#define SMAA_INCLUDE_VS 1\n" + " #define SMAA_INCLUDE_VS 1\n" "#endif\n" "#ifndef SMAA_INCLUDE_PS\n" - "#define SMAA_INCLUDE_PS 1\n" + " #define SMAA_INCLUDE_PS 1\n" "#endif\n" "\n" "//-----------------------------------------------------------------------------\n" "// Texture Access Defines\n" "\n" "#ifndef SMAA_AREATEX_SELECT\n" - "#if defined(SMAA_HLSL_3)\n" - "#define SMAA_AREATEX_SELECT(sample) sample.ra\n" - "#else\n" - "#define SMAA_AREATEX_SELECT(sample) sample.rg\n" - "#endif\n" + " #if defined(SMAA_HLSL_3)\n" + " #define SMAA_AREATEX_SELECT(sample) sample.ra\n" + " #else\n" + " #define SMAA_AREATEX_SELECT(sample) sample.rg\n" + " #endif\n" "#endif\n" "\n" "#ifndef SMAA_SEARCHTEX_SELECT\n" - "#define SMAA_SEARCHTEX_SELECT(sample) sample.r\n" + " #define SMAA_SEARCHTEX_SELECT(sample) sample.r\n" "#endif\n" "\n" "#ifndef SMAA_DECODE_VELOCITY\n" - "#define SMAA_DECODE_VELOCITY(sample) sample.rg\n" + " #define SMAA_DECODE_VELOCITY(sample) sample.rg\n" "#endif\n" "\n" "//-----------------------------------------------------------------------------\n" @@ -896,20 +910,20 @@ static const cgShaderDef_t cg_renderprogs[] = "// Porting Functions\n" "\n" "#if defined(SMAA_HLSL_3)\n" - "#define API_V_DIR(v) v\n" - "#define API_V_COORD(v) v\n" - "#define API_V_BELOW(v1, v2) v1 > v2\n" - "#define API_V_ABOVE(v1, v2) v1 < v2\n" - "#define SMAATexture2D(tex) sampler2D tex\n" - "#define SMAATexturePass2D(tex) tex\n" - "#define SMAASampleLevelZero(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))\n" - "#define SMAASampleLevelZeroPoint(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))\n" - "#define SMAASampleLevelZeroOffset(tex, coord, offset) tex2Dlod(tex, float4(coord + offset * SMAA_RT_METRICS.xy, 0.0, 0.0))\n" - "#define SMAASample(tex, coord) tex2D(tex, coord)\n" - "#define SMAASamplePoint(tex, coord) tex2D(tex, coord)\n" - "#define SMAASampleOffset(tex, coord, offset) tex2D(tex, coord + offset * SMAA_RT_METRICS.xy)\n" - "#define SMAA_FLATTEN [flatten]\n" - "#define SMAA_BRANCH [branch]\n" + " #define API_V_DIR(v) v\n" + " #define API_V_COORD(v) v\n" + " #define API_V_BELOW(v1, v2) v1 > v2\n" + " #define API_V_ABOVE(v1, v2) v1 < v2\n" + " #define SMAATexture2D(tex) sampler2D tex\n" + " #define SMAATexturePass2D(tex) tex\n" + " #define SMAASampleLevelZero(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))\n" + " #define SMAASampleLevelZeroPoint(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))\n" + " #define SMAASampleLevelZeroOffset(tex, coord, offset) tex2Dlod(tex, float4(coord + offset * SMAA_RT_METRICS.xy, 0.0, 0.0))\n" + " #define SMAASample(tex, coord) tex2D(tex, coord)\n" + " #define SMAASamplePoint(tex, coord) tex2D(tex, coord)\n" + " #define SMAASampleOffset(tex, coord, offset) tex2D(tex, coord + offset * SMAA_RT_METRICS.xy)\n" + " #define SMAA_FLATTEN [flatten]\n" + " #define SMAA_BRANCH [branch]\n" "#endif\n" "#if defined(SMAA_HLSL_4) || defined(SMAA_HLSL_4_1)\n" "#define API_V_DIR(v) v\n" @@ -931,51 +945,51 @@ static const cgShaderDef_t cg_renderprogs[] = "#define SMAATexture2DMS2(tex) Texture2DMS tex\n" "#define SMAALoad(tex, pos, sample) tex.Load(pos, sample)\n" "#if defined(SMAA_HLSL_4_1)\n" - "#define SMAAGather(tex, coord) tex.Gather(LinearSampler, coord, 0)\n" + " #define SMAAGather(tex, coord) tex.Gather(LinearSampler, coord, 0)\n" "#endif\n" "#endif\n" "#if defined(SMAA_GLSL_3) || defined(SMAA_GLSL_4)\n" - "//#define API_V_DIR(v) -(v)\n" - "//#define API_V_COORD(v) (1.0 - v)\n" - "//#define API_V_BELOW(v1, v2) v1 < v2\n" - "//#define API_V_ABOVE(v1, v2) v1 > v2\n" + " //#define API_V_DIR(v) -(v)\n" + " //#define API_V_COORD(v) (1.0 - v)\n" + " //#define API_V_BELOW(v1, v2) v1 < v2\n" + " //#define API_V_ABOVE(v1, v2) v1 > v2\n" "\n" - "#define API_V_DIR(v) v\n" - "#define API_V_COORD(v) v\n" - "#define API_V_BELOW(v1, v2) v1 > v2\n" - "#define API_V_ABOVE(v1, v2) v1 < v2\n" + " #define API_V_DIR(v) v\n" + " #define API_V_COORD(v) v\n" + " #define API_V_BELOW(v1, v2) v1 > v2\n" + " #define API_V_ABOVE(v1, v2) v1 < v2\n" "\n" - "#define SMAATexture2D(tex) sampler2D tex\n" - "#define SMAATexturePass2D(tex) tex\n" - "#define SMAASampleLevelZero(tex, coord) textureLod(tex, coord, 0.0)\n" - "#define SMAASampleLevelZeroPoint(tex, coord) textureLod(tex, coord, 0.0)\n" - "#define SMAASampleLevelZeroOffset(tex, coord, offset) textureLodOffset(tex, coord, 0.0, offset)\n" - "#define SMAASample(tex, coord) texture(tex, coord)\n" - "#define SMAASamplePoint(tex, coord) texture(tex, coord)\n" - "#define SMAASampleOffset(tex, coord, offset) texture(tex, coord, offset)\n" - "#define SMAA_FLATTEN\n" - "#define SMAA_BRANCH\n" - "#define lerp(a, b, t) mix(a, b, t)\n" - "#define saturate(a) clamp(a, 0.0, 10.0)\n" - "#if defined(SMAA_GLSL_4)\n" - "#define mad(a, b, c) fma(a, b, c)\n" - "#define SMAAGather(tex, coord) textureGather(tex, coord)\n" - "#else\n" - "#define mad(a, b, c) (a * b + c)\n" - "#endif\n" - "//#define float2 vec2\n" - "//#define float3 vec3\n" - "//#define float4 vec4\n" - "//#define int2 ivec2\n" - "//#define int3 ivec3\n" - "//#define int4 ivec4\n" - "//#define bool2 bvec2\n" - "//#define bool3 bvec3\n" - "//#define bool4 bvec4\n" + " #define SMAATexture2D(tex) sampler2D tex\n" + " #define SMAATexturePass2D(tex) tex\n" + " #define SMAASampleLevelZero(tex, coord) textureLod(tex, coord, 0.0)\n" + " #define SMAASampleLevelZeroPoint(tex, coord) textureLod(tex, coord, 0.0)\n" + " #define SMAASampleLevelZeroOffset(tex, coord, offset) textureLodOffset(tex, coord, 0.0, offset)\n" + " #define SMAASample(tex, coord) texture(tex, coord)\n" + " #define SMAASamplePoint(tex, coord) texture(tex, coord)\n" + " #define SMAASampleOffset(tex, coord, offset) texture(tex, coord, offset)\n" + " #define SMAA_FLATTEN\n" + " #define SMAA_BRANCH\n" + " #define lerp(a, b, t) mix(a, b, t)\n" + " #define saturate(a) clamp(a, 0.0, 10.0)\n" + " #if defined(SMAA_GLSL_4)\n" + " #define mad(a, b, c) fma(a, b, c)\n" + " #define SMAAGather(tex, coord) textureGather(tex, coord)\n" + " #else\n" + " #define mad(a, b, c) (a * b + c)\n" + " #endif\n" + " //#define float2 vec2\n" + " //#define float3 vec3\n" + " //#define float4 vec4\n" + " //#define int2 ivec2\n" + " //#define int3 ivec3\n" + " //#define int4 ivec4\n" + " //#define bool2 bvec2\n" + " //#define bool3 bvec3\n" + " //#define bool4 bvec4\n" "#endif\n" "\n" "#if !defined(SMAA_HLSL_3) && !defined(SMAA_HLSL_4) && !defined(SMAA_HLSL_4_1) && !defined(SMAA_GLSL_3) && !defined(SMAA_GLSL_4) && !defined(SMAA_CUSTOM_SL)\n" - "#error you must define the shading language: SMAA_HLSL_*, SMAA_GLSL_* or SMAA_CUSTOM_SL\n" + " #error you must define the shading language: SMAA_HLSL_*, SMAA_GLSL_* or SMAA_CUSTOM_SL\n" "#endif\n" "\n" "//-----------------------------------------------------------------------------\n" @@ -984,42 +998,52 @@ static const cgShaderDef_t cg_renderprogs[] = "/**\n" " * Gathers current pixel, and the top-left neighbors.\n" " */\n" - "float3 SMAAGatherNeighbours(float2 texcoord,\n" - " float4 offset[3],\n" - " SMAATexture2D(tex)) {\n" - " #ifdef SMAAGather\n" - " return SMAAGather(tex, texcoord + SMAA_RT_METRICS.xy * float2(-0.5, -0.5)).grb;\n" - " #else\n" - " float P = SMAASamplePoint(tex, texcoord).r;\n" - " float Pleft = SMAASamplePoint(tex, offset[0].xy).r;\n" - " float Ptop = SMAASamplePoint(tex, offset[0].zw).r;\n" - " return float3(P, Pleft, Ptop);\n" - " #endif\n" + "float3 SMAAGatherNeighbours( float2 texcoord,\n" + " float4 offset[3],\n" + " SMAATexture2D( tex ) )\n" + "{\n" + "#ifdef SMAAGather\n" + " return SMAAGather( tex, texcoord + SMAA_RT_METRICS.xy * float2( -0.5, -0.5 ) ).grb;\n" + "#else\n" + " float P = SMAASamplePoint( tex, texcoord ).r;\n" + " float Pleft = SMAASamplePoint( tex, offset[0].xy ).r;\n" + " float Ptop = SMAASamplePoint( tex, offset[0].zw ).r;\n" + " return float3( P, Pleft, Ptop );\n" + "#endif\n" "}\n" "\n" "/**\n" " * Adjusts the threshold by means of predication.\n" " */\n" - "float2 SMAACalculatePredicatedThreshold(float2 texcoord,\n" - " float4 offset[3],\n" - " SMAATexture2D(predicationTex)) {\n" - " float3 neighbours = SMAAGatherNeighbours(texcoord, offset, SMAATexturePass2D(predicationTex));\n" - " float2 delta = abs(neighbours.xx - neighbours.yz);\n" - " float2 edges = step(SMAA_PREDICATION_THRESHOLD, delta);\n" - " return SMAA_PREDICATION_SCALE * SMAA_THRESHOLD * (1.0 - SMAA_PREDICATION_STRENGTH * edges);\n" + "float2 SMAACalculatePredicatedThreshold( float2 texcoord,\n" + " float4 offset[3],\n" + " SMAATexture2D( predicationTex ) )\n" + "{\n" + " float3 neighbours = SMAAGatherNeighbours( texcoord, offset, SMAATexturePass2D( predicationTex ) );\n" + " float2 delta = abs( neighbours.xx - neighbours.yz );\n" + " float2 edges = step( SMAA_PREDICATION_THRESHOLD, delta );\n" + " return SMAA_PREDICATION_SCALE * SMAA_THRESHOLD * ( 1.0 - SMAA_PREDICATION_STRENGTH * edges );\n" "}\n" "\n" "/**\n" " * Conditional move:\n" " */\n" - "void SMAAMovc(bool2 cond, inout float2 variable, float2 value) {\n" - " SMAA_FLATTEN if (cond.x) variable.x = value.x;\n" - " SMAA_FLATTEN if (cond.y) variable.y = value.y;\n" + "void SMAAMovc( bool2 cond, inout float2 variable, float2 value )\n" + "{\n" + " SMAA_FLATTEN if( cond.x )\n" + " {\n" + " variable.x = value.x;\n" + " }\n" + " SMAA_FLATTEN if( cond.y )\n" + " {\n" + " variable.y = value.y;\n" + " }\n" "}\n" "\n" - "void SMAAMovc(bool4 cond, inout float4 variable, float4 value) {\n" - " SMAAMovc(cond.xy, variable.xy, value.xy);\n" - " SMAAMovc(cond.zw, variable.zw, value.zw);\n" + "void SMAAMovc( bool4 cond, inout float4 variable, float4 value )\n" + "{\n" + " SMAAMovc( cond.xy, variable.xy, value.xy );\n" + " SMAAMovc( cond.zw, variable.zw, value.zw );\n" "}\n" "\n" "\n" @@ -1030,37 +1054,40 @@ static const cgShaderDef_t cg_renderprogs[] = "/**\n" " * Edge Detection Vertex Shader\n" " */\n" - "void SMAAEdgeDetectionVS(float2 texcoord,\n" - " out float4 offset[3]) {\n" - " offset[0] = mad(SMAA_RT_METRICS.xyxy, float4(-1.0, 0.0, 0.0, API_V_DIR(-1.0)), texcoord.xyxy);\n" - " offset[1] = mad(SMAA_RT_METRICS.xyxy, float4( 1.0, 0.0, 0.0, API_V_DIR(1.0)), texcoord.xyxy);\n" - " offset[2] = mad(SMAA_RT_METRICS.xyxy, float4(-2.0, 0.0, 0.0, API_V_DIR(-2.0)), texcoord.xyxy);\n" + "void SMAAEdgeDetectionVS( float2 texcoord,\n" + " out float4 offset[3] )\n" + "{\n" + " offset[0] = mad( SMAA_RT_METRICS.xyxy, float4( -1.0, 0.0, 0.0, API_V_DIR( -1.0 ) ), texcoord.xyxy );\n" + " offset[1] = mad( SMAA_RT_METRICS.xyxy, float4( 1.0, 0.0, 0.0, API_V_DIR( 1.0 ) ), texcoord.xyxy );\n" + " offset[2] = mad( SMAA_RT_METRICS.xyxy, float4( -2.0, 0.0, 0.0, API_V_DIR( -2.0 ) ), texcoord.xyxy );\n" "}\n" "\n" "/**\n" " * Blend Weight Calculation Vertex Shader\n" " */\n" - "void SMAABlendingWeightCalculationVS(float2 texcoord,\n" - " out float2 pixcoord,\n" - " out float4 offset[3]) {\n" - " pixcoord = texcoord * SMAA_RT_METRICS.zw;\n" + "void SMAABlendingWeightCalculationVS( float2 texcoord,\n" + " out float2 pixcoord,\n" + " out float4 offset[3] )\n" + "{\n" + " pixcoord = texcoord * SMAA_RT_METRICS.zw;\n" "\n" - " // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n" - " offset[0] = mad(SMAA_RT_METRICS.xyxy, float4(-0.25, API_V_DIR(-0.125), 1.25, API_V_DIR(-0.125)), texcoord.xyxy);\n" - " offset[1] = mad(SMAA_RT_METRICS.xyxy, float4(-0.125, API_V_DIR(-0.25), -0.125, API_V_DIR(1.25)), texcoord.xyxy);\n" + " // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n" + " offset[0] = mad( SMAA_RT_METRICS.xyxy, float4( -0.25, API_V_DIR( -0.125 ), 1.25, API_V_DIR( -0.125 ) ), texcoord.xyxy );\n" + " offset[1] = mad( SMAA_RT_METRICS.xyxy, float4( -0.125, API_V_DIR( -0.25 ), -0.125, API_V_DIR( 1.25 ) ), texcoord.xyxy );\n" "\n" - " // And these for the searches, they indicate the ends of the loops:\n" - " offset[2] = mad(SMAA_RT_METRICS.xxyy,\n" - " float4(-2.0, 2.0, API_V_DIR(-2.0), API_V_DIR(2.0)) * float(SMAA_MAX_SEARCH_STEPS),\n" - " float4(offset[0].xz, offset[1].yw));\n" + " // And these for the searches, they indicate the ends of the loops:\n" + " offset[2] = mad( SMAA_RT_METRICS.xxyy,\n" + " float4( -2.0, 2.0, API_V_DIR( -2.0 ), API_V_DIR( 2.0 ) ) * float( SMAA_MAX_SEARCH_STEPS ),\n" + " float4( offset[0].xz, offset[1].yw ) );\n" "}\n" "\n" "/**\n" " * Neighborhood Blending Vertex Shader\n" " */\n" - "void SMAANeighborhoodBlendingVS(float2 texcoord,\n" - " out float4 offset) {\n" - " offset = mad(SMAA_RT_METRICS.xyxy, float4( 1.0, 0.0, 0.0, API_V_DIR(1.0)), texcoord.xyxy);\n" + "void SMAANeighborhoodBlendingVS( float2 texcoord,\n" + " out float4 offset )\n" + "{\n" + " offset = mad( SMAA_RT_METRICS.xyxy, float4( 1.0, 0.0, 0.0, API_V_DIR( 1.0 ) ), texcoord.xyxy );\n" "}\n" "#endif // SMAA_INCLUDE_VS\n" "\n" @@ -1074,57 +1101,60 @@ static const cgShaderDef_t cg_renderprogs[] = " * IMPORTANT NOTICE: luma edge detection requires gamma-corrected colors, and\n" " * thus 'colorTex' should be a non-sRGB texture.\n" " */\n" - "float2 SMAALumaEdgeDetectionPS(float2 texcoord,\n" - " float4 offset[3],\n" - " SMAATexture2D(colorTex)\n" - " #if SMAA_PREDICATION\n" - " , SMAATexture2D(predicationTex)\n" - " #endif\n" - " ) {\n" - " // Calculate the threshold:\n" - " #if SMAA_PREDICATION\n" - " float2 threshold = SMAACalculatePredicatedThreshold(texcoord, offset, SMAATexturePass2D(predicationTex));\n" - " #else\n" - " float2 threshold = float2(SMAA_THRESHOLD, SMAA_THRESHOLD);\n" - " #endif\n" + "float2 SMAALumaEdgeDetectionPS( float2 texcoord,\n" + " float4 offset[3],\n" + " SMAATexture2D( colorTex )\n" + "#if SMAA_PREDICATION\n" + " , SMAATexture2D( predicationTex )\n" + "#endif\n" + " )\n" + "{\n" + " // Calculate the threshold:\n" + "#if SMAA_PREDICATION\n" + " float2 threshold = SMAACalculatePredicatedThreshold( texcoord, offset, SMAATexturePass2D( predicationTex ) );\n" + "#else\n" + " float2 threshold = float2( SMAA_THRESHOLD, SMAA_THRESHOLD );\n" + "#endif\n" "\n" - " // Calculate lumas:\n" - " float3 weights = float3(0.2126, 0.7152, 0.0722);\n" - " float L = dot(SMAASamplePoint(colorTex, texcoord).rgb, weights);\n" + " // Calculate lumas:\n" + " float3 weights = float3( 0.2126, 0.7152, 0.0722 );\n" + " float L = dot( SMAASamplePoint( colorTex, texcoord ).rgb, weights );\n" "\n" - " float Lleft = dot(SMAASamplePoint(colorTex, offset[0].xy).rgb, weights);\n" - " float Ltop = dot(SMAASamplePoint(colorTex, offset[0].zw).rgb, weights);\n" + " float Lleft = dot( SMAASamplePoint( colorTex, offset[0].xy ).rgb, weights );\n" + " float Ltop = dot( SMAASamplePoint( colorTex, offset[0].zw ).rgb, weights );\n" "\n" - " // We do the usual threshold:\n" - " float4 delta;\n" - " delta.xy = abs(L - float2(Lleft, Ltop));\n" - " float2 edges = step(threshold, delta.xy);\n" + " // We do the usual threshold:\n" + " float4 delta;\n" + " delta.xy = abs( L - float2( Lleft, Ltop ) );\n" + " float2 edges = step( threshold, delta.xy );\n" "\n" - " // Then discard if there is no edge:\n" - " if (dot(edges, float2(1.0, 1.0)) == 0.0)\n" - " discard;\n" + " // Then discard if there is no edge:\n" + " if( dot( edges, float2( 1.0, 1.0 ) ) == 0.0 )\n" + " {\n" + " discard;\n" + " }\n" "\n" - " // Calculate right and bottom deltas:\n" - " float Lright = dot(SMAASamplePoint(colorTex, offset[1].xy).rgb, weights);\n" - " float Lbottom = dot(SMAASamplePoint(colorTex, offset[1].zw).rgb, weights);\n" - " delta.zw = abs(L - float2(Lright, Lbottom));\n" + " // Calculate right and bottom deltas:\n" + " float Lright = dot( SMAASamplePoint( colorTex, offset[1].xy ).rgb, weights );\n" + " float Lbottom = dot( SMAASamplePoint( colorTex, offset[1].zw ).rgb, weights );\n" + " delta.zw = abs( L - float2( Lright, Lbottom ) );\n" "\n" - " // Calculate the maximum delta in the direct neighborhood:\n" - " float2 maxDelta = max(delta.xy, delta.zw);\n" + " // Calculate the maximum delta in the direct neighborhood:\n" + " float2 maxDelta = max( delta.xy, delta.zw );\n" "\n" - " // Calculate left-left and top-top deltas:\n" - " float Lleftleft = dot(SMAASamplePoint(colorTex, offset[2].xy).rgb, weights);\n" - " float Ltoptop = dot(SMAASamplePoint(colorTex, offset[2].zw).rgb, weights);\n" - " delta.zw = abs(float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop));\n" + " // Calculate left-left and top-top deltas:\n" + " float Lleftleft = dot( SMAASamplePoint( colorTex, offset[2].xy ).rgb, weights );\n" + " float Ltoptop = dot( SMAASamplePoint( colorTex, offset[2].zw ).rgb, weights );\n" + " delta.zw = abs( float2( Lleft, Ltop ) - float2( Lleftleft, Ltoptop ) );\n" "\n" - " // Calculate the final maximum delta:\n" - " maxDelta = max(maxDelta.xy, delta.zw);\n" - " float finalDelta = max(maxDelta.x, maxDelta.y);\n" + " // Calculate the final maximum delta:\n" + " maxDelta = max( maxDelta.xy, delta.zw );\n" + " float finalDelta = max( maxDelta.x, maxDelta.y );\n" "\n" - " // Local contrast adaptation:\n" - " edges.xy *= step(finalDelta, SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR * delta.xy);\n" + " // Local contrast adaptation:\n" + " edges.xy *= step( finalDelta, SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR * delta.xy );\n" "\n" - " return edges;\n" + " return edges;\n" "}\n" "\n" "/**\n" @@ -1133,84 +1163,90 @@ static const cgShaderDef_t cg_renderprogs[] = " * IMPORTANT NOTICE: color edge detection requires gamma-corrected colors, and\n" " * thus 'colorTex' should be a non-sRGB texture.\n" " */\n" - "float2 SMAAColorEdgeDetectionPS(float2 texcoord,\n" - " float4 offset[3],\n" - " SMAATexture2D(colorTex)\n" - " #if SMAA_PREDICATION\n" - " , SMAATexture2D(predicationTex)\n" - " #endif\n" - " ) {\n" - " // Calculate the threshold:\n" - " #if SMAA_PREDICATION\n" - " float2 threshold = SMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);\n" - " #else\n" - " float2 threshold = float2(SMAA_THRESHOLD, SMAA_THRESHOLD);\n" - " #endif\n" + "float2 SMAAColorEdgeDetectionPS( float2 texcoord,\n" + " float4 offset[3],\n" + " SMAATexture2D( colorTex )\n" + "#if SMAA_PREDICATION\n" + " , SMAATexture2D( predicationTex )\n" + "#endif\n" + " )\n" + "{\n" + " // Calculate the threshold:\n" + "#if SMAA_PREDICATION\n" + " float2 threshold = SMAACalculatePredicatedThreshold( texcoord, offset, predicationTex );\n" + "#else\n" + " float2 threshold = float2( SMAA_THRESHOLD, SMAA_THRESHOLD );\n" + "#endif\n" "\n" - " // Calculate color deltas:\n" - " float4 delta;\n" - " float3 C = SMAASamplePoint(colorTex, texcoord).rgb;\n" + " // Calculate color deltas:\n" + " float4 delta;\n" + " float3 C = SMAASamplePoint( colorTex, texcoord ).rgb;\n" "\n" - " float3 Cleft = SMAASamplePoint(colorTex, offset[0].xy).rgb;\n" - " float3 t = abs(C - Cleft);\n" - " delta.x = max(max(t.r, t.g), t.b);\n" + " float3 Cleft = SMAASamplePoint( colorTex, offset[0].xy ).rgb;\n" + " float3 t = abs( C - Cleft );\n" + " delta.x = max( max( t.r, t.g ), t.b );\n" "\n" - " float3 Ctop = SMAASamplePoint(colorTex, offset[0].zw).rgb;\n" - " t = abs(C - Ctop);\n" - " delta.y = max(max(t.r, t.g), t.b);\n" + " float3 Ctop = SMAASamplePoint( colorTex, offset[0].zw ).rgb;\n" + " t = abs( C - Ctop );\n" + " delta.y = max( max( t.r, t.g ), t.b );\n" "\n" - " // We do the usual threshold:\n" - " float2 edges = step(threshold, delta.xy);\n" + " // We do the usual threshold:\n" + " float2 edges = step( threshold, delta.xy );\n" "\n" - " // Then discard if there is no edge:\n" - " if (dot(edges, float2(1.0, 1.0)) == 0.0)\n" - " discard;\n" + " // Then discard if there is no edge:\n" + " if( dot( edges, float2( 1.0, 1.0 ) ) == 0.0 )\n" + " {\n" + " discard;\n" + " }\n" "\n" - " // Calculate right and bottom deltas:\n" - " float3 Cright = SMAASamplePoint(colorTex, offset[1].xy).rgb;\n" - " t = abs(C - Cright);\n" - " delta.z = max(max(t.r, t.g), t.b);\n" + " // Calculate right and bottom deltas:\n" + " float3 Cright = SMAASamplePoint( colorTex, offset[1].xy ).rgb;\n" + " t = abs( C - Cright );\n" + " delta.z = max( max( t.r, t.g ), t.b );\n" "\n" - " float3 Cbottom = SMAASamplePoint(colorTex, offset[1].zw).rgb;\n" - " t = abs(C - Cbottom);\n" - " delta.w = max(max(t.r, t.g), t.b);\n" + " float3 Cbottom = SMAASamplePoint( colorTex, offset[1].zw ).rgb;\n" + " t = abs( C - Cbottom );\n" + " delta.w = max( max( t.r, t.g ), t.b );\n" "\n" - " // Calculate the maximum delta in the direct neighborhood:\n" - " float2 maxDelta = max(delta.xy, delta.zw);\n" + " // Calculate the maximum delta in the direct neighborhood:\n" + " float2 maxDelta = max( delta.xy, delta.zw );\n" "\n" - " // Calculate left-left and top-top deltas:\n" - " float3 Cleftleft = SMAASamplePoint(colorTex, offset[2].xy).rgb;\n" - " t = abs(C - Cleftleft);\n" - " delta.z = max(max(t.r, t.g), t.b);\n" + " // Calculate left-left and top-top deltas:\n" + " float3 Cleftleft = SMAASamplePoint( colorTex, offset[2].xy ).rgb;\n" + " t = abs( C - Cleftleft );\n" + " delta.z = max( max( t.r, t.g ), t.b );\n" "\n" - " float3 Ctoptop = SMAASamplePoint(colorTex, offset[2].zw).rgb;\n" - " t = abs(C - Ctoptop);\n" - " delta.w = max(max(t.r, t.g), t.b);\n" + " float3 Ctoptop = SMAASamplePoint( colorTex, offset[2].zw ).rgb;\n" + " t = abs( C - Ctoptop );\n" + " delta.w = max( max( t.r, t.g ), t.b );\n" "\n" - " // Calculate the final maximum delta:\n" - " maxDelta = max(maxDelta.xy, delta.zw);\n" - " float finalDelta = max(maxDelta.x, maxDelta.y);\n" + " // Calculate the final maximum delta:\n" + " maxDelta = max( maxDelta.xy, delta.zw );\n" + " float finalDelta = max( maxDelta.x, maxDelta.y );\n" "\n" - " // Local contrast adaptation:\n" - " edges.xy *= step(finalDelta, SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR * delta.xy);\n" + " // Local contrast adaptation:\n" + " edges.xy *= step( finalDelta, SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR * delta.xy );\n" "\n" - " return edges;\n" + " return edges;\n" "}\n" "\n" "/**\n" " * Depth Edge Detection\n" " */\n" - "float2 SMAADepthEdgeDetectionPS(float2 texcoord,\n" - " float4 offset[3],\n" - " SMAATexture2D(depthTex)) {\n" - " float3 neighbours = SMAAGatherNeighbours(texcoord, offset, SMAATexturePass2D(depthTex));\n" - " float2 delta = abs(neighbours.xx - float2(neighbours.y, neighbours.z));\n" - " float2 edges = step(SMAA_DEPTH_THRESHOLD, delta);\n" + "float2 SMAADepthEdgeDetectionPS( float2 texcoord,\n" + " float4 offset[3],\n" + " SMAATexture2D( depthTex ) )\n" + "{\n" + " float3 neighbours = SMAAGatherNeighbours( texcoord, offset, SMAATexturePass2D( depthTex ) );\n" + " float2 delta = abs( neighbours.xx - float2( neighbours.y, neighbours.z ) );\n" + " float2 edges = step( SMAA_DEPTH_THRESHOLD, delta );\n" "\n" - " if (dot(edges, float2(1.0, 1.0)) == 0.0)\n" - " discard;\n" + " if( dot( edges, float2( 1.0, 1.0 ) ) == 0.0 )\n" + " {\n" + " discard;\n" + " }\n" "\n" - " return edges;\n" + " return edges;\n" "}\n" "\n" "//-----------------------------------------------------------------------------\n" @@ -1221,159 +1257,177 @@ static const cgShaderDef_t cg_renderprogs[] = "/**\n" " * Allows to decode two binary values from a bilinear-filtered access.\n" " */\n" - "float2 SMAADecodeDiagBilinearAccess(float2 e) {\n" - " // Bilinear access for fetching 'e' have a 0.25 offset, and we are\n" - " // interested in the R and G edges:\n" - " //\n" - " // +---G---+-------+\n" - " // | x o R x |\n" - " // +-------+-------+\n" - " //\n" - " // Then, if one of these edge is enabled:\n" - " // Red: (0.75 * X + 0.25 * 1) => 0.25 or 1.0\n" - " // Green: (0.75 * 1 + 0.25 * X) => 0.75 or 1.0\n" - " //\n" - " // This function will unpack the values (mad + mul + round):\n" - " // wolframalpha.com: round(x * abs(5 * x - 5 * 0.75)) plot 0 to 1\n" - " e.r = e.r * abs(5.0 * e.r - 5.0 * 0.75);\n" - " return round(e);\n" + "float2 SMAADecodeDiagBilinearAccess( float2 e )\n" + "{\n" + " // Bilinear access for fetching 'e' have a 0.25 offset, and we are\n" + " // interested in the R and G edges:\n" + " //\n" + " // +---G---+-------+\n" + " // | x o R x |\n" + " // +-------+-------+\n" + " //\n" + " // Then, if one of these edge is enabled:\n" + " // Red: (0.75 * X + 0.25 * 1) => 0.25 or 1.0\n" + " // Green: (0.75 * 1 + 0.25 * X) => 0.75 or 1.0\n" + " //\n" + " // This function will unpack the values (mad + mul + round):\n" + " // wolframalpha.com: round(x * abs(5 * x - 5 * 0.75)) plot 0 to 1\n" + " e.r = e.r * abs( 5.0 * e.r - 5.0 * 0.75 );\n" + " return round( e );\n" "}\n" "\n" - "float4 SMAADecodeDiagBilinearAccess(float4 e) {\n" - " e.rb = e.rb * abs(5.0 * e.rb - 5.0 * 0.75);\n" - " return round(e);\n" + "float4 SMAADecodeDiagBilinearAccess( float4 e )\n" + "{\n" + " e.rb = e.rb * abs( 5.0 * e.rb - 5.0 * 0.75 );\n" + " return round( e );\n" "}\n" "\n" "/**\n" " * These functions allows to perform diagonal pattern searches.\n" " */\n" - "float2 SMAASearchDiag1(SMAATexture2D(edgesTex), float2 texcoord, float2 dir, out float2 e) {\n" - " dir.y = API_V_DIR(dir.y);\n" - " float4 coord = float4(texcoord, -1.0, 1.0);\n" - " float3 t = float3(SMAA_RT_METRICS.xy, 1.0);\n" - " while (coord.z < float(SMAA_MAX_SEARCH_STEPS_DIAG - 1) &&\n" - " coord.w > 0.9) {\n" - " coord.xyz = mad(t, float3(dir, 1.0), coord.xyz);\n" - " e = SMAASampleLevelZero(edgesTex, coord.xy).rg;\n" - " coord.w = dot(e, float2(0.5, 0.5));\n" - " }\n" - " return coord.zw;\n" + "float2 SMAASearchDiag1( SMAATexture2D( edgesTex ), float2 texcoord, float2 dir, out float2 e )\n" + "{\n" + " dir.y = API_V_DIR( dir.y );\n" + " float4 coord = float4( texcoord, -1.0, 1.0 );\n" + " float3 t = float3( SMAA_RT_METRICS.xy, 1.0 );\n" + " while( coord.z < float( SMAA_MAX_SEARCH_STEPS_DIAG - 1 ) &&\n" + " coord.w > 0.9 )\n" + " {\n" + " coord.xyz = mad( t, float3( dir, 1.0 ), coord.xyz );\n" + " e = SMAASampleLevelZero( edgesTex, coord.xy ).rg;\n" + " coord.w = dot( e, float2( 0.5, 0.5 ) );\n" + " }\n" + " return coord.zw;\n" "}\n" "\n" - "float2 SMAASearchDiag2(SMAATexture2D(edgesTex), float2 texcoord, float2 dir, out float2 e) {\n" - " dir.y = API_V_DIR(dir.y);\n" - " float4 coord = float4(texcoord, -1.0, 1.0);\n" - " coord.x += 0.25 * SMAA_RT_METRICS.x; // See @SearchDiag2Optimization\n" - " float3 t = float3(SMAA_RT_METRICS.xy, 1.0);\n" - " while (coord.z < float(SMAA_MAX_SEARCH_STEPS_DIAG - 1) &&\n" - " coord.w > 0.9) {\n" - " coord.xyz = mad(t, float3(dir, 1.0), coord.xyz);\n" + "float2 SMAASearchDiag2( SMAATexture2D( edgesTex ), float2 texcoord, float2 dir, out float2 e )\n" + "{\n" + " dir.y = API_V_DIR( dir.y );\n" + " float4 coord = float4( texcoord, -1.0, 1.0 );\n" + " coord.x += 0.25 * SMAA_RT_METRICS.x; // See @SearchDiag2Optimization\n" + " float3 t = float3( SMAA_RT_METRICS.xy, 1.0 );\n" + " while( coord.z < float( SMAA_MAX_SEARCH_STEPS_DIAG - 1 ) &&\n" + " coord.w > 0.9 )\n" + " {\n" + " coord.xyz = mad( t, float3( dir, 1.0 ), coord.xyz );\n" "\n" - " // @SearchDiag2Optimization\n" - " // Fetch both edges at once using bilinear filtering:\n" - " e = SMAASampleLevelZero(edgesTex, coord.xy).rg;\n" - " e = SMAADecodeDiagBilinearAccess(e);\n" + " // @SearchDiag2Optimization\n" + " // Fetch both edges at once using bilinear filtering:\n" + " e = SMAASampleLevelZero( edgesTex, coord.xy ).rg;\n" + " e = SMAADecodeDiagBilinearAccess( e );\n" "\n" - " // Non-optimized version:\n" - " // e.g = SMAASampleLevelZero(edgesTex, coord.xy).g;\n" - " // e.r = SMAASampleLevelZeroOffset(edgesTex, coord.xy, int2(1, 0)).r;\n" + " // Non-optimized version:\n" + " // e.g = SMAASampleLevelZero(edgesTex, coord.xy).g;\n" + " // e.r = SMAASampleLevelZeroOffset(edgesTex, coord.xy, int2(1, 0)).r;\n" "\n" - " coord.w = dot(e, float2(0.5, 0.5));\n" - " }\n" - " return coord.zw;\n" + " coord.w = dot( e, float2( 0.5, 0.5 ) );\n" + " }\n" + " return coord.zw;\n" "}\n" "\n" - "/** \n" + "/**\n" " * Similar to SMAAArea, this calculates the area corresponding to a certain\n" " * diagonal distance and crossing edges 'e'.\n" " */\n" - "float2 SMAAAreaDiag(SMAATexture2D(areaTex), float2 dist, float2 e, float offset) {\n" - " float2 texcoord = mad(float2(SMAA_AREATEX_MAX_DISTANCE_DIAG, SMAA_AREATEX_MAX_DISTANCE_DIAG), e, dist);\n" + "float2 SMAAAreaDiag( SMAATexture2D( areaTex ), float2 dist, float2 e, float offset )\n" + "{\n" + " float2 texcoord = mad( float2( SMAA_AREATEX_MAX_DISTANCE_DIAG, SMAA_AREATEX_MAX_DISTANCE_DIAG ), e, dist );\n" "\n" - " // We do a scale and bias for mapping to texel space:\n" - " texcoord = mad(SMAA_AREATEX_PIXEL_SIZE, texcoord, 0.5 * SMAA_AREATEX_PIXEL_SIZE);\n" + " // We do a scale and bias for mapping to texel space:\n" + " texcoord = mad( SMAA_AREATEX_PIXEL_SIZE, texcoord, 0.5 * SMAA_AREATEX_PIXEL_SIZE );\n" "\n" - " // Diagonal areas are on the second half of the texture:\n" - " texcoord.x += 0.5;\n" + " // Diagonal areas are on the second half of the texture:\n" + " texcoord.x += 0.5;\n" "\n" - " // Move to proper place, according to the subpixel offset:\n" - " texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\n" + " // Move to proper place, according to the subpixel offset:\n" + " texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\n" "\n" - " texcoord.y = API_V_COORD(texcoord.y);\n" + " texcoord.y = API_V_COORD( texcoord.y );\n" "\n" - " // Do it!\n" - " return SMAA_AREATEX_SELECT(SMAASampleLevelZero(areaTex, texcoord));\n" + " // Do it!\n" + " return SMAA_AREATEX_SELECT( SMAASampleLevelZero( areaTex, texcoord ) );\n" "}\n" "\n" "/**\n" " * This searches for diagonal patterns and returns the corresponding weights.\n" " */\n" - "float2 SMAACalculateDiagWeights(SMAATexture2D(edgesTex), SMAATexture2D(areaTex), float2 texcoord, float2 e, float4 subsampleIndices) {\n" - " float2 weights = float2(0.0, 0.0);\n" + "float2 SMAACalculateDiagWeights( SMAATexture2D( edgesTex ), SMAATexture2D( areaTex ), float2 texcoord, float2 e, float4 subsampleIndices )\n" + "{\n" + " float2 weights = float2( 0.0, 0.0 );\n" "\n" - " // Search for the line ends:\n" - " float4 d;\n" - " float2 end;\n" - " if (e.r > 0.0) {\n" - " d.xz = SMAASearchDiag1(SMAATexturePass2D(edgesTex), texcoord, float2(-1.0, 1.0), end);\n" - " d.x += float(end.y > 0.9);\n" - " } else\n" - " d.xz = float2(0.0, 0.0);\n" - " d.yw = SMAASearchDiag1(SMAATexturePass2D(edgesTex), texcoord, float2(1.0, -1.0), end);\n" + " // Search for the line ends:\n" + " float4 d;\n" + " float2 end;\n" + " if( e.r > 0.0 )\n" + " {\n" + " d.xz = SMAASearchDiag1( SMAATexturePass2D( edgesTex ), texcoord, float2( -1.0, 1.0 ), end );\n" + " d.x += float( end.y > 0.9 );\n" + " }\n" + " else\n" + " {\n" + " d.xz = float2( 0.0, 0.0 );\n" + " }\n" + " d.yw = SMAASearchDiag1( SMAATexturePass2D( edgesTex ), texcoord, float2( 1.0, -1.0 ), end );\n" "\n" - " SMAA_BRANCH\n" - " if (d.x + d.y > 2.0) { // d.x + d.y + 1 > 3\n" - " // Fetch the crossing edges:\n" - " float4 coords = mad(float4(-d.x + 0.25, API_V_DIR(d.x), d.y, API_V_DIR(-d.y - 0.25)), SMAA_RT_METRICS.xyxy, texcoord.xyxy);\n" - " float4 c;\n" - " c.xy = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-1, 0)).rg;\n" - " c.zw = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1, 0)).rg;\n" - " c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw);\n" + " SMAA_BRANCH\n" + " if( d.x + d.y > 2.0 ) // d.x + d.y + 1 > 3\n" + " {\n" + " // Fetch the crossing edges:\n" + " float4 coords = mad( float4( -d.x + 0.25, API_V_DIR( d.x ), d.y, API_V_DIR( -d.y - 0.25 ) ), SMAA_RT_METRICS.xyxy, texcoord.xyxy );\n" + " float4 c;\n" + " c.xy = SMAASampleLevelZeroOffset( edgesTex, coords.xy, int2( -1, 0 ) ).rg;\n" + " c.zw = SMAASampleLevelZeroOffset( edgesTex, coords.zw, int2( 1, 0 ) ).rg;\n" + " c.yxwz = SMAADecodeDiagBilinearAccess( c.xyzw );\n" "\n" - " // Non-optimized version:\n" - " // float4 coords = mad(float4(-d.x, d.x, d.y, -d.y), SMAA_RT_METRICS.xyxy, texcoord.xyxy);\n" - " // float4 c;\n" - " // c.x = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-1, 0)).g;\n" - " // c.y = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2( 0, 0)).r;\n" - " // c.z = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1, 0)).g;\n" - " // c.w = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1, -1)).r;\n" + " // Non-optimized version:\n" + " // float4 coords = mad(float4(-d.x, d.x, d.y, -d.y), SMAA_RT_METRICS.xyxy, texcoord.xyxy);\n" + " // float4 c;\n" + " // c.x = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-1, 0)).g;\n" + " // c.y = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2( 0, 0)).r;\n" + " // c.z = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1, 0)).g;\n" + " // c.w = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1, -1)).r;\n" "\n" - " // Merge crossing edges at each side into a single value:\n" - " float2 cc = mad(float2(2.0, 2.0), c.xz, c.yw);\n" + " // Merge crossing edges at each side into a single value:\n" + " float2 cc = mad( float2( 2.0, 2.0 ), c.xz, c.yw );\n" "\n" - " // Remove the crossing edge if we didn't found the end of the line:\n" - " SMAAMovc(bool2(step(0.9, d.zw)), cc, float2(0.0, 0.0));\n" + " // Remove the crossing edge if we didn't found the end of the line:\n" + " SMAAMovc( bool2( step( 0.9, d.zw ) ), cc, float2( 0.0, 0.0 ) );\n" "\n" - " // Fetch the areas for this line:\n" - " weights += SMAAAreaDiag(SMAATexturePass2D(areaTex), d.xy, cc, subsampleIndices.z);\n" - " }\n" + " // Fetch the areas for this line:\n" + " weights += SMAAAreaDiag( SMAATexturePass2D( areaTex ), d.xy, cc, subsampleIndices.z );\n" + " }\n" "\n" - " // Search for the line ends:\n" - " d.xz = SMAASearchDiag2(SMAATexturePass2D(edgesTex), texcoord, float2(-1.0, -1.0), end);\n" - " if (SMAASampleLevelZeroOffset(edgesTex, texcoord, int2(1, 0)).r > 0.0) {\n" - " d.yw = SMAASearchDiag2(SMAATexturePass2D(edgesTex), texcoord, float2(1.0, 1.0), end);\n" - " d.y += float(end.y > 0.9);\n" - " } else\n" - " d.yw = float2(0.0, 0.0);\n" + " // Search for the line ends:\n" + " d.xz = SMAASearchDiag2( SMAATexturePass2D( edgesTex ), texcoord, float2( -1.0, -1.0 ), end );\n" + " if( SMAASampleLevelZeroOffset( edgesTex, texcoord, int2( 1, 0 ) ).r > 0.0 )\n" + " {\n" + " d.yw = SMAASearchDiag2( SMAATexturePass2D( edgesTex ), texcoord, float2( 1.0, 1.0 ), end );\n" + " d.y += float( end.y > 0.9 );\n" + " }\n" + " else\n" + " {\n" + " d.yw = float2( 0.0, 0.0 );\n" + " }\n" "\n" - " SMAA_BRANCH\n" - " if (d.x + d.y > 2.0) { // d.x + d.y + 1 > 3\n" - " // Fetch the crossing edges:\n" - " float4 coords = mad(float4(-d.x, API_V_DIR(-d.x), d.y, API_V_DIR(d.y)), SMAA_RT_METRICS.xyxy, texcoord.xyxy);\n" - " float4 c;\n" - " c.x = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-1, 0)).g;\n" - " c.y = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2( 0, API_V_DIR(-1))).r;\n" - " c.zw = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1, 0)).gr;\n" - " float2 cc = mad(float2(2.0, 2.0), c.xz, c.yw);\n" + " SMAA_BRANCH\n" + " if( d.x + d.y > 2.0 ) // d.x + d.y + 1 > 3\n" + " {\n" + " // Fetch the crossing edges:\n" + " float4 coords = mad( float4( -d.x, API_V_DIR( -d.x ), d.y, API_V_DIR( d.y ) ), SMAA_RT_METRICS.xyxy, texcoord.xyxy );\n" + " float4 c;\n" + " c.x = SMAASampleLevelZeroOffset( edgesTex, coords.xy, int2( -1, 0 ) ).g;\n" + " c.y = SMAASampleLevelZeroOffset( edgesTex, coords.xy, int2( 0, API_V_DIR( -1 ) ) ).r;\n" + " c.zw = SMAASampleLevelZeroOffset( edgesTex, coords.zw, int2( 1, 0 ) ).gr;\n" + " float2 cc = mad( float2( 2.0, 2.0 ), c.xz, c.yw );\n" "\n" - " // Remove the crossing edge if we didn't found the end of the line:\n" - " SMAAMovc(bool2(step(0.9, d.zw)), cc, float2(0.0, 0.0));\n" + " // Remove the crossing edge if we didn't found the end of the line:\n" + " SMAAMovc( bool2( step( 0.9, d.zw ) ), cc, float2( 0.0, 0.0 ) );\n" "\n" - " // Fetch the areas for this line:\n" - " weights += SMAAAreaDiag(SMAATexturePass2D(areaTex), d.xy, cc, subsampleIndices.w).gr;\n" - " }\n" + " // Fetch the areas for this line:\n" + " weights += SMAAAreaDiag( SMAATexturePass2D( areaTex ), d.xy, cc, subsampleIndices.w ).gr;\n" + " }\n" "\n" - " return weights;\n" + " return weights;\n" "}\n" "#endif\n" "\n" @@ -1382,375 +1436,400 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "/**\n" " * This allows to determine how much length should we add in the last step\n" - " * of the searches. It takes the bilinearly interpolated edge (see \n" + " * of the searches. It takes the bilinearly interpolated edge (see\n" " * @PSEUDO_GATHER4), and adds 0, 1 or 2, depending on which edges and\n" " * crossing edges are active.\n" " */\n" - "float SMAASearchLength(SMAATexture2D(searchTex), float2 e, float offset) {\n" - " // The texture is flipped vertically, with left and right cases taking half\n" - " // of the space horizontally:\n" - " float2 scale = SMAA_SEARCHTEX_SIZE * float2(0.5, -1.0);\n" - " float2 bias = SMAA_SEARCHTEX_SIZE * float2(offset, 1.0);\n" + "float SMAASearchLength( SMAATexture2D( searchTex ), float2 e, float offset )\n" + "{\n" + " // The texture is flipped vertically, with left and right cases taking half\n" + " // of the space horizontally:\n" + " float2 scale = SMAA_SEARCHTEX_SIZE * float2( 0.5, -1.0 );\n" + " float2 bias = SMAA_SEARCHTEX_SIZE * float2( offset, 1.0 );\n" "\n" - " // Scale and bias to access texel centers:\n" - " scale += float2(-1.0, 1.0);\n" - " bias += float2( 0.5, -0.5);\n" + " // Scale and bias to access texel centers:\n" + " scale += float2( -1.0, 1.0 );\n" + " bias += float2( 0.5, -0.5 );\n" "\n" - " // Convert from pixel coordinates to texcoords:\n" - " // (We use SMAA_SEARCHTEX_PACKED_SIZE because the texture is cropped)\n" - " scale *= 1.0 / SMAA_SEARCHTEX_PACKED_SIZE;\n" - " bias *= 1.0 / SMAA_SEARCHTEX_PACKED_SIZE;\n" + " // Convert from pixel coordinates to texcoords:\n" + " // (We use SMAA_SEARCHTEX_PACKED_SIZE because the texture is cropped)\n" + " scale *= 1.0 / SMAA_SEARCHTEX_PACKED_SIZE;\n" + " bias *= 1.0 / SMAA_SEARCHTEX_PACKED_SIZE;\n" "\n" - " float2 coord = mad(scale, e, bias);\n" - " coord.y = API_V_COORD(coord.y);\n" + " float2 coord = mad( scale, e, bias );\n" + " coord.y = API_V_COORD( coord.y );\n" "\n" - " // Lookup the search texture:\n" - " return SMAA_SEARCHTEX_SELECT(SMAASampleLevelZero(searchTex, coord));\n" + " // Lookup the search texture:\n" + " return SMAA_SEARCHTEX_SELECT( SMAASampleLevelZero( searchTex, coord ) );\n" "}\n" "\n" "/**\n" " * Horizontal/vertical search functions for the 2nd pass.\n" " */\n" - "float SMAASearchXLeft(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 texcoord, float end) {\n" - " /**\n" - " * @PSEUDO_GATHER4\n" - " * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to\n" - " * sample between edge, thus fetching four edges in a row.\n" - " * Sampling with different offsets in each direction allows to disambiguate\n" - " * which edges are active from the four fetched ones.\n" - " */\n" - " float2 e = float2(0.0, 1.0);\n" - " while (texcoord.x > end && \n" - " e.g > 0.8281 && // Is there some edge not activated?\n" - " e.r == 0.0) { // Or is there a crossing edge that breaks the line?\n" - " e = SMAASampleLevelZero(edgesTex, texcoord).rg;\n" - " texcoord = mad(-float2(2.0, 0.0), SMAA_RT_METRICS.xy, texcoord);\n" - " }\n" + "float SMAASearchXLeft( SMAATexture2D( edgesTex ), SMAATexture2D( searchTex ), float2 texcoord, float end )\n" + "{\n" + " /**\n" + " * @PSEUDO_GATHER4\n" + " * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to\n" + " * sample between edge, thus fetching four edges in a row.\n" + " * Sampling with different offsets in each direction allows to disambiguate\n" + " * which edges are active from the four fetched ones.\n" + " */\n" + " float2 e = float2( 0.0, 1.0 );\n" + " while( texcoord.x > end &&\n" + " e.g > 0.8281 && // Is there some edge not activated?\n" + " e.r == 0.0 ) // Or is there a crossing edge that breaks the line?\n" + " {\n" + " e = SMAASampleLevelZero( edgesTex, texcoord ).rg;\n" + " texcoord = mad( -float2( 2.0, 0.0 ), SMAA_RT_METRICS.xy, texcoord );\n" + " }\n" "\n" - " float offset = mad(-(255.0 / 127.0), SMAASearchLength(SMAATexturePass2D(searchTex), e, 0.0), 3.25);\n" - " return mad(SMAA_RT_METRICS.x, offset, texcoord.x);\n" + " float offset = mad( -( 255.0 / 127.0 ), SMAASearchLength( SMAATexturePass2D( searchTex ), e, 0.0 ), 3.25 );\n" + " return mad( SMAA_RT_METRICS.x, offset, texcoord.x );\n" "\n" - " // Non-optimized version:\n" - " // We correct the previous (-0.25, -0.125) offset we applied:\n" - " // texcoord.x += 0.25 * SMAA_RT_METRICS.x;\n" + " // Non-optimized version:\n" + " // We correct the previous (-0.25, -0.125) offset we applied:\n" + " // texcoord.x += 0.25 * SMAA_RT_METRICS.x;\n" "\n" - " // The searches are bias by 1, so adjust the coords accordingly:\n" - " // texcoord.x += SMAA_RT_METRICS.x;\n" + " // The searches are bias by 1, so adjust the coords accordingly:\n" + " // texcoord.x += SMAA_RT_METRICS.x;\n" "\n" - " // Disambiguate the length added by the last step:\n" - " // texcoord.x += 2.0 * SMAA_RT_METRICS.x; // Undo last step\n" - " // texcoord.x -= SMAA_RT_METRICS.x * (255.0 / 127.0) * SMAASearchLength(SMAATexturePass2D(searchTex), e, 0.0);\n" - " // return mad(SMAA_RT_METRICS.x, offset, texcoord.x);\n" + " // Disambiguate the length added by the last step:\n" + " // texcoord.x += 2.0 * SMAA_RT_METRICS.x; // Undo last step\n" + " // texcoord.x -= SMAA_RT_METRICS.x * (255.0 / 127.0) * SMAASearchLength(SMAATexturePass2D(searchTex), e, 0.0);\n" + " // return mad(SMAA_RT_METRICS.x, offset, texcoord.x);\n" "}\n" "\n" - "float SMAASearchXRight(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 texcoord, float end) {\n" - " float2 e = float2(0.0, 1.0);\n" - " while (texcoord.x < end && \n" - " e.g > 0.8281 && // Is there some edge not activated?\n" - " e.r == 0.0) { // Or is there a crossing edge that breaks the line?\n" - " e = SMAASampleLevelZero(edgesTex, texcoord).rg;\n" - " texcoord = mad(float2(2.0, 0.0), SMAA_RT_METRICS.xy, texcoord);\n" - " }\n" - " float offset = mad(-(255.0 / 127.0), SMAASearchLength(SMAATexturePass2D(searchTex), e, 0.5), 3.25);\n" - " return mad(-SMAA_RT_METRICS.x, offset, texcoord.x);\n" + "float SMAASearchXRight( SMAATexture2D( edgesTex ), SMAATexture2D( searchTex ), float2 texcoord, float end )\n" + "{\n" + " float2 e = float2( 0.0, 1.0 );\n" + " while( texcoord.x < end &&\n" + " e.g > 0.8281 && // Is there some edge not activated?\n" + " e.r == 0.0 ) // Or is there a crossing edge that breaks the line?\n" + " {\n" + " e = SMAASampleLevelZero( edgesTex, texcoord ).rg;\n" + " texcoord = mad( float2( 2.0, 0.0 ), SMAA_RT_METRICS.xy, texcoord );\n" + " }\n" + " float offset = mad( -( 255.0 / 127.0 ), SMAASearchLength( SMAATexturePass2D( searchTex ), e, 0.5 ), 3.25 );\n" + " return mad( -SMAA_RT_METRICS.x, offset, texcoord.x );\n" "}\n" "\n" - "float SMAASearchYUp(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 texcoord, float end) {\n" - " float2 e = float2(1.0, 0.0);\n" - " while (API_V_BELOW(texcoord.y, end) && \n" - " e.r > 0.8281 && // Is there some edge not activated?\n" - " e.g == 0.0) { // Or is there a crossing edge that breaks the line?\n" - " e = SMAASampleLevelZero(edgesTex, texcoord).rg;\n" - " texcoord = mad(-float2(0.0, API_V_DIR(2.0)), SMAA_RT_METRICS.xy, texcoord);\n" - " }\n" - " float offset = mad(-(255.0 / 127.0), SMAASearchLength(SMAATexturePass2D(searchTex), e.gr, 0.0), 3.25);\n" - " return mad(SMAA_RT_METRICS.y, API_V_DIR(offset), texcoord.y);\n" + "float SMAASearchYUp( SMAATexture2D( edgesTex ), SMAATexture2D( searchTex ), float2 texcoord, float end )\n" + "{\n" + " float2 e = float2( 1.0, 0.0 );\n" + " while( API_V_BELOW( texcoord.y, end ) &&\n" + " e.r > 0.8281 && // Is there some edge not activated?\n" + " e.g == 0.0 ) // Or is there a crossing edge that breaks the line?\n" + " {\n" + " e = SMAASampleLevelZero( edgesTex, texcoord ).rg;\n" + " texcoord = mad( -float2( 0.0, API_V_DIR( 2.0 ) ), SMAA_RT_METRICS.xy, texcoord );\n" + " }\n" + " float offset = mad( -( 255.0 / 127.0 ), SMAASearchLength( SMAATexturePass2D( searchTex ), e.gr, 0.0 ), 3.25 );\n" + " return mad( SMAA_RT_METRICS.y, API_V_DIR( offset ), texcoord.y );\n" "}\n" "\n" - "float SMAASearchYDown(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 texcoord, float end) {\n" - " float2 e = float2(1.0, 0.0);\n" - " while (API_V_ABOVE(texcoord.y, end) && \n" - " e.r > 0.8281 && // Is there some edge not activated?\n" - " e.g == 0.0) { // Or is there a crossing edge that breaks the line?\n" - " e = SMAASampleLevelZero(edgesTex, texcoord).rg;\n" - " texcoord = mad(float2(0.0, API_V_DIR(2.0)), SMAA_RT_METRICS.xy, texcoord);\n" - " }\n" - " float offset = mad(-(255.0 / 127.0), SMAASearchLength(SMAATexturePass2D(searchTex), e.gr, 0.5), 3.25);\n" - " return mad(-SMAA_RT_METRICS.y, API_V_DIR(offset), texcoord.y);\n" + "float SMAASearchYDown( SMAATexture2D( edgesTex ), SMAATexture2D( searchTex ), float2 texcoord, float end )\n" + "{\n" + " float2 e = float2( 1.0, 0.0 );\n" + " while( API_V_ABOVE( texcoord.y, end ) &&\n" + " e.r > 0.8281 && // Is there some edge not activated?\n" + " e.g == 0.0 ) // Or is there a crossing edge that breaks the line?\n" + " {\n" + " e = SMAASampleLevelZero( edgesTex, texcoord ).rg;\n" + " texcoord = mad( float2( 0.0, API_V_DIR( 2.0 ) ), SMAA_RT_METRICS.xy, texcoord );\n" + " }\n" + " float offset = mad( -( 255.0 / 127.0 ), SMAASearchLength( SMAATexturePass2D( searchTex ), e.gr, 0.5 ), 3.25 );\n" + " return mad( -SMAA_RT_METRICS.y, API_V_DIR( offset ), texcoord.y );\n" "}\n" "\n" - "/** \n" + "/**\n" " * Ok, we have the distance and both crossing edges. So, what are the areas\n" " * at each side of current edge?\n" " */\n" - "float2 SMAAArea(SMAATexture2D(areaTex), float2 dist, float e1, float e2, float offset) {\n" - " // Rounding prevents precision errors of bilinear filtering:\n" - " float2 texcoord = mad(float2(SMAA_AREATEX_MAX_DISTANCE, SMAA_AREATEX_MAX_DISTANCE), round(4.0 * float2(e1, e2)), dist);\n" - " \n" - " // We do a scale and bias for mapping to texel space:\n" - " texcoord = mad(SMAA_AREATEX_PIXEL_SIZE, texcoord, 0.5 * SMAA_AREATEX_PIXEL_SIZE);\n" + "float2 SMAAArea( SMAATexture2D( areaTex ), float2 dist, float e1, float e2, float offset )\n" + "{\n" + " // Rounding prevents precision errors of bilinear filtering:\n" + " float2 texcoord = mad( float2( SMAA_AREATEX_MAX_DISTANCE, SMAA_AREATEX_MAX_DISTANCE ), round( 4.0 * float2( e1, e2 ) ), dist );\n" "\n" - " // Move to proper place, according to the subpixel offset:\n" - " texcoord.y = mad(SMAA_AREATEX_SUBTEX_SIZE, offset, texcoord.y);\n" + " // We do a scale and bias for mapping to texel space:\n" + " texcoord = mad( SMAA_AREATEX_PIXEL_SIZE, texcoord, 0.5 * SMAA_AREATEX_PIXEL_SIZE );\n" "\n" - " texcoord.y = API_V_COORD(texcoord.y);\n" + " // Move to proper place, according to the subpixel offset:\n" + " texcoord.y = mad( SMAA_AREATEX_SUBTEX_SIZE, offset, texcoord.y );\n" "\n" - " // Do it!\n" - " return SMAA_AREATEX_SELECT(SMAASampleLevelZero(areaTex, texcoord));\n" + " texcoord.y = API_V_COORD( texcoord.y );\n" + "\n" + " // Do it!\n" + " return SMAA_AREATEX_SELECT( SMAASampleLevelZero( areaTex, texcoord ) );\n" "}\n" "\n" "//-----------------------------------------------------------------------------\n" "// Corner Detection Functions\n" "\n" - "void SMAADetectHorizontalCornerPattern(SMAATexture2D(edgesTex), inout float2 weights, float4 texcoord, float2 d) {\n" - " #if !defined(SMAA_DISABLE_CORNER_DETECTION)\n" - " float2 leftRight = step(d.xy, d.yx);\n" - " float2 rounding = (1.0 - SMAA_CORNER_ROUNDING_NORM) * leftRight;\n" + "void SMAADetectHorizontalCornerPattern( SMAATexture2D( edgesTex ), inout float2 weights, float4 texcoord, float2 d )\n" + "{\n" + "#if !defined(SMAA_DISABLE_CORNER_DETECTION)\n" + " float2 leftRight = step( d.xy, d.yx );\n" + " float2 rounding = ( 1.0 - SMAA_CORNER_ROUNDING_NORM ) * leftRight;\n" "\n" - " rounding /= leftRight.x + leftRight.y; // Reduce blending for pixels in the center of a line.\n" + " rounding /= leftRight.x + leftRight.y; // Reduce blending for pixels in the center of a line.\n" "\n" - " float2 factor = float2(1.0, 1.0);\n" - " factor.x -= rounding.x * SMAASampleLevelZeroOffset(edgesTex, texcoord.xy, int2(0, API_V_DIR(1))).r;\n" - " factor.x -= rounding.y * SMAASampleLevelZeroOffset(edgesTex, texcoord.zw, int2(1, API_V_DIR(1))).r;\n" - " factor.y -= rounding.x * SMAASampleLevelZeroOffset(edgesTex, texcoord.xy, int2(0, API_V_DIR(-2))).r;\n" - " factor.y -= rounding.y * SMAASampleLevelZeroOffset(edgesTex, texcoord.zw, int2(1, API_V_DIR(-2))).r;\n" + " float2 factor = float2( 1.0, 1.0 );\n" + " factor.x -= rounding.x * SMAASampleLevelZeroOffset( edgesTex, texcoord.xy, int2( 0, API_V_DIR( 1 ) ) ).r;\n" + " factor.x -= rounding.y * SMAASampleLevelZeroOffset( edgesTex, texcoord.zw, int2( 1, API_V_DIR( 1 ) ) ).r;\n" + " factor.y -= rounding.x * SMAASampleLevelZeroOffset( edgesTex, texcoord.xy, int2( 0, API_V_DIR( -2 ) ) ).r;\n" + " factor.y -= rounding.y * SMAASampleLevelZeroOffset( edgesTex, texcoord.zw, int2( 1, API_V_DIR( -2 ) ) ).r;\n" "\n" - " weights *= saturate(factor);\n" - " #endif\n" + " weights *= saturate( factor );\n" + "#endif\n" "}\n" "\n" - "void SMAADetectVerticalCornerPattern(SMAATexture2D(edgesTex), inout float2 weights, float4 texcoord, float2 d) {\n" - " #if !defined(SMAA_DISABLE_CORNER_DETECTION)\n" - " float2 leftRight = step(d.xy, d.yx);\n" - " float2 rounding = (1.0 - SMAA_CORNER_ROUNDING_NORM) * leftRight;\n" + "void SMAADetectVerticalCornerPattern( SMAATexture2D( edgesTex ), inout float2 weights, float4 texcoord, float2 d )\n" + "{\n" + "#if !defined(SMAA_DISABLE_CORNER_DETECTION)\n" + " float2 leftRight = step( d.xy, d.yx );\n" + " float2 rounding = ( 1.0 - SMAA_CORNER_ROUNDING_NORM ) * leftRight;\n" "\n" - " rounding /= leftRight.x + leftRight.y;\n" + " rounding /= leftRight.x + leftRight.y;\n" "\n" - " float2 factor = float2(1.0, 1.0);\n" - " factor.x -= rounding.x * SMAASampleLevelZeroOffset(edgesTex, texcoord.xy, int2( 1, 0)).g;\n" - " factor.x -= rounding.y * SMAASampleLevelZeroOffset(edgesTex, texcoord.zw, int2( 1, API_V_DIR(1))).g;\n" - " factor.y -= rounding.x * SMAASampleLevelZeroOffset(edgesTex, texcoord.xy, int2(-2, 0)).g;\n" - " factor.y -= rounding.y * SMAASampleLevelZeroOffset(edgesTex, texcoord.zw, int2(-2, API_V_DIR(1))).g;\n" + " float2 factor = float2( 1.0, 1.0 );\n" + " factor.x -= rounding.x * SMAASampleLevelZeroOffset( edgesTex, texcoord.xy, int2( 1, 0 ) ).g;\n" + " factor.x -= rounding.y * SMAASampleLevelZeroOffset( edgesTex, texcoord.zw, int2( 1, API_V_DIR( 1 ) ) ).g;\n" + " factor.y -= rounding.x * SMAASampleLevelZeroOffset( edgesTex, texcoord.xy, int2( -2, 0 ) ).g;\n" + " factor.y -= rounding.y * SMAASampleLevelZeroOffset( edgesTex, texcoord.zw, int2( -2, API_V_DIR( 1 ) ) ).g;\n" "\n" - " weights *= saturate(factor);\n" - " #endif\n" + " weights *= saturate( factor );\n" + "#endif\n" "}\n" "\n" "//-----------------------------------------------------------------------------\n" "// Blending Weight Calculation Pixel Shader (Second Pass)\n" "\n" - "float4 SMAABlendingWeightCalculationPS(float2 texcoord,\n" - " float2 pixcoord,\n" - " float4 offset[3],\n" - " SMAATexture2D(edgesTex),\n" - " SMAATexture2D(areaTex),\n" - " SMAATexture2D(searchTex),\n" - " float4 subsampleIndices) { // Just pass zero for SMAA 1x, see @SUBSAMPLE_INDICES.\n" - " float4 weights = float4(0.0, 0.0, 0.0, 0.0);\n" + "float4 SMAABlendingWeightCalculationPS( float2 texcoord,\n" + " float2 pixcoord,\n" + " float4 offset[3],\n" + " SMAATexture2D( edgesTex ),\n" + " SMAATexture2D( areaTex ),\n" + " SMAATexture2D( searchTex ),\n" + " float4 subsampleIndices ) // Just pass zero for SMAA 1x, see @SUBSAMPLE_INDICES.\n" + "{\n" + " float4 weights = float4( 0.0, 0.0, 0.0, 0.0 );\n" "\n" - " float2 e = SMAASample(edgesTex, texcoord).rg;\n" + " float2 e = SMAASample( edgesTex, texcoord ).rg;\n" "\n" - " SMAA_BRANCH\n" - " if (e.g > 0.0) { // Edge at north\n" - " #if !defined(SMAA_DISABLE_DIAG_DETECTION)\n" - " // Diagonals have both north and west edges, so searching for them in\n" - " // one of the boundaries is enough.\n" - " weights.rg = SMAACalculateDiagWeights(SMAATexturePass2D(edgesTex), SMAATexturePass2D(areaTex), texcoord, e, subsampleIndices);\n" + " SMAA_BRANCH\n" + " if( e.g > 0.0 ) // Edge at north\n" + " {\n" + "#if !defined(SMAA_DISABLE_DIAG_DETECTION)\n" + " // Diagonals have both north and west edges, so searching for them in\n" + " // one of the boundaries is enough.\n" + " weights.rg = SMAACalculateDiagWeights( SMAATexturePass2D( edgesTex ), SMAATexturePass2D( areaTex ), texcoord, e, subsampleIndices );\n" "\n" - " // We give priority to diagonals, so if we find a diagonal we skip \n" - " // horizontal/vertical processing.\n" - " SMAA_BRANCH\n" - " if (weights.r == -weights.g) { // weights.r + weights.g == 0.0\n" - " #endif\n" + " // We give priority to diagonals, so if we find a diagonal we skip\n" + " // horizontal/vertical processing.\n" + " SMAA_BRANCH\n" + " if( weights.r == -weights.g ) // weights.r + weights.g == 0.0\n" + " {\n" + "#endif\n" "\n" - " float2 d;\n" + " float2 d;\n" "\n" - " // Find the distance to the left:\n" - " float3 coords;\n" - " coords.x = SMAASearchXLeft(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[0].xy, offset[2].x);\n" - " coords.y = offset[1].y; // offset[1].y = texcoord.y - 0.25 * SMAA_RT_METRICS.y (@CROSSING_OFFSET)\n" - " d.x = coords.x;\n" + " // Find the distance to the left:\n" + " float3 coords;\n" + " coords.x = SMAASearchXLeft( SMAATexturePass2D( edgesTex ), SMAATexturePass2D( searchTex ), offset[0].xy, offset[2].x );\n" + " coords.y = offset[1].y; // offset[1].y = texcoord.y - 0.25 * SMAA_RT_METRICS.y (@CROSSING_OFFSET)\n" + " d.x = coords.x;\n" "\n" - " // Now fetch the left crossing edges, two at a time using bilinear\n" - " // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n" - " // discern what value each edge has:\n" - " float e1 = SMAASampleLevelZero(edgesTex, coords.xy).r;\n" + " // Now fetch the left crossing edges, two at a time using bilinear\n" + " // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n" + " // discern what value each edge has:\n" + " float e1 = SMAASampleLevelZero( edgesTex, coords.xy ).r;\n" "\n" - " // Find the distance to the right:\n" - " coords.z = SMAASearchXRight(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[0].zw, offset[2].y);\n" - " d.y = coords.z;\n" + " // Find the distance to the right:\n" + " coords.z = SMAASearchXRight( SMAATexturePass2D( edgesTex ), SMAATexturePass2D( searchTex ), offset[0].zw, offset[2].y );\n" + " d.y = coords.z;\n" "\n" - " // We want the distances to be in pixel units (doing this here allow to\n" - " // better interleave arithmetic and memory accesses):\n" - " d = abs(round(mad(SMAA_RT_METRICS.zz, d, -pixcoord.xx)));\n" + " // We want the distances to be in pixel units (doing this here allow to\n" + " // better interleave arithmetic and memory accesses):\n" + " d = abs( round( mad( SMAA_RT_METRICS.zz, d, -pixcoord.xx ) ) );\n" "\n" - " // SMAAArea below needs a sqrt, as the areas texture is compressed\n" - " // quadratically:\n" - " float2 sqrt_d = sqrt(d);\n" + " // SMAAArea below needs a sqrt, as the areas texture is compressed\n" + " // quadratically:\n" + " float2 sqrt_d = sqrt( d );\n" "\n" - " // Fetch the right crossing edges:\n" - " float e2 = SMAASampleLevelZeroOffset(edgesTex, coords.zy, int2(1, 0)).r;\n" + " // Fetch the right crossing edges:\n" + " float e2 = SMAASampleLevelZeroOffset( edgesTex, coords.zy, int2( 1, 0 ) ).r;\n" "\n" - " // Ok, we know how this pattern looks like, now it is time for getting\n" - " // the actual area:\n" - " weights.rg = SMAAArea(SMAATexturePass2D(areaTex), sqrt_d, e1, e2, subsampleIndices.y);\n" + " // Ok, we know how this pattern looks like, now it is time for getting\n" + " // the actual area:\n" + " weights.rg = SMAAArea( SMAATexturePass2D( areaTex ), sqrt_d, e1, e2, subsampleIndices.y );\n" "\n" - " // Fix corners:\n" - " coords.y = texcoord.y;\n" - " SMAADetectHorizontalCornerPattern(SMAATexturePass2D(edgesTex), weights.rg, coords.xyzy, d);\n" + " // Fix corners:\n" + " coords.y = texcoord.y;\n" + " SMAADetectHorizontalCornerPattern( SMAATexturePass2D( edgesTex ), weights.rg, coords.xyzy, d );\n" "\n" - " #if !defined(SMAA_DISABLE_DIAG_DETECTION)\n" - " } else\n" - " e.r = 0.0; // Skip vertical processing.\n" - " #endif\n" - " }\n" + "#if !defined(SMAA_DISABLE_DIAG_DETECTION)\n" + " }\n" + " else\n" + " {\n" + " e.r = 0.0; // Skip vertical processing.\n" + " }\n" + "#endif\n" + " }\n" "\n" - " SMAA_BRANCH\n" - " if (e.r > 0.0) { // Edge at west\n" - " float2 d;\n" + " SMAA_BRANCH\n" + " if( e.r > 0.0 ) // Edge at west\n" + " {\n" + " float2 d;\n" "\n" - " // Find the distance to the top:\n" - " float3 coords;\n" - " coords.y = SMAASearchYUp(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[1].xy, offset[2].z);\n" - " coords.x = offset[0].x; // offset[1].x = texcoord.x - 0.25 * SMAA_RT_METRICS.x;\n" - " d.x = coords.y;\n" + " // Find the distance to the top:\n" + " float3 coords;\n" + " coords.y = SMAASearchYUp( SMAATexturePass2D( edgesTex ), SMAATexturePass2D( searchTex ), offset[1].xy, offset[2].z );\n" + " coords.x = offset[0].x; // offset[1].x = texcoord.x - 0.25 * SMAA_RT_METRICS.x;\n" + " d.x = coords.y;\n" "\n" - " // Fetch the top crossing edges:\n" - " float e1 = SMAASampleLevelZero(edgesTex, coords.xy).g;\n" + " // Fetch the top crossing edges:\n" + " float e1 = SMAASampleLevelZero( edgesTex, coords.xy ).g;\n" "\n" - " // Find the distance to the bottom:\n" - " coords.z = SMAASearchYDown(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[1].zw, offset[2].w);\n" - " d.y = coords.z;\n" + " // Find the distance to the bottom:\n" + " coords.z = SMAASearchYDown( SMAATexturePass2D( edgesTex ), SMAATexturePass2D( searchTex ), offset[1].zw, offset[2].w );\n" + " d.y = coords.z;\n" "\n" - " // We want the distances to be in pixel units:\n" - " d = abs(round(mad(SMAA_RT_METRICS.ww, d, -pixcoord.yy)));\n" + " // We want the distances to be in pixel units:\n" + " d = abs( round( mad( SMAA_RT_METRICS.ww, d, -pixcoord.yy ) ) );\n" "\n" - " // SMAAArea below needs a sqrt, as the areas texture is compressed \n" - " // quadratically:\n" - " float2 sqrt_d = sqrt(d);\n" + " // SMAAArea below needs a sqrt, as the areas texture is compressed\n" + " // quadratically:\n" + " float2 sqrt_d = sqrt( d );\n" "\n" - " // Fetch the bottom crossing edges:\n" - " float e2 = SMAASampleLevelZeroOffset(edgesTex, coords.xz, int2(0, API_V_DIR(1))).g;\n" + " // Fetch the bottom crossing edges:\n" + " float e2 = SMAASampleLevelZeroOffset( edgesTex, coords.xz, int2( 0, API_V_DIR( 1 ) ) ).g;\n" "\n" - " // Get the area for this direction:\n" - " weights.ba = SMAAArea(SMAATexturePass2D(areaTex), sqrt_d, e1, e2, subsampleIndices.x);\n" + " // Get the area for this direction:\n" + " weights.ba = SMAAArea( SMAATexturePass2D( areaTex ), sqrt_d, e1, e2, subsampleIndices.x );\n" "\n" - " // Fix corners:\n" - " coords.x = texcoord.x;\n" - " SMAADetectVerticalCornerPattern(SMAATexturePass2D(edgesTex), weights.ba, coords.xyxz, d);\n" - " }\n" + " // Fix corners:\n" + " coords.x = texcoord.x;\n" + " SMAADetectVerticalCornerPattern( SMAATexturePass2D( edgesTex ), weights.ba, coords.xyxz, d );\n" + " }\n" "\n" - " return weights;\n" + " return weights;\n" "}\n" "\n" "//-----------------------------------------------------------------------------\n" "// Neighborhood Blending Pixel Shader (Third Pass)\n" "\n" - "float4 SMAANeighborhoodBlendingPS(float2 texcoord,\n" - " float4 offset,\n" - " SMAATexture2D(colorTex),\n" - " SMAATexture2D(blendTex)\n" - " #if SMAA_REPROJECTION\n" - " , SMAATexture2D(velocityTex)\n" - " #endif\n" - " ) {\n" - " // Fetch the blending weights for current pixel:\n" - " float4 a;\n" - " a.x = SMAASample(blendTex, offset.xy).a; // Right\n" - " a.y = SMAASample(blendTex, offset.zw).g; // Top\n" - " a.wz = SMAASample(blendTex, texcoord).xz; // Bottom / Left\n" + "float4 SMAANeighborhoodBlendingPS( float2 texcoord,\n" + " float4 offset,\n" + " SMAATexture2D( colorTex ),\n" + " SMAATexture2D( blendTex )\n" + "#if SMAA_REPROJECTION\n" + " , SMAATexture2D( velocityTex )\n" + "#endif\n" + " )\n" + "{\n" + " // Fetch the blending weights for current pixel:\n" + " float4 a;\n" + " a.x = SMAASample( blendTex, offset.xy ).a; // Right\n" + " a.y = SMAASample( blendTex, offset.zw ).g; // Top\n" + " a.wz = SMAASample( blendTex, texcoord ).xz; // Bottom / Left\n" "\n" - " // Is there any blending weight with a value greater than 0.0?\n" - " SMAA_BRANCH\n" - " if (dot(a, float4(1.0, 1.0, 1.0, 1.0)) < 1e-5) {\n" - " float4 color = SMAASampleLevelZero(colorTex, texcoord);\n" + " // Is there any blending weight with a value greater than 0.0?\n" + " SMAA_BRANCH\n" + " if( dot( a, float4( 1.0, 1.0, 1.0, 1.0 ) ) < 1e-5 )\n" + " {\n" + " float4 color = SMAASampleLevelZero( colorTex, texcoord );\n" "\n" - " #if SMAA_REPROJECTION\n" - " float2 velocity = SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, texcoord));\n" + "#if SMAA_REPROJECTION\n" + " float2 velocity = SMAA_DECODE_VELOCITY( SMAASampleLevelZero( velocityTex, texcoord ) );\n" "\n" - " // Pack velocity into the alpha channel:\n" - " color.a = sqrt(5.0 * length(velocity));\n" - " #endif\n" + " // Pack velocity into the alpha channel:\n" + " color.a = sqrt( 5.0 * length( velocity ) );\n" + "#endif\n" "\n" - " return color;\n" - " } else {\n" - " bool h = max(a.x, a.z) > max(a.y, a.w); // max(horizontal) > max(vertical)\n" + " return color;\n" + " }\n" + " else\n" + " {\n" + " bool h = max( a.x, a.z ) > max( a.y, a.w ); // max(horizontal) > max(vertical)\n" "\n" - " // Calculate the blending offsets:\n" - " float4 blendingOffset = float4(0.0, API_V_DIR(a.y), 0.0, API_V_DIR(a.w));\n" - " float2 blendingWeight = a.yw;\n" - " SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.0, a.z, 0.0));\n" - " SMAAMovc(bool2(h, h), blendingWeight, a.xz);\n" - " blendingWeight /= dot(blendingWeight, float2(1.0, 1.0));\n" + " // Calculate the blending offsets:\n" + " float4 blendingOffset = float4( 0.0, API_V_DIR( a.y ), 0.0, API_V_DIR( a.w ) );\n" + " float2 blendingWeight = a.yw;\n" + " SMAAMovc( bool4( h, h, h, h ), blendingOffset, float4( a.x, 0.0, a.z, 0.0 ) );\n" + " SMAAMovc( bool2( h, h ), blendingWeight, a.xz );\n" + " blendingWeight /= dot( blendingWeight, float2( 1.0, 1.0 ) );\n" "\n" - " // Calculate the texture coordinates:\n" - " float4 blendingCoord = mad(blendingOffset, float4(SMAA_RT_METRICS.xy, -SMAA_RT_METRICS.xy), texcoord.xyxy);\n" + " // Calculate the texture coordinates:\n" + " float4 blendingCoord = mad( blendingOffset, float4( SMAA_RT_METRICS.xy, -SMAA_RT_METRICS.xy ), texcoord.xyxy );\n" "\n" - " // We exploit bilinear filtering to mix current pixel with the chosen\n" - " // neighbor:\n" - " float4 color = blendingWeight.x * SMAASampleLevelZero(colorTex, blendingCoord.xy);\n" - " color += blendingWeight.y * SMAASampleLevelZero(colorTex, blendingCoord.zw);\n" + " // We exploit bilinear filtering to mix current pixel with the chosen\n" + " // neighbor:\n" + " float4 color = blendingWeight.x * SMAASampleLevelZero( colorTex, blendingCoord.xy );\n" + " color += blendingWeight.y * SMAASampleLevelZero( colorTex, blendingCoord.zw );\n" "\n" - " #if SMAA_REPROJECTION\n" - " // Antialias velocity for proper reprojection in a later stage:\n" - " float2 velocity = blendingWeight.x * SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, blendingCoord.xy));\n" - " velocity += blendingWeight.y * SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, blendingCoord.zw));\n" + "#if SMAA_REPROJECTION\n" + " // Antialias velocity for proper reprojection in a later stage:\n" + " float2 velocity = blendingWeight.x * SMAA_DECODE_VELOCITY( SMAASampleLevelZero( velocityTex, blendingCoord.xy ) );\n" + " velocity += blendingWeight.y * SMAA_DECODE_VELOCITY( SMAASampleLevelZero( velocityTex, blendingCoord.zw ) );\n" "\n" - " // Pack velocity into the alpha channel:\n" - " color.a = sqrt(5.0 * length(velocity));\n" - " #endif\n" + " // Pack velocity into the alpha channel:\n" + " color.a = sqrt( 5.0 * length( velocity ) );\n" + "#endif\n" "\n" - " return color;\n" - " }\n" + " return color;\n" + " }\n" "}\n" "\n" "//-----------------------------------------------------------------------------\n" "// Temporal Resolve Pixel Shader (Optional Pass)\n" "\n" - "float4 SMAAResolvePS(float2 texcoord,\n" - " SMAATexture2D(currentColorTex),\n" - " SMAATexture2D(previousColorTex)\n" - " #if SMAA_REPROJECTION\n" - " , SMAATexture2D(velocityTex)\n" - " #endif\n" - " ) {\n" - " #if SMAA_REPROJECTION\n" - " // Velocity is assumed to be calculated for motion blur, so we need to\n" - " // inverse it for reprojection:\n" - " float2 velocity = -SMAA_DECODE_VELOCITY(SMAASamplePoint(velocityTex, texcoord).rg);\n" + "float4 SMAAResolvePS( float2 texcoord,\n" + " SMAATexture2D( currentColorTex ),\n" + " SMAATexture2D( previousColorTex )\n" + "#if SMAA_REPROJECTION\n" + " , SMAATexture2D( velocityTex )\n" + "#endif\n" + " )\n" + "{\n" + "#if SMAA_REPROJECTION\n" + " // Velocity is assumed to be calculated for motion blur, so we need to\n" + " // inverse it for reprojection:\n" + " float2 velocity = -SMAA_DECODE_VELOCITY( SMAASamplePoint( velocityTex, texcoord ).rg );\n" "\n" - " // Fetch current pixel:\n" - " float4 current = SMAASamplePoint(currentColorTex, texcoord);\n" + " // Fetch current pixel:\n" + " float4 current = SMAASamplePoint( currentColorTex, texcoord );\n" "\n" - " // Reproject current coordinates and fetch previous pixel:\n" - " float4 previous = SMAASamplePoint(previousColorTex, texcoord + velocity);\n" + " // Reproject current coordinates and fetch previous pixel:\n" + " float4 previous = SMAASamplePoint( previousColorTex, texcoord + velocity );\n" "\n" - " // Attenuate the previous pixel if the velocity is different:\n" - " float delta = abs(current.a * current.a - previous.a * previous.a) / 5.0;\n" - " float weight = 0.5 * saturate(1.0 - sqrt(delta) * SMAA_REPROJECTION_WEIGHT_SCALE);\n" + " // Attenuate the previous pixel if the velocity is different:\n" + " float delta = abs( current.a * current.a - previous.a * previous.a ) / 5.0;\n" + " float weight = 0.5 * saturate( 1.0 - sqrt( delta ) * SMAA_REPROJECTION_WEIGHT_SCALE );\n" "\n" - " // Blend the pixels according to the calculated weight:\n" - " return lerp(current, previous, weight);\n" - " #else\n" - " // Just blend the pixels:\n" - " float4 current = SMAASamplePoint(currentColorTex, texcoord);\n" - " float4 previous = SMAASamplePoint(previousColorTex, texcoord);\n" - " return lerp(current, previous, 0.5);\n" - " #endif\n" + " // Blend the pixels according to the calculated weight:\n" + " return lerp( current, previous, weight );\n" + "#else\n" + " // Just blend the pixels:\n" + " float4 current = SMAASamplePoint( currentColorTex, texcoord );\n" + " float4 previous = SMAASamplePoint( previousColorTex, texcoord );\n" + " return lerp( current, previous, 0.5 );\n" + "#endif\n" "}\n" "\n" "//-----------------------------------------------------------------------------\n" "// Separate Multisamples Pixel Shader (Optional Pass)\n" "\n" "#ifdef SMAALoad\n" - "void SMAASeparatePS(float4 position,\n" - " float2 texcoord,\n" - " out float4 target0,\n" - " out float4 target1,\n" - " SMAATexture2DMS2(colorTexMS)) {\n" - " int2 pos = int2(position.xy);\n" - " target0 = SMAALoad(colorTexMS, pos, 0);\n" - " target1 = SMAALoad(colorTexMS, pos, 1);\n" + "void SMAASeparatePS( float4 position,\n" + " float2 texcoord,\n" + " out float4 target0,\n" + " out float4 target1,\n" + " SMAATexture2DMS2( colorTexMS ) )\n" + "{\n" + " int2 pos = int2( position.xy );\n" + " target0 = SMAALoad( colorTexMS, pos, 0 );\n" + " target1 = SMAALoad( colorTexMS, pos, 1 );\n" "}\n" "#endif\n" "\n" @@ -1768,7 +1847,7 @@ static const cgShaderDef_t cg_renderprogs[] = "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 2014-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" + "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" @@ -1798,7 +1877,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float a2 = alpha * alpha;\n" " //float tmp = ( hdotN * hdotN ) * ( a2 - 1.0 ) + 1.0;\n" " float tmp = ( hdotN * a2 - hdotN ) * hdotN + 1.0;\n" - " \n" + "\n" " return ( a2 / ( PI * tmp * tmp ) );\n" "}\n" "\n" @@ -1807,7 +1886,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float a2 = alphaG * alphaG;\n" " float tmp = ( hdotN * hdotN ) * ( a2 - 1.0 ) + 1.0;\n" " //tmp *= tmp;\n" - " \n" + "\n" " return ( a2 / ( PI * tmp ) );\n" "}\n" "\n" @@ -1835,7 +1914,7 @@ static const cgShaderDef_t cg_renderprogs[] = "// See Sébastien Lagarde and Charles de Rousiers. 2014. Moving Frostbite to PBR.\n" "float ComputeSpecularAO( float vDotN, float ao, float roughness )\n" "{\n" - " return clamp( pow( vDotN + ao, exp2( -16.0 * roughness - 1.0) ) - 1.0 + ao, 0.0, 1.0 );\n" + " return clamp( pow( vDotN + ao, exp2( -16.0 * roughness - 1.0 ) ) - 1.0 + ao, 0.0, 1.0 );\n" "}\n" "\n" "// Visibility term G( l, v, h )\n" @@ -1843,10 +1922,10 @@ static const cgShaderDef_t cg_renderprogs[] = "float Visibility_Schlick( half vdotN, half ldotN, float alpha )\n" "{\n" " float k = alpha * 0.5;\n" - " \n" + "\n" " float schlickL = ( ldotN * ( 1.0 - k ) + k );\n" " float schlickV = ( vdotN * ( 1.0 - k ) + k );\n" - " \n" + "\n" " return ( 0.25 / ( schlickL * schlickV ) );\n" " //return ( ( schlickL * schlickV ) / ( 4.0 * vdotN * ldotN ) );\n" "}\n" @@ -1860,7 +1939,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " float V1 = ldotN + sqrt( alpha + ( 1.0 - alpha ) * ldotN * ldotN );\n" " float V2 = vdotN + sqrt( alpha + ( 1.0 - alpha ) * vdotN * vdotN );\n" - " \n" + "\n" " // RB: avoid too bright spots\n" " return ( 1.0 / max( V1 * V2, 0.15 ) );\n" "}\n" @@ -1891,7 +1970,7 @@ static const cgShaderDef_t cg_renderprogs[] = " t += float4( 0.0, 0.0, ( 0.015 - 0.75 * 0.04 ) / 0.96, 0.75 );\n" " half a0 = t.x * min( t.y, exp2( -9.28 * vdotN ) ) + t.z;\n" " half a1 = t.w;\n" - " \n" + "\n" " return saturate( a0 + rf0 * ( a1 - a0 ) );\n" "}\n" "\n" @@ -1921,10 +2000,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 2013-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" + "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" @@ -1948,6 +2027,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\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" @@ -1969,8 +2049,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " half4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );\n" "// half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );\n" "// half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );\n" @@ -1995,21 +2077,21 @@ static const cgShaderDef_t cg_renderprogs[] = " half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );\n" "\n" " half3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz ) * 1.5f;\n" - " half3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz ); \n" - " \n" + " half3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz );\n" + "\n" " // RB: http://developer.valvesoftware.com/wiki/Half_Lambert\n" " float halfLdotN = dot3( localNormal, lightVector ) * 0.5 + 0.5;\n" " halfLdotN *= halfLdotN;\n" - " \n" + "\n" " // traditional very dark Lambert light model used in Doom 3\n" " float ldotN = dot3( localNormal, lightVector );\n" - " \n" + "\n" " half3 lightColor = sRGBToLinearRGB( rpAmbientColor.rgb );\n" - " \n" + "\n" " half rim = 1.0f - saturate( hDotN );\n" " half rimPower = 8.0;\n" " half3 rimColor = sRGBToLinearRGB( half3( 0.125 ) * 1.2 ) * lightColor * pow( rim, rimPower );\n" - " \n" + "\n" " //result.color.rgb = localNormal.xyz * 0.5 + 0.5;\n" " result.color.xyz = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor + rimColor ) * fragment.color.rgb;\n" " //result.color = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor + rimColor ) * fragment.color.rgba;\n" @@ -2025,10 +2107,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 2013-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" + "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" @@ -2056,6 +2138,7 @@ static const cgShaderDef_t cg_renderprogs[] = "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" @@ -2076,8 +2159,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord6 : TEXCOORD6;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -2095,25 +2180,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -2197,7 +2282,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " //# calculate normalized vector to viewer in R1\n" " float4 toView = normalize( rpLocalViewOrigin - modelPosition );\n" - " \n" + "\n" " //# add together to become the half angle vector in object space (non-normalized)\n" " float4 halfAngleVector = toLight + toView;\n" "\n" @@ -2216,7 +2301,7 @@ static const cgShaderDef_t cg_renderprogs[] = " //# 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" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" @@ -2258,14 +2343,14 @@ static const cgShaderDef_t cg_renderprogs[] = "#include \"BRDF.inc.hlsl\"\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 samp0 : register(s0); // texture 0 is the per-surface normal map\n" + "uniform sampler2D samp1 : register(s1); // texture 1 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 BRDF LUT\n" - "uniform sampler2D samp4 : register(s4); // texture 5 is SSAO\n" + "uniform sampler2D samp3 : register(s3); // texture 3 is the BRDF LUT\n" + "uniform sampler2D samp4 : register(s4); // texture 4 is SSAO\n" "\n" - "uniform samplerCUBE samp7 : register(s7); // texture 6 is the irradiance cube map\n" - "uniform samplerCUBE samp8 : register(s8); // texture 7 is the radiance cube map\n" + "uniform samplerCUBE samp7 : register(s7); // texture 7 is the irradiance cube map\n" + "uniform samplerCUBE samp8 : register(s8); // texture 8 is the radiance cube map\n" "\n" "struct PS_IN \n" "{\n" @@ -2396,13 +2481,14 @@ static const cgShaderDef_t cg_renderprogs[] = " // evaluate diffuse IBL\n" "\n" " float3 irradiance = texCUBE( samp7, globalNormal ).rgb;\n" - " float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 3.0 );\n" + " float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 1.0 );\n" "\n" " // evaluate specular IBL\n" "\n" - " // should be 4.0\n" + " // should be 8 = numMips - 1, 256^2 = 9 mips \n" " const float MAX_REFLECTION_LOD = 10.0;\n" - " float mip = clamp( ( roughness * MAX_REFLECTION_LOD ) + 0.0, 0.0, 10.0 );\n" + " float mip = clamp( ( roughness * MAX_REFLECTION_LOD ), 0.0, MAX_REFLECTION_LOD );\n" + " //float mip = 0.0;\n" " float3 radiance = textureLod( samp8, reflectionVector, mip ).rgb;\n" "\n" " float2 envBRDF = texture( samp3, float2( max( vDotN, 0.0 ), roughness ) ).rg;\n" @@ -2414,7 +2500,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#endif\n" "\n" " float specAO = ComputeSpecularAO( vDotN, ao, roughness );\n" - " float3 specularLight = radiance * ( kS * envBRDF.x + float3( envBRDF.y ) ) * specAO * ( rpSpecularModifier.xyz * 0.75 );\n" + " float3 specularLight = radiance * ( kS * envBRDF.x + float3( envBRDF.y ) ) * specAO * ( rpSpecularModifier.xyz * 0.5 );\n" "\n" "#if 0\n" " // Marmoset Horizon Fade trick\n" @@ -2446,10 +2532,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 2013-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" + "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" @@ -2477,6 +2563,7 @@ static const cgShaderDef_t cg_renderprogs[] = "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" @@ -2497,8 +2584,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord6 : TEXCOORD6;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -2516,25 +2605,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -2602,7 +2691,7 @@ static const cgShaderDef_t cg_renderprogs[] = " result.texcoord3.x = dot3( toEye, rpModelMatrixX );\n" " result.texcoord3.y = dot3( toEye, rpModelMatrixY );\n" " result.texcoord3.z = dot3( toEye, rpModelMatrixZ );\n" - " \n" + "\n" " result.texcoord4.x = dot3( tangent, rpModelMatrixX );\n" " result.texcoord5.x = dot3( tangent, rpModelMatrixY );\n" " result.texcoord6.x = dot3( tangent, rpModelMatrixZ );\n" @@ -2624,7 +2713,7 @@ static const cgShaderDef_t cg_renderprogs[] = " //# 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" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" @@ -3092,9 +3181,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -3118,6 +3207,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -3129,6 +3219,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -3538,9 +3629,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -3564,6 +3655,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -3575,6 +3667,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -3678,9 +3771,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -3704,6 +3797,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -3715,6 +3809,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -3730,9 +3825,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -3756,6 +3851,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -3768,8 +3864,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -3786,7 +3884,7 @@ static const cgShaderDef_t cg_renderprogs[] = " color.xyz = p;\n" " color.w = 1.0;\n" " color *= rpColor;\n" - " \n" + "\n" " result.color = sRGBAToLinearRGBA( color );\n" "}\n" @@ -3798,9 +3896,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -3824,6 +3922,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -3836,8 +3935,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -3854,9 +3955,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -3880,6 +3981,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -3894,8 +3996,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -3925,10 +4029,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -3952,6 +4056,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -3967,8 +4072,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord1 : TEXCOORD1;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -3988,9 +4095,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4014,6 +4121,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "uniform sampler2D samp1 : register(s1);\n" "\n" @@ -4026,8 +4134,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " result.color = idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;\n" "}\n" "\n" @@ -4040,9 +4150,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4066,6 +4176,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -4080,8 +4191,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord0 : TEXCOORD0;\n" " float2 texcoord1 : TEXCOORD1;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -4105,9 +4218,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4131,6 +4244,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4144,8 +4258,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -4162,9 +4278,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4188,6 +4304,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform float4 rpUser0 : register( c128 ); //rpCenterScale\n" "\n" "struct VS_IN {\n" @@ -4203,8 +4320,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord0 : TEXCOORD0;\n" " float2 texcoord1 : TEXCOORD1;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -4214,7 +4333,7 @@ static const cgShaderDef_t cg_renderprogs[] = " const float4 centerScale = rpUser0;\n" " result.texcoord0 = CenterScale( vertex.texcoord, centerScale.xy );\n" "\n" - " // pass through texcoords \n" + " // pass through texcoords\n" " result.texcoord1 = vertex.texcoord;\n" "}\n" @@ -4226,9 +4345,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4252,6 +4371,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4267,8 +4387,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -4289,9 +4411,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4315,6 +4437,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4333,8 +4456,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord1 : TEXCOORD1;\n" " float2 texcoord2 : TEXCOORD2;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -4363,9 +4488,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4389,6 +4514,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4405,8 +4531,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -4438,9 +4566,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4464,6 +4592,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4484,8 +4613,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord3 : TEXCOORD3;\n" " float2 texcoord4 : TEXCOORD4;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -4519,9 +4650,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4545,6 +4676,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4557,8 +4689,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -4575,9 +4709,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4601,6 +4735,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -4613,8 +4748,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -4632,10 +4769,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4659,6 +4796,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4675,8 +4813,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -4713,9 +4853,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4739,6 +4879,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -4756,8 +4897,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 texcoord4 : TEXCOORD4;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -4798,10 +4941,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4825,6 +4968,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -4841,11 +4985,13 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" + "\n" " // RB begin\n" " float3 localNormal;\n" "#if defined(GLES2)\n" @@ -4880,10 +5026,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -4907,6 +5053,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" "struct VS_IN {\n" @@ -4927,8 +5074,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 texcoord4 : TEXCOORD4;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -4944,25 +5093,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -5023,9 +5172,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -5049,13 +5198,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = rpColor;\n" "}\n" @@ -5067,10 +5219,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -5098,6 +5250,7 @@ static const cgShaderDef_t cg_renderprogs[] = "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" @@ -5110,6 +5263,7 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -5125,25 +5279,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -5171,9 +5325,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -5197,6 +5351,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -5208,8 +5363,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -5224,9 +5381,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -5250,6 +5407,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -5267,15 +5425,17 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 color : COLOR0;\n" " float3 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" + "\n" " result.color = rpUser1; // targetHue\n" - " \n" + "\n" " result.texcoord0.x = vertex.texcoord.x;\n" " result.texcoord0.y = 1.0f - vertex.texcoord.y;\n" "\n" @@ -5855,9 +6015,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -5881,6 +6041,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -5892,6 +6053,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -5927,16 +6089,16 @@ static const cgShaderDef_t cg_renderprogs[] = "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" + "\n" "#define normal_buffer samp0\n" "#define cszBuffer samp1\n" "#define source samp2 \n" - " \n" + "\n" "struct PS_IN\n" "{\n" " float2 texcoord0 : TEXCOORD0_centroid;\n" "};\n" - " \n" + "\n" "struct PS_OUT \n" "{\n" " float4 color : COLOR;\n" @@ -5992,7 +6154,7 @@ static const cgShaderDef_t cg_renderprogs[] = "//uniform int2 axis;\n" "\n" "#if USE_OCT16\n" - "#include \n" + " #include \n" "#endif\n" "\n" "float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )\n" @@ -6018,10 +6180,10 @@ static const cgShaderDef_t cg_renderprogs[] = "float reconstructCSZ( float d )\n" "{\n" " //return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);\n" - " \n" + "\n" " // infinite far perspective matrix\n" " return -3.0 / ( -1.0 * d + 1.0 );\n" - " \n" + "\n" " //d = d * 2.0 - 1.0;\n" " //return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );\n" "}\n" @@ -6032,15 +6194,15 @@ static const cgShaderDef_t cg_renderprogs[] = " P.z = z * 2.0 - 1.0;\n" " P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0;\n" " P.w = 1.0;\n" - " \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" + "\n" " csP.xyz /= csP.w;\n" - " \n" + "\n" " return csP.xyz;\n" "}\n" "\n" @@ -6058,7 +6220,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), key );\n" " key = P.z;\n" "#endif\n" - " \n" + "\n" " key = clamp( key * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );\n" " return key;\n" "}\n" @@ -6075,10 +6237,10 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " float3 P;\n" " P.z = texelFetch( cszBuffer, ssP, 0 ).r;\n" - " \n" + "\n" " // Offset to pixel center\n" " P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );\n" - " \n" + "\n" " return P;\n" "}\n" "\n" @@ -6086,43 +6248,43 @@ static const cgShaderDef_t cg_renderprogs[] = "{\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" + "\n" " float k_normal = 1.0; //40.0;\n" " float k_plane = 1.0; //0.5;\n" - " \n" + "\n" " // Prevents blending over creases.\n" " float normalWeight = 1.0; //1000.0;\n" " float planeWeight = 1.0;\n" - " \n" + "\n" "#if USE_NORMALS\n" " float3 tapN_C = sampleNormal( normal_buffer, tapLoc, 0 );\n" " depthWeight = 1.0;\n" - " \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" + "\n" + "\n" " float lowDistanceThreshold2 = 0.001; //0.01;\n" - " \n" + "\n" " //float3 tapC = positionFromKey( tapKey, tapLoc, projInfo );\n" " float3 tapC = getPosition( tapLoc, cszBuffer );\n" - " \n" + "\n" " // Change in position in camera space\n" " float3 dq = C - tapC;\n" - " \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" + "\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" + "\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" + "\n" + "\n" "#endif\n" - " \n" + "\n" " return depthWeight * normalWeight * planeWeight;\n" "}\n" "\n" @@ -6169,11 +6331,11 @@ static const cgShaderDef_t cg_renderprogs[] = " kernel[6] = 0.036108;\n" "#endif\n" "//#endif\n" - " \n" + "\n" " int2 ssC = int2( gl_FragCoord.xy );\n" - " \n" + "\n" " float4 temp = texelFetch( source, ssC, 0 );\n" - " \n" + "\n" "#if 0\n" " if( fragment.texcoord0.x < 0.75 )\n" " {\n" @@ -6181,7 +6343,7 @@ static const cgShaderDef_t cg_renderprogs[] = " return;\n" " }\n" "#endif\n" - " \n" + "\n" "#if 0\n" " float key = getKey( ssC );\n" " float3 C = positionFromKey( key, ssC );\n" @@ -6189,27 +6351,27 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 C = getPosition( ssC, cszBuffer );\n" " float key = CSZToKey( C.z );\n" "#endif\n" - " \n" + "\n" " VALUE_TYPE sum = temp.VALUE_COMPONENTS;\n" - " \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" + "\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" + "\n" " float3 n_C;\n" "#if USE_NORMALS\n" " n_C = sampleNormal( normal_buffer, ssC, 0 );\n" "#endif\n" - " \n" + "\n" "#if MDB_WEIGHTS == 0\n" " for( int r = -R; r <= R; ++r )\n" " {\n" @@ -6219,35 +6381,35 @@ static const cgShaderDef_t cg_renderprogs[] = " {\n" " int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );\n" " temp = texelFetch( source, tapLoc, 0 );\n" - " \n" - " \n" + "\n" + "\n" " float tapKey = getKey( tapLoc );\n" " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - " \n" + "\n" " // spatial domain: offset kernel tap\n" " float weight = 0.3 + kernel[abs( r )];\n" - " \n" + "\n" " float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );\n" - " \n" + "\n" " weight *= bilateralWeight;\n" " sum += value * weight;\n" " totalWeight += weight;\n" " }\n" " }\n" "#else\n" - " \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" + "\n" " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - " \n" + "\n" " // spatial domain: offset kernel tap\n" " float weight = 0.3 + kernel[abs( r )];\n" - " \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" @@ -6256,7 +6418,7 @@ static const cgShaderDef_t cg_renderprogs[] = " sum += value * weight;\n" " totalWeight += weight;\n" " }\n" - " \n" + "\n" " lastBilateralWeight = 9999.0;\n" " for( int r = 1; r <= R; ++r )\n" " {\n" @@ -6264,10 +6426,10 @@ static const cgShaderDef_t cg_renderprogs[] = " temp = texelFetch( source, tapLoc, 0 );\n" " float tapKey = getKey( tapLoc );\n" " VALUE_TYPE value = temp.VALUE_COMPONENTS;\n" - " \n" + "\n" " // spatial domain: offset kernel tap\n" " float weight = 0.3 + kernel[abs( r )];\n" - " \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" @@ -6277,7 +6439,7 @@ static const cgShaderDef_t cg_renderprogs[] = " totalWeight += weight;\n" " }\n" "#endif\n" - " \n" + "\n" " const float epsilon = 0.0001;\n" " blurResult = sum / ( totalWeight + epsilon );\n" "}\n" @@ -6291,9 +6453,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6317,6 +6479,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -6328,6 +6491,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -6343,10 +6507,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6370,6 +6534,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2DArray samp0 : register(s0);\n" "\n" "struct PS_IN\n" @@ -6382,6 +6547,7 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" @@ -6400,9 +6566,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6426,6 +6592,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -6438,18 +6605,23 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - " } else {\n" + " }\n" + " else\n" + " {\n" " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" " }\n" @@ -6463,9 +6635,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6489,12 +6661,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" "}\n" @@ -6506,9 +6682,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6532,6 +6708,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" "};\n" @@ -6539,8 +6716,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -6555,9 +6734,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6581,12 +6760,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" "}\n" @@ -6598,10 +6781,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6627,6 +6810,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -6639,8 +6823,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " //--------------------------------------------------------------\n" " // GPU transformation of the normal / binormal / bitangent\n" " //\n" @@ -6652,25 +6838,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -6692,9 +6878,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6718,6 +6904,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -6730,11 +6917,13 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" "\n" " float2 screenTexCoord = fragment.texcoord;\n" - " \n" + "\n" " // compute warp factor\n" " float4 warpFactor = 1.0 - ( tex2D( samp1, screenTexCoord.xy ) * fragment.color );\n" " screenTexCoord -= float2( 0.5, 0.5 );\n" @@ -6754,9 +6943,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6782,6 +6971,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -6798,15 +6988,16 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord : TEXCOORD0;\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" + "\n" " result.texcoord = vertex.texcoord.xy;\n" "\n" " const float4 deformMagnitude = rpUser1;\n" @@ -6821,9 +7012,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6847,6 +7038,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -6859,8 +7051,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -6883,9 +7077,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6909,6 +7103,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float4 normal : NORMAL;\n" @@ -6921,8 +7116,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 texcoord1 : TEXCOORD1;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" "\n" " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" "\n" @@ -6948,9 +7145,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -6974,6 +7171,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -6986,8 +7184,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -7010,10 +7210,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7039,6 +7239,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -7054,8 +7255,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 texcoord1 : TEXCOORD1;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " float4 vNormal = vertex.normal * 2.0 - 1.0;\n" "\n" " //--------------------------------------------------------------\n" @@ -7069,25 +7272,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -7123,9 +7326,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7149,6 +7352,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "uniform sampler2D samp1 : register(s1);\n" "\n" @@ -7161,8 +7365,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * sRGBAToLinearRGBA( rpColor );\n" "}\n" "\n" @@ -7176,9 +7382,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7202,6 +7408,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -7215,8 +7422,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord0 : TEXCOORD0;\n" " float2 texcoord1 : TEXCOORD1;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -7238,9 +7447,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7264,6 +7473,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "uniform sampler2D samp1 : register(s1);\n" "\n" @@ -7276,8 +7486,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * sRGBAToLinearRGBA( rpColor );\n" "}\n" "\n" @@ -7291,10 +7503,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7320,6 +7532,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -7334,8 +7547,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord0 : TEXCOORD0;\n" " float2 texcoord1 : TEXCOORD1;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " //--------------------------------------------------------------\n" " // GPU transformation of the normal / binormal / bitangent\n" " //\n" @@ -7347,25 +7562,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -7396,9 +7611,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7425,6 +7640,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#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" @@ -7445,8 +7661,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT { \n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" "\n" " const float4 FXAAQualityRCPFrame = rpUser0;\n" " const float4 FXAAConsoleRcpFrameOpt = rpUser1;\n" @@ -7499,7 +7717,7 @@ static const cgShaderDef_t cg_renderprogs[] = " fxaaConsoleEdgeThreshold,\n" " fxaaConsoleEdgeThresholdMin,\n" " fxaaConsole360ConstDir );\n" - " \n" + "\n" " result.color = colorSample;\n" "}\n" @@ -7511,9 +7729,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7537,6 +7755,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -7549,8 +7768,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " result.position = vertex.position;\n" " result.texcoord0 = vertex.texcoord;\n" "}\n" @@ -7563,10 +7784,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7590,6 +7811,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // normal map\n" "\n" "struct PS_IN\n" @@ -7607,11 +7829,12 @@ static const cgShaderDef_t cg_renderprogs[] = "{\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" + "\n" " // RB begin\n" " float3 localNormal;\n" "#if defined(USE_NORMAL_FMT_RGB8)\n" @@ -7651,10 +7874,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7682,6 +7905,7 @@ static const cgShaderDef_t cg_renderprogs[] = "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" @@ -7700,9 +7924,11 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" - "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 vBitangent = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;\n" @@ -7719,25 +7945,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -7796,8 +8022,8 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " result.texcoord2.z = dot3( normal, rpModelMatrixX );\n" " result.texcoord3.z = dot3( normal, rpModelMatrixY );\n" - " result.texcoord4.z = dot3( normal, rpModelMatrixZ ); \n" - " \n" + " result.texcoord4.z = dot3( normal, rpModelMatrixZ );\n" + "\n" "#else\n" " // rotate into view space\n" " result.texcoord2.x = dot3( tangent, rpModelViewMatrixX );\n" @@ -7810,7 +8036,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " result.texcoord2.z = dot3( normal, rpModelViewMatrixX );\n" " result.texcoord3.z = dot3( normal, rpModelViewMatrixY );\n" - " result.texcoord4.z = dot3( normal, rpModelViewMatrixZ ); \n" + " result.texcoord4.z = dot3( normal, rpModelViewMatrixZ );\n" "#endif\n" "\n" "#if defined( USE_GPU_SKINNING )\n" @@ -7822,7 +8048,7 @@ static const cgShaderDef_t cg_renderprogs[] = " //# 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" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" @@ -7835,9 +8061,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7861,6 +8087,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -7873,8 +8100,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -7888,10 +8117,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7915,6 +8144,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -7930,8 +8160,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord1 : TEXCOORD1;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -7951,10 +8183,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -7978,6 +8210,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN\n" @@ -7990,6 +8223,7 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" "float linterp( float t )\n" "{\n" @@ -8014,63 +8248,63 @@ static const cgShaderDef_t cg_renderprogs[] = "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " float2 st = fragment.texcoord0;\n" - " \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" + "\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( 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( 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" + "\n" " float scale = 13.0; // bloom width\n" " const float weightScale = 2.3; // bloom strength\n" - " \n" + "\n" " for( int i = 0; i < samples; i++ )\n" - " {\n" - " //float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );\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" + "\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" + "\n" " float weight = gaussFact[ i ];\n" " sumColor += color.rgb * ( so.rgb * weight * weightScale );\n" " }\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" + " {\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" + "\n" " float weight = gaussFact[ i ];\n" " sumColor += color.rgb * ( so.rgb * weight * weightScale );\n" " }\n" "#endif\n" - " \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" @@ -8085,9 +8319,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -8111,6 +8345,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -8123,8 +8358,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -8142,9 +8379,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -8168,6 +8405,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -8182,8 +8420,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -8214,9 +8454,9 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "Copyright (C) 2013 Robert Beckebans \n" + "Copyright (C) 2013 Robert Beckebans\n" "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \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" @@ -8246,6 +8486,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#endif\n" "// RB end\n" "\n" + "// *INDENT-OFF*\n" "uniform float4 rpUser0 : register(c128); // rpScroll\n" "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" "\n" @@ -8264,10 +8505,12 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord1 : TEXCOORD1;\n" " float4 texcoord2 : TEXCOORD2;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" "\n" - " #include \"skinning.inc.hlsl\"\n" + "#include \"skinning.inc.hlsl\"\n" "\n" " // texture 0 takes the texture coordinates unmodified\n" " result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 );\n" @@ -8280,12 +8523,12 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " // 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" + " 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" @@ -8307,9 +8550,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -8333,6 +8576,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -8348,8 +8592,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -8380,10 +8626,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\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" + "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" + "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" @@ -8413,6 +8659,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#endif\n" "// RB end\n" "\n" + "// *INDENT-OFF*\n" "uniform float4 rpUser0 : register(c128); // rpScroll\n" "uniform float4 rpUser1 : register(c129); // rpDeformMagnitude\n" "\n" @@ -8432,10 +8679,12 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord2 : TEXCOORD2;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" "\n" - " #include \"skinning.inc.hlsl\"\n" + "#include \"skinning.inc.hlsl\"\n" "\n" " // texture 0 takes the texture coordinates unmodified\n" " result.texcoord0 = float4( vertex.texcoord, 0 , 0 );\n" @@ -8448,11 +8697,11 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " // 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 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" @@ -8477,9 +8726,9 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "Doom 3 BFG Edition GPL Source Code\n" "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" - "Copyright (C) 2013-2014 Robert Beckebans \n" + "Copyright (C) 2013-2014 Robert Beckebans\n" "\n" - "This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n" + "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" @@ -8503,6 +8752,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -8515,8 +8765,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -8539,10 +8791,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -8568,6 +8820,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -8591,10 +8844,12 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord0 : TEXCOORD0;\n" " float4 texcoord1 : TEXCOORD1;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" "\n" - " #include \"skinning.inc.hlsl\"\n" + "#include \"skinning.inc.hlsl\"\n" "\n" " //texture 0 takes the texture coordinates and adds a scroll\n" " const float4 textureScroll = rpUser0;\n" @@ -8604,8 +8859,8 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " // 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" @@ -8631,10 +8886,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 2013-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" + "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" @@ -8659,6 +8914,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#include \"global.inc.hlsl\"\n" "#include \"BRDF.inc.hlsl\"\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" @@ -8682,12 +8938,13 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " half4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );\n" " half4 lightFalloff = ( idtex2Dproj( samp3, fragment.texcoord2 ) );\n" - " half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );\n" + " half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );\n" " half4 YCoCG = tex2D( samp2, fragment.texcoord4.xy );\n" " half4 specMapSRGB = tex2D( samp1, fragment.texcoord5.xy );\n" " half4 specMap = sRGBAToLinearRGBA( specMapSRGB );\n" @@ -8706,7 +8963,7 @@ static const cgShaderDef_t cg_renderprogs[] = " // RB end\n" " localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );\n" " localNormal = normalize( localNormal );\n" - " \n" + "\n" " // traditional very dark Lambert light model used in Doom 3\n" " half ldotN = saturate( dot3( localNormal, lightVector ) );\n" "\n" @@ -8726,7 +8983,7 @@ static const cgShaderDef_t cg_renderprogs[] = " half hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 );\n" "\n" "#if 1\n" - " \n" + "\n" "#if defined( USE_PBR )\n" " const half metallic = specMapSRGB.g;\n" " const half roughness = specMapSRGB.r;\n" @@ -8734,84 +8991,84 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "\n" " // approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)\n" " const half3 dielectricColor = half3( 0.04 );\n" - " \n" + "\n" " // derive diffuse and specular from albedo(m) base color\n" " const half3 baseColor = diffuseMap;\n" - " \n" + "\n" " half3 diffuseColor = baseColor * ( 1.0 - metallic );\n" " half3 specularColor = lerp( dielectricColor, baseColor, metallic );\n" "#else\n" " // HACK calculate roughness from D3 gloss maps\n" " float Y = dot( LUMINANCE_SRGB.rgb, specMapSRGB.rgb );\n" - " \n" + "\n" " //const float glossiness = clamp( 1.0 - specMapSRGB.r, 0.0, 0.98 );\n" " const float glossiness = clamp( pow( Y, 1.0 / 2.0 ), 0.0, 0.98 );\n" - " \n" + "\n" " const float roughness = 1.0 - glossiness;\n" - " \n" + "\n" " half3 diffuseColor = diffuseMap;\n" - " half3 specularColor = specMapSRGB.rgb; // RB: should be linear but it looks too flat\n" + " half3 specularColor = specMapSRGB.rgb; // RB: should be linear but it looks too flat\n" "#endif\n" "\n" - " \n" + "\n" " // RB: compensate r_lightScale 3 and the division of Pi\n" " //lambert *= 1.3;\n" - " \n" + "\n" " // rpDiffuseModifier contains light color multiplier\n" " half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );// * rpDiffuseModifier.xyz;\n" - " \n" + "\n" " half vdotN = clamp( dot3( viewVector, localNormal ), 0.0, 1.0 );\n" " half vdotH = clamp( dot3( viewVector, halfAngleVector ), 0.0, 1.0 );\n" " half ldotH = clamp( dot3( lightVector, halfAngleVector ), 0.0, 1.0 );\n" - " \n" + "\n" " // compensate r_lightScale 3 * 2\n" " half3 reflectColor = specularColor * rpSpecularModifier.rgb * 1.0;// * 0.5;\n" - " \n" + "\n" " // cheap approximation by ARM with only one division\n" " // http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf\n" " // page 26\n" - " \n" + "\n" " float rr = roughness * roughness;\n" " float rrrr = rr * rr;\n" - " \n" + "\n" " // disney GGX\n" " float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;\n" " float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );\n" " half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;\n" " //specularBRDF = half3( 0.0 );\n" - " \n" + "\n" "#if 0\n" " result.color = float4( _half3( VFapprox ), 1.0 );\n" " return;\n" "#endif\n" - " \n" + "\n" " // see http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/\n" " //lambert /= PI;\n" - " \n" + "\n" " //half3 diffuseColor = mix( diffuseMap, F0, metal ) * rpDiffuseModifier.xyz;\n" " half3 diffuseBRDF = diffuseColor * lambert * sRGBToLinearRGB( rpDiffuseModifier.xyz );\n" - " \n" + "\n" " result.color.xyz = ( diffuseBRDF + specularBRDF ) * lightColor * fragment.color.rgb;\n" " result.color.w = 1.0;\n" - " \n" + "\n" "#else\n" - " \n" + "\n" " /*\n" " OLD Blinn Phong\n" " */\n" "\n" " const half specularPower = 10.0f;\n" - " \n" + "\n" " // RB: added abs\n" - " half3 specularContribution = _half3( pow( hdotN, specularPower ) );\n" + " half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );\n" "\n" " half3 diffuseColor = diffuseMap * sRGBToLinearRGB( rpDiffuseModifier.xyz );\n" " half3 specularColor = specMap.xyz * specularContribution * sRGBToLinearRGB( rpSpecularModifier.xyz );\n" " half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );\n" - " \n" + "\n" " /*\n" " half rim = 1.0f - saturate( hdotN );\n" " half rimPower = 16.0f;\n" @@ -8832,10 +9089,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -8863,6 +9120,7 @@ static const cgShaderDef_t cg_renderprogs[] = "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" @@ -8883,8 +9141,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord6 : TEXCOORD6;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -8902,25 +9162,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -9003,7 +9263,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " //# calculate normalized vector to viewer in R1\n" " float4 toView = normalize( rpLocalViewOrigin - modelPosition );\n" - " \n" + "\n" " //# put into texture space\n" " result.texcoord6.x = dot3( tangent, toView );\n" " result.texcoord6.y = dot3( bitangent, toView );\n" @@ -9019,7 +9279,7 @@ static const cgShaderDef_t cg_renderprogs[] = " //# 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" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" @@ -9032,9 +9292,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2013-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" + "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" @@ -9058,6 +9319,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\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" @@ -9078,13 +9340,16 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " half4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );\n" " half4 lightFalloff = idtex2Dproj( samp3, fragment.texcoord2 );\n" " half4 lightProj = idtex2Dproj( samp4, fragment.texcoord3 );\n" " half4 YCoCG = tex2D( samp2, fragment.texcoord4.xy );\n" - " half4 specMap = sRGBAToLinearRGBA( tex2D( samp1, fragment.texcoord5.xy ) );\n" + " half4 specMapSRGB = tex2D( samp1, fragment.texcoord5.xy );\n" + " half4 specMap = sRGBAToLinearRGBA( specMapSRGB );\n" "\n" " const half3 ambientLightVector = half3( 0.5f, 9.5f - 0.385f, 0.8925f );\n" " half3 lightVector = normalize( ambientLightVector );\n" @@ -9100,7 +9365,7 @@ static const cgShaderDef_t cg_renderprogs[] = " // RB end\n" " localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );\n" " localNormal = normalize( localNormal );\n" - " \n" + "\n" " // traditional very dark Lambert light model used in Doom 3\n" " half ldotN = saturate( dot3( localNormal, lightVector ) );\n" "\n" @@ -9113,7 +9378,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#else\n" " half lambert = ldotN;\n" "#endif\n" - " \n" + "\n" " const half specularPower = 10.0f;\n" " half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );\n" " // RB: added abs\n" @@ -9121,7 +9386,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " half3 diffuseColor = diffuseMap * sRGBToLinearRGB( rpDiffuseModifier.xyz );\n" " half3 specularColor = specMap.xyz * specularContribution * sRGBToLinearRGB( rpSpecularModifier.xyz );\n" - " half3 lightColor = 1.0 * lightProj.xyz * lightFalloff.xyz;\n" + " half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );\n" "\n" " result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;\n" " result.color.w = 1.0;\n" @@ -9136,9 +9401,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -9162,6 +9427,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -9180,8 +9446,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord6 : TEXCOORD6;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -9229,7 +9497,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " //# calculate normalized vector to viewer in R1\n" " float4 toView = normalize( rpLocalViewOrigin - vertex.position );\n" - " \n" + "\n" " //# add together to become the half angle vector in object space (non-normalized)\n" " float4 halfAngleVector = toLight + toView;\n" "\n" @@ -9242,7 +9510,7 @@ static const cgShaderDef_t cg_renderprogs[] = " //# 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" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "}\n" @@ -9254,10 +9522,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\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" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" + "Copyright (C) 2013-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" + "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" @@ -9281,6 +9549,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\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" @@ -9301,17 +9570,20 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " half4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );\n" " half4 lightFalloff = idtex2Dproj( samp3, fragment.texcoord2 );\n" " half4 lightProj = idtex2Dproj( samp4, fragment.texcoord3 );\n" " half4 YCoCG = tex2D( samp2, fragment.texcoord4.xy );\n" - " half4 specMap = tex2D( samp1, fragment.texcoord5.xy );\n" + " half4 specMapSRGB = tex2D( samp1, fragment.texcoord5.xy );\n" + " half4 specMap = sRGBAToLinearRGBA( specMapSRGB );\n" "\n" " const half3 ambientLightVector = half3( 0.5f, 9.5f - 0.385f, 0.8925f );\n" " half3 lightVector = normalize( ambientLightVector );\n" - " half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );\n" + " half3 diffuseMap = sRGBToLinearRGB( ConvertYCoCgToRGB( YCoCG ) );\n" "\n" " half3 localNormal;\n" " // RB begin\n" @@ -9323,7 +9595,7 @@ static const cgShaderDef_t cg_renderprogs[] = " // RB end\n" " localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );\n" " localNormal = normalize( localNormal );\n" - " \n" + "\n" " // traditional very dark Lambert light model used in Doom 3\n" " half ldotN = saturate( dot3( localNormal, lightVector ) );\n" "\n" @@ -9336,15 +9608,15 @@ static const cgShaderDef_t cg_renderprogs[] = "#else\n" " half lambert = ldotN;\n" "#endif\n" - " \n" + "\n" " const half specularPower = 10.0f;\n" " half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );\n" " // RB: added abs\n" " half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );\n" "\n" - " half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;\n" - " half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;\n" - " half3 lightColor = 1.0 * lightProj.xyz * lightFalloff.xyz;\n" + " half3 diffuseColor = diffuseMap * sRGBToLinearRGB( rpDiffuseModifier.xyz );\n" + " half3 specularColor = specMap.xyz * specularContribution * sRGBToLinearRGB( rpSpecularModifier.xyz );\n" + " half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );\n" "\n" " result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;\n" " result.color.w = 1.0;\n" @@ -9359,10 +9631,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -9388,6 +9660,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -9407,8 +9680,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord6 : TEXCOORD6;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -9425,25 +9700,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -9511,7 +9786,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " //# calculate normalized vector to viewer in R1\n" " float4 toView = normalize( rpLocalViewOrigin - modelPosition );\n" - " \n" + "\n" " //# add together to become the half angle vector in object space (non-normalized)\n" " float4 halfAngleVector = toLight + toView;\n" "\n" @@ -9524,7 +9799,7 @@ static const cgShaderDef_t cg_renderprogs[] = " //# 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" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "}\n" @@ -9536,10 +9811,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 2013-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" + "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" @@ -9564,6 +9839,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#include \"global.inc.hlsl\"\n" "#include \"BRDF.inc.hlsl\"\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" @@ -9592,26 +9868,26 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " half4 color : COLOR;\n" "};\n" - "\n" + "// *INDENT-ON*\n" "\n" "float BlueNoise( float2 n, float x )\n" "{\n" - " float noise = tex2D( samp6, ( n.xy / 256.0 ) ).r;\n" - " \n" - " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" - " \n" - " noise = RemapNoiseTriErp( noise );\n" - " \n" - " //noise = noise * 2.0 - 1.0;\n" - " \n" - " return noise;\n" + " float noise = tex2D( samp6, ( n.xy / 256.0 ) ).r;\n" + "\n" + " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" + "\n" + " noise = RemapNoiseTriErp( noise );\n" + "\n" + " //noise = noise * 2.0 - 1.0;\n" + "\n" + " return noise;\n" "}\n" "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );\n" " half4 lightFalloff = ( idtex2Dproj( samp3, fragment.texcoord2 ) );\n" - " half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );\n" + " half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );\n" " half4 YCoCG = tex2D( samp2, fragment.texcoord4.xy );\n" " half4 specMapSRGB = tex2D( samp1, fragment.texcoord5.xy );\n" " half4 specMap = sRGBAToLinearRGBA( specMapSRGB );\n" @@ -9630,7 +9906,7 @@ static const cgShaderDef_t cg_renderprogs[] = " // RB end\n" " localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );\n" " localNormal = normalize( localNormal );\n" - " \n" + "\n" " // traditional very dark Lambert light model used in Doom 3\n" " half ldotN = saturate( dot3( localNormal, lightVector ) );\n" "\n" @@ -9650,10 +9926,10 @@ static const cgShaderDef_t cg_renderprogs[] = " // shadow mapping\n" " //\n" " int shadowIndex = 0;\n" - " \n" + "\n" "#if defined( LIGHT_POINT )\n" " float3 toLightGlobal = normalize( fragment.texcoord8.xyz );\n" - " \n" + "\n" " float axis[6];\n" " axis[0] = -toLightGlobal.x;\n" " axis[1] = toLightGlobal.x;\n" @@ -9673,9 +9949,9 @@ static const cgShaderDef_t cg_renderprogs[] = "#endif // #if defined( POINTLIGHT )\n" "\n" "#if defined( LIGHT_PARALLEL )\n" - " \n" + "\n" " float viewZ = -fragment.texcoord9.z;\n" - " \n" + "\n" " shadowIndex = 4;\n" " for( int i = 0; i < 4; i++ )\n" " {\n" @@ -9686,7 +9962,7 @@ static const cgShaderDef_t cg_renderprogs[] = " }\n" " }\n" "#endif\n" - " \n" + "\n" "#if 0\n" " if( shadowIndex == 0 )\n" " {\n" @@ -9712,33 +9988,33 @@ static const cgShaderDef_t cg_renderprogs[] = " {\n" " result.color = float4( 0.0, 1.0, 1.0, 1.0 );\n" " }\n" - " \n" + "\n" " //result.color.xyz *= lightColor;\n" " return;\n" "#endif\n" - " \n" + "\n" " float4 shadowMatrixX = rpShadowMatrices[ int ( shadowIndex * 4 + 0 ) ];\n" " float4 shadowMatrixY = rpShadowMatrices[ int ( shadowIndex * 4 + 1 ) ];\n" " float4 shadowMatrixZ = rpShadowMatrices[ int ( shadowIndex * 4 + 2 ) ];\n" " float4 shadowMatrixW = rpShadowMatrices[ int ( shadowIndex * 4 + 3 ) ];\n" - " \n" + "\n" " float4 modelPosition = float4( fragment.texcoord7.xyz, 1.0 );\n" " float4 shadowTexcoord;\n" " shadowTexcoord.x = dot4( modelPosition, shadowMatrixX );\n" " shadowTexcoord.y = dot4( modelPosition, shadowMatrixY );\n" " shadowTexcoord.z = dot4( modelPosition, shadowMatrixZ );\n" " shadowTexcoord.w = dot4( modelPosition, shadowMatrixW );\n" - " \n" + "\n" " //float bias = 0.005 * tan( acos( ldotN ) );\n" " //bias = clamp( bias, 0, 0.01 );\n" " float bias = 0.001;\n" - " \n" + "\n" " shadowTexcoord.xyz /= shadowTexcoord.w;\n" - " \n" + "\n" " shadowTexcoord.z = shadowTexcoord.z * rpScreenCorrectionFactor.w;\n" " //shadowTexcoord.z = shadowTexcoord.z * 0.999991;\n" " //shadowTexcoord.z = shadowTexcoord.z - bias;\n" - " shadowTexcoord.w = float(shadowIndex);\n" + " shadowTexcoord.w = float( shadowIndex );\n" "\n" "#if 0\n" " result.color.xyz = float3( shadowTexcoord.z, shadowTexcoord.z, shadowTexcoord.z );\n" @@ -9747,126 +10023,126 @@ static const cgShaderDef_t cg_renderprogs[] = "#endif\n" "\n" " // multiple taps\n" - " \n" + "\n" "#if 0\n" " float4 base = shadowTexcoord;\n" - " \n" + "\n" " base.xy += rpJitterTexScale.xy * -0.5;\n" - " \n" + "\n" " float shadow = 0.0;\n" - " \n" + "\n" " //float stepSize = 1.0 / 16.0;\n" " float numSamples = 16;\n" " float stepSize = 1.0 / numSamples;\n" - " \n" + "\n" " float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;\n" " for( float i = 0.0; i < numSamples; i += 1.0 )\n" " {\n" " float4 jitter = base + tex2D( samp6, jitterTC.xy ) * rpJitterTexScale;\n" " jitter.zw = shadowTexcoord.zw;\n" - " \n" + "\n" " shadow += texture( samp5, jitter.xywz );\n" " jitterTC.x += stepSize;\n" " }\n" - " \n" + "\n" " shadow *= stepSize;\n" "\n" "#elif 0\n" - " \n" + "\n" " const float2 poissonDisk[12] = float2[](\n" - " float2(0.6111618, 0.1050905),\n" - " float2(0.1088336, 0.1127091),\n" - " float2(0.3030421, -0.6292974),\n" - " float2(0.4090526, 0.6716492),\n" - " float2(-0.1608387, -0.3867823),\n" - " float2(0.7685862, -0.6118501),\n" - " float2(-0.1935026, -0.856501),\n" - " float2(-0.4028573, 0.07754025),\n" - " float2(-0.6411021, -0.4748057),\n" - " float2(-0.1314865, 0.8404058),\n" - " float2(-0.7005203, 0.4596822),\n" - " float2(-0.9713828, -0.06329931) );\n" - " \n" + " float2( 0.6111618, 0.1050905 ),\n" + " float2( 0.1088336, 0.1127091 ),\n" + " float2( 0.3030421, -0.6292974 ),\n" + " float2( 0.4090526, 0.6716492 ),\n" + " float2( -0.1608387, -0.3867823 ),\n" + " float2( 0.7685862, -0.6118501 ),\n" + " float2( -0.1935026, -0.856501 ),\n" + " float2( -0.4028573, 0.07754025 ),\n" + " float2( -0.6411021, -0.4748057 ),\n" + " float2( -0.1314865, 0.8404058 ),\n" + " float2( -0.7005203, 0.4596822 ),\n" + " float2( -0.9713828, -0.06329931 ) );\n" + "\n" " float shadow = 0.0;\n" - " \n" + "\n" " // RB: casting a float to int and using it as index can really kill the performance ...\n" " float numSamples = 12.0; //int(rpScreenCorrectionFactor.w);\n" " float stepSize = 1.0 / numSamples;\n" - " \n" + "\n" " float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;\n" " float4 random = tex2D( samp6, jitterTC.xy ) * PI;\n" " //float4 random = fragment.position;\n" - " \n" + "\n" " float2 rot;\n" " rot.x = cos( random.x );\n" " rot.y = sin( random.x );\n" - " \n" + "\n" " float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x;\n" - " for( int i = 0; i < 12; i++ )\n" - " {\n" - " float2 jitter = poissonDisk[i];\n" + " for( int i = 0; i < 12; i++ )\n" + " {\n" + " float2 jitter = poissonDisk[i];\n" " float2 jitterRotated;\n" " jitterRotated.x = jitter.x * rot.x - jitter.y * rot.y;\n" " jitterRotated.y = jitter.x * rot.y + jitter.y * rot.x;\n" - " \n" + "\n" " float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitterRotated * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );\n" - " \n" - " shadow += texture( samp5, shadowTexcoordJittered.xywz);\n" - " }\n" "\n" - " shadow *= stepSize;\n" + " shadow += texture( samp5, shadowTexcoordJittered.xywz );\n" + " }\n" + "\n" + " shadow *= stepSize;\n" + "\n" + "\n" + "#elif 1\n" + "\n" + " const float2 poissonDisk[12] = float2[](\n" + " float2( 0.6111618, 0.1050905 ),\n" + " float2( 0.1088336, 0.1127091 ),\n" + " float2( 0.3030421, -0.6292974 ),\n" + " float2( 0.4090526, 0.6716492 ),\n" + " float2( -0.1608387, -0.3867823 ),\n" + " float2( 0.7685862, -0.6118501 ),\n" + " float2( -0.1935026, -0.856501 ),\n" + " float2( -0.4028573, 0.07754025 ),\n" + " float2( -0.6411021, -0.4748057 ),\n" + " float2( -0.1314865, 0.8404058 ),\n" + " float2( -0.7005203, 0.4596822 ),\n" + " float2( -0.9713828, -0.06329931 ) );\n" "\n" - " \n" - " #elif 1\n" - " \n" - " const float2 poissonDisk[12] = float2[](\n" - " float2(0.6111618, 0.1050905),\n" - " float2(0.1088336, 0.1127091),\n" - " float2(0.3030421, -0.6292974),\n" - " float2(0.4090526, 0.6716492),\n" - " float2(-0.1608387, -0.3867823),\n" - " float2(0.7685862, -0.6118501),\n" - " float2(-0.1935026, -0.856501),\n" - " float2(-0.4028573, 0.07754025),\n" - " float2(-0.6411021, -0.4748057),\n" - " float2(-0.1314865, 0.8404058),\n" - " float2(-0.7005203, 0.4596822),\n" - " float2(-0.9713828, -0.06329931) );\n" - " \n" " float shadow = 0.0;\n" - " \n" + "\n" " // RB: casting a float to int and using it as index can really kill the performance ...\n" " float numSamples = 6.0; //int(rpScreenCorrectionFactor.w);\n" " float stepSize = 1.0 / numSamples;\n" - " \n" + "\n" " //float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;\n" " //float random = tex2D( samp6, jitterTC.xy ).x;\n" - " \n" - " float random = BlueNoise( fragment.position.xy * 1.0, 100.0 );\n" - " \n" - " //float random = InterleavedGradientNoise( fragment.position.xy );\n" - " \n" - " random *= PI;\n" - " \n" + "\n" + " float random = BlueNoise( fragment.position.xy * 1.0, 100.0 );\n" + "\n" + " //float random = InterleavedGradientNoise( fragment.position.xy );\n" + "\n" + " random *= PI;\n" + "\n" " float2 rot;\n" " rot.x = cos( random );\n" " rot.y = sin( random );\n" - " \n" + "\n" " float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x;\n" - " for( int i = 0; i < 6; i++ )\n" - " {\n" - " float2 jitter = poissonDisk[i];\n" + " for( int i = 0; i < 6; i++ )\n" + " {\n" + " float2 jitter = poissonDisk[i];\n" " float2 jitterRotated;\n" " jitterRotated.x = jitter.x * rot.x - jitter.y * rot.y;\n" " jitterRotated.y = jitter.x * rot.y + jitter.y * rot.x;\n" - " \n" - " float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitterRotated * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );\n" - " \n" - " shadow += texture( samp5, shadowTexcoordJittered.xywz);\n" - " }\n" "\n" - " shadow *= stepSize;\n" - " \n" + " float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitterRotated * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );\n" + "\n" + " shadow += texture( samp5, shadowTexcoordJittered.xywz );\n" + " }\n" + "\n" + " shadow *= stepSize;\n" + "\n" "#else\n" "\n" " float shadow = texture( samp5, shadowTexcoord.xywz );\n" @@ -9877,7 +10153,7 @@ static const cgShaderDef_t cg_renderprogs[] = " half hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 );\n" "\n" "#if 1\n" - " \n" + "\n" "#if defined( USE_PBR )\n" " const half metallic = specMapSRGB.g;\n" " const half roughness = specMapSRGB.r;\n" @@ -9885,85 +10161,85 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "\n" " // approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)\n" " const half3 dielectricColor = half3( 0.04 );\n" - " \n" + "\n" " // derive diffuse and specular from albedo(m) base color\n" " const half3 baseColor = diffuseMap;\n" - " \n" + "\n" " half3 diffuseColor = baseColor * ( 1.0 - metallic );\n" " half3 specularColor = lerp( dielectricColor, baseColor, metallic );\n" "#else\n" " // HACK calculate roughness from D3 gloss maps\n" " float Y = dot( LUMINANCE_SRGB.rgb, specMapSRGB.rgb );\n" - " \n" + "\n" " //const float glossiness = clamp( 1.0 - specMapSRGB.r, 0.0, 0.98 );\n" " const float glossiness = clamp( pow( Y, 1.0 / 2.0 ), 0.0, 0.98 );\n" - " \n" + "\n" " const float roughness = 1.0 - glossiness;\n" - " \n" + "\n" " half3 diffuseColor = diffuseMap;\n" " half3 specularColor = specMapSRGB.rgb; // RB: should be linear but it looks too flat\n" "#endif\n" - " \n" - " //diffuseColor = half3( 1.0 );\n" - " \n" + "\n" + " //diffuseColor = half3( 1.0 );\n" + "\n" " // RB: compensate r_lightScale 3 and the division of Pi\n" " //lambert *= 1.3;\n" - " \n" + "\n" " // rpDiffuseModifier contains light color multiplier\n" " half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );// * rpDiffuseModifier.xyz;\n" - " \n" + "\n" " half vdotN = clamp( dot3( viewVector, localNormal ), 0.0, 1.0 );\n" " half vdotH = clamp( dot3( viewVector, halfAngleVector ), 0.0, 1.0 );\n" " half ldotH = clamp( dot3( lightVector, halfAngleVector ), 0.0, 1.0 );\n" - " \n" + "\n" " // compensate r_lightScale 3 * 2\n" " half3 reflectColor = specularColor * rpSpecularModifier.rgb * 1.0;// * 0.5;\n" - " \n" + "\n" " // cheap approximation by ARM with only one division\n" " // http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf\n" " // page 26\n" - " \n" + "\n" " float rr = roughness * roughness;\n" " float rrrr = rr * rr;\n" - " \n" + "\n" " // disney GGX\n" " float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;\n" " float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );\n" " half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;\n" " //specularBRDF = half3( 0.0 );\n" - " \n" + "\n" "#if 0\n" " result.color = float4( _half3( VFapprox ), 1.0 );\n" " return;\n" "#endif\n" - " \n" + "\n" " // see http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/\n" " //lambert /= PI;\n" - " \n" + "\n" " //half3 diffuseColor = mix( diffuseMap, F0, metal ) * rpDiffuseModifier.xyz;\n" " half3 diffuseBRDF = diffuseColor * lambert * sRGBToLinearRGB( rpDiffuseModifier.xyz );\n" - " \n" + "\n" " result.color.xyz = ( diffuseBRDF + specularBRDF ) * lightColor * fragment.color.rgb * shadow;\n" " result.color.w = 1.0;\n" - " \n" + "\n" "#else\n" - " \n" + "\n" " /*\n" " OLD Blinn Phong\n" " */\n" "\n" " const half specularPower = 10.0f;\n" - " \n" + "\n" " // RB: added abs\n" " half3 specularContribution = _half3( pow( hdotN, specularPower ) );\n" "\n" " half3 diffuseColor = diffuseMap * sRGBToLinearRGB( rpDiffuseModifier.xyz );\n" " half3 specularColor = specMap.xyz * specularContribution * sRGBToLinearRGB( rpSpecularModifier.xyz );\n" " half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );\n" - " \n" + "\n" " /*\n" " half rim = 1.0f - saturate( hdotN );\n" " half rimPower = 16.0f;\n" @@ -9985,10 +10261,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -10016,6 +10292,7 @@ static const cgShaderDef_t cg_renderprogs[] = "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" @@ -10039,8 +10316,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord9 : TEXCOORD9;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -10058,25 +10337,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -10159,31 +10438,31 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " //# calculate normalized vector to viewer in R1\n" " float4 toView = normalize( rpLocalViewOrigin - modelPosition );\n" - " \n" + "\n" " //# put into texture space\n" " result.texcoord6.x = dot3( tangent, toView );\n" " result.texcoord6.y = dot3( bitangent, toView );\n" " result.texcoord6.z = dot3( normal, toView );\n" " result.texcoord6.w = 1.0f;\n" - " \n" + "\n" " result.texcoord7 = modelPosition;\n" - " \n" + "\n" " float4 worldPosition;\n" " worldPosition.x = dot4( modelPosition, rpModelMatrixX );\n" " worldPosition.y = dot4( modelPosition, rpModelMatrixY );\n" " worldPosition.z = dot4( modelPosition, rpModelMatrixZ );\n" " worldPosition.w = dot4( modelPosition, rpModelMatrixW );\n" - " \n" + "\n" " float4 toLightGlobal = rpGlobalLightOrigin - worldPosition;\n" - " \n" + "\n" " result.texcoord8 = toLightGlobal;\n" - " \n" + "\n" " float4 viewPosition;\n" " viewPosition.x = dot4( modelPosition, rpModelViewMatrixX );\n" " viewPosition.y = dot4( modelPosition, rpModelViewMatrixY );\n" " viewPosition.z = dot4( modelPosition, rpModelViewMatrixZ );\n" " viewPosition.w = dot4( modelPosition, rpModelViewMatrixW );\n" - " \n" + "\n" " result.texcoord9 = viewPosition;\n" "\n" "#if defined( USE_GPU_SKINNING )\n" @@ -10195,7 +10474,7 @@ static const cgShaderDef_t cg_renderprogs[] = " //# 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" + " //# for 1.0-color : env[16] = -1, env[17] = 1\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "#endif\n" "}\n" @@ -10208,10 +10487,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -10235,6 +10514,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // view color\n" "uniform sampler2D samp1 : register(s1); // view depth\n" "\n" @@ -10245,16 +10525,20 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" "#if 0\n" - " if ( fragment.texcoord0.x < 0.5 ) {\n" - " // only draw on half the screen for comparison\n" - " discard;\n" - " }\n" + " if( fragment.texcoord0.x < 0.5 )\n" + " {\n" + " // only draw on half the screen for comparison\n" + " discard;\n" + " }\n" "#endif\n" " // don't motion blur the hands, which were drawn with alpha = 0\n" - " if ( tex2D( samp0, fragment.texcoord0 ).w == 0.0 ) {\n" + " if( tex2D( samp0, fragment.texcoord0 ).w == 0.0 )\n" + " {\n" " discard;\n" " }\n" "\n" @@ -10286,7 +10570,8 @@ static const cgShaderDef_t cg_renderprogs[] = " float goodSamples = 0.0;\n" " float samples = rpOverbright.x;\n" "\n" - " for ( float i = 0.0 ; i < samples ; i = i + 1.0 ) {\n" + " for( float i = 0.0 ; i < samples ; i = i + 1.0 )\n" + " {\n" " float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1.0 ) ) - 0.5 );\n" " float4 color = tex2D( samp0, pos );\n" " // only take the values that are not part of the weapon\n" @@ -10307,9 +10592,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -10333,6 +10618,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -10342,8 +10628,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " result.position = vertex.position;\n" " result.texcoord0 = vertex.texcoord;\n" "}\n" @@ -10592,46 +10880,46 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "float BlueNoise( float2 n, float x )\n" "{\n" - " float noise = tex2D( samp1, ( n.xy / 512.0 ) * 1.0 ).r;\n" - " \n" - " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" - " \n" - " //noise = InterleavedGradientNoise( n );\n" - " \n" - " noise = RemapNoiseTriErp( noise );\n" - " \n" - " noise = noise * 2.0 - 1.0;\n" - " \n" - " return noise;\n" + " float noise = tex2D( samp1, ( n.xy / 512.0 ) * 1.0 ).r;\n" + "\n" + " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" + "\n" + " //noise = InterleavedGradientNoise( n );\n" + "\n" + " noise = RemapNoiseTriErp( noise );\n" + "\n" + " noise = noise * 2.0 - 1.0;\n" + "\n" + " return noise;\n" "}\n" "\n" "float3 BlueNoise3( float2 n, float x )\n" "{\n" - " float3 noise = tex2D( samp1, ( n.xy / 512.0 ) * 1.0 ).rgb;\n" - " \n" - " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" - " \n" - " noise.x = RemapNoiseTriErp( noise.x );\n" - " noise.y = RemapNoiseTriErp( noise.y );\n" - " noise.z = RemapNoiseTriErp( noise.z );\n" - " \n" - " noise = noise * 2.0 - 1.0;\n" - " \n" - " return noise;\n" + " float3 noise = tex2D( samp1, ( n.xy / 512.0 ) * 1.0 ).rgb;\n" + "\n" + " noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );\n" + "\n" + " noise.x = RemapNoiseTriErp( noise.x );\n" + " noise.y = RemapNoiseTriErp( noise.y );\n" + " noise.z = RemapNoiseTriErp( noise.z );\n" + "\n" + " noise = noise * 2.0 - 1.0;\n" + "\n" + " return noise;\n" "}\n" "\n" "\n" "float Noise( float2 n, float x )\n" "{\n" - " n += x;\n" - " \n" + " n += x;\n" + "\n" "#if 1\n" " return fract( sin( dot( n.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 ) * 2.0 - 1.0;\n" "#else\n" - " //return BlueNoise( n, 55.0 );\n" - " return BlueNoise( n, 1.0 );\n" - " \n" - " //return InterleavedGradientNoise( n ) * 2.0 - 1.0;\n" + " //return BlueNoise( n, 55.0 );\n" + " return BlueNoise( n, 1.0 );\n" + "\n" + " //return InterleavedGradientNoise( n ) * 2.0 - 1.0;\n" "#endif\n" "}\n" "\n" @@ -10639,7 +10927,7 @@ static const cgShaderDef_t cg_renderprogs[] = "float Step1( float2 uv, float n )\n" "{\n" " float a = 1.0, b = 2.0, c = -12.0, t = 1.0;\n" - " \n" + "\n" " return ( 1.0 / ( a * 4.0 + b * 4.0 - c ) ) * (\n" " Noise( uv + float2( -1.0, -1.0 ) * t, n ) * a +\n" " Noise( uv + float2( 0.0, -1.0 ) * t, n ) * b +\n" @@ -10657,7 +10945,7 @@ static const cgShaderDef_t cg_renderprogs[] = "float Step2( float2 uv, float n )\n" "{\n" " float a = 1.0, b = 2.0, c = -2.0, t = 1.0;\n" - " \n" + "\n" " return ( 1.0 / ( a * 4.0 + b * 4.0 - c ) ) * (\n" " Step1( uv + float2( -1.0, -1.0 ) * t, n ) * a +\n" " Step1( uv + float2( 0.0, -1.0 ) * t, n ) * b +\n" @@ -10678,40 +10966,40 @@ static const cgShaderDef_t cg_renderprogs[] = " float a = Step2( uv, 0.07 );\n" " float b = Step2( uv, 0.11 );\n" " float c = Step2( uv, 0.13 );\n" - " \n" - " return float3( a, b, c );\n" + "\n" + " return float3( a, b, c );\n" "#else\n" - " //float a = BlueNoise( uv, 0.07 );\n" + " //float a = BlueNoise( uv, 0.07 );\n" " //float b = BlueNoise( uv, 0.11 );\n" " //float c = BlueNoise( uv, 0.13 );\n" - " \n" - " //float a = 1.0, b = 2.0, c = -12.0;\n" - " //return ( 1.0 / ( a * 4.0 + b * 4.0 - c ) ) * float3( BlueNoise( uv, 0.0 ) );\n" - " return BlueNoise3( uv, 0.0 );\n" + "\n" + " //float a = 1.0, b = 2.0, c = -12.0;\n" + " //return ( 1.0 / ( a * 4.0 + b * 4.0 - c ) ) * float3( BlueNoise( uv, 0.0 ) );\n" + " return BlueNoise3( uv, 0.0 );\n" "#endif\n" "}\n" "\n" "// Used for temporal dither.\n" "float3 Step3T( float2 uv )\n" "{\n" - " #if 1\n" + "#if 1\n" " float a = Step2( uv, 0.07 * fract( rpJitterTexOffset.z ) );\n" " float b = Step2( uv, 0.11 * fract( rpJitterTexOffset.z ) );\n" " float c = Step2( uv, 0.13 * fract( rpJitterTexOffset.z ) );\n" - " \n" + "\n" " return float3( a, b, c );\n" "#else\n" - " float a = BlueNoise( uv + 0.07, 1.0 );\n" + " float a = BlueNoise( uv + 0.07, 1.0 );\n" " float b = BlueNoise( uv + 0.11, 1.0 );\n" " float c = BlueNoise( uv + 0.13, 1.0 );\n" - " \n" - " //return BlueNoise3( uv + 0.07, 1.0 );\n" - " return float3( a, b, c );\n" - " \n" - " //float a = 1.0, b = 2.0, c = -2.0, d = -12.0;\n" - " \n" - " //float3 step2 = ( 1.0 / ( a * 4.0 + b * 4.0 - c ) ) * BlueNoise3( uv, 55.0 );\n" - " //return step2 * ( 1.0 / ( a * 4.0 + b * 4.0 - d ) ) * BlueNoise3( uv, 55.0 );\n" + "\n" + " //return BlueNoise3( uv + 0.07, 1.0 );\n" + " return float3( a, b, c );\n" + "\n" + " //float a = 1.0, b = 2.0, c = -2.0, d = -12.0;\n" + "\n" + " //float3 step2 = ( 1.0 / ( a * 4.0 + b * 4.0 - c ) ) * BlueNoise3( uv, 55.0 );\n" + " //return step2 * ( 1.0 / ( a * 4.0 + b * 4.0 - d ) ) * BlueNoise3( uv, 55.0 );\n" "#endif\n" "}\n" "\n" @@ -10839,9 +11127,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -10865,6 +11153,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -10877,8 +11166,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -10896,10 +11187,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -10923,6 +11214,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN\n" @@ -10935,11 +11227,12 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " float2 tCoords = fragment.texcoord0;\n" - " \n" + "\n" " float4 color = tex2D( samp0, tCoords );\n" " result.color = color;\n" "}\n" @@ -10953,9 +11246,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -10979,6 +11272,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -10991,8 +11285,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -11010,9 +11306,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11036,12 +11332,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = rpColor;\n" "}\n" @@ -11053,9 +11353,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11079,6 +11379,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" "};\n" @@ -11086,8 +11387,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -11105,9 +11408,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11131,12 +11434,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = rpColor;\n" "}\n" @@ -11148,9 +11455,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11174,6 +11481,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" "};\n" @@ -11181,8 +11489,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -11200,9 +11510,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11226,12 +11536,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = rpColor;\n" "}\n" @@ -11243,10 +11557,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11272,6 +11586,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float4 color : COLOR0;\n" @@ -11281,8 +11596,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " //--------------------------------------------------------------\n" " // GPU transformation of the normal / binormal / bitangent\n" " //\n" @@ -11294,25 +11611,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -11340,9 +11657,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11366,12 +11683,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = rpColor;\n" "}\n" @@ -11383,10 +11704,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11410,6 +11731,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" "struct VS_IN {\n" @@ -11421,8 +11743,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " //--------------------------------------------------------------\n" " // GPU transformation of the normal / binormal / bitangent\n" " //\n" @@ -11434,25 +11758,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -11480,9 +11804,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11506,6 +11830,9 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" @@ -11514,8 +11841,7 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" - "\n" - "uniform sampler2D samp0 : register(s0);\n" + "// *INDENT-OFF*\n" "\n" "static float2 screenPosToTexcoord( float2 pos, float4 bias_scale ) { return ( pos * bias_scale.zw + bias_scale.xy ); }\n" "\n" @@ -11523,7 +11849,7 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + "\n" " float interpolatedZOverW = ( 1.0 - ( fragment.texcoord0.z / fragment.texcoord0.w ) );\n" "\n" " float3 pos;\n" @@ -11547,9 +11873,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11573,6 +11899,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -11585,8 +11912,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float4 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -11605,9 +11934,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11631,6 +11960,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform samplerCUBE samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -11642,8 +11972,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n" "}\n" "\n" @@ -11656,9 +11988,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -11682,6 +12014,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -11695,15 +12028,17 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 texcoord0 : TEXCOORD0;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" + "\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "}\n" "\n" @@ -11752,7 +12087,7 @@ static const cgShaderDef_t cg_renderprogs[] = "uniform sampler2D samp0 : register(s0); // _smaaEdges\n" "uniform sampler2D samp1 : register(s1); // _smaaArea\n" "uniform sampler2D samp2 : register(s2); // _smaaSearch\n" - " \n" + "\n" "struct PS_IN\n" "{\n" " float4 position : VPOS;\n" @@ -11762,7 +12097,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord3 : TEXCOORD3_centroid;\n" " float4 texcoord4 : TEXCOORD4_centroid;\n" "};\n" - " \n" + "\n" "struct PS_OUT\n" "{\n" " float4 color : COLOR;\n" @@ -11773,25 +12108,25 @@ static const cgShaderDef_t cg_renderprogs[] = "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " float2 texcoord = fragment.texcoord0;\n" - " \n" + "\n" " float4 offset[3];\n" " offset[0] = fragment.texcoord1;\n" " offset[1] = fragment.texcoord2;\n" " offset[2] = fragment.texcoord3;\n" "\n" " float2 pixcoord = fragment.texcoord4.st;\n" - " \n" + "\n" " // TODO\n" " //float4 subsampleIndices = float4( 1.0, 1.0, 1.0, 0.0 );\n" " float4 subsampleIndices = float4( 0.0, 0.0, 0.0, 0.0 );\n" - " \n" + "\n" " float4 color = SMAABlendingWeightCalculationPS( texcoord,\n" - " pixcoord,\n" - " offset,\n" - " samp0,\n" - " samp1,\n" - " samp2,\n" - " subsampleIndices );\n" + " pixcoord,\n" + " offset,\n" + " samp0,\n" + " samp1,\n" + " samp2,\n" + " subsampleIndices );\n" "\n" " //color = float4( texcoord.s, texcoord.t, 0.0, 1.0 );\n" " result.color = color;\n" @@ -11806,10 +12141,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 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" + "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" @@ -11837,6 +12172,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#define SMAA_INCLUDE_PS 0\n" "#include \"SMAA.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -11855,6 +12191,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord3 : TEXCOORD3;\n" " float4 texcoord4 : TEXCOORD4;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -11867,7 +12204,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 offset[3];\n" " float2 pixcoord;\n" " SMAABlendingWeightCalculationVS( texcoord, pixcoord, offset );\n" - " \n" + "\n" " result.texcoord1 = offset[0];\n" " result.texcoord2 = offset[1];\n" " result.texcoord3 = offset[2];\n" @@ -11917,7 +12254,7 @@ static const cgShaderDef_t cg_renderprogs[] = "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // _currentColor\n" "uniform sampler2D samp1 : register(s1); // TODO _predictColor\n" - " \n" + "\n" "struct PS_IN\n" "{\n" " float4 position : VPOS;\n" @@ -11926,7 +12263,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord2 : TEXCOORD2_centroid;\n" " float4 texcoord3 : TEXCOORD3_centroid;\n" "};\n" - " \n" + "\n" "struct PS_OUT\n" "{\n" " float4 color : COLOR;\n" @@ -11937,21 +12274,21 @@ static const cgShaderDef_t cg_renderprogs[] = "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " float2 tCoords = fragment.texcoord0;\n" - " \n" + "\n" " float4 offset[3];\n" " offset[0] = fragment.texcoord1;\n" " offset[1] = fragment.texcoord2;\n" " offset[2] = fragment.texcoord3;\n" - " \n" + "\n" " float4 color = float4( 0.0 );\n" " color.rg = SMAALumaEdgeDetectionPS( tCoords,\n" - " offset,\n" - " samp0\n" - " #if SMAA_PREDICATION\n" - " , samp1\n" - " #endif\n" - " );\n" - " \n" + " offset,\n" + " samp0\n" + "#if SMAA_PREDICATION\n" + " , samp1\n" + "#endif\n" + " );\n" + "\n" " result.color = color;\n" "}\n" "\n" @@ -11964,10 +12301,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 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" + "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" @@ -11995,6 +12332,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#define SMAA_INCLUDE_PS 0\n" "#include \"SMAA.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -12012,6 +12350,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord2 : TEXCOORD2;\n" " float4 texcoord3 : TEXCOORD3;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -12019,12 +12358,12 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " float2 texcoord = vertex.texcoord;\n" " //float2 texcoord = float2( vertex.texcoord.s, 1.0 - vertex.texcoord.t );\n" - " \n" + "\n" " result.texcoord0 = texcoord;\n" "\n" " float4 offset[3];\n" " SMAAEdgeDetectionVS( texcoord, offset );\n" - " \n" + "\n" " result.texcoord1 = offset[0];\n" " result.texcoord2 = offset[1];\n" " result.texcoord3 = offset[2];\n" @@ -12073,14 +12412,14 @@ static const cgShaderDef_t cg_renderprogs[] = "uniform sampler2D samp0 : register(s0); // _currentColor\n" "uniform sampler2D samp1 : register(s1); // _smaaBlend\n" "//uniform sampler2D samp2 : register(s1); // _velocity\n" - " \n" + "\n" "struct PS_IN\n" "{\n" " float4 position : VPOS;\n" " float2 texcoord0 : TEXCOORD0_centroid;\n" " float4 texcoord1 : TEXCOORD1_centroid;\n" "};\n" - " \n" + "\n" "struct PS_OUT\n" "{\n" " float4 color : COLOR;\n" @@ -12091,18 +12430,18 @@ static const cgShaderDef_t cg_renderprogs[] = "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " float2 texcoord = fragment.texcoord0;\n" - " \n" + "\n" " float4 offset = fragment.texcoord1;\n" "\n" - " float4 color = SMAANeighborhoodBlendingPS(texcoord,\n" - " offset,\n" - " samp0,\n" - " samp1\n" - " #if SMAA_REPROJECTION\n" - " , SMAATexture2D(velocityTex)\n" - " #endif\n" - " );\n" - " \n" + " float4 color = SMAANeighborhoodBlendingPS( texcoord,\n" + " offset,\n" + " samp0,\n" + " samp1\n" + "#if SMAA_REPROJECTION\n" + " , SMAATexture2D( velocityTex )\n" + "#endif\n" + " );\n" + "\n" " //color = tex2D( samp1, texcoord );\n" " //color = float4( samp1 );\n" " result.color = color;\n" @@ -12117,10 +12456,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 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" + "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" @@ -12148,6 +12487,7 @@ static const cgShaderDef_t cg_renderprogs[] = "#define SMAA_INCLUDE_PS 0\n" "#include \"SMAA.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN \n" "{\n" " float4 position : POSITION;\n" @@ -12163,6 +12503,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord0 : TEXCOORD0;\n" " float4 texcoord1 : TEXCOORD1;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -12172,7 +12513,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" " float4 offset;\n" " SMAANeighborhoodBlendingVS( vertex.texcoord, offset );\n" - " \n" + "\n" " result.texcoord1 = offset;\n" "}\n" @@ -12184,9 +12525,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12210,13 +12551,16 @@ static const cgShaderDef_t cg_renderprogs[] = "\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" + "void main( out PS_OUT result )\n" + "{\n" " result.color = rpColor;\n" "}\n" @@ -12228,9 +12572,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12254,6 +12598,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -12265,8 +12610,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -12281,9 +12628,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12307,6 +12654,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "uniform sampler2D samp1 : register(s1);\n" "\n" @@ -12317,14 +12665,19 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" - " // texcoords will run from 0 to 1 across the entire screen\n" - " if ( fract( fragment.position.y * 0.5 ) < 0.5 ) {\n" - " result.color = tex2D( samp0, vec2( fragment.texcoord0 ) );\n" - " } else {\n" - " result.color = tex2D( samp1, vec2( fragment.texcoord0 ) );\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" }, @@ -12335,9 +12688,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12361,6 +12714,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -12370,8 +12724,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -12388,9 +12744,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12422,6 +12778,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "*/\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -12432,12 +12789,14 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" - " const float screenWarp_range = 1.45;\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" + " 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" @@ -12447,14 +12806,14 @@ static const cgShaderDef_t cg_renderprogs[] = " float scaledRadialLength = radialLength * range;\n" " float tanScaled = tan( scaledRadialLength );\n" "\n" - " float rescaleValue = tan( 0.5 * range );\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" + " // 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" + " vec2 warped = warpCenter + vec2( 0.5, 0.5 ) * radialDir * rescaled;\n" "\n" " result.color = tex2D( samp0, warped );\n" "}\n" @@ -12468,9 +12827,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12494,6 +12853,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float4 texcoord : TEXCOORD0;\n" @@ -12503,8 +12863,10 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + "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" @@ -12520,9 +12882,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12546,6 +12908,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -12556,8 +12919,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -12571,9 +12936,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12597,6 +12962,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -12609,18 +12975,23 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - " } else {\n" + " }\n" + " else\n" + " {\n" " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" " }\n" @@ -12634,9 +13005,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12660,6 +13031,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -12671,8 +13043,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -12686,9 +13060,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12712,6 +13086,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -12725,18 +13100,23 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord0 : TEXCOORD0;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" " result.texcoord0.x = dot4( vertex.position, rpTexGen0S );\n" " result.texcoord0.y = dot4( vertex.position, rpTexGen0T );\n" - " } else {\n" + " }\n" + " else\n" + " {\n" " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" " }\n" @@ -12753,9 +13133,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12779,6 +13159,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -12790,8 +13171,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -12805,10 +13188,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12834,6 +13217,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "uniform matrices_ubo { float4 matrices[408]; };\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -12848,8 +13232,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float2 texcoord0 : TEXCOORD0;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " //--------------------------------------------------------------\n" " // GPU transformation of the normal / binormal / bitangent\n" " //\n" @@ -12861,25 +13247,25 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + " 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" + " 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" + " 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" + " 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" @@ -12893,10 +13279,13 @@ static const cgShaderDef_t cg_renderprogs[] = " result.position.w = dot4( modelPosition, rpMVPmatrixW );\n" "\n" " // compute oldschool texgen or multiply by texture matrix\n" - " BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {\n" + " BRANCH if( rpTexGen0Enabled.x > 0.0 )\n" + " {\n" " result.texcoord0.x = dot4( modelPosition, rpTexGen0S );\n" " result.texcoord0.y = dot4( modelPosition, rpTexGen0T );\n" - " } else {\n" + " }\n" + " else\n" + " {\n" " result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );\n" " result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );\n" " }\n" @@ -12913,9 +13302,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12939,8 +13328,10 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" - "uniform sampler2D samp0 : register(s0);\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" @@ -12950,8 +13341,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\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" @@ -12970,9 +13363,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -12996,6 +13389,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -13009,8 +13403,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 texcoord0 : TEXCOORD0;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -13021,7 +13417,7 @@ static const cgShaderDef_t cg_renderprogs[] = " tc0.y = dot4( vertex.position, rpTexGen0T );\n" "\n" " tc0.z = 0.0f;\n" - " tc0.w = dot4( vertex.position, rpTexGen0Q ); \n" + " tc0.w = dot4( vertex.position, rpTexGen0Q );\n" "\n" " // multiply the texture matrix in\n" " result.texcoord0.x = dot4( tc0, rpTextureMatrixS );\n" @@ -13041,10 +13437,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n" + "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.\n" "Copyright (C) 2009-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" + "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" @@ -13068,6 +13464,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0); // texture 0 is _currentRender\n" "uniform sampler2D samp1 : register(s1); // texture 1 is heatmap\n" "\n" @@ -13081,9 +13478,8 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "\n" - " \n" "float3 Uncharted2Tonemap( float3 x )\n" "{\n" " float A = 0.22; // shoulder strength\n" @@ -13100,62 +13496,62 @@ static const cgShaderDef_t cg_renderprogs[] = "// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/\n" "float3 ACESFilm( float3 x )\n" "{\n" - " float a = 2.51;\n" - " float b = 0.03;\n" - " float c = 2.43;\n" - " float d = 0.59;\n" - " float e = 0.14;\n" - " return saturate( ( x * ( a * x + b ) ) / ( x * ( c * x + d ) + e ) );\n" + " float a = 2.51;\n" + " float b = 0.03;\n" + " float c = 2.43;\n" + " float d = 0.59;\n" + " float e = 0.14;\n" + " return saturate( ( x * ( a * x + b ) ) / ( x * ( c * x + d ) + e ) );\n" "}\n" "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" " float2 tCoords = fragment.texcoord0;\n" - " \n" + "\n" "#if defined(BRIGHTPASS_FILTER)\n" " // multiply with 4 because the FBO is only 1/4th of the screen resolution\n" " tCoords *= float2( 4.0, 4.0 );\n" "#endif\n" - " \n" + "\n" " float4 color = tex2D( samp0, tCoords );\n" - " \n" + "\n" " // get the luminance of the current pixel\n" " float Y = dot( LUMINANCE_SRGB, color );\n" "\n" " const float hdrGamma = 2.2;\n" " float gamma = hdrGamma;\n" - " \n" + "\n" "#if 0\n" " // convert from sRGB to linear RGB\n" " color.r = pow( color.r, gamma );\n" " color.g = pow( color.g, gamma );\n" " color.b = pow( color.b, gamma );\n" "#endif\n" - " \n" + "\n" "#if defined(BRIGHTPASS)\n" - " if(Y < 0.1)\n" + " if( Y < 0.1 )\n" " {\n" " //discard;\n" " result.color = float4( 0.0, 0.0, 0.0, 1.0 );\n" " return;\n" " }\n" "#endif\n" - " \n" + "\n" " float hdrKey = rpScreenCorrectionFactor.x;\n" " float hdrAverageLuminance = rpScreenCorrectionFactor.y;\n" " float hdrMaxLuminance = rpScreenCorrectionFactor.z;\n" - " \n" + "\n" " // calculate the relative luminance\n" " float Yr = ( hdrKey * Y ) / hdrAverageLuminance;\n" "\n" " float Ymax = hdrMaxLuminance;\n" "\n" "#define OPERATOR 2\n" - " \n" + "\n" "#if OPERATOR == 0\n" " // advanced Reinhard operator, artistically desirable to burn out bright areas\n" " //float L = Yr * ( 1.0 + Yr / ( Ymax * Ymax ) ) / ( 1.0 + Yr );\n" - " \n" + "\n" " // exponential tone mapper that is very similar to the Uncharted one\n" " // very good in keeping the colors natural\n" " float L = 1.0 - exp( -Yr );\n" @@ -13168,44 +13564,44 @@ static const cgShaderDef_t cg_renderprogs[] = " float exposure = 1.0;\n" " float L = ( 1.0 - exp( -Yr * exposure ) );\n" " color.rgb *= L;\n" - " \n" + "\n" " // Kodak filmic tone mappping, includes gamma correction\n" " //float3 rgb = max( float3( 0 ), color.rgb - float3( 0.004 ) );\n" " //color.rgb = rgb * ( float3( 0.5 ) + 6.2 * rgb ) / ( float3( 0.06 ) + rgb * ( float3( 1.7 ) + 6.2 * rgb ) );\n" - " \n" + "\n" " // http://iwasbeingirony.blogspot.de/2010/04/approximating-film-with-tonemapping.html\n" " //const float cutoff = 0.025;\n" " //color.rgb += ( cutoff * 2.0 - color.rgb ) * saturate( cutoff * 2 - color.rgb ) * ( 0.25 / cutoff ) - cutoff;\n" " //color.rgb = color.rgb * ( float3( 0.5 ) + 6.2 * color.rgb ) / ( float3( 0.06 ) + color.rgb * ( float3( 1.7 ) + 6.2 * color.rgb ) );\n" - " \n" + "\n" "#elif OPERATOR == 2\n" "\n" " // can be in range [-4.0 .. 4.0]\n" " //float exposureOffset = rpScreenCorrectionFactor.w;\n" - " \n" + "\n" " float avgLuminance = max( hdrAverageLuminance, 0.001 );\n" " float linearExposure = ( hdrKey / avgLuminance );\n" " float exposure = log2( max( linearExposure, 0.0001 ) );\n" - " \n" + "\n" " //exposure = -2.0;\n" " float3 exposedColor = exp2( exposure ) * color.rgb;\n" - " \n" + "\n" " color.rgb = ACESFilm( exposedColor );\n" - " \n" + "\n" "#elif OPERATOR == 3\n" "\n" " // can be in range [-4.0 .. 4.0]\n" " float exposure = rpScreenCorrectionFactor.w;\n" - " \n" + "\n" " // exposure curves ranges from 0.0625 to 16.0\n" " float3 exposedColor = exp2( exposure ) * color.rgb;\n" " //float3 exposedColor = exposure * color.rgb;\n" - " \n" + "\n" " float3 curr = ACESFilm( exposedColor );\n" - " \n" + "\n" " float3 whiteScale = 1.0 / ACESFilm( float3( Ymax ) );\n" " color.rgb = curr * whiteScale;\n" - " \n" + "\n" "#elif OPERATOR == 4\n" " // Uncharted 2 tone mapping based on Kodak film curve\n" "\n" @@ -13213,29 +13609,29 @@ static const cgShaderDef_t cg_renderprogs[] = " //float exposure = Yr * 1.0;\n" " float exposure = rpScreenCorrectionFactor.w;\n" " float3 exposedColor = exposure * color.rgb;\n" - " \n" + "\n" " float3 curr = Uncharted2Tonemap( exposedColor );\n" - " \n" + "\n" " float3 whiteScale = 1.0 / Uncharted2Tonemap( float3( Ymax ) );\n" " color.rgb = curr * whiteScale;\n" "#endif\n" - " \n" + "\n" "#if defined(BRIGHTPASS)\n" " // adjust contrast\n" " //L = pow( L, 1.32 );\n" - " \n" + "\n" " const half hdrContrastThreshold = rpOverbright.x;\n" " const half hdrContrastOffset = rpOverbright.y;\n" - " \n" + "\n" " //float T = max( ( Yr * ( 1.0 + Yr / ( Ymax * Ymax * 2.0 ) ) ) - hdrContrastThreshold, 0.0 );\n" " //float T = max( 1.0 - exp( -Yr ) - hdrContrastThreshold, 0.0 );\n" " float T = max( Yr - hdrContrastThreshold, 0.0 );\n" - " \n" + "\n" " float B = T > 0.0 ? T / ( hdrContrastOffset + T ) : T;\n" - " \n" + "\n" " color.rgb *= clamp( B, 0.0, 1.0 );\n" "#endif\n" - " \n" + "\n" "#if 1\n" " // convert from linear RGB to sRGB\n" "\n" @@ -13245,43 +13641,43 @@ static const cgShaderDef_t cg_renderprogs[] = " color.g = pow( color.g, gamma );\n" " color.b = pow( color.b, gamma );\n" "#endif\n" - " \n" + "\n" "#if defined(HDR_DEBUG)\n" " // https://google.github.io/filament/Filament.md.html#figure_luminanceviz\n" - " \n" - " const float3 debugColors[16] = float3[](\n" - " float3(0.0, 0.0, 0.0), // black\n" - " float3(0.0, 0.0, 0.1647), // darkest blue\n" - " float3(0.0, 0.0, 0.3647), // darker blue\n" - " float3(0.0, 0.0, 0.6647), // dark blue\n" - " float3(0.0, 0.0, 0.9647), // blue\n" - " float3(0.0, 0.9255, 0.9255), // cyan\n" - " float3(0.0, 0.5647, 0.0), // dark green\n" - " float3(0.0, 0.7843, 0.0), // green\n" - " float3(1.0, 1.0, 0.0), // yellow\n" - " float3(0.90588, 0.75294, 0.0), // yellow-orange\n" - " float3(1.0, 0.5647, 0.0), // orange\n" - " float3(1.0, 0.0, 0.0), // bright red\n" - " float3(0.8392, 0.0, 0.0), // red\n" - " float3(1.0, 0.0, 1.0), // magenta\n" - " float3(0.6, 0.3333, 0.7882), // purple\n" - " float3(1.0, 1.0, 1.0) // white\n" - " );\n" - " \n" - " // The 5th color in the array (cyan) represents middle gray (18%)\n" - " // Every stop above or below middle gray causes a color shift\n" - " float v = log2( Y / 0.18 );\n" - " v = clamp( v + 5.0, 0.0, 15.0 );\n" - " int index = int( floor( v ) );\n" - " \n" - " color.rgb = lerp( debugColors[index], debugColors[ min(15, index + 1) ], fract( v ) );\n" - " \n" - " //color = tex2D( samp1, float2( L, 0.0 ) );\n" - " //color = tex2D( samp1, float2( dot( LUMINANCE_SRGB, color ), 0.0 ) );\n" + "\n" + " const float3 debugColors[16] = float3[](\n" + " float3( 0.0, 0.0, 0.0 ), // black\n" + " float3( 0.0, 0.0, 0.1647 ), // darkest blue\n" + " float3( 0.0, 0.0, 0.3647 ), // darker blue\n" + " float3( 0.0, 0.0, 0.6647 ), // dark blue\n" + " float3( 0.0, 0.0, 0.9647 ), // blue\n" + " float3( 0.0, 0.9255, 0.9255 ), // cyan\n" + " float3( 0.0, 0.5647, 0.0 ), // dark green\n" + " float3( 0.0, 0.7843, 0.0 ), // green\n" + " float3( 1.0, 1.0, 0.0 ), // yellow\n" + " float3( 0.90588, 0.75294, 0.0 ), // yellow-orange\n" + " float3( 1.0, 0.5647, 0.0 ), // orange\n" + " float3( 1.0, 0.0, 0.0 ), // bright red\n" + " float3( 0.8392, 0.0, 0.0 ), // red\n" + " float3( 1.0, 0.0, 1.0 ), // magenta\n" + " float3( 0.6, 0.3333, 0.7882 ), // purple\n" + " float3( 1.0, 1.0, 1.0 ) // white\n" + " );\n" + "\n" + " // The 5th color in the array (cyan) represents middle gray (18%)\n" + " // Every stop above or below middle gray causes a color shift\n" + " float v = log2( Y / 0.18 );\n" + " v = clamp( v + 5.0, 0.0, 15.0 );\n" + " int index = int( floor( v ) );\n" + "\n" + " color.rgb = lerp( debugColors[index], debugColors[ min( 15, index + 1 ) ], fract( v ) );\n" + "\n" + " //color = tex2D( samp1, float2( L, 0.0 ) );\n" + " //color = tex2D( samp1, float2( dot( LUMINANCE_SRGB, color ), 0.0 ) );\n" "#endif\n" "\n" " result.color = color;\n" - " \n" + "\n" "#if 0\n" " result.color = float4( L, L, L, 1.0 );\n" "#endif\n" @@ -13296,9 +13692,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -13322,6 +13718,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -13334,8 +13731,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float2 texcoord0 : TEXCOORD0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -13353,10 +13752,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -13380,6 +13779,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform sampler2D samp0 : register(s0);\n" "\n" "struct PS_IN\n" @@ -13391,6 +13791,7 @@ static const cgShaderDef_t cg_renderprogs[] = "{\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( PS_IN fragment, out PS_OUT result )\n" "{\n" @@ -13405,10 +13806,10 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -13432,6 +13833,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN\n" "{\n" " float4 position : POSITION;\n" @@ -13446,6 +13848,7 @@ static const cgShaderDef_t cg_renderprogs[] = " float4 position : POSITION;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" "void main( VS_IN vertex, out VS_OUT result )\n" "{\n" @@ -13453,7 +13856,7 @@ static const cgShaderDef_t cg_renderprogs[] = " 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" + "\n" " result.color = swizzleColor( vertex.color );\n" "}\n" @@ -13465,9 +13868,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -13491,6 +13894,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "uniform samplerCUBE samp0 : register(s0);\n" "\n" "struct PS_IN {\n" @@ -13502,8 +13906,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct PS_OUT {\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( PS_IN fragment, out PS_OUT result ) {\n" + "void main( PS_IN fragment, out PS_OUT result )\n" + "{\n" " result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n" "}\n" "\n" @@ -13516,9 +13922,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -13542,6 +13948,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" " float2 texcoord : TEXCOORD0;\n" @@ -13555,8 +13962,10 @@ static const cgShaderDef_t cg_renderprogs[] = " float3 texcoord0 : TEXCOORD0;\n" " float4 color : COLOR0;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\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" @@ -13566,7 +13975,7 @@ static const cgShaderDef_t cg_renderprogs[] = " result.texcoord0.x = dot3( t0, rpWobbleSkyX );\n" " result.texcoord0.y = dot3( t0, rpWobbleSkyY );\n" " result.texcoord0.z = dot3( t0, rpWobbleSkyZ );\n" - " \n" + "\n" " result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;\n" "}\n" "\n" @@ -13579,9 +13988,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -13605,12 +14014,15 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct PS_OUT { \n" " float depth : DEPTH;\n" " float4 color : COLOR;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( out PS_OUT result ) {\n" + "void main( out PS_OUT result )\n" + "{\n" " result.depth = 1;\n" " result.color = float4( 0.0, 0.0, 0.0, 0.0 );\n" "}\n" @@ -13623,9 +14035,9 @@ static const cgShaderDef_t cg_renderprogs[] = "===========================================================================\n" "\n" "Doom 3 BFG Edition GPL Source Code\n" - "Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \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" + "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" @@ -13649,6 +14061,7 @@ static const cgShaderDef_t cg_renderprogs[] = "\n" "#include \"global.inc.hlsl\"\n" "\n" + "// *INDENT-OFF*\n" "struct VS_IN {\n" " float4 position : POSITION;\n" "};\n" @@ -13656,8 +14069,10 @@ static const cgShaderDef_t cg_renderprogs[] = "struct VS_OUT {\n" " float4 position : POSITION;\n" "};\n" + "// *INDENT-ON*\n" "\n" - "void main( VS_IN vertex, out VS_OUT result ) {\n" + "void main( VS_IN vertex, out VS_OUT result )\n" + "{\n" " result.position = vertex.position;\n" " result.position.z = -1.0;\n" "}\n" diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index c27d6505..7b9fc70b 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -282,9 +282,9 @@ idCVar r_ldrContrastOffset( "r_ldrContrastOffset", "3", CVAR_RENDERER | CVAR_FLO idCVar r_useFilmicPostProcessEffects( "r_useFilmicPostProcessEffects", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "apply several post process effects to mimic a filmic look" ); #if defined( USE_VULKAN ) - idCVar r_forceAmbient( "r_forceAmbient", "0.2", CVAR_RENDERER | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 0.4f ); + idCVar r_forceAmbient( "r_forceAmbient", "0.2", CVAR_RENDERER | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 0.75f ); #else - idCVar r_forceAmbient( "r_forceAmbient", "0.3", CVAR_RENDERER | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 0.4f ); + idCVar r_forceAmbient( "r_forceAmbient", "0.3", CVAR_RENDERER | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 0.75f ); #endif idCVar r_useSSGI( "r_useSSGI", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "use screen space global illumination and reflections" ); diff --git a/neo/renderer/Vulkan/Image_VK.cpp b/neo/renderer/Vulkan/Image_VK.cpp index 1250ca53..d0723772 100644 --- a/neo/renderer/Vulkan/Image_VK.cpp +++ b/neo/renderer/Vulkan/Image_VK.cpp @@ -236,6 +236,10 @@ void idImage::CreateSampler() createInfo.compareEnable = ( opts.format == FMT_DEPTH ); createInfo.compareOp = ( opts.format == FMT_DEPTH ) ? VK_COMPARE_OP_LESS_OR_EQUAL : VK_COMPARE_OP_NEVER; + // RB: support textureLod + createInfo.minLod = 0.0f; + createInfo.maxLod = opts.numLevels; + switch( filter ) { case TF_DEFAULT: