mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-17 20:10:21 +03:00
Mapbase v5.1
- Fixed a major oversight in Source 2013 which was causing some code to think all logic entities were worldspawn - Added WIP background nodraw for point_cameras set to not draw skybox at all - Fixed map-specific talker not flushing on restore - Added optional HUD hint to code-based game instructor hints - Added workaround for suspicious crashes in HL2 NPC rappelling code (reported by 1upD) - Made antlions summoned by npc_antlionguard report as dead when removed with the "Kill" input - Fixed math_mod not saving mod value (reported by Klems) - Added SDK_WindowImposter, which uses the SteamPipe cubemap bug workaround and includes support for parallax corrected cubemaps - Updated thirdpartylegalnotices.txt to mention the Squirrel API - Fixed incorrect type checking for script instances in VScript - Added a bunch of new misc. VScript constants - Added a few new base VScript functions - Added a separate "Clientside Script Language" keyvalue to worldspawn for VScript, allowing client scripts to use a different language from server scripts - Fixed worldspawn crashing the game when running entity scripts (reported by krassell) - Fixed manifests creating a second worldspawn, allowing them to function properly in HL2 - Added tons of remapping-related fixes for instances and manifests, including node IDs and overlay remapping - Added a keyvalue to func_instance which allows vector axis lines to be remapped properly - Added support for manifest root path instances in VBSP - Added missing PrintBrushContents() contents to VBSP - Added -nohiddenmaps parameter - Made manifest cordon somewhat functional
This commit is contained in:
64
sp/src/materialsystem/stdshaders/SDK_windowimposter_ps2x.fxc
Normal file
64
sp/src/materialsystem/stdshaders/SDK_windowimposter_ps2x.fxc
Normal file
@@ -0,0 +1,64 @@
|
||||
//========== Copyright (c) Valve Corporation, All rights reserved. ==========//
|
||||
// STATIC: "PARALLAXCORRECT" "0..1"
|
||||
|
||||
// DYNAMIC: "PIXELFOGTYPE" "0..1"
|
||||
|
||||
// SKIP: $PARALLAXCORRECT [ps20]
|
||||
|
||||
#include "common_ps_fxc.h"
|
||||
#include "shader_constant_register_map.h"
|
||||
|
||||
sampler EnvmapSampler : register( s0 );
|
||||
|
||||
const float4 g_FogParams : register( PSREG_FOG_PARAMS );
|
||||
const float4 g_EyePos_SpecExponent : register( PSREG_EYEPOS_SPEC_EXPONENT );
|
||||
|
||||
#if PARALLAXCORRECT
|
||||
// Parallax cubemaps
|
||||
const float3 cubemapPos : register(c0);
|
||||
const float4x4 obbMatrix : register(c1); //through c4
|
||||
#endif
|
||||
|
||||
struct PS_INPUT
|
||||
{
|
||||
float3 eyeToVertVector : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
|
||||
#if PARALLAXCORRECT
|
||||
float3 worldSpaceNormal : TEXCOORD1;
|
||||
#endif
|
||||
|
||||
float4 worldPos_projPosZ : TEXCOORD2; // Necessary for pixel fog
|
||||
};
|
||||
|
||||
float4 main( PS_INPUT i ) : COLOR
|
||||
{
|
||||
#if PARALLAXCORRECT
|
||||
float3 reflectVect = CalcReflectionVectorUnnormalized( i.worldSpaceNormal, g_EyePos_SpecExponent.xyz - i.worldPos_projPosZ.xyz ); //i.eyeToVertVector; //CalcReflectionVectorUnnormalized( i.worldSpaceNormal, i.eyeToVertVector );
|
||||
|
||||
//Parallax correction (2_0b and beyond)
|
||||
//Adapted from http://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
|
||||
float3 worldPos = i.worldPos_projPosZ.xyz;
|
||||
float3 positionLS = mul(float4(worldPos, 1), obbMatrix);
|
||||
float3 rayLS = mul(reflectVect, (float3x3) obbMatrix);
|
||||
|
||||
float3 firstPlaneIntersect = (float3(1.0f, 1.0f, 1.0f) - positionLS) / rayLS;
|
||||
float3 secondPlaneIntersect = (-positionLS) / rayLS;
|
||||
float3 furthestPlane = max(firstPlaneIntersect, secondPlaneIntersect);
|
||||
float distance = min(furthestPlane.x, min(furthestPlane.y, furthestPlane.z));
|
||||
|
||||
// Use distance in WS directly to recover intersection
|
||||
float3 intersectPositionWS = worldPos + reflectVect * distance;
|
||||
reflectVect = intersectPositionWS - cubemapPos;
|
||||
#else
|
||||
float3 reflectVect = i.eyeToVertVector;
|
||||
#endif
|
||||
|
||||
HALF4 color;
|
||||
color.xyz = ENV_MAP_SCALE * texCUBE( EnvmapSampler, reflectVect );
|
||||
color.a = 1.0f;
|
||||
color *= i.vertexColor;
|
||||
|
||||
float fogFactor = CalcPixelFogFactor( PIXELFOGTYPE, g_FogParams, g_EyePos_SpecExponent.xyz, i.worldPos_projPosZ.xyz, i.worldPos_projPosZ.w );
|
||||
return FinalOutput( color, fogFactor, PIXELFOGTYPE, TONEMAP_SCALE_LINEAR );
|
||||
}
|
||||
61
sp/src/materialsystem/stdshaders/SDK_windowimposter_vs20.fxc
Normal file
61
sp/src/materialsystem/stdshaders/SDK_windowimposter_vs20.fxc
Normal file
@@ -0,0 +1,61 @@
|
||||
//========== Copyright (c) Valve Corporation, All rights reserved. ==========//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//===========================================================================
|
||||
// STATIC: "PARALLAXCORRECT" "0..1"
|
||||
|
||||
// DYNAMIC: "DOWATERFOG" "0..1"
|
||||
|
||||
#include "common_vs_fxc.h"
|
||||
|
||||
static const int g_FogType = DOWATERFOG;
|
||||
|
||||
struct VS_INPUT
|
||||
{
|
||||
float3 vPos : POSITION;
|
||||
#if PARALLAXCORRECT
|
||||
float4 vNormal : NORMAL;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 projPos : POSITION;
|
||||
#if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
|
||||
float fog : FOG;
|
||||
#endif
|
||||
float3 eyeToVertVector : TEXCOORD0;
|
||||
float4 vertexColor : COLOR;
|
||||
|
||||
#if PARALLAXCORRECT
|
||||
float3 worldNormal : TEXCOORD1;
|
||||
#endif
|
||||
|
||||
float4 worldPos_projPosZ : TEXCOORD2; // Necessary for pixel fog
|
||||
};
|
||||
|
||||
VS_OUTPUT main( const VS_INPUT v )
|
||||
{
|
||||
VS_OUTPUT o = ( VS_OUTPUT )0;
|
||||
|
||||
o.projPos = mul( float4( v.vPos, 1 ), cModelViewProj );
|
||||
|
||||
float3 worldPos = mul( float4( v.vPos, 1 ), cModel[0] );
|
||||
o.worldPos_projPosZ = float4( worldPos.xyz, o.projPos.z );
|
||||
o.eyeToVertVector = worldPos - cEyePos;
|
||||
|
||||
#if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
|
||||
o.fog = CalcFixedFunctionFog( worldPos, g_FogType );
|
||||
#endif
|
||||
|
||||
#if PARALLAXCORRECT
|
||||
float3 vObjNormal;
|
||||
DecompressVertex_Normal( v.vNormal, vObjNormal );
|
||||
o.worldNormal = mul( vObjNormal, ( float3x3 )cModel[0] );
|
||||
#endif
|
||||
|
||||
o.vertexColor = cModulationColor;
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "shaderlib/cshader.h"
|
||||
class sdk_windowimposter_ps20_Static_Index
|
||||
{
|
||||
private:
|
||||
int m_nPARALLAXCORRECT;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPARALLAXCORRECT;
|
||||
#endif
|
||||
public:
|
||||
void SetPARALLAXCORRECT( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPARALLAXCORRECT = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
void SetPARALLAXCORRECT( bool i )
|
||||
{
|
||||
m_nPARALLAXCORRECT = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20_Static_Index( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = false;
|
||||
#endif // _DEBUG
|
||||
m_nPARALLAXCORRECT = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllStaticVarsDefined = m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 2 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_windowimposter_ps20 psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_windowimposter_ps20_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
int m_nPIXELFOGTYPE;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPIXELFOGTYPE;
|
||||
#endif
|
||||
public:
|
||||
void SetPIXELFOGTYPE( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPIXELFOGTYPE = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
void SetPIXELFOGTYPE( bool i )
|
||||
{
|
||||
m_nPIXELFOGTYPE = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20_Dynamic_Index()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = false;
|
||||
#endif // _DEBUG
|
||||
m_nPIXELFOGTYPE = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE;
|
||||
Assert( bAllDynamicVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 1 * m_nPIXELFOGTYPE ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderDynamicTest_sdk_windowimposter_ps20 psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "shaderlib/cshader.h"
|
||||
class sdk_windowimposter_ps20b_Static_Index
|
||||
{
|
||||
private:
|
||||
int m_nPARALLAXCORRECT;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPARALLAXCORRECT;
|
||||
#endif
|
||||
public:
|
||||
void SetPARALLAXCORRECT( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPARALLAXCORRECT = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
void SetPARALLAXCORRECT( bool i )
|
||||
{
|
||||
m_nPARALLAXCORRECT = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20b_Static_Index( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = false;
|
||||
#endif // _DEBUG
|
||||
m_nPARALLAXCORRECT = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllStaticVarsDefined = m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 2 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_windowimposter_ps20b psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_windowimposter_ps20b_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
int m_nPIXELFOGTYPE;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPIXELFOGTYPE;
|
||||
#endif
|
||||
public:
|
||||
void SetPIXELFOGTYPE( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPIXELFOGTYPE = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
void SetPIXELFOGTYPE( bool i )
|
||||
{
|
||||
m_nPIXELFOGTYPE = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20b_Dynamic_Index()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = false;
|
||||
#endif // _DEBUG
|
||||
m_nPIXELFOGTYPE = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE;
|
||||
Assert( bAllDynamicVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 1 * m_nPIXELFOGTYPE ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderDynamicTest_sdk_windowimposter_ps20b psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "shaderlib/cshader.h"
|
||||
class sdk_windowimposter_vs20_Static_Index
|
||||
{
|
||||
private:
|
||||
int m_nPARALLAXCORRECT;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPARALLAXCORRECT;
|
||||
#endif
|
||||
public:
|
||||
void SetPARALLAXCORRECT( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPARALLAXCORRECT = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
void SetPARALLAXCORRECT( bool i )
|
||||
{
|
||||
m_nPARALLAXCORRECT = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_vs20_Static_Index( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = false;
|
||||
#endif // _DEBUG
|
||||
m_nPARALLAXCORRECT = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllStaticVarsDefined = m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 2 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_windowimposter_vs20 vsh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_windowimposter_vs20_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
int m_nDOWATERFOG;
|
||||
#ifdef _DEBUG
|
||||
bool m_bDOWATERFOG;
|
||||
#endif
|
||||
public:
|
||||
void SetDOWATERFOG( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nDOWATERFOG = i;
|
||||
#ifdef _DEBUG
|
||||
m_bDOWATERFOG = true;
|
||||
#endif
|
||||
}
|
||||
void SetDOWATERFOG( bool i )
|
||||
{
|
||||
m_nDOWATERFOG = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bDOWATERFOG = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_vs20_Dynamic_Index()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bDOWATERFOG = false;
|
||||
#endif // _DEBUG
|
||||
m_nDOWATERFOG = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllDynamicVarsDefined = m_bDOWATERFOG;
|
||||
Assert( bAllDynamicVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 1 * m_nDOWATERFOG ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderDynamicTest_sdk_windowimposter_vs20 vsh_forgot_to_set_dynamic_DOWATERFOG + 0
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "shaderlib/cshader.h"
|
||||
class sdk_windowimposter_ps20_Static_Index
|
||||
{
|
||||
private:
|
||||
int m_nPARALLAXCORRECT;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPARALLAXCORRECT;
|
||||
#endif
|
||||
public:
|
||||
void SetPARALLAXCORRECT( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPARALLAXCORRECT = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
void SetPARALLAXCORRECT( bool i )
|
||||
{
|
||||
m_nPARALLAXCORRECT = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20_Static_Index( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = false;
|
||||
#endif // _DEBUG
|
||||
m_nPARALLAXCORRECT = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllStaticVarsDefined = m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 2 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_windowimposter_ps20 psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_windowimposter_ps20_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
int m_nPIXELFOGTYPE;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPIXELFOGTYPE;
|
||||
#endif
|
||||
public:
|
||||
void SetPIXELFOGTYPE( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPIXELFOGTYPE = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
void SetPIXELFOGTYPE( bool i )
|
||||
{
|
||||
m_nPIXELFOGTYPE = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20_Dynamic_Index()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = false;
|
||||
#endif // _DEBUG
|
||||
m_nPIXELFOGTYPE = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE;
|
||||
Assert( bAllDynamicVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 1 * m_nPIXELFOGTYPE ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderDynamicTest_sdk_windowimposter_ps20 psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "shaderlib/cshader.h"
|
||||
class sdk_windowimposter_ps20b_Static_Index
|
||||
{
|
||||
private:
|
||||
int m_nPARALLAXCORRECT;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPARALLAXCORRECT;
|
||||
#endif
|
||||
public:
|
||||
void SetPARALLAXCORRECT( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPARALLAXCORRECT = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
void SetPARALLAXCORRECT( bool i )
|
||||
{
|
||||
m_nPARALLAXCORRECT = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20b_Static_Index( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = false;
|
||||
#endif // _DEBUG
|
||||
m_nPARALLAXCORRECT = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllStaticVarsDefined = m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 2 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_windowimposter_ps20b psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_windowimposter_ps20b_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
int m_nPIXELFOGTYPE;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPIXELFOGTYPE;
|
||||
#endif
|
||||
public:
|
||||
void SetPIXELFOGTYPE( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPIXELFOGTYPE = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
void SetPIXELFOGTYPE( bool i )
|
||||
{
|
||||
m_nPIXELFOGTYPE = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_ps20b_Dynamic_Index()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPIXELFOGTYPE = false;
|
||||
#endif // _DEBUG
|
||||
m_nPIXELFOGTYPE = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE;
|
||||
Assert( bAllDynamicVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 1 * m_nPIXELFOGTYPE ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderDynamicTest_sdk_windowimposter_ps20b psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "shaderlib/cshader.h"
|
||||
class sdk_windowimposter_vs20_Static_Index
|
||||
{
|
||||
private:
|
||||
int m_nPARALLAXCORRECT;
|
||||
#ifdef _DEBUG
|
||||
bool m_bPARALLAXCORRECT;
|
||||
#endif
|
||||
public:
|
||||
void SetPARALLAXCORRECT( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nPARALLAXCORRECT = i;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
void SetPARALLAXCORRECT( bool i )
|
||||
{
|
||||
m_nPARALLAXCORRECT = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_vs20_Static_Index( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bPARALLAXCORRECT = false;
|
||||
#endif // _DEBUG
|
||||
m_nPARALLAXCORRECT = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllStaticVarsDefined = m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 2 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_windowimposter_vs20 vsh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_windowimposter_vs20_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
int m_nDOWATERFOG;
|
||||
#ifdef _DEBUG
|
||||
bool m_bDOWATERFOG;
|
||||
#endif
|
||||
public:
|
||||
void SetDOWATERFOG( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nDOWATERFOG = i;
|
||||
#ifdef _DEBUG
|
||||
m_bDOWATERFOG = true;
|
||||
#endif
|
||||
}
|
||||
void SetDOWATERFOG( bool i )
|
||||
{
|
||||
m_nDOWATERFOG = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bDOWATERFOG = true;
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
sdk_windowimposter_vs20_Dynamic_Index()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bDOWATERFOG = false;
|
||||
#endif // _DEBUG
|
||||
m_nDOWATERFOG = 0;
|
||||
}
|
||||
int GetIndex()
|
||||
{
|
||||
// Asserts to make sure that we aren't using any skipped combinations.
|
||||
// Asserts to make sure that we are setting all of the combination vars.
|
||||
#ifdef _DEBUG
|
||||
bool bAllDynamicVarsDefined = m_bDOWATERFOG;
|
||||
Assert( bAllDynamicVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 1 * m_nDOWATERFOG ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderDynamicTest_sdk_windowimposter_vs20 vsh_forgot_to_set_dynamic_DOWATERFOG + 0
|
||||
@@ -60,6 +60,7 @@ $Project
|
||||
$File "unlittwotexture_dx9.cpp"
|
||||
$File "MonitorScreen_dx9.cpp"
|
||||
$File "shatteredglass.cpp"
|
||||
$File "windowimposter_dx90.cpp"
|
||||
}
|
||||
|
||||
//$Shaders "mapbase_dx9_20b.txt"
|
||||
|
||||
@@ -93,3 +93,5 @@ SDK_unlittwotexture_vs20.fxc
|
||||
SDK_monitorscreen_ps2x.fxc
|
||||
SDK_ShatteredGlass_ps2x.fxc
|
||||
SDK_ShatteredGlass_vs20.fxc
|
||||
SDK_windowimposter_ps2x.fxc
|
||||
SDK_windowimposter_vs20.fxc
|
||||
|
||||
181
sp/src/materialsystem/stdshaders/windowimposter_dx90.cpp
Normal file
181
sp/src/materialsystem/stdshaders/windowimposter_dx90.cpp
Normal file
@@ -0,0 +1,181 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "BaseVSShader.h"
|
||||
#include "cpp_shader_constant_register_map.h"
|
||||
|
||||
#include "sdk_windowimposter_vs20.inc"
|
||||
#include "sdk_windowimposter_ps20.inc"
|
||||
#include "sdk_windowimposter_ps20b.inc"
|
||||
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
DEFINE_FALLBACK_SHADER( sdk_windowimposter, sdk_windowimposter_DX90 )
|
||||
|
||||
BEGIN_VS_SHADER( sdk_windowimposter_DX90,
|
||||
"Help for WindowImposter_DX90" )
|
||||
|
||||
BEGIN_SHADER_PARAMS
|
||||
SHADER_PARAM( ENVMAP, SHADER_PARAM_TYPE_TEXTURE, "shadertest/shadertest_env", "envmap" )
|
||||
|
||||
#ifdef MAPBASE
|
||||
SHADER_PARAM( ENVMAPFRAME, SHADER_PARAM_TYPE_INTEGER, "0", "" )
|
||||
#endif
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
SHADER_PARAM( ENVMAPPARALLAX, SHADER_PARAM_TYPE_BOOL, "0", "Enables parallax correction code for env_cubemaps" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB1, SHADER_PARAM_TYPE_VEC4, "[1 0 0 0]", "The first line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB2, SHADER_PARAM_TYPE_VEC4, "[0 1 0 0]", "The second line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB3, SHADER_PARAM_TYPE_VEC4, "[0 0 1 0]", "The third line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPORIGIN, SHADER_PARAM_TYPE_VEC3, "[0 0 0]", "The world space position of the env_cubemap being corrected" )
|
||||
#endif
|
||||
END_SHADER_PARAMS
|
||||
|
||||
// Set up anything that is necessary to make decisions in SHADER_FALLBACK.
|
||||
SHADER_INIT_PARAMS()
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
if( !params[ENVMAPFRAME]->IsDefined() )
|
||||
params[ENVMAPFRAME]->SetIntValue( 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
SHADER_FALLBACK
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SHADER_INIT
|
||||
{
|
||||
LoadCubeMap( ENVMAP );
|
||||
#ifdef MAPBASE
|
||||
if (mat_specular_disable_on_missing.GetBool())
|
||||
{
|
||||
// Revert to defaultcubemap when the envmap texture is missing
|
||||
// (should be equivalent to toolsblack in Mapbase)
|
||||
if (params[ENVMAP]->GetTextureValue()->IsError())
|
||||
{
|
||||
params[ENVMAP]->SetStringValue( "engine/defaultcubemap" );
|
||||
LoadCubeMap( ENVMAP );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
SHADER_DRAW
|
||||
{
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
bool hasParallaxCorrection = params[ENVMAPPARALLAX]->GetIntValue() > 0;
|
||||
#else
|
||||
bool hasParallaxCorrection = false;
|
||||
#endif
|
||||
|
||||
SHADOW_STATE
|
||||
{
|
||||
if( g_pHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
|
||||
pShaderShadow->EnableSRGBWrite( true );
|
||||
|
||||
pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
|
||||
|
||||
DECLARE_STATIC_VERTEX_SHADER( sdk_windowimposter_vs20 );
|
||||
SET_STATIC_VERTEX_SHADER_COMBO( PARALLAXCORRECT, hasParallaxCorrection ); // Parallax cubemaps enabled for 2_0b and onwards
|
||||
SET_STATIC_VERTEX_SHADER( sdk_windowimposter_vs20 );
|
||||
|
||||
if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
|
||||
{
|
||||
DECLARE_STATIC_PIXEL_SHADER( sdk_windowimposter_ps20b );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( PARALLAXCORRECT, hasParallaxCorrection ); // Parallax cubemaps enabled for 2_0b and onwards
|
||||
SET_STATIC_PIXEL_SHADER( sdk_windowimposter_ps20b );
|
||||
}
|
||||
else
|
||||
{
|
||||
DECLARE_STATIC_PIXEL_SHADER( sdk_windowimposter_ps20 );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( PARALLAXCORRECT, 0 ); // No parallax cubemaps with ps_2_0 :(
|
||||
SET_STATIC_PIXEL_SHADER( sdk_windowimposter_ps20 );
|
||||
}
|
||||
|
||||
unsigned int flags = VERTEX_POSITION;
|
||||
int nTexCoordCount = 2;
|
||||
|
||||
if (hasParallaxCorrection)
|
||||
{
|
||||
flags |= VERTEX_NORMAL;
|
||||
nTexCoordCount++;
|
||||
}
|
||||
|
||||
pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, 0, 0 );
|
||||
pShaderShadow->EnableBlending( true );
|
||||
pShaderShadow->BlendFunc( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA );
|
||||
pShaderShadow->EnableDepthWrites( false );
|
||||
FogToFogColor();
|
||||
}
|
||||
DYNAMIC_STATE
|
||||
{
|
||||
DECLARE_DYNAMIC_VERTEX_SHADER( sdk_windowimposter_vs20 );
|
||||
SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );
|
||||
SET_DYNAMIC_VERTEX_SHADER( sdk_windowimposter_vs20 );
|
||||
|
||||
if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
|
||||
{
|
||||
DECLARE_DYNAMIC_PIXEL_SHADER( sdk_windowimposter_ps20b );
|
||||
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
|
||||
SET_DYNAMIC_PIXEL_SHADER( sdk_windowimposter_ps20b );
|
||||
}
|
||||
else
|
||||
{
|
||||
DECLARE_DYNAMIC_PIXEL_SHADER( sdk_windowimposter_ps20 );
|
||||
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
|
||||
SET_DYNAMIC_PIXEL_SHADER( sdk_windowimposter_ps20 );
|
||||
}
|
||||
|
||||
SetModulationVertexShaderDynamicState();
|
||||
|
||||
pShaderAPI->SetPixelShaderFogParams( PSREG_FOG_PARAMS );
|
||||
|
||||
float vEyePos_SpecExponent[4];
|
||||
pShaderAPI->GetWorldSpaceCameraPosition( vEyePos_SpecExponent );
|
||||
vEyePos_SpecExponent[3] = 0.0f;
|
||||
pShaderAPI->SetPixelShaderConstant( PSREG_EYEPOS_SPEC_EXPONENT, vEyePos_SpecExponent, 1 );
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
if (hasParallaxCorrection)
|
||||
{
|
||||
pShaderAPI->SetPixelShaderConstant( 0, params[ENVMAPORIGIN]->GetVecValue() );
|
||||
|
||||
float* vecs[3];
|
||||
vecs[0] = const_cast<float*>(params[ENVMAPPARALLAXOBB1]->GetVecValue());
|
||||
vecs[1] = const_cast<float*>(params[ENVMAPPARALLAXOBB2]->GetVecValue());
|
||||
vecs[2] = const_cast<float*>(params[ENVMAPPARALLAXOBB3]->GetVecValue());
|
||||
float matrix[4][4];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
matrix[i][j] = vecs[i][j];
|
||||
}
|
||||
}
|
||||
matrix[3][0] = matrix[3][1] = matrix[3][2] = 0;
|
||||
matrix[3][3] = 1;
|
||||
pShaderAPI->SetPixelShaderConstant( 1, &matrix[0][0], 4 );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE
|
||||
BindTexture( SHADER_SAMPLER0, ENVMAP, ENVMAPFRAME );
|
||||
#else
|
||||
BindTexture( SHADER_SAMPLER0, ENVMAP, -1 );
|
||||
#endif
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
END_SHADER
|
||||
Reference in New Issue
Block a user