mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-04 01:41:40 +00:00
6706 lines
293 KiB
C
6706 lines
293 KiB
C
// Cg shaders, as static data buffers for release mode builds
|
||
// DO NOT EDIT - this file is autogenerated - see BUILD.txt
|
||
// To regenerate this file, run: premake4 embed
|
||
|
||
struct cgShaderDef_t
|
||
{
|
||
const char* name;
|
||
const char* shaderText;
|
||
};
|
||
|
||
static const cgShaderDef_t cg_renderprogs[] =
|
||
{
|
||
{
|
||
"renderprogs/global.inc",
|
||
"/*\n"
|
||
"===========================================================================\n"
|
||
"\n"
|
||
"Doom 3 BFG Edition GPL Source Code\n"
|
||
"Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n"
|
||
"Copyright (C) 2013 Robert Beckebans\n"
|
||
"\n"
|
||
"This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n"
|
||
"\n"
|
||
"Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify\n"
|
||
"it under the terms of the GNU General Public License as published by\n"
|
||
"the Free Software Foundation, either version 3 of the License, or\n"
|
||
"(at your option) any later version.\n"
|
||
"\n"
|
||
"Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,\n"
|
||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||
"GNU General Public License for more details.\n"
|
||
"\n"
|
||
"You should have received a copy of the GNU General Public License\n"
|
||
"along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.\n"
|
||
"\n"
|
||
"In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.\n"
|
||
"\n"
|
||
"If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.\n"
|
||
"\n"
|
||
"===========================================================================\n"
|
||
"*/\n"
|
||
"\n"
|
||
"uniform float4 rpScreenCorrectionFactor : register(c0);\n"
|
||
"uniform float4 rpWindowCoord : register(c1);\n"
|
||
"uniform float4 rpDiffuseModifier : register(c2);\n"
|
||
"uniform float4 rpSpecularModifier : register(c3);\n"
|
||
"\n"
|
||
"uniform float4 rpLocalLightOrigin : register(c4);\n"
|
||
"uniform float4 rpLocalViewOrigin : register(c5);\n"
|
||
"\n"
|
||
"uniform float4 rpLightProjectionS : register(c6);\n"
|
||
"uniform float4 rpLightProjectionT : register(c7);\n"
|
||
"uniform float4 rpLightProjectionQ : register(c8);\n"
|
||
"uniform float4 rpLightFalloffS : register(c9);\n"
|
||
"\n"
|
||
"uniform float4 rpBumpMatrixS : register(c10);\n"
|
||
"uniform float4 rpBumpMatrixT : register(c11);\n"
|
||
"\n"
|
||
"uniform float4 rpDiffuseMatrixS : register(c12);\n"
|
||
"uniform float4 rpDiffuseMatrixT : register(c13);\n"
|
||
"\n"
|
||
"uniform float4 rpSpecularMatrixS : register(c14);\n"
|
||
"uniform float4 rpSpecularMatrixT : register(c15);\n"
|
||
"\n"
|
||
"uniform float4 rpVertexColorModulate : register(c16);\n"
|
||
"uniform float4 rpVertexColorAdd : register(c17);\n"
|
||
"\n"
|
||
"uniform float4 rpColor : register(c18);\n"
|
||
"uniform float4 rpViewOrigin : register(c19);\n"
|
||
"uniform float4 rpGlobalEyePos : register(c20);\n"
|
||
"\n"
|
||
"uniform float4 rpMVPmatrixX : register(c21);\n"
|
||
"uniform float4 rpMVPmatrixY : register(c22);\n"
|
||
"uniform float4 rpMVPmatrixZ : register(c23);\n"
|
||
"uniform float4 rpMVPmatrixW : register(c24);\n"
|
||
"\n"
|
||
"uniform float4 rpModelMatrixX : register(c25);\n"
|
||
"uniform float4 rpModelMatrixY : register(c26);\n"
|
||
"uniform float4 rpModelMatrixZ : register(c27);\n"
|
||
"uniform float4 rpModelMatrixW : register(c28);\n"
|
||
"\n"
|
||
"uniform float4 rpProjectionMatrixX : register(c29);\n"
|
||
"uniform float4 rpProjectionMatrixY : register(c30);\n"
|
||
"uniform float4 rpProjectionMatrixZ : register(c31);\n"
|
||
"uniform float4 rpProjectionMatrixW : register(c32);\n"
|
||
"\n"
|
||
"uniform float4 rpModelViewMatrixX : register(c33);\n"
|
||
"uniform float4 rpModelViewMatrixY : register(c34);\n"
|
||
"uniform float4 rpModelViewMatrixZ : register(c35);\n"
|
||
"uniform float4 rpModelViewMatrixW : register(c36);\n"
|
||
"\n"
|
||
"uniform float4 rpTextureMatrixS : register(c37);\n"
|
||
"uniform float4 rpTextureMatrixT : register(c38);\n"
|
||
"\n"
|
||
"uniform float4 rpTexGen0S : register(c39);\n"
|
||
"uniform float4 rpTexGen0T : register(c40);\n"
|
||
"uniform float4 rpTexGen0Q : register(c41);\n"
|
||
"uniform float4 rpTexGen0Enabled : register(c42);\n"
|
||
"\n"
|
||
"uniform float4 rpTexGen1S : register(c43);\n"
|
||
"uniform float4 rpTexGen1T : register(c44);\n"
|
||
"uniform float4 rpTexGen1Q : register(c45);\n"
|
||
"uniform float4 rpTexGen1Enabled : register(c46);\n"
|
||
"\n"
|
||
"uniform float4 rpWobbleSkyX : register(c47);\n"
|
||
"uniform float4 rpWobbleSkyY : register(c48);\n"
|
||
"uniform float4 rpWobbleSkyZ : register(c49);\n"
|
||
"\n"
|
||
"uniform float4 rpOverbright : register(c50);\n"
|
||
"uniform float4 rpEnableSkinning : register(c51);\n"
|
||
"uniform float4 rpAlphaTest : register(c52);\n"
|
||
"\n"
|
||
"static float dot2( float2 a, float2 b ) { return dot( a, b ); }\n"
|
||
"static float dot3( float3 a, float3 b ) { return dot( a, b ); }\n"
|
||
"static float dot3( float3 a, float4 b ) { return dot( a, b.xyz ); }\n"
|
||
"static float dot3( float4 a, float3 b ) { return dot( a.xyz, b ); }\n"
|
||
"static float dot3( float4 a, float4 b ) { return dot( a.xyz, b.xyz ); }\n"
|
||
"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"
|
||
"// ----------------------\n"
|
||
"// YCoCg Color Conversion\n"
|
||
"// ----------------------\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"
|
||
"\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"
|
||
" half3 rgbColor;\n"
|
||
"\n"
|
||
" YCoCg.z = ( YCoCg.z * 31.875 ) + 1.0; //z = z * 255.0/8.0 + 1.0\n"
|
||
" YCoCg.z = 1.0 / YCoCg.z;\n"
|
||
" YCoCg.xy *= YCoCg.z;\n"
|
||
" rgbColor.x = dot4( YCoCg, matrixCoCg1YtoRGB1X );\n"
|
||
" rgbColor.y = dot4( YCoCg, matrixCoCg1YtoRGB1Y );\n"
|
||
" rgbColor.z = dot4( YCoCg, matrixCoCg1YtoRGB1Z );\n"
|
||
" return rgbColor;\n"
|
||
"}\n"
|
||
"\n"
|
||
"static float2 CenterScale( float2 inTC, float2 centerScale ) {\n"
|
||
" float scaleX = centerScale.x;\n"
|
||
" float scaleY = centerScale.y;\n"
|
||
" float4 tc0 = float4( scaleX, 0, 0, 0.5 - ( 0.5f * scaleX ) );\n"
|
||
" float4 tc1 = float4( 0, scaleY, 0, 0.5 - ( 0.5f * scaleY ) );\n"
|
||
"\n"
|
||
" float2 finalTC;\n"
|
||
" finalTC.x = dot4( inTC, tc0 );\n"
|
||
" finalTC.y = dot4( inTC, tc1 );\n"
|
||
" return finalTC;\n"
|
||
"}\n"
|
||
"\n"
|
||
"static float2 Rotate2D( float2 inTC, float2 cs ) {\n"
|
||
" float sinValue = cs.y;\n"
|
||
" float cosValue = cs.x;\n"
|
||
"\n"
|
||
" float4 tc0 = float4( cosValue, -sinValue, 0, ( -0.5f * cosValue ) + ( 0.5f * sinValue ) + 0.5f );\n"
|
||
" float4 tc1 = float4( sinValue, cosValue, 0, ( -0.5f * sinValue ) + ( -0.5f * cosValue ) + 0.5f );\n"
|
||
"\n"
|
||
" float2 finalTC;\n"
|
||
" finalTC.x = dot4( inTC, tc0 );\n"
|
||
" finalTC.y = dot4( inTC, tc1 );\n"
|
||
" return finalTC;\n"
|
||
"}\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"
|
||
"}\n"
|
||
"\n"
|
||
"// RB begin\n"
|
||
"#ifndef PI\n"
|
||
"#define PI 3.14159265358979323846\n"
|
||
"#endif\n"
|
||
"\n"
|
||
"#define DEG2RAD( a ) ( ( a ) * PI / 180.0f )\n"
|
||
"#define RAD2DEG( a ) ( ( a ) * 180.0f / PI )\n"
|
||
"// RB end\n"
|
||
"\n"
|
||
"#define _half2( x ) half2( x )\n"
|
||
"#define _half3( x ) half3( x )\n"
|
||
"#define _half4( x ) half4( x )\n"
|
||
"#define _float2( x ) float2( x )\n"
|
||
"#define _float3( x ) float3( x )\n"
|
||
"#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 ) { return c; }\n"
|
||
"static float2 vposToScreenPosTexCoord( float2 vpos ) { return vpos.xy * rpWindowCoord.xy; }\n"
|
||
"\n"
|
||
"\n"
|
||
"#define BRANCH\n"
|
||
"#define IFANY\n"
|
||
"\n"
|
||
|