mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-04-24 02:32:18 +00:00
Supress warnings about failed #include global.inc when using embedded Cg shaders
This commit is contained in:
parent
75d6e89876
commit
26bb497b3c
4 changed files with 20 additions and 43 deletions
|
@ -1093,7 +1093,7 @@ idParser::Directive_include
|
|||
================
|
||||
*/
|
||||
// RB: added token as parameter
|
||||
int idParser::Directive_include( idToken* token )
|
||||
int idParser::Directive_include( idToken* token, bool supressWarning )
|
||||
{
|
||||
idLexer* script;
|
||||
idStr path;
|
||||
|
@ -1173,9 +1173,13 @@ int idParser::Directive_include( idToken* token )
|
|||
idParser::Error( "#include without file name" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !script )
|
||||
{
|
||||
idParser::Error( "file '%s' not found", path.c_str() );
|
||||
if( !supressWarning )
|
||||
{
|
||||
idParser::Error( "file '%s' not found", path.c_str() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
script->SetFlags( idParser::flags );
|
||||
|
|
|
@ -228,7 +228,7 @@ protected:
|
|||
static define_t* DefineFromString( const char* string );
|
||||
define_t* CopyFirstDefine();
|
||||
// RB: allow override
|
||||
virtual int Directive_include( idToken* token );
|
||||
virtual int Directive_include( idToken* token, bool supressWarning = false );
|
||||
// RB end
|
||||
int Directive_undef();
|
||||
int Directive_if_def( int type );
|
||||
|
|
|
@ -392,9 +392,9 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
int Directive_include( idToken* token )
|
||||
int Directive_include( idToken* token, bool supressWarning )
|
||||
{
|
||||
if( idParser::Directive_include( token ) )
|
||||
if( idParser::Directive_include( token, true ) )
|
||||
{
|
||||
// RB: try local shaders in base/renderprogs/ first
|
||||
return true;
|
||||
|
|
|
@ -4349,13 +4349,13 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
" shadowTexcoord.z = dot4( modelPosition, shadowMatrixZ );\n"
|
||||
" shadowTexcoord.w = dot4( modelPosition, shadowMatrixW );\n"
|
||||
" \n"
|
||||
" //float bias = 0.001 * tan( acos( ldotN ) );\n"
|
||||
" //bias = clamp( bias, 0, 0.001 );\n"
|
||||
" //float bias = 0.005 * tan( acos( ldotN ) );\n"
|
||||
" //bias = clamp( bias, 0, 0.01 );\n"
|
||||
" float bias = 0.001;\n"
|
||||
" \n"
|
||||
" shadowTexcoord.xyz /= shadowTexcoord.w;\n"
|
||||
" shadowTexcoord.z = shadowTexcoord.z * 0.9991;\n"
|
||||
" //shadowTexcoord.z = shadowTexcoord.z - bias;\n"
|
||||
" //shadowTexcoord.z = shadowTexcoord.z * 0.9991;\n"
|
||||
" shadowTexcoord.z = shadowTexcoord.z - bias;\n"
|
||||
" shadowTexcoord.w = float(shadowIndex);\n"
|
||||
"\n"
|
||||
"#if 0\n"
|
||||
|
@ -4366,46 +4366,19 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
" // multiple taps\n"
|
||||
" \n"
|
||||
"#if 0\n"
|
||||
" const float2 poissonDisk2[12] = float2[](\n"
|
||||
" float2(-0.326,-0.406),\n"
|
||||
" float2(-0.840,-0.074),\n"
|
||||
" float2(-0.696, 0.457),\n"
|
||||
" float2(-0.203, 0.621),\n"
|
||||
" float2( 0.962,-0.195),\n"
|
||||
" float2( 0.473,-0.480),\n"
|
||||
" float2( 0.519, 0.767),\n"
|
||||
" float2( 0.185,-0.893),\n"
|
||||
" float2( 0.507, 0.064),\n"
|
||||
" float2( 0.896, 0.412),\n"
|
||||
" float2(-0.322,-0.933),\n"
|
||||
" float2(-0.792,-0.598)\n"
|
||||
" );\n"
|
||||
" float shadow = 0.0;\n"
|
||||
" \n"
|
||||
" float shadowTexelSize = ( 1.0 / 1024.0 ) * 0.5;\n"
|
||||
" for( int i = 0; i < 12; i++ )\n"
|
||||
" {\n"
|
||||
" int index = int( rand( shadowTexcoord.xy * 1.0 ) * 12 );\n"
|
||||
" \n"
|
||||
" float4 shadowTexcoordOffset = float4( shadowTexcoord.xy + poissonDisk2[index] * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );\n"
|
||||
" \n"
|
||||
" shadow += texture( samp5, shadowTexcoordOffset.xywz);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" shadow *= ( 1.0 / 12.0 );\n"
|
||||
" \n"
|
||||
"#elif 1\n"
|
||||
"#if 1\n"
|
||||
" float4 base = shadowTexcoord;\n"
|
||||
" \n"
|
||||
" base.xy += rpJitterTexScale.xy * -0.5;\n"
|
||||
" \n"
|
||||
" float shadow = 0.0;\n"
|
||||
" \n"
|
||||
" float stepSize = 1.0 / 16.0;\n"
|
||||
" //float stepSize = 1.0 / 16.0;\n"
|
||||
" float numSamples = rpScreenCorrectionFactor.w;\n"
|
||||
" float stepSize = 1.0 / numSamples;\n"
|
||||
" \n"
|
||||
" float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;\n"
|
||||
" for( int i = 0; i < 16; i++ )\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"
|
||||
|
@ -4414,8 +4387,8 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
" jitterTC.x += stepSize;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" shadow *= ( 1.0 / 16.0 );\n"
|
||||
"#else \n"
|
||||
" shadow *= stepSize;\n"
|
||||
"#else\n"
|
||||
" float shadow = texture( samp5, shadowTexcoord.xywz );\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
|
|
Loading…
Reference in a new issue