Compare commits

...

3 commits

Author SHA1 Message Date
6f30d2272d Added Parallax Corrected Cubemaps 2024-09-20 04:38:41 +02:00
b9b7e6f3f5 Fixed stdshaders 2024-09-20 04:13:49 +02:00
e1f9394cb0 Updated submodules 2024-09-20 03:20:21 +02:00
61 changed files with 4579 additions and 2840 deletions

Binary file not shown.

View file

@ -0,0 +1,31 @@
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true)][System.IO.FileInfo]$File,
[Parameter(Mandatory=$true)][string]$Version,
[Parameter(Mandatory=$false)][switch]$Dynamic,
[Parameter(Mandatory=$false)][System.UInt32]$Threads
)
if ($Version -notin @("20b", "30", "40", "41", "50", "51")) {
return
}
$fileList = $File.OpenText()
while ($null -ne ($line = $fileList.ReadLine())) {
if ($line -match '^\s*$' -or $line -match '^\s*//') {
continue
}
if ($Dynamic) {
& "$PSScriptRoot\ShaderCompile" "-dynamic" "-ver" $Version "-shaderpath" $File.DirectoryName $line
continue
}
if ($Threads -ne 0) {
& "$PSScriptRoot\ShaderCompile" "-threads" $Threads "-ver" $Version "-shaderpath" $File.DirectoryName $line
continue
}
& "$PSScriptRoot\ShaderCompile" "-ver" $Version "-shaderpath" $File.DirectoryName $line
}
$fileList.Close()

View file

@ -590,7 +590,7 @@ jmp_buf host_enddemo;
static ConVar host_profile( "host_profile","0" ); static ConVar host_profile( "host_profile","0" );
ConVar host_limitlocal( "host_limitlocal", "0", 0, "Apply cl_cmdrate and cl_updaterate to loopback connection" ); ConVar host_limitlocal( "host_limitlocal", "0", 0, "Apply cl_cmdrate and cl_updaterate to loopback connection" );
ConVar host_framerate( "host_framerate","0", FCVAR_REPLICATED, "Set to lock per-frame time elapse." ); ConVar host_framerate( "host_framerate","0", 0, "Set to lock per-frame time elapse." );
ConVar host_timescale( "host_timescale","1.0", FCVAR_REPLICATED, "Prescale the clock by this amount." ); ConVar host_timescale( "host_timescale","1.0", FCVAR_REPLICATED, "Prescale the clock by this amount." );
ConVar host_speeds( "host_speeds","0", 0, "Show general system running times." ); // set for running times ConVar host_speeds( "host_speeds","0", 0, "Show general system running times." ); // set for running times

View file

@ -207,7 +207,7 @@ char const *GetImpactDecal( C_BaseEntity *pEntity, int iMaterial, int iDamageTyp
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Perform custom effects based on the Decal index // Purpose: Perform custom effects based on the Decal index
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static ConVar cl_new_impact_effects( "cl_new_impact_effects", "0" ); static ConVar cl_new_impact_effects( "cl_new_impact_effects", "1" );
struct ImpactEffect_t struct ImpactEffect_t
{ {

@ -1 +1 @@
Subproject commit eb380ec60ead23d5be47d89c36e321c6a066d42c Subproject commit d4bd0682aa304abce59901729d97f67d799629c1

View file

@ -6,7 +6,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "lightmappedgeneric_vs11.inc" #include "lightmappedgeneric_vs11.inc"
#include "LightmappedGeneric_Decal.inc" #include "lightmappedgeneric_decal.inc"
#include "mathlib/bumpvects.h" #include "mathlib/bumpvects.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!

View file

@ -180,7 +180,8 @@ BEGIN_VS_SHADER( DecalModulate_dx9,
{ {
DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs20 ); DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs20 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, 0 ); // Use simplest possible vertex lighting, since ps is so simple SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, 0 ); // Use simplest possible vertex lighting, since ps is so simple
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, 0); // SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_VERTEX, 0 ); //
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, 0); //
SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex );
SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, 0 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( LIGHTING_PREVIEW, 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( LIGHTING_PREVIEW, 0 );
@ -208,7 +209,8 @@ BEGIN_VS_SHADER( DecalModulate_dx9,
DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs30 ); DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs30 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, 0 ); // Use simplest possible vertex lighting, since ps is so simple SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, 0 ); // Use simplest possible vertex lighting, since ps is so simple
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, 0); // SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_VERTEX, 0 ); //
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, 0); //
SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex );
SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( LIGHTING_PREVIEW, 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( LIGHTING_PREVIEW, 0 );

View file

@ -6,7 +6,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "UnlitTwoTexture.inc" #include "unlittwotexture.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

Binary file not shown.

View file

@ -9,7 +9,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "convar.h" #include "convar.h"
#include "WorldVertexTransition.inc" #include "worldvertextransition.inc"
#include "worldvertextransition_vs14.inc" #include "worldvertextransition_vs14.inc"
#include "worldvertextransition_seamless.inc" #include "worldvertextransition_seamless.inc"
#include "lightmappedgeneric_vs11.inc" #include "lightmappedgeneric_vs11.inc"

View file

@ -44,8 +44,8 @@ REM PC SHADERS
REM **************** REM ****************
if /i "%ALLSHADERS_CONFIG%" == "pc" ( if /i "%ALLSHADERS_CONFIG%" == "pc" (
%BUILD_SHADER% stdshader_dx9_20b %BUILD_SHADER% stdshader_dx9_20b
%BUILD_SHADER% stdshader_dx9_20b_new -dx9_30 %BUILD_SHADER% stdshader_dx9_20b_new
%BUILD_SHADER% stdshader_dx9_30 -dx9_30 -force30 %BUILD_SHADER% stdshader_dx9_30 -force30
rem %BUILD_SHADER% stdshader_dx10 -dx10 rem %BUILD_SHADER% stdshader_dx10 -dx10
) )

View file

@ -9,62 +9,37 @@ set TTEXE=time /t
:no_ttexe_end :no_ttexe_end
echo. echo.
rem echo ==================== buildshaders %* ================== echo ==================== buildshaders %* ==================
%TTEXE% -cur-Q %TTEXE% -cur-Q
set tt_start=%ERRORLEVEL% set tt_start=%ERRORLEVEL%
set tt_chkpt=%tt_start% set tt_chkpt=%tt_start%
REM **************** REM ****************
REM usage: buildshaders <shaderProjectName> [-x360] REM usage: buildshaders <shaderProjectName>
REM **************** REM ****************
setlocal setlocal
set arg_filename=%1 set arg_filename=%1
rem set shadercompilecommand=echo shadercompile.exe -mpi_graphics -mpi_TrackEvents set shadercompilecommand=ShaderCompile.exe
set shadercompilecommand=shadercompile.exe set targetdir=shaders
set shadercompileworkers=128
set x360_args=
set targetdir=..\..\..\game\hl2\shaders
set SrcDirBase=..\.. set SrcDirBase=..\..
set ChangeToDir=../../../game/bin
set shaderDir=shaders set shaderDir=shaders
set SDKArgs= set SDKArgs=-local
set SHADERINCPATH=vshtmp9/... fxctmp9/...
set DIRECTX_SDK_VER=pc09.00
set DIRECTX_SDK_BIN_DIR=dx9sdk\utilities
if /i "%2" == "-x360" goto dx_sdk_x360
if /i "%2" == "-dx9_30" goto dx_sdk_dx9_30
if /i "%2" == "-dx10" goto dx_sdk_dx10
goto dx_sdk_end
:dx_sdk_x360
set DIRECTX_SDK_VER=x360.00
set DIRECTX_SDK_BIN_DIR=x360xdk\bin\win32
goto dx_sdk_end
:dx_sdk_dx9_30
set DIRECTX_SDK_VER=pc09.30
set DIRECTX_SDK_BIN_DIR=dx10sdk\utilities\dx9_30
goto dx_sdk_end
:dx_sdk_dx10
set DIRECTX_SDK_VER=pc10.00
set DIRECTX_SDK_BIN_DIR=dx10sdk\utilities\dx10_40
goto dx_sdk_end
:dx_sdk_end
if "%1" == "" goto usage if "%1" == "" goto usage
set inputbase=%1 set inputbase=%1
if /i "%3" == "-force30" goto set_force30_arg REM ignore -dx9_30
if /i "%6" == "-dx9_30" shift /6
if /i "%6" == "-force30" goto set_force30_arg
goto set_force_end goto set_force_end
:set_force30_arg :set_force30_arg
set DIRECTX_FORCE_MODEL=30 set IS30=1
goto set_force_end goto set_force_end
:set_force_end :set_force_end
if /i "%2" == "-x360" goto set_x360_args
if /i "%2" == "-game" goto set_mod_args if /i "%2" == "-game" goto set_mod_args
goto build_shaders goto build_shaders
@ -73,47 +48,43 @@ REM USAGE
REM **************** REM ****************
:usage :usage
echo. echo.
echo "usage: buildshaders <shaderProjectName> [-x360 or -dx10 or -game] [gameDir if -game was specified] [-source sourceDir]" echo "usage: buildshaders <shaderProjectName> [-game] [gameDir if -game was specified] [-source sourceDir]"
echo " gameDir is where gameinfo.txt is (where it will store the compiled shaders)." echo " gameDir is where gameinfo.txt is (where it will store the compiled shaders)."
echo " sourceDir is where the source code is (where it will find scripts and compilers)." echo " sourceDir is where the source code is (where it will find scripts and compilers)."
echo "ex : buildshaders myshaders" echo "ex : buildshaders myshaders"
echo "ex : buildshaders myshaders -game c:\steam\steamapps\sourcemods\mymod -source c:\mymod\src" echo "ex : buildshaders myshaders -game c:\steam\steamapps\sourcemods\mymod -source c:\mymod\src"
goto :end goto :end
REM ****************
REM X360 ARGS
REM ****************
:set_x360_args
set x360_args=-x360
set SHADERINCPATH=vshtmp9_360/... fxctmp9_360/...
goto build_shaders
REM **************** REM ****************
REM MOD ARGS - look for -game or the vproject environment variable REM MOD ARGS - look for -game or the vproject environment variable
REM **************** REM ****************
:set_mod_args :set_mod_args
if not exist %sourcesdk%\bin\shadercompile.exe goto NoShaderCompile if not exist "..\..\devtools\bin\ShaderCompile.exe" goto NoShaderCompile
set ChangeToDir=%sourcesdk%\bin set ChangeToDir=%SrcDirBase%\devtools\bin\
if /i "%4" NEQ "-source" goto NoSourceDirSpecified if /i "%4" NEQ "-source" goto NoSourceDirSpecified
set SrcDirBase=%~5 set SrcDirBase=%~5
REM ** use the -game parameter to tell us where to put the files REM ** use the -game parameter to tell us where to put the files
set targetdir=%~3\shaders set targetdir=%~3\shaders
set SDKArgs=-nompi -game "%~3"
if not exist "%~3\gameinfo.txt" goto InvalidGameDirectory if not exist "%~3\gameinfo.txt" goto InvalidGameDirectory
if not exist "%inputbase%.txt" goto InvalidInputFile
goto build_shaders goto build_shaders
REM **************** REM ****************
REM ERRORS REM ERRORS
REM **************** REM ****************
:InvalidGameDirectory :InvalidGameDirectory
echo -
echo Error: "%~3" is not a valid game directory. echo Error: "%~3" is not a valid game directory.
echo (The -game directory must have a gameinfo.txt file) echo (The -game directory must have a gameinfo.txt file)
echo - goto end
:InvalidInputFile
echo Error: "%inputbase%.txt" is not a valid file.
goto end goto end
:NoSourceDirSpecified :NoSourceDirSpecified
@ -122,9 +93,7 @@ goto usage
goto end goto end
:NoShaderCompile :NoShaderCompile
echo - echo - ERROR: ShaderCompile.exe doesn't exist in devtools\bin
echo - ERROR: shadercompile.exe doesn't exist in %sourcesdk%\bin
echo -
goto end goto end
REM **************** REM ****************
@ -137,115 +106,35 @@ rem echo %inputbase%
rem echo -------------------------------- rem echo --------------------------------
REM make sure that target dirs exist REM make sure that target dirs exist
REM files will be built in these targets and copied to their final destination REM files will be built in these targets and copied to their final destination
if not exist include mkdir include
if not exist %shaderDir% mkdir %shaderDir% if not exist %shaderDir% mkdir %shaderDir%
if not exist %shaderDir%\fxc mkdir %shaderDir%\fxc if not exist %shaderDir%\fxc mkdir %shaderDir%\fxc
if not exist %shaderDir%\vsh mkdir %shaderDir%\vsh
if not exist %shaderDir%\psh mkdir %shaderDir%\psh
REM Nuke some files that we will add to later. REM Nuke some files that we will add to later.
if exist filelist.txt del /f /q filelist.txt
if exist filestocopy.txt del /f /q filestocopy.txt
if exist filelistgen.txt del /f /q filelistgen.txt
if exist inclist.txt del /f /q inclist.txt
if exist vcslist.txt del /f /q vcslist.txt
set SHVER=20b
REM **************** if defined IS30 (
REM Revert any targets (vcs or inc) that are opened for integrate. set SHVER=30
REM ****************
perl "%SrcDirBase%\devtools\bin\p4revertshadertargets.pl" %x360_args% -source "%SrcDirBase%" %inputbase%
REM ****************
REM Generate a makefile for the shader project
REM ****************
perl "%SrcDirBase%\devtools\bin\updateshaders.pl" %x360_args% -source "%SrcDirBase%" %inputbase%
REM ****************
REM Run the makefile, generating minimal work/build list for fxc files, go ahead and compile vsh and psh files.
REM ****************
rem nmake /S /C -f makefile.%inputbase% clean > clean.txt 2>&1
echo Building inc files, asm vcs files, and VMPI worklist for %inputbase%...
nmake /S /C -f makefile.%inputbase%
REM ****************
REM Copy the inc files to their target
REM ****************
if exist "inclist.txt" (
echo Publishing shader inc files to target...
perl %SrcDirBase%\devtools\bin\copyshaderincfiles.pl inclist.txt %x360_args%
) )
REM **************** title %1 %SHVER%
REM Deal with perforce operations for inc files
REM **************** echo Building inc files and worklist for %inputbase%...
if exist inclist.txt if not "%VALVE_NO_AUTO_P4_SHADERS%" == "1" (
echo Executing perforce operations on .inc files. set DYNAMIC=
perl ..\..\devtools\bin\p4autocheckout.pl inclist.txt "Shader Auto Checkout INC" . %SHADERINCPATH% if "%dynamic_shaders%" == "1" set DYNAMIC=-Dynamic
) powershell -NoLogo -ExecutionPolicy Bypass -Command "%SrcDirBase%\devtools\bin\process_shaders.ps1 %DYNAMIC% -Version %SHVER% '%inputbase%.txt'"
REM **************** REM ****************
REM Add the executables to the worklist. REM PC Shader copy
REM **************** REM Publish the generated files to the output dir using XCOPY
if /i "%DIRECTX_SDK_VER%" == "pc09.00" (
rem echo "Copy extra files for dx 9 std
)
if /i "%DIRECTX_SDK_VER%" == "pc09.30" (
echo %SrcDirBase%\devtools\bin\d3dx9_33.dll >> filestocopy.txt
)
if /i "%DIRECTX_SDK_VER%" == "pc10.00" (
echo %SrcDirBase%\devtools\bin\d3dx10_33.dll >> filestocopy.txt
)
if /i "%DIRECTX_SDK_VER%" == "x360.00" (
rem echo "Copy extra files for xbox360
)
echo %SrcDirBase%\%DIRECTX_SDK_BIN_DIR%\dx_proxy.dll >> filestocopy.txt
echo %SrcDirBase%\..\game\bin\shadercompile.exe >> filestocopy.txt
echo %SrcDirBase%\..\game\bin\shadercompile_dll.dll >> filestocopy.txt
echo %SrcDirBase%\..\game\bin\vstdlib.dll >> filestocopy.txt
echo %SrcDirBase%\..\game\bin\tier0.dll >> filestocopy.txt
REM ****************
REM Cull duplicate entries in work/build list
REM ****************
if exist filestocopy.txt type filestocopy.txt | perl "%SrcDirBase%\devtools\bin\uniqifylist.pl" > uniquefilestocopy.txt
if exist filelistgen.txt if not "%dynamic_shaders%" == "1" (
echo Generating action list...
copy filelistgen.txt filelist.txt >nul
rem %SrcDirBase%\devtools\bin\fxccombogen.exe <filelistgen.txt 1>nul 2>filelist.txt
)
REM ****************
REM Execute distributed process on work/build list
REM ****************
set shader_path_cd=%cd%
if exist "filelist.txt" if exist "uniquefilestocopy.txt" if not "%dynamic_shaders%" == "1" (
echo Running distributed shader compilation...
cd %ChangeToDir%
%shadercompilecommand% -mpi_workercount %shadercompileworkers% -allowdebug -shaderpath "%shader_path_cd:/=\%" %x360_args% %SDKArgs%
cd %shader_path_cd%
)
REM ****************
REM PC and 360 Shader copy
REM Publish the generated files to the output dir using ROBOCOPY (smart copy) or XCOPY
REM This batch file may have been invoked standalone or slaved (master does final smart mirror copy) REM This batch file may have been invoked standalone or slaved (master does final smart mirror copy)
REM **************** REM ****************
:DoXCopy
if not "%dynamic_shaders%" == "1" ( if not "%dynamic_shaders%" == "1" (
if exist makefile.%inputbase%.copy echo Publishing shaders to target... if not exist "%targetdir%" md "%targetdir%"
if exist makefile.%inputbase%.copy perl %SrcDirBase%\devtools\bin\copyshaders.pl makefile.%inputbase%.copy %x360_args% if not "%targetdir%"=="%shaderDir%" xcopy %shaderDir%\*.* "%targetdir%" /e /y
)
REM ****************
REM Deal with perforce operations for vcs files
REM ****************
if not "%dynamic_shaders%" == "1" if exist vcslist.txt if not "%VALVE_NO_AUTO_P4_SHADERS%" == "1" (
echo Executing perforce operations on .vcs files.
perl ..\..\devtools\bin\p4autocheckout.pl vcslist.txt "Shader Auto Checkout VCS" ../../../game/hl2/shaders ../../../game/hl2/shaders/...
) )
goto end
REM **************** REM ****************
REM END REM END
@ -254,5 +143,4 @@ REM ****************
%TTEXE% -diff %tt_start% %TTEXE% -diff %tt_start%
echo. echo.

View file

@ -8,7 +8,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "Cable.inc" #include "cable.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
@ -113,7 +113,7 @@ BEGIN_VS_SHADER( Cable_DX8,
} }
// This is the light direction [0,1,0,0] * A * 0.5 // This is the light direction [0,1,0,0] * A * 0.5
float lightDir[4] = {0, A*0.5f, 0, 0}; float lightDir[4] = {0, A*0.5, 0, 0};
if( g_pHardwareConfig->GetDXSupportLevel() >= 90) if( g_pHardwareConfig->GetDXSupportLevel() >= 90)
{ {
SetVertexShaderConstantGammaToLinear( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, lightDir ); SetVertexShaderConstantGammaToLinear( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, lightDir );

View file

@ -198,7 +198,7 @@ BEGIN_VS_SHADER_FLAGS( DepthWrite, "Help for Depth Write", SHADER_NOT_EDITABLE )
vParms.y = 4000.0f; // arbitrary far vParms.y = 4000.0f; // arbitrary far
vParms.z = 0.0f; vParms.z = 0.0f;
vParms.w = 0.0f; vParms.w = 0.0f;
pShaderAPI->SetPixelShaderConstant( 1, vParms.Base(), 1 ); pShaderAPI->SetPixelShaderConstant( 1, vParms.Base(), 2 );
} // DYNAMIC_STATE } // DYNAMIC_STATE

View file

@ -254,7 +254,7 @@ void DrawFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params
// Debug force flesh on // Debug force flesh on
vVsConst0[3] = IS_PARAM_DEFINED( info.m_nflDebugForceFleshOn ) ? params[info.m_nflDebugForceFleshOn]->GetFloatValue() : kDefaultDebugForceFleshOn; vVsConst0[3] = IS_PARAM_DEFINED( info.m_nflDebugForceFleshOn ) ? params[info.m_nflDebugForceFleshOn]->GetFloatValue() : kDefaultDebugForceFleshOn;
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, vVsConst0 ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, vVsConst0, 1 );
// Flesh effect centers and radii // Flesh effect centers and radii
float vVsConst1[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] }; float vVsConst1[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] };
@ -265,7 +265,7 @@ void DrawFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params
vVsConst1[3] = 0.001f; vVsConst1[3] = 0.001f;
vVsConst1[3] = 1.0f / vVsConst1[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader vVsConst1[3] = 1.0f / vVsConst1[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader
} }
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_1, vVsConst1 ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_1, vVsConst1, 1 );
float vVsConst2[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] }; float vVsConst2[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] };
if ( IS_PARAM_DEFINED( info.m_nvEffectCenterRadius2 ) ) if ( IS_PARAM_DEFINED( info.m_nvEffectCenterRadius2 ) )
@ -275,7 +275,7 @@ void DrawFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params
vVsConst2[3] = 0.001f; vVsConst2[3] = 0.001f;
vVsConst2[3] = 1.0f / vVsConst2[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader vVsConst2[3] = 1.0f / vVsConst2[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader
} }
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_2, vVsConst2 ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_2, vVsConst2, 2 );
float vVsConst3[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] }; float vVsConst3[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] };
if ( IS_PARAM_DEFINED( info.m_nvEffectCenterRadius3 ) ) if ( IS_PARAM_DEFINED( info.m_nvEffectCenterRadius3 ) )
@ -285,7 +285,7 @@ void DrawFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params
vVsConst3[3] = 0.001f; vVsConst3[3] = 0.001f;
vVsConst3[3] = 1.0f / vVsConst3[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader vVsConst3[3] = 1.0f / vVsConst3[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader
} }
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_3, vVsConst3 ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_3, vVsConst3, 3 );
float vVsConst4[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] }; float vVsConst4[4] = { kDefaultEffectCenterRadius[0], kDefaultEffectCenterRadius[1], kDefaultEffectCenterRadius[2], kDefaultEffectCenterRadius[3] };
if ( IS_PARAM_DEFINED( info.m_nvEffectCenterRadius4 ) ) if ( IS_PARAM_DEFINED( info.m_nvEffectCenterRadius4 ) )
@ -295,7 +295,7 @@ void DrawFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params
vVsConst4[3] = 0.001f; vVsConst4[3] = 0.001f;
vVsConst4[3] = 1.0f / vVsConst4[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader vVsConst4[3] = 1.0f / vVsConst4[3]; // Pass 1.0/radius so we do a mul instead of a divide in the shader
} }
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, vVsConst4 ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, vVsConst4, 4 );
// Set Pixel Shader Combos // Set Pixel Shader Combos
if( g_pHardwareConfig->SupportsPixelShaders_2_b() ) if( g_pHardwareConfig->SupportsPixelShaders_2_b() )

View file

@ -1,264 +1,462 @@
// ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!! #include "shaderlib/cshader.h"
// $USE_STATIC_CONTROL_FLOW && ( $NUM_LIGHTS > 0 ) class vertexlit_and_unlit_generic_vs20_Static_Index
// ($SEPARATE_DETAIL_UVS) && ($SEAMLESS_DETAIL) {
// ($DONT_GAMMA_CONVERT_VERTEX_COLOR && ( ! $VERTEXCOLOR ) ) private:
// defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH int m_nVERTEXCOLOR;
#ifdef _DEBUG
#ifndef VERTEXLIT_AND_UNLIT_GENERIC_VS20_H bool m_bVERTEXCOLOR;
#define VERTEXLIT_AND_UNLIT_GENERIC_VS20_H #endif
public:
#include "shaderapi/ishaderapi.h" void SetVERTEXCOLOR( int i )
#include "shaderapi/ishadershadow.h" {
#include "materialsystem/imaterialvar.h" Assert( i >= 0 && i <= 1 );
m_nVERTEXCOLOR = i;
class vertexlit_and_unlit_generic_vs20_Static_Index #ifdef _DEBUG
{ m_bVERTEXCOLOR = true;
unsigned int m_nVERTEXCOLOR : 2; #endif
unsigned int m_nCUBEMAP : 2; }
unsigned int m_nHALFLAMBERT : 2; void SetVERTEXCOLOR( bool i )
unsigned int m_nFLASHLIGHT : 2; {
unsigned int m_nSEAMLESS_BASE : 2; m_nVERTEXCOLOR = i ? 1 : 0;
unsigned int m_nSEAMLESS_DETAIL : 2; #ifdef _DEBUG
unsigned int m_nSEPARATE_DETAIL_UVS : 2; m_bVERTEXCOLOR = true;
unsigned int m_nUSE_STATIC_CONTROL_FLOW : 2; #endif
unsigned int m_nDONT_GAMMA_CONVERT_VERTEX_COLOR : 2; }
#ifdef _DEBUG private:
bool m_bVERTEXCOLOR : 1; int m_nCUBEMAP;
bool m_bCUBEMAP : 1; #ifdef _DEBUG
bool m_bHALFLAMBERT : 1; bool m_bCUBEMAP;
bool m_bFLASHLIGHT : 1; #endif
bool m_bSEAMLESS_BASE : 1; public:
bool m_bSEAMLESS_DETAIL : 1; void SetCUBEMAP( int i )
bool m_bSEPARATE_DETAIL_UVS : 1; {
bool m_bUSE_STATIC_CONTROL_FLOW : 1; Assert( i >= 0 && i <= 1 );
bool m_bDONT_GAMMA_CONVERT_VERTEX_COLOR : 1; m_nCUBEMAP = i;
#endif // _DEBUG #ifdef _DEBUG
public: m_bCUBEMAP = true;
void SetVERTEXCOLOR( int i ) #endif
{ }
Assert( i >= 0 && i <= 1 ); void SetCUBEMAP( bool i )
m_nVERTEXCOLOR = i; {
#ifdef _DEBUG m_nCUBEMAP = i ? 1 : 0;
m_bVERTEXCOLOR = true; #ifdef _DEBUG
#endif // _DEBUG m_bCUBEMAP = true;
} #endif
}
void SetCUBEMAP( int i ) private:
{ int m_nHALFLAMBERT;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nCUBEMAP = i; bool m_bHALFLAMBERT;
#ifdef _DEBUG #endif
m_bCUBEMAP = true; public:
#endif // _DEBUG void SetHALFLAMBERT( int i )
} {
Assert( i >= 0 && i <= 1 );
void SetHALFLAMBERT( int i ) m_nHALFLAMBERT = i;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); m_bHALFLAMBERT = true;
m_nHALFLAMBERT = i; #endif
#ifdef _DEBUG }
m_bHALFLAMBERT = true; void SetHALFLAMBERT( bool i )
#endif // _DEBUG {
} m_nHALFLAMBERT = i ? 1 : 0;
#ifdef _DEBUG
void SetFLASHLIGHT( int i ) m_bHALFLAMBERT = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nFLASHLIGHT = i; private:
#ifdef _DEBUG int m_nFLASHLIGHT;
m_bFLASHLIGHT = true; #ifdef _DEBUG
#endif // _DEBUG bool m_bFLASHLIGHT;
} #endif
public:
void SetSEAMLESS_BASE( int i ) void SetFLASHLIGHT( int i )
{ {
Assert( i >= 0 && i <= 1 ); Assert( i >= 0 && i <= 1 );
m_nSEAMLESS_BASE = i; m_nFLASHLIGHT = i;
#ifdef _DEBUG #ifdef _DEBUG
m_bSEAMLESS_BASE = true; m_bFLASHLIGHT = true;
#endif // _DEBUG #endif
} }
void SetFLASHLIGHT( bool i )
void SetSEAMLESS_DETAIL( int i ) {
{ m_nFLASHLIGHT = i ? 1 : 0;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nSEAMLESS_DETAIL = i; m_bFLASHLIGHT = true;
#ifdef _DEBUG #endif
m_bSEAMLESS_DETAIL = true; }
#endif // _DEBUG private:
} int m_nSEAMLESS_BASE;
#ifdef _DEBUG
void SetSEPARATE_DETAIL_UVS( int i ) bool m_bSEAMLESS_BASE;
{ #endif
Assert( i >= 0 && i <= 1 ); public:
m_nSEPARATE_DETAIL_UVS = i; void SetSEAMLESS_BASE( int i )
#ifdef _DEBUG {
m_bSEPARATE_DETAIL_UVS = true; Assert( i >= 0 && i <= 1 );
#endif // _DEBUG m_nSEAMLESS_BASE = i;
} #ifdef _DEBUG
m_bSEAMLESS_BASE = true;
void SetUSE_STATIC_CONTROL_FLOW( int i ) #endif
{ }
Assert( i >= 0 && i <= 1 ); void SetSEAMLESS_BASE( bool i )
m_nUSE_STATIC_CONTROL_FLOW = i; {
#ifdef _DEBUG m_nSEAMLESS_BASE = i ? 1 : 0;
m_bUSE_STATIC_CONTROL_FLOW = true; #ifdef _DEBUG
#endif // _DEBUG m_bSEAMLESS_BASE = true;
} #endif
}
void SetDONT_GAMMA_CONVERT_VERTEX_COLOR( int i ) private:
{ int m_nSEAMLESS_DETAIL;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = i; bool m_bSEAMLESS_DETAIL;
#ifdef _DEBUG #endif
m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = true; public:
#endif // _DEBUG void SetSEAMLESS_DETAIL( int i )
} {
Assert( i >= 0 && i <= 1 );
vertexlit_and_unlit_generic_vs20_Static_Index( ) m_nSEAMLESS_DETAIL = i;
{ #ifdef _DEBUG
m_nVERTEXCOLOR = 0; m_bSEAMLESS_DETAIL = true;
m_nCUBEMAP = 0; #endif
m_nHALFLAMBERT = 0; }
m_nFLASHLIGHT = 0; void SetSEAMLESS_DETAIL( bool i )
m_nSEAMLESS_BASE = 0; {
m_nSEAMLESS_DETAIL = 0; m_nSEAMLESS_DETAIL = i ? 1 : 0;
m_nSEPARATE_DETAIL_UVS = 0; #ifdef _DEBUG
m_nUSE_STATIC_CONTROL_FLOW = 0; m_bSEAMLESS_DETAIL = true;
m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = 0; #endif
#ifdef _DEBUG }
m_bVERTEXCOLOR = false; private:
m_bCUBEMAP = false; int m_nSEPARATE_DETAIL_UVS;
m_bHALFLAMBERT = false; #ifdef _DEBUG
m_bFLASHLIGHT = false; bool m_bSEPARATE_DETAIL_UVS;
m_bSEAMLESS_BASE = false; #endif
m_bSEAMLESS_DETAIL = false; public:
m_bSEPARATE_DETAIL_UVS = false; void SetSEPARATE_DETAIL_UVS( int i )
m_bUSE_STATIC_CONTROL_FLOW = false; {
m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = false; Assert( i >= 0 && i <= 1 );
#endif // _DEBUG m_nSEPARATE_DETAIL_UVS = i;
} #ifdef _DEBUG
m_bSEPARATE_DETAIL_UVS = true;
int GetIndex() const #endif
{ }
Assert( m_bVERTEXCOLOR && m_bCUBEMAP && m_bHALFLAMBERT && m_bFLASHLIGHT && m_bSEAMLESS_BASE && m_bSEAMLESS_DETAIL && m_bSEPARATE_DETAIL_UVS && m_bUSE_STATIC_CONTROL_FLOW && m_bDONT_GAMMA_CONVERT_VERTEX_COLOR ); void SetSEPARATE_DETAIL_UVS( bool i )
return ( 192 * m_nVERTEXCOLOR ) + ( 384 * m_nCUBEMAP ) + ( 768 * m_nHALFLAMBERT ) + ( 1536 * m_nFLASHLIGHT ) + ( 3072 * m_nSEAMLESS_BASE ) + ( 6144 * m_nSEAMLESS_DETAIL ) + ( 12288 * m_nSEPARATE_DETAIL_UVS ) + ( 24576 * m_nUSE_STATIC_CONTROL_FLOW ) + ( 49152 * m_nDONT_GAMMA_CONVERT_VERTEX_COLOR ) + 0; {
} m_nSEPARATE_DETAIL_UVS = i ? 1 : 0;
}; #ifdef _DEBUG
m_bSEPARATE_DETAIL_UVS = true;
#define shaderStaticTest_vertexlit_and_unlit_generic_vs20 vsh_forgot_to_set_static_VERTEXCOLOR + vsh_forgot_to_set_static_CUBEMAP + vsh_forgot_to_set_static_HALFLAMBERT + vsh_forgot_to_set_static_FLASHLIGHT + vsh_forgot_to_set_static_SEAMLESS_BASE + vsh_forgot_to_set_static_SEAMLESS_DETAIL + vsh_forgot_to_set_static_SEPARATE_DETAIL_UVS + vsh_forgot_to_set_static_USE_STATIC_CONTROL_FLOW + vsh_forgot_to_set_static_DONT_GAMMA_CONVERT_VERTEX_COLOR #endif
}
private:
class vertexlit_and_unlit_generic_vs20_Dynamic_Index int m_nUSE_STATIC_CONTROL_FLOW;
{ #ifdef _DEBUG
unsigned int m_nCOMPRESSED_VERTS : 2; bool m_bUSE_STATIC_CONTROL_FLOW;
unsigned int m_nDYNAMIC_LIGHT : 2; #endif
unsigned int m_nSTATIC_LIGHT : 2; public:
unsigned int m_nDOWATERFOG : 2; void SetUSE_STATIC_CONTROL_FLOW( int i )
unsigned int m_nSKINNING : 2; {
unsigned int m_nLIGHTING_PREVIEW : 2; Assert( i >= 0 && i <= 1 );
unsigned int m_nNUM_LIGHTS : 2; m_nUSE_STATIC_CONTROL_FLOW = i;
#ifdef _DEBUG #ifdef _DEBUG
bool m_bCOMPRESSED_VERTS : 1; m_bUSE_STATIC_CONTROL_FLOW = true;
bool m_bDYNAMIC_LIGHT : 1; #endif
bool m_bSTATIC_LIGHT : 1; }
bool m_bDOWATERFOG : 1; void SetUSE_STATIC_CONTROL_FLOW( bool i )
bool m_bSKINNING : 1; {
bool m_bLIGHTING_PREVIEW : 1; m_nUSE_STATIC_CONTROL_FLOW = i ? 1 : 0;
bool m_bNUM_LIGHTS : 1; #ifdef _DEBUG
#endif // _DEBUG m_bUSE_STATIC_CONTROL_FLOW = true;
public: #endif
void SetCOMPRESSED_VERTS( int i ) }
{ private:
Assert( i >= 0 && i <= 1 ); int m_nDONT_GAMMA_CONVERT_VERTEX_COLOR;
m_nCOMPRESSED_VERTS = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bDONT_GAMMA_CONVERT_VERTEX_COLOR;
m_bCOMPRESSED_VERTS = true; #endif
#endif // _DEBUG public:
} void SetDONT_GAMMA_CONVERT_VERTEX_COLOR( int i )
{
void SetDYNAMIC_LIGHT( int i ) Assert( i >= 0 && i <= 1 );
{ m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = i;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nDYNAMIC_LIGHT = i; m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = true;
#ifdef _DEBUG #endif
m_bDYNAMIC_LIGHT = true; }
#endif // _DEBUG void SetDONT_GAMMA_CONVERT_VERTEX_COLOR( bool i )
} {
m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = i ? 1 : 0;
void SetSTATIC_LIGHT( int i ) #ifdef _DEBUG
{ m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nSTATIC_LIGHT = i; }
#ifdef _DEBUG public:
m_bSTATIC_LIGHT = true; vertexlit_and_unlit_generic_vs20_Static_Index( )
#endif // _DEBUG {
} #ifdef _DEBUG
m_bVERTEXCOLOR = false;
void SetDOWATERFOG( int i ) #endif // _DEBUG
{ m_nVERTEXCOLOR = 0;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nDOWATERFOG = i; m_bCUBEMAP = false;
#ifdef _DEBUG #endif // _DEBUG
m_bDOWATERFOG = true; m_nCUBEMAP = 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bHALFLAMBERT = false;
#endif // _DEBUG
void SetSKINNING( int i ) m_nHALFLAMBERT = 0;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); m_bFLASHLIGHT = false;
m_nSKINNING = i; #endif // _DEBUG
#ifdef _DEBUG m_nFLASHLIGHT = 0;
m_bSKINNING = true; #ifdef _DEBUG
#endif // _DEBUG m_bSEAMLESS_BASE = false;
} #endif // _DEBUG
m_nSEAMLESS_BASE = 0;
void SetLIGHTING_PREVIEW( int i ) #ifdef _DEBUG
{ m_bSEAMLESS_DETAIL = false;
Assert( i >= 0 && i <= 1 ); #endif // _DEBUG
m_nLIGHTING_PREVIEW = i; m_nSEAMLESS_DETAIL = 0;
#ifdef _DEBUG #ifdef _DEBUG
m_bLIGHTING_PREVIEW = true; m_bSEPARATE_DETAIL_UVS = false;
#endif // _DEBUG #endif // _DEBUG
} m_nSEPARATE_DETAIL_UVS = 0;
#ifdef _DEBUG
void SetNUM_LIGHTS( int i ) m_bUSE_STATIC_CONTROL_FLOW = false;
{ #endif // _DEBUG
Assert( i >= 0 && i <= 2 ); m_nUSE_STATIC_CONTROL_FLOW = 0;
m_nNUM_LIGHTS = i; #ifdef _DEBUG
#ifdef _DEBUG m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = false;
m_bNUM_LIGHTS = true; #endif // _DEBUG
#endif // _DEBUG m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = 0;
} }
int GetIndex()
vertexlit_and_unlit_generic_vs20_Dynamic_Index() {
{ // Asserts to make sure that we aren't using any skipped combinations.
m_nCOMPRESSED_VERTS = 0; // Asserts to make sure that we are setting all of the combination vars.
m_nDYNAMIC_LIGHT = 0; #ifdef _DEBUG
m_nSTATIC_LIGHT = 0; bool bAllStaticVarsDefined = m_bVERTEXCOLOR && m_bCUBEMAP && m_bHALFLAMBERT && m_bFLASHLIGHT && m_bSEAMLESS_BASE && m_bSEAMLESS_DETAIL && m_bSEPARATE_DETAIL_UVS && m_bUSE_STATIC_CONTROL_FLOW && m_bDONT_GAMMA_CONVERT_VERTEX_COLOR;
m_nDOWATERFOG = 0; Assert( bAllStaticVarsDefined );
m_nSKINNING = 0; #endif // _DEBUG
m_nLIGHTING_PREVIEW = 0; return ( 384 * m_nVERTEXCOLOR ) + ( 768 * m_nCUBEMAP ) + ( 1536 * m_nHALFLAMBERT ) + ( 3072 * m_nFLASHLIGHT ) + ( 6144 * m_nSEAMLESS_BASE ) + ( 12288 * m_nSEAMLESS_DETAIL ) + ( 24576 * m_nSEPARATE_DETAIL_UVS ) + ( 49152 * m_nUSE_STATIC_CONTROL_FLOW ) + ( 98304 * m_nDONT_GAMMA_CONVERT_VERTEX_COLOR ) + 0;
m_nNUM_LIGHTS = 0; }
#ifdef _DEBUG };
m_bCOMPRESSED_VERTS = false; #define shaderStaticTest_vertexlit_and_unlit_generic_vs20 vsh_forgot_to_set_static_VERTEXCOLOR + vsh_forgot_to_set_static_CUBEMAP + vsh_forgot_to_set_static_HALFLAMBERT + vsh_forgot_to_set_static_FLASHLIGHT + vsh_forgot_to_set_static_SEAMLESS_BASE + vsh_forgot_to_set_static_SEAMLESS_DETAIL + vsh_forgot_to_set_static_SEPARATE_DETAIL_UVS + vsh_forgot_to_set_static_USE_STATIC_CONTROL_FLOW + vsh_forgot_to_set_static_DONT_GAMMA_CONVERT_VERTEX_COLOR + 0
m_bDYNAMIC_LIGHT = false; class vertexlit_and_unlit_generic_vs20_Dynamic_Index
m_bSTATIC_LIGHT = false; {
m_bDOWATERFOG = false; private:
m_bSKINNING = false; int m_nCOMPRESSED_VERTS;
m_bLIGHTING_PREVIEW = false; #ifdef _DEBUG
m_bNUM_LIGHTS = false; bool m_bCOMPRESSED_VERTS;
#endif // _DEBUG #endif
} public:
void SetCOMPRESSED_VERTS( int i )
int GetIndex() const {
{ Assert( i >= 0 && i <= 1 );
Assert( m_bCOMPRESSED_VERTS && m_bDYNAMIC_LIGHT && m_bSTATIC_LIGHT && m_bDOWATERFOG && m_bSKINNING && m_bLIGHTING_PREVIEW && m_bNUM_LIGHTS ); m_nCOMPRESSED_VERTS = i;
return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDYNAMIC_LIGHT ) + ( 4 * m_nSTATIC_LIGHT ) + ( 8 * m_nDOWATERFOG ) + ( 16 * m_nSKINNING ) + ( 32 * m_nLIGHTING_PREVIEW ) + ( 64 * m_nNUM_LIGHTS ) + 0; #ifdef _DEBUG
} m_bCOMPRESSED_VERTS = true;
}; #endif
}
#define shaderDynamicTest_vertexlit_and_unlit_generic_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_DYNAMIC_LIGHT + vsh_forgot_to_set_dynamic_STATIC_LIGHT + vsh_forgot_to_set_dynamic_DOWATERFOG + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_LIGHTING_PREVIEW + vsh_forgot_to_set_dynamic_NUM_LIGHTS void SetCOMPRESSED_VERTS( bool i )
{
m_nCOMPRESSED_VERTS = i ? 1 : 0;
#endif // VERTEXLIT_AND_UNLIT_GENERIC_VS20_H #ifdef _DEBUG
m_bCOMPRESSED_VERTS = true;
#endif
}
private:
int m_nDYNAMIC_LIGHT;
#ifdef _DEBUG
bool m_bDYNAMIC_LIGHT;
#endif
public:
void SetDYNAMIC_LIGHT( int i )
{
Assert( i >= 0 && i <= 1 );
m_nDYNAMIC_LIGHT = i;
#ifdef _DEBUG
m_bDYNAMIC_LIGHT = true;
#endif
}
void SetDYNAMIC_LIGHT( bool i )
{
m_nDYNAMIC_LIGHT = i ? 1 : 0;
#ifdef _DEBUG
m_bDYNAMIC_LIGHT = true;
#endif
}
private:
int m_nSTATIC_LIGHT_VERTEX;
#ifdef _DEBUG
bool m_bSTATIC_LIGHT_VERTEX;
#endif
public:
void SetSTATIC_LIGHT_VERTEX( int i )
{
Assert( i >= 0 && i <= 1 );
m_nSTATIC_LIGHT_VERTEX = i;
#ifdef _DEBUG
m_bSTATIC_LIGHT_VERTEX = true;
#endif
}
void SetSTATIC_LIGHT_VERTEX( bool i )
{
m_nSTATIC_LIGHT_VERTEX = i ? 1 : 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_VERTEX = true;
#endif
}
private:
int m_nSTATIC_LIGHT_LIGHTMAP;
#ifdef _DEBUG
bool m_bSTATIC_LIGHT_LIGHTMAP;
#endif
public:
void SetSTATIC_LIGHT_LIGHTMAP( int i )
{
Assert( i >= 0 && i <= 1 );
m_nSTATIC_LIGHT_LIGHTMAP = i;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = true;
#endif
}
void SetSTATIC_LIGHT_LIGHTMAP( bool i )
{
m_nSTATIC_LIGHT_LIGHTMAP = i ? 1 : 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = true;
#endif
}
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
}
private:
int m_nSKINNING;
#ifdef _DEBUG
bool m_bSKINNING;
#endif
public:
void SetSKINNING( int i )
{
Assert( i >= 0 && i <= 1 );
m_nSKINNING = i;
#ifdef _DEBUG
m_bSKINNING = true;
#endif
}
void SetSKINNING( bool i )
{
m_nSKINNING = i ? 1 : 0;
#ifdef _DEBUG
m_bSKINNING = true;
#endif
}
private:
int m_nLIGHTING_PREVIEW;
#ifdef _DEBUG
bool m_bLIGHTING_PREVIEW;
#endif
public:
void SetLIGHTING_PREVIEW( int i )
{
Assert( i >= 0 && i <= 1 );
m_nLIGHTING_PREVIEW = i;
#ifdef _DEBUG
m_bLIGHTING_PREVIEW = true;
#endif
}
void SetLIGHTING_PREVIEW( bool i )
{
m_nLIGHTING_PREVIEW = i ? 1 : 0;
#ifdef _DEBUG
m_bLIGHTING_PREVIEW = true;
#endif
}
private:
int m_nNUM_LIGHTS;
#ifdef _DEBUG
bool m_bNUM_LIGHTS;
#endif
public:
void SetNUM_LIGHTS( int i )
{
Assert( i >= 0 && i <= 2 );
m_nNUM_LIGHTS = i;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
void SetNUM_LIGHTS( bool i )
{
m_nNUM_LIGHTS = i ? 1 : 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
public:
vertexlit_and_unlit_generic_vs20_Dynamic_Index()
{
#ifdef _DEBUG
m_bCOMPRESSED_VERTS = false;
#endif // _DEBUG
m_nCOMPRESSED_VERTS = 0;
#ifdef _DEBUG
m_bDYNAMIC_LIGHT = false;
#endif // _DEBUG
m_nDYNAMIC_LIGHT = 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_VERTEX = false;
#endif // _DEBUG
m_nSTATIC_LIGHT_VERTEX = 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = false;
#endif // _DEBUG
m_nSTATIC_LIGHT_LIGHTMAP = 0;
#ifdef _DEBUG
m_bDOWATERFOG = false;
#endif // _DEBUG
m_nDOWATERFOG = 0;
#ifdef _DEBUG
m_bSKINNING = false;
#endif // _DEBUG
m_nSKINNING = 0;
#ifdef _DEBUG
m_bLIGHTING_PREVIEW = false;
#endif // _DEBUG
m_nLIGHTING_PREVIEW = 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = false;
#endif // _DEBUG
m_nNUM_LIGHTS = 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_bCOMPRESSED_VERTS && m_bDYNAMIC_LIGHT && m_bSTATIC_LIGHT_VERTEX && m_bSTATIC_LIGHT_LIGHTMAP && m_bDOWATERFOG && m_bSKINNING && m_bLIGHTING_PREVIEW && m_bNUM_LIGHTS;
Assert( bAllDynamicVarsDefined );
#endif // _DEBUG
return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDYNAMIC_LIGHT ) + ( 4 * m_nSTATIC_LIGHT_VERTEX ) + ( 8 * m_nSTATIC_LIGHT_LIGHTMAP ) + ( 16 * m_nDOWATERFOG ) + ( 32 * m_nSKINNING ) + ( 64 * m_nLIGHTING_PREVIEW ) + ( 128 * m_nNUM_LIGHTS ) + 0;
}
};
#define shaderDynamicTest_vertexlit_and_unlit_generic_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_DYNAMIC_LIGHT + vsh_forgot_to_set_dynamic_STATIC_LIGHT_VERTEX + vsh_forgot_to_set_dynamic_STATIC_LIGHT_LIGHTMAP + vsh_forgot_to_set_dynamic_DOWATERFOG + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_LIGHTING_PREVIEW + vsh_forgot_to_set_dynamic_NUM_LIGHTS + 0

View file

@ -1,322 +1,537 @@
// ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!! #include "shaderlib/cshader.h"
// ($PIXELFOGTYPE == 0) && ($WRITEWATERFOGTODESTALPHA != 0) class skin_ps20b_Static_Index
// (! $DETAILTEXTURE) && ( $DETAIL_BLEND_MODE != 0 ) {
// ( $FLASHLIGHT == 0 ) && ( $FLASHLIGHTSHADOWS == 1 ) private:
// ( $FLASHLIGHT == 0 ) && ( $FLASHLIGHTDEPTHFILTERMODE != 0 ) int m_nCONVERT_TO_SRGB;
// ( $SELFILLUM == 0 ) && ( $SELFILLUMFRESNEL == 1 ) #ifdef _DEBUG
// ( $FLASHLIGHT == 1 ) && ( $SELFILLUMFRESNEL == 1 ) bool m_bCONVERT_TO_SRGB;
// ( $FLASHLIGHT == 1 ) && ( $SELFILLUM == 1 ) #endif
// ( $BLENDTINTBYBASEALPHA ) && ( $SELFILLUM ) public:
// $FASTPATH_NOBUMP && ( $RIMLIGHT || $DETAILTEXTURE || $PHONGWARPTEXTURE || $SELFILLUM || $BLENDTINTBYBASEALPHA ) void SetCONVERT_TO_SRGB( int i )
// defined $HDRTYPE && defined $HDRENABLED && !$HDRTYPE && $HDRENABLED {
// defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA Assert( i >= 0 && i <= 0 );
// defined $LIGHTING_PREVIEW && defined $HDRTYPE && $LIGHTING_PREVIEW && $HDRTYPE != 0 m_nCONVERT_TO_SRGB = i;
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT #ifdef _DEBUG
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST m_bCONVERT_TO_SRGB = true;
// defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH #endif
// ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW }
// defined $HDRTYPE && defined $HDRENABLED && !$HDRTYPE && $HDRENABLED void SetCONVERT_TO_SRGB( bool i )
// defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA {
// defined $LIGHTING_PREVIEW && defined $HDRTYPE && $LIGHTING_PREVIEW && $HDRTYPE != 0 m_nCONVERT_TO_SRGB = i ? 1 : 0;
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT #ifdef _DEBUG
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST m_bCONVERT_TO_SRGB = true;
// defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH #endif
// ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW }
private:
#ifndef SKIN_PS20B_H int m_nCUBEMAP;
#define SKIN_PS20B_H #ifdef _DEBUG
bool m_bCUBEMAP;
#include "shaderapi/ishaderapi.h" #endif
#include "shaderapi/ishadershadow.h" public:
#include "materialsystem/imaterialvar.h" void SetCUBEMAP( int i )
{
class skin_ps20b_Static_Index Assert( i >= 0 && i <= 1 );
{ m_nCUBEMAP = i;
unsigned int m_nCONVERT_TO_SRGB : 1; #ifdef _DEBUG
unsigned int m_nCUBEMAP : 2; m_bCUBEMAP = true;
unsigned int m_nSELFILLUM : 2; #endif
unsigned int m_nSELFILLUMFRESNEL : 2; }
unsigned int m_nFLASHLIGHT : 2; void SetCUBEMAP( bool i )
unsigned int m_nLIGHTWARPTEXTURE : 2; {
unsigned int m_nPHONGWARPTEXTURE : 2; m_nCUBEMAP = i ? 1 : 0;
unsigned int m_nWRINKLEMAP : 2; #ifdef _DEBUG
unsigned int m_nDETAIL_BLEND_MODE : 3; m_bCUBEMAP = true;
unsigned int m_nDETAILTEXTURE : 2; #endif
unsigned int m_nRIMLIGHT : 2; }
unsigned int m_nFLASHLIGHTDEPTHFILTERMODE : 2; private:
unsigned int m_nFASTPATH_NOBUMP : 2; int m_nSELFILLUM;
unsigned int m_nBLENDTINTBYBASEALPHA : 2; #ifdef _DEBUG
#ifdef _DEBUG bool m_bSELFILLUM;
bool m_bCONVERT_TO_SRGB : 1; #endif
bool m_bCUBEMAP : 1; public:
bool m_bSELFILLUM : 1; void SetSELFILLUM( int i )
bool m_bSELFILLUMFRESNEL : 1; {
bool m_bFLASHLIGHT : 1; Assert( i >= 0 && i <= 1 );
bool m_bLIGHTWARPTEXTURE : 1; m_nSELFILLUM = i;
bool m_bPHONGWARPTEXTURE : 1; #ifdef _DEBUG
bool m_bWRINKLEMAP : 1; m_bSELFILLUM = true;
bool m_bDETAIL_BLEND_MODE : 1; #endif
bool m_bDETAILTEXTURE : 1; }
bool m_bRIMLIGHT : 1; void SetSELFILLUM( bool i )
bool m_bFLASHLIGHTDEPTHFILTERMODE : 1; {
bool m_bFASTPATH_NOBUMP : 1; m_nSELFILLUM = i ? 1 : 0;
bool m_bBLENDTINTBYBASEALPHA : 1; #ifdef _DEBUG
#endif // _DEBUG m_bSELFILLUM = true;
public: #endif
void SetCONVERT_TO_SRGB( int i ) }
{ private:
Assert( i >= 0 && i <= 0 ); int m_nSELFILLUMFRESNEL;
m_nCONVERT_TO_SRGB = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bSELFILLUMFRESNEL;
m_bCONVERT_TO_SRGB = true; #endif
#endif // _DEBUG public:
} void SetSELFILLUMFRESNEL( int i )
{
void SetCUBEMAP( int i ) Assert( i >= 0 && i <= 1 );
{ m_nSELFILLUMFRESNEL = i;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nCUBEMAP = i; m_bSELFILLUMFRESNEL = true;
#ifdef _DEBUG #endif
m_bCUBEMAP = true; }
#endif // _DEBUG void SetSELFILLUMFRESNEL( bool i )
} {
m_nSELFILLUMFRESNEL = i ? 1 : 0;
void SetSELFILLUM( int i ) #ifdef _DEBUG
{ m_bSELFILLUMFRESNEL = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nSELFILLUM = i; }
#ifdef _DEBUG private:
m_bSELFILLUM = true; int m_nFLASHLIGHT;
#endif // _DEBUG #ifdef _DEBUG
} bool m_bFLASHLIGHT;
#endif
void SetSELFILLUMFRESNEL( int i ) public:
{ void SetFLASHLIGHT( int i )
Assert( i >= 0 && i <= 1 ); {
m_nSELFILLUMFRESNEL = i; Assert( i >= 0 && i <= 1 );
#ifdef _DEBUG m_nFLASHLIGHT = i;
m_bSELFILLUMFRESNEL = true; #ifdef _DEBUG
#endif // _DEBUG m_bFLASHLIGHT = true;
} #endif
}
void SetFLASHLIGHT( int i ) void SetFLASHLIGHT( bool i )
{ {
Assert( i >= 0 && i <= 1 ); m_nFLASHLIGHT = i ? 1 : 0;
m_nFLASHLIGHT = i; #ifdef _DEBUG
#ifdef _DEBUG m_bFLASHLIGHT = true;
m_bFLASHLIGHT = true; #endif
#endif // _DEBUG }
} private:
int m_nLIGHTWARPTEXTURE;
void SetLIGHTWARPTEXTURE( int i ) #ifdef _DEBUG
{ bool m_bLIGHTWARPTEXTURE;
Assert( i >= 0 && i <= 1 ); #endif
m_nLIGHTWARPTEXTURE = i; public:
#ifdef _DEBUG void SetLIGHTWARPTEXTURE( int i )
m_bLIGHTWARPTEXTURE = true; {
#endif // _DEBUG Assert( i >= 0 && i <= 1 );
} m_nLIGHTWARPTEXTURE = i;
#ifdef _DEBUG
void SetPHONGWARPTEXTURE( int i ) m_bLIGHTWARPTEXTURE = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nPHONGWARPTEXTURE = i; void SetLIGHTWARPTEXTURE( bool i )
#ifdef _DEBUG {
m_bPHONGWARPTEXTURE = true; m_nLIGHTWARPTEXTURE = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bLIGHTWARPTEXTURE = true;
#endif
void SetWRINKLEMAP( int i ) }
{ private:
Assert( i >= 0 && i <= 1 ); int m_nPHONGWARPTEXTURE;
m_nWRINKLEMAP = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bPHONGWARPTEXTURE;
m_bWRINKLEMAP = true; #endif
#endif // _DEBUG public:
} void SetPHONGWARPTEXTURE( int i )
{
void SetDETAIL_BLEND_MODE( int i ) Assert( i >= 0 && i <= 1 );
{ m_nPHONGWARPTEXTURE = i;
Assert( i >= 0 && i <= 6 ); #ifdef _DEBUG
m_nDETAIL_BLEND_MODE = i; m_bPHONGWARPTEXTURE = true;
#ifdef _DEBUG #endif
m_bDETAIL_BLEND_MODE = true; }
#endif // _DEBUG void SetPHONGWARPTEXTURE( bool i )
} {
m_nPHONGWARPTEXTURE = i ? 1 : 0;
void SetDETAILTEXTURE( int i ) #ifdef _DEBUG
{ m_bPHONGWARPTEXTURE = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nDETAILTEXTURE = i; }
#ifdef _DEBUG private:
m_bDETAILTEXTURE = true; int m_nWRINKLEMAP;
#endif // _DEBUG #ifdef _DEBUG
} bool m_bWRINKLEMAP;
#endif
void SetRIMLIGHT( int i ) public:
{ void SetWRINKLEMAP( int i )
Assert( i >= 0 && i <= 1 ); {
m_nRIMLIGHT = i; Assert( i >= 0 && i <= 1 );
#ifdef _DEBUG m_nWRINKLEMAP = i;
m_bRIMLIGHT = true; #ifdef _DEBUG
#endif // _DEBUG m_bWRINKLEMAP = true;
} #endif
}
void SetFLASHLIGHTDEPTHFILTERMODE( int i ) void SetWRINKLEMAP( bool i )
{ {
Assert( i >= 0 && i <= 2 ); m_nWRINKLEMAP = i ? 1 : 0;
m_nFLASHLIGHTDEPTHFILTERMODE = i; #ifdef _DEBUG
#ifdef _DEBUG m_bWRINKLEMAP = true;
m_bFLASHLIGHTDEPTHFILTERMODE = true; #endif
#endif // _DEBUG }
} private:
int m_nDETAIL_BLEND_MODE;
void SetFASTPATH_NOBUMP( int i ) #ifdef _DEBUG
{ bool m_bDETAIL_BLEND_MODE;
Assert( i >= 0 && i <= 1 ); #endif
m_nFASTPATH_NOBUMP = i; public:
#ifdef _DEBUG void SetDETAIL_BLEND_MODE( int i )
m_bFASTPATH_NOBUMP = true; {
#endif // _DEBUG Assert( i >= 0 && i <= 6 );
} m_nDETAIL_BLEND_MODE = i;
#ifdef _DEBUG
void SetBLENDTINTBYBASEALPHA( int i ) m_bDETAIL_BLEND_MODE = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nBLENDTINTBYBASEALPHA = i; void SetDETAIL_BLEND_MODE( bool i )
#ifdef _DEBUG {
m_bBLENDTINTBYBASEALPHA = true; m_nDETAIL_BLEND_MODE = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bDETAIL_BLEND_MODE = true;
#endif
skin_ps20b_Static_Index() }
{ private:
m_nCONVERT_TO_SRGB = 0; int m_nDETAILTEXTURE;
m_nCUBEMAP = 0; #ifdef _DEBUG
m_nSELFILLUM = 0; bool m_bDETAILTEXTURE;
m_nSELFILLUMFRESNEL = 0; #endif
m_nFLASHLIGHT = 0; public:
m_nLIGHTWARPTEXTURE = 0; void SetDETAILTEXTURE( int i )
m_nPHONGWARPTEXTURE = 0; {
m_nWRINKLEMAP = 0; Assert( i >= 0 && i <= 1 );
m_nDETAIL_BLEND_MODE = 0; m_nDETAILTEXTURE = i;
m_nDETAILTEXTURE = 0; #ifdef _DEBUG
m_nRIMLIGHT = 0; m_bDETAILTEXTURE = true;
m_nFLASHLIGHTDEPTHFILTERMODE = 0; #endif
m_nFASTPATH_NOBUMP = 0; }
m_nBLENDTINTBYBASEALPHA = 0; void SetDETAILTEXTURE( bool i )
#ifdef _DEBUG {
m_bCONVERT_TO_SRGB = false; m_nDETAILTEXTURE = i ? 1 : 0;
m_bCUBEMAP = false; #ifdef _DEBUG
m_bSELFILLUM = false; m_bDETAILTEXTURE = true;
m_bSELFILLUMFRESNEL = false; #endif
m_bFLASHLIGHT = false; }
m_bLIGHTWARPTEXTURE = false; private:
m_bPHONGWARPTEXTURE = false; int m_nRIMLIGHT;
m_bWRINKLEMAP = false; #ifdef _DEBUG
m_bDETAIL_BLEND_MODE = false; bool m_bRIMLIGHT;
m_bDETAILTEXTURE = false; #endif
m_bRIMLIGHT = false; public:
m_bFLASHLIGHTDEPTHFILTERMODE = false; void SetRIMLIGHT( int i )
m_bFASTPATH_NOBUMP = false; {
m_bBLENDTINTBYBASEALPHA = false; Assert( i >= 0 && i <= 1 );
#endif // _DEBUG m_nRIMLIGHT = i;
} #ifdef _DEBUG
m_bRIMLIGHT = true;
int GetIndex() const #endif
{ }
Assert( m_bCONVERT_TO_SRGB && m_bCUBEMAP && m_bSELFILLUM && m_bSELFILLUMFRESNEL && m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bPHONGWARPTEXTURE && m_bWRINKLEMAP && m_bDETAIL_BLEND_MODE && m_bDETAILTEXTURE && m_bRIMLIGHT && m_bFLASHLIGHTDEPTHFILTERMODE && m_bFASTPATH_NOBUMP && m_bBLENDTINTBYBASEALPHA ); void SetRIMLIGHT( bool i )
return ( 80 * m_nCONVERT_TO_SRGB ) + ( 80 * m_nCUBEMAP ) + ( 160 * m_nSELFILLUM ) + ( 320 * m_nSELFILLUMFRESNEL ) + ( 640 * m_nFLASHLIGHT ) + ( 1280 * m_nLIGHTWARPTEXTURE ) + ( 2560 * m_nPHONGWARPTEXTURE ) + ( 5120 * m_nWRINKLEMAP ) + ( 10240 * m_nDETAIL_BLEND_MODE ) + ( 71680 * m_nDETAILTEXTURE ) + ( 143360 * m_nRIMLIGHT ) + ( 286720 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 860160 * m_nFASTPATH_NOBUMP ) + ( 1720320 * m_nBLENDTINTBYBASEALPHA ) + 0; {
} m_nRIMLIGHT = i ? 1 : 0;
}; #ifdef _DEBUG
m_bRIMLIGHT = true;
#define shaderStaticTest_skin_ps20b psh_forgot_to_set_static_CONVERT_TO_SRGB + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_SELFILLUMFRESNEL + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_LIGHTWARPTEXTURE + psh_forgot_to_set_static_PHONGWARPTEXTURE + psh_forgot_to_set_static_WRINKLEMAP + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_RIMLIGHT + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_FASTPATH_NOBUMP + psh_forgot_to_set_static_BLENDTINTBYBASEALPHA #endif
}
private:
class skin_ps20b_Dynamic_Index int m_nFLASHLIGHTDEPTHFILTERMODE;
{ #ifdef _DEBUG
unsigned int m_nWRITEWATERFOGTODESTALPHA : 2; bool m_bFLASHLIGHTDEPTHFILTERMODE;
unsigned int m_nPIXELFOGTYPE : 2; #endif
unsigned int m_nNUM_LIGHTS : 3; public:
unsigned int m_nWRITE_DEPTH_TO_DESTALPHA : 2; void SetFLASHLIGHTDEPTHFILTERMODE( int i )
unsigned int m_nFLASHLIGHTSHADOWS : 2; {
#ifdef _DEBUG Assert( i >= 0 && i <= 2 );
bool m_bWRITEWATERFOGTODESTALPHA : 1; m_nFLASHLIGHTDEPTHFILTERMODE = i;
bool m_bPIXELFOGTYPE : 1; #ifdef _DEBUG
bool m_bNUM_LIGHTS : 1; m_bFLASHLIGHTDEPTHFILTERMODE = true;
bool m_bWRITE_DEPTH_TO_DESTALPHA : 1; #endif
bool m_bFLASHLIGHTSHADOWS : 1; }
#endif // _DEBUG void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
public: {
void SetWRITEWATERFOGTODESTALPHA( int i ) m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); m_bFLASHLIGHTDEPTHFILTERMODE = true;
m_nWRITEWATERFOGTODESTALPHA = i; #endif
#ifdef _DEBUG }
m_bWRITEWATERFOGTODESTALPHA = true; private:
#endif // _DEBUG int m_nFASTPATH_NOBUMP;
} #ifdef _DEBUG
bool m_bFASTPATH_NOBUMP;
void SetPIXELFOGTYPE( int i ) #endif
{ public:
Assert( i >= 0 && i <= 1 ); void SetFASTPATH_NOBUMP( int i )
m_nPIXELFOGTYPE = i; {
#ifdef _DEBUG Assert( i >= 0 && i <= 1 );
m_bPIXELFOGTYPE = true; m_nFASTPATH_NOBUMP = i;
#endif // _DEBUG #ifdef _DEBUG
} m_bFASTPATH_NOBUMP = true;
#endif
void SetNUM_LIGHTS( int i ) }
{ void SetFASTPATH_NOBUMP( bool i )
Assert( i >= 0 && i <= 4 ); {
m_nNUM_LIGHTS = i; m_nFASTPATH_NOBUMP = i ? 1 : 0;
#ifdef _DEBUG #ifdef _DEBUG
m_bNUM_LIGHTS = true; m_bFASTPATH_NOBUMP = true;
#endif // _DEBUG #endif
} }
private:
void SetWRITE_DEPTH_TO_DESTALPHA( int i ) int m_nBLENDTINTBYBASEALPHA;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); bool m_bBLENDTINTBYBASEALPHA;
m_nWRITE_DEPTH_TO_DESTALPHA = i; #endif
#ifdef _DEBUG public:
m_bWRITE_DEPTH_TO_DESTALPHA = true; void SetBLENDTINTBYBASEALPHA( int i )
#endif // _DEBUG {
} Assert( i >= 0 && i <= 1 );
m_nBLENDTINTBYBASEALPHA = i;
void SetFLASHLIGHTSHADOWS( int i ) #ifdef _DEBUG
{ m_bBLENDTINTBYBASEALPHA = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nFLASHLIGHTSHADOWS = i; }
#ifdef _DEBUG void SetBLENDTINTBYBASEALPHA( bool i )
m_bFLASHLIGHTSHADOWS = true; {
#endif // _DEBUG m_nBLENDTINTBYBASEALPHA = i ? 1 : 0;
} #ifdef _DEBUG
m_bBLENDTINTBYBASEALPHA = true;
skin_ps20b_Dynamic_Index() #endif
{ }
m_nWRITEWATERFOGTODESTALPHA = 0; public:
m_nPIXELFOGTYPE = 0; skin_ps20b_Static_Index( )
m_nNUM_LIGHTS = 0; {
m_nWRITE_DEPTH_TO_DESTALPHA = 0; #ifdef _DEBUG
m_nFLASHLIGHTSHADOWS = 0; m_bCONVERT_TO_SRGB = false;
#ifdef _DEBUG #endif // _DEBUG
m_bWRITEWATERFOGTODESTALPHA = false; m_nCONVERT_TO_SRGB = 0;
m_bPIXELFOGTYPE = false; #ifdef _DEBUG
m_bNUM_LIGHTS = false; m_bCUBEMAP = false;
m_bWRITE_DEPTH_TO_DESTALPHA = false; #endif // _DEBUG
m_bFLASHLIGHTSHADOWS = false; m_nCUBEMAP = 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bSELFILLUM = false;
#endif // _DEBUG
int GetIndex() const m_nSELFILLUM = 0;
{ #ifdef _DEBUG
Assert( m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bNUM_LIGHTS && m_bWRITE_DEPTH_TO_DESTALPHA && m_bFLASHLIGHTSHADOWS ); m_bSELFILLUMFRESNEL = false;
return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nNUM_LIGHTS ) + ( 20 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 40 * m_nFLASHLIGHTSHADOWS ) + 0; #endif // _DEBUG
} m_nSELFILLUMFRESNEL = 0;
}; #ifdef _DEBUG
m_bFLASHLIGHT = false;
#define shaderDynamicTest_skin_ps20b psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS #endif // _DEBUG
m_nFLASHLIGHT = 0;
#ifdef _DEBUG
#endif // SKIN_PS20B_H m_bLIGHTWARPTEXTURE = false;
#endif // _DEBUG
m_nLIGHTWARPTEXTURE = 0;
#ifdef _DEBUG
m_bPHONGWARPTEXTURE = false;
#endif // _DEBUG
m_nPHONGWARPTEXTURE = 0;
#ifdef _DEBUG
m_bWRINKLEMAP = false;
#endif // _DEBUG
m_nWRINKLEMAP = 0;
#ifdef _DEBUG
m_bDETAIL_BLEND_MODE = false;
#endif // _DEBUG
m_nDETAIL_BLEND_MODE = 0;
#ifdef _DEBUG
m_bDETAILTEXTURE = false;
#endif // _DEBUG
m_nDETAILTEXTURE = 0;
#ifdef _DEBUG
m_bRIMLIGHT = false;
#endif // _DEBUG
m_nRIMLIGHT = 0;
#ifdef _DEBUG
m_bFLASHLIGHTDEPTHFILTERMODE = false;
#endif // _DEBUG
m_nFLASHLIGHTDEPTHFILTERMODE = 0;
#ifdef _DEBUG
m_bFASTPATH_NOBUMP = false;
#endif // _DEBUG
m_nFASTPATH_NOBUMP = 0;
#ifdef _DEBUG
m_bBLENDTINTBYBASEALPHA = false;
#endif // _DEBUG
m_nBLENDTINTBYBASEALPHA = 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_bCONVERT_TO_SRGB && m_bCUBEMAP && m_bSELFILLUM && m_bSELFILLUMFRESNEL && m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bPHONGWARPTEXTURE && m_bWRINKLEMAP && m_bDETAIL_BLEND_MODE && m_bDETAILTEXTURE && m_bRIMLIGHT && m_bFLASHLIGHTDEPTHFILTERMODE && m_bFASTPATH_NOBUMP && m_bBLENDTINTBYBASEALPHA;
Assert( bAllStaticVarsDefined );
#endif // _DEBUG
return ( 160 * m_nCONVERT_TO_SRGB ) + ( 160 * m_nCUBEMAP ) + ( 320 * m_nSELFILLUM ) + ( 640 * m_nSELFILLUMFRESNEL ) + ( 1280 * m_nFLASHLIGHT ) + ( 2560 * m_nLIGHTWARPTEXTURE ) + ( 5120 * m_nPHONGWARPTEXTURE ) + ( 10240 * m_nWRINKLEMAP ) + ( 20480 * m_nDETAIL_BLEND_MODE ) + ( 143360 * m_nDETAILTEXTURE ) + ( 286720 * m_nRIMLIGHT ) + ( 573440 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 1720320 * m_nFASTPATH_NOBUMP ) + ( 3440640 * m_nBLENDTINTBYBASEALPHA ) + 0;
}
};
#define shaderStaticTest_skin_ps20b psh_forgot_to_set_static_CONVERT_TO_SRGB + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_SELFILLUMFRESNEL + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_LIGHTWARPTEXTURE + psh_forgot_to_set_static_PHONGWARPTEXTURE + psh_forgot_to_set_static_WRINKLEMAP + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_RIMLIGHT + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_FASTPATH_NOBUMP + psh_forgot_to_set_static_BLENDTINTBYBASEALPHA + 0
class skin_ps20b_Dynamic_Index
{
private:
int m_nWRITEWATERFOGTODESTALPHA;
#ifdef _DEBUG
bool m_bWRITEWATERFOGTODESTALPHA;
#endif
public:
void SetWRITEWATERFOGTODESTALPHA( int i )
{
Assert( i >= 0 && i <= 1 );
m_nWRITEWATERFOGTODESTALPHA = i;
#ifdef _DEBUG
m_bWRITEWATERFOGTODESTALPHA = true;
#endif
}
void SetWRITEWATERFOGTODESTALPHA( bool i )
{
m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
#ifdef _DEBUG
m_bWRITEWATERFOGTODESTALPHA = true;
#endif
}
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
}
private:
int m_nNUM_LIGHTS;
#ifdef _DEBUG
bool m_bNUM_LIGHTS;
#endif
public:
void SetNUM_LIGHTS( int i )
{
Assert( i >= 0 && i <= 4 );
m_nNUM_LIGHTS = i;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
void SetNUM_LIGHTS( bool i )
{
m_nNUM_LIGHTS = i ? 1 : 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
private:
int m_nWRITE_DEPTH_TO_DESTALPHA;
#ifdef _DEBUG
bool m_bWRITE_DEPTH_TO_DESTALPHA;
#endif
public:
void SetWRITE_DEPTH_TO_DESTALPHA( int i )
{
Assert( i >= 0 && i <= 1 );
m_nWRITE_DEPTH_TO_DESTALPHA = i;
#ifdef _DEBUG
m_bWRITE_DEPTH_TO_DESTALPHA = true;
#endif
}
void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
{
m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
#ifdef _DEBUG
m_bWRITE_DEPTH_TO_DESTALPHA = true;
#endif
}
private:
int m_nFLASHLIGHTSHADOWS;
#ifdef _DEBUG
bool m_bFLASHLIGHTSHADOWS;
#endif
public:
void SetFLASHLIGHTSHADOWS( int i )
{
Assert( i >= 0 && i <= 1 );
m_nFLASHLIGHTSHADOWS = i;
#ifdef _DEBUG
m_bFLASHLIGHTSHADOWS = true;
#endif
}
void SetFLASHLIGHTSHADOWS( bool i )
{
m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
#ifdef _DEBUG
m_bFLASHLIGHTSHADOWS = true;
#endif
}
private:
int m_nPHONG_USE_EXPONENT_FACTOR;
#ifdef _DEBUG
bool m_bPHONG_USE_EXPONENT_FACTOR;
#endif
public:
void SetPHONG_USE_EXPONENT_FACTOR( int i )
{
Assert( i >= 0 && i <= 1 );
m_nPHONG_USE_EXPONENT_FACTOR = i;
#ifdef _DEBUG
m_bPHONG_USE_EXPONENT_FACTOR = true;
#endif
}
void SetPHONG_USE_EXPONENT_FACTOR( bool i )
{
m_nPHONG_USE_EXPONENT_FACTOR = i ? 1 : 0;
#ifdef _DEBUG
m_bPHONG_USE_EXPONENT_FACTOR = true;
#endif
}
public:
skin_ps20b_Dynamic_Index()
{
#ifdef _DEBUG
m_bWRITEWATERFOGTODESTALPHA = false;
#endif // _DEBUG
m_nWRITEWATERFOGTODESTALPHA = 0;
#ifdef _DEBUG
m_bPIXELFOGTYPE = false;
#endif // _DEBUG
m_nPIXELFOGTYPE = 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = false;
#endif // _DEBUG
m_nNUM_LIGHTS = 0;
#ifdef _DEBUG
m_bWRITE_DEPTH_TO_DESTALPHA = false;
#endif // _DEBUG
m_nWRITE_DEPTH_TO_DESTALPHA = 0;
#ifdef _DEBUG
m_bFLASHLIGHTSHADOWS = false;
#endif // _DEBUG
m_nFLASHLIGHTSHADOWS = 0;
#ifdef _DEBUG
m_bPHONG_USE_EXPONENT_FACTOR = false;
#endif // _DEBUG
m_nPHONG_USE_EXPONENT_FACTOR = 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_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bNUM_LIGHTS && m_bWRITE_DEPTH_TO_DESTALPHA && m_bFLASHLIGHTSHADOWS && m_bPHONG_USE_EXPONENT_FACTOR;
Assert( bAllDynamicVarsDefined );
#endif // _DEBUG
return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nNUM_LIGHTS ) + ( 20 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 40 * m_nFLASHLIGHTSHADOWS ) + ( 80 * m_nPHONG_USE_EXPONENT_FACTOR ) + 0;
}
};
#define shaderDynamicTest_skin_ps20b psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + psh_forgot_to_set_dynamic_PHONG_USE_EXPONENT_FACTOR + 0

View file

@ -1,322 +1,537 @@
// ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!! #include "shaderlib/cshader.h"
// ($PIXELFOGTYPE == 0) && ($WRITEWATERFOGTODESTALPHA != 0) class skin_ps30_Static_Index
// (! $DETAILTEXTURE) && ( $DETAIL_BLEND_MODE != 0 ) {
// ( $FLASHLIGHT == 0 ) && ( $FLASHLIGHTSHADOWS == 1 ) private:
// ( $FLASHLIGHT == 0 ) && ( $FLASHLIGHTDEPTHFILTERMODE != 0 ) int m_nCONVERT_TO_SRGB;
// ( $SELFILLUM == 0 ) && ( $SELFILLUMFRESNEL == 1 ) #ifdef _DEBUG
// ( $FLASHLIGHT == 1 ) && ( $SELFILLUMFRESNEL == 1 ) bool m_bCONVERT_TO_SRGB;
// ( $FLASHLIGHT == 1 ) && ( $SELFILLUM == 1 ) #endif
// ( $BLENDTINTBYBASEALPHA ) && ( $SELFILLUM ) public:
// $FASTPATH_NOBUMP && ( $RIMLIGHT || $DETAILTEXTURE || $PHONGWARPTEXTURE || $SELFILLUM || $BLENDTINTBYBASEALPHA ) void SetCONVERT_TO_SRGB( int i )
// defined $HDRTYPE && defined $HDRENABLED && !$HDRTYPE && $HDRENABLED {
// defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA Assert( i >= 0 && i <= 0 );
// defined $LIGHTING_PREVIEW && defined $HDRTYPE && $LIGHTING_PREVIEW && $HDRTYPE != 0 m_nCONVERT_TO_SRGB = i;
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT #ifdef _DEBUG
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST m_bCONVERT_TO_SRGB = true;
// defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH #endif
// ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW }
// defined $HDRTYPE && defined $HDRENABLED && !$HDRTYPE && $HDRENABLED void SetCONVERT_TO_SRGB( bool i )
// defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA {
// defined $LIGHTING_PREVIEW && defined $HDRTYPE && $LIGHTING_PREVIEW && $HDRTYPE != 0 m_nCONVERT_TO_SRGB = i ? 1 : 0;
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT #ifdef _DEBUG
// defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST m_bCONVERT_TO_SRGB = true;
// defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH #endif
// ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW }
private:
#ifndef SKIN_PS30_H int m_nCUBEMAP;
#define SKIN_PS30_H #ifdef _DEBUG
bool m_bCUBEMAP;
#include "shaderapi/ishaderapi.h" #endif
#include "shaderapi/ishadershadow.h" public:
#include "materialsystem/imaterialvar.h" void SetCUBEMAP( int i )
{
class skin_ps30_Static_Index Assert( i >= 0 && i <= 1 );
{ m_nCUBEMAP = i;
unsigned int m_nCONVERT_TO_SRGB : 1; #ifdef _DEBUG
unsigned int m_nCUBEMAP : 2; m_bCUBEMAP = true;
unsigned int m_nSELFILLUM : 2; #endif
unsigned int m_nSELFILLUMFRESNEL : 2; }
unsigned int m_nFLASHLIGHT : 2; void SetCUBEMAP( bool i )
unsigned int m_nLIGHTWARPTEXTURE : 2; {
unsigned int m_nPHONGWARPTEXTURE : 2; m_nCUBEMAP = i ? 1 : 0;
unsigned int m_nWRINKLEMAP : 2; #ifdef _DEBUG
unsigned int m_nDETAIL_BLEND_MODE : 3; m_bCUBEMAP = true;
unsigned int m_nDETAILTEXTURE : 2; #endif
unsigned int m_nRIMLIGHT : 2; }
unsigned int m_nFLASHLIGHTDEPTHFILTERMODE : 2; private:
unsigned int m_nFASTPATH_NOBUMP : 2; int m_nSELFILLUM;
unsigned int m_nBLENDTINTBYBASEALPHA : 2; #ifdef _DEBUG
#ifdef _DEBUG bool m_bSELFILLUM;
bool m_bCONVERT_TO_SRGB : 1; #endif
bool m_bCUBEMAP : 1; public:
bool m_bSELFILLUM : 1; void SetSELFILLUM( int i )
bool m_bSELFILLUMFRESNEL : 1; {
bool m_bFLASHLIGHT : 1; Assert( i >= 0 && i <= 1 );
bool m_bLIGHTWARPTEXTURE : 1; m_nSELFILLUM = i;
bool m_bPHONGWARPTEXTURE : 1; #ifdef _DEBUG
bool m_bWRINKLEMAP : 1; m_bSELFILLUM = true;
bool m_bDETAIL_BLEND_MODE : 1; #endif
bool m_bDETAILTEXTURE : 1; }
bool m_bRIMLIGHT : 1; void SetSELFILLUM( bool i )
bool m_bFLASHLIGHTDEPTHFILTERMODE : 1; {
bool m_bFASTPATH_NOBUMP : 1; m_nSELFILLUM = i ? 1 : 0;
bool m_bBLENDTINTBYBASEALPHA : 1; #ifdef _DEBUG
#endif // _DEBUG m_bSELFILLUM = true;
public: #endif
void SetCONVERT_TO_SRGB( int i ) }
{ private:
Assert( i >= 0 && i <= 0 ); int m_nSELFILLUMFRESNEL;
m_nCONVERT_TO_SRGB = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bSELFILLUMFRESNEL;
m_bCONVERT_TO_SRGB = true; #endif
#endif // _DEBUG public:
} void SetSELFILLUMFRESNEL( int i )
{
void SetCUBEMAP( int i ) Assert( i >= 0 && i <= 1 );
{ m_nSELFILLUMFRESNEL = i;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nCUBEMAP = i; m_bSELFILLUMFRESNEL = true;
#ifdef _DEBUG #endif
m_bCUBEMAP = true; }
#endif // _DEBUG void SetSELFILLUMFRESNEL( bool i )
} {
m_nSELFILLUMFRESNEL = i ? 1 : 0;
void SetSELFILLUM( int i ) #ifdef _DEBUG
{ m_bSELFILLUMFRESNEL = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nSELFILLUM = i; }
#ifdef _DEBUG private:
m_bSELFILLUM = true; int m_nFLASHLIGHT;
#endif // _DEBUG #ifdef _DEBUG
} bool m_bFLASHLIGHT;
#endif
void SetSELFILLUMFRESNEL( int i ) public:
{ void SetFLASHLIGHT( int i )
Assert( i >= 0 && i <= 1 ); {
m_nSELFILLUMFRESNEL = i; Assert( i >= 0 && i <= 1 );
#ifdef _DEBUG m_nFLASHLIGHT = i;
m_bSELFILLUMFRESNEL = true; #ifdef _DEBUG
#endif // _DEBUG m_bFLASHLIGHT = true;
} #endif
}
void SetFLASHLIGHT( int i ) void SetFLASHLIGHT( bool i )
{ {
Assert( i >= 0 && i <= 1 ); m_nFLASHLIGHT = i ? 1 : 0;
m_nFLASHLIGHT = i; #ifdef _DEBUG
#ifdef _DEBUG m_bFLASHLIGHT = true;
m_bFLASHLIGHT = true; #endif
#endif // _DEBUG }
} private:
int m_nLIGHTWARPTEXTURE;
void SetLIGHTWARPTEXTURE( int i ) #ifdef _DEBUG
{ bool m_bLIGHTWARPTEXTURE;
Assert( i >= 0 && i <= 1 ); #endif
m_nLIGHTWARPTEXTURE = i; public:
#ifdef _DEBUG void SetLIGHTWARPTEXTURE( int i )
m_bLIGHTWARPTEXTURE = true; {
#endif // _DEBUG Assert( i >= 0 && i <= 1 );
} m_nLIGHTWARPTEXTURE = i;
#ifdef _DEBUG
void SetPHONGWARPTEXTURE( int i ) m_bLIGHTWARPTEXTURE = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nPHONGWARPTEXTURE = i; void SetLIGHTWARPTEXTURE( bool i )
#ifdef _DEBUG {
m_bPHONGWARPTEXTURE = true; m_nLIGHTWARPTEXTURE = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bLIGHTWARPTEXTURE = true;
#endif
void SetWRINKLEMAP( int i ) }
{ private:
Assert( i >= 0 && i <= 1 ); int m_nPHONGWARPTEXTURE;
m_nWRINKLEMAP = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bPHONGWARPTEXTURE;
m_bWRINKLEMAP = true; #endif
#endif // _DEBUG public:
} void SetPHONGWARPTEXTURE( int i )
{
void SetDETAIL_BLEND_MODE( int i ) Assert( i >= 0 && i <= 1 );
{ m_nPHONGWARPTEXTURE = i;
Assert( i >= 0 && i <= 6 ); #ifdef _DEBUG
m_nDETAIL_BLEND_MODE = i; m_bPHONGWARPTEXTURE = true;
#ifdef _DEBUG #endif
m_bDETAIL_BLEND_MODE = true; }
#endif // _DEBUG void SetPHONGWARPTEXTURE( bool i )
} {
m_nPHONGWARPTEXTURE = i ? 1 : 0;
void SetDETAILTEXTURE( int i ) #ifdef _DEBUG
{ m_bPHONGWARPTEXTURE = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nDETAILTEXTURE = i; }
#ifdef _DEBUG private:
m_bDETAILTEXTURE = true; int m_nWRINKLEMAP;
#endif // _DEBUG #ifdef _DEBUG
} bool m_bWRINKLEMAP;
#endif
void SetRIMLIGHT( int i ) public:
{ void SetWRINKLEMAP( int i )
Assert( i >= 0 && i <= 1 ); {
m_nRIMLIGHT = i; Assert( i >= 0 && i <= 1 );
#ifdef _DEBUG m_nWRINKLEMAP = i;
m_bRIMLIGHT = true; #ifdef _DEBUG
#endif // _DEBUG m_bWRINKLEMAP = true;
} #endif
}
void SetFLASHLIGHTDEPTHFILTERMODE( int i ) void SetWRINKLEMAP( bool i )
{ {
Assert( i >= 0 && i <= 2 ); m_nWRINKLEMAP = i ? 1 : 0;
m_nFLASHLIGHTDEPTHFILTERMODE = i; #ifdef _DEBUG
#ifdef _DEBUG m_bWRINKLEMAP = true;
m_bFLASHLIGHTDEPTHFILTERMODE = true; #endif
#endif // _DEBUG }
} private:
int m_nDETAIL_BLEND_MODE;
void SetFASTPATH_NOBUMP( int i ) #ifdef _DEBUG
{ bool m_bDETAIL_BLEND_MODE;
Assert( i >= 0 && i <= 1 ); #endif
m_nFASTPATH_NOBUMP = i; public:
#ifdef _DEBUG void SetDETAIL_BLEND_MODE( int i )
m_bFASTPATH_NOBUMP = true; {
#endif // _DEBUG Assert( i >= 0 && i <= 6 );
} m_nDETAIL_BLEND_MODE = i;
#ifdef _DEBUG
void SetBLENDTINTBYBASEALPHA( int i ) m_bDETAIL_BLEND_MODE = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nBLENDTINTBYBASEALPHA = i; void SetDETAIL_BLEND_MODE( bool i )
#ifdef _DEBUG {
m_bBLENDTINTBYBASEALPHA = true; m_nDETAIL_BLEND_MODE = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bDETAIL_BLEND_MODE = true;
#endif
skin_ps30_Static_Index() }
{ private:
m_nCONVERT_TO_SRGB = 0; int m_nDETAILTEXTURE;
m_nCUBEMAP = 0; #ifdef _DEBUG
m_nSELFILLUM = 0; bool m_bDETAILTEXTURE;
m_nSELFILLUMFRESNEL = 0; #endif
m_nFLASHLIGHT = 0; public:
m_nLIGHTWARPTEXTURE = 0; void SetDETAILTEXTURE( int i )
m_nPHONGWARPTEXTURE = 0; {
m_nWRINKLEMAP = 0; Assert( i >= 0 && i <= 1 );
m_nDETAIL_BLEND_MODE = 0; m_nDETAILTEXTURE = i;
m_nDETAILTEXTURE = 0; #ifdef _DEBUG
m_nRIMLIGHT = 0; m_bDETAILTEXTURE = true;
m_nFLASHLIGHTDEPTHFILTERMODE = 0; #endif
m_nFASTPATH_NOBUMP = 0; }
m_nBLENDTINTBYBASEALPHA = 0; void SetDETAILTEXTURE( bool i )
#ifdef _DEBUG {
m_bCONVERT_TO_SRGB = false; m_nDETAILTEXTURE = i ? 1 : 0;
m_bCUBEMAP = false; #ifdef _DEBUG
m_bSELFILLUM = false; m_bDETAILTEXTURE = true;
m_bSELFILLUMFRESNEL = false; #endif
m_bFLASHLIGHT = false; }
m_bLIGHTWARPTEXTURE = false; private:
m_bPHONGWARPTEXTURE = false; int m_nRIMLIGHT;
m_bWRINKLEMAP = false; #ifdef _DEBUG
m_bDETAIL_BLEND_MODE = false; bool m_bRIMLIGHT;
m_bDETAILTEXTURE = false; #endif
m_bRIMLIGHT = false; public:
m_bFLASHLIGHTDEPTHFILTERMODE = false; void SetRIMLIGHT( int i )
m_bFASTPATH_NOBUMP = false; {
m_bBLENDTINTBYBASEALPHA = false; Assert( i >= 0 && i <= 1 );
#endif // _DEBUG m_nRIMLIGHT = i;
} #ifdef _DEBUG
m_bRIMLIGHT = true;
int GetIndex() const #endif
{ }
Assert( m_bCONVERT_TO_SRGB && m_bCUBEMAP && m_bSELFILLUM && m_bSELFILLUMFRESNEL && m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bPHONGWARPTEXTURE && m_bWRINKLEMAP && m_bDETAIL_BLEND_MODE && m_bDETAILTEXTURE && m_bRIMLIGHT && m_bFLASHLIGHTDEPTHFILTERMODE && m_bFASTPATH_NOBUMP && m_bBLENDTINTBYBASEALPHA ); void SetRIMLIGHT( bool i )
return ( 80 * m_nCONVERT_TO_SRGB ) + ( 80 * m_nCUBEMAP ) + ( 160 * m_nSELFILLUM ) + ( 320 * m_nSELFILLUMFRESNEL ) + ( 640 * m_nFLASHLIGHT ) + ( 1280 * m_nLIGHTWARPTEXTURE ) + ( 2560 * m_nPHONGWARPTEXTURE ) + ( 5120 * m_nWRINKLEMAP ) + ( 10240 * m_nDETAIL_BLEND_MODE ) + ( 71680 * m_nDETAILTEXTURE ) + ( 143360 * m_nRIMLIGHT ) + ( 286720 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 860160 * m_nFASTPATH_NOBUMP ) + ( 1720320 * m_nBLENDTINTBYBASEALPHA ) + 0; {
} m_nRIMLIGHT = i ? 1 : 0;
}; #ifdef _DEBUG
m_bRIMLIGHT = true;
#define shaderStaticTest_skin_ps30 psh_forgot_to_set_static_CONVERT_TO_SRGB + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_SELFILLUMFRESNEL + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_LIGHTWARPTEXTURE + psh_forgot_to_set_static_PHONGWARPTEXTURE + psh_forgot_to_set_static_WRINKLEMAP + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_RIMLIGHT + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_FASTPATH_NOBUMP + psh_forgot_to_set_static_BLENDTINTBYBASEALPHA #endif
}
private:
class skin_ps30_Dynamic_Index int m_nFLASHLIGHTDEPTHFILTERMODE;
{ #ifdef _DEBUG
unsigned int m_nWRITEWATERFOGTODESTALPHA : 2; bool m_bFLASHLIGHTDEPTHFILTERMODE;
unsigned int m_nPIXELFOGTYPE : 2; #endif
unsigned int m_nNUM_LIGHTS : 3; public:
unsigned int m_nWRITE_DEPTH_TO_DESTALPHA : 2; void SetFLASHLIGHTDEPTHFILTERMODE( int i )
unsigned int m_nFLASHLIGHTSHADOWS : 2; {
#ifdef _DEBUG Assert( i >= 0 && i <= 2 );
bool m_bWRITEWATERFOGTODESTALPHA : 1; m_nFLASHLIGHTDEPTHFILTERMODE = i;
bool m_bPIXELFOGTYPE : 1; #ifdef _DEBUG
bool m_bNUM_LIGHTS : 1; m_bFLASHLIGHTDEPTHFILTERMODE = true;
bool m_bWRITE_DEPTH_TO_DESTALPHA : 1; #endif
bool m_bFLASHLIGHTSHADOWS : 1; }
#endif // _DEBUG void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
public: {
void SetWRITEWATERFOGTODESTALPHA( int i ) m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); m_bFLASHLIGHTDEPTHFILTERMODE = true;
m_nWRITEWATERFOGTODESTALPHA = i; #endif
#ifdef _DEBUG }
m_bWRITEWATERFOGTODESTALPHA = true; private:
#endif // _DEBUG int m_nFASTPATH_NOBUMP;
} #ifdef _DEBUG
bool m_bFASTPATH_NOBUMP;
void SetPIXELFOGTYPE( int i ) #endif
{ public:
Assert( i >= 0 && i <= 1 ); void SetFASTPATH_NOBUMP( int i )
m_nPIXELFOGTYPE = i; {
#ifdef _DEBUG Assert( i >= 0 && i <= 1 );
m_bPIXELFOGTYPE = true; m_nFASTPATH_NOBUMP = i;
#endif // _DEBUG #ifdef _DEBUG
} m_bFASTPATH_NOBUMP = true;
#endif
void SetNUM_LIGHTS( int i ) }
{ void SetFASTPATH_NOBUMP( bool i )
Assert( i >= 0 && i <= 4 ); {
m_nNUM_LIGHTS = i; m_nFASTPATH_NOBUMP = i ? 1 : 0;
#ifdef _DEBUG #ifdef _DEBUG
m_bNUM_LIGHTS = true; m_bFASTPATH_NOBUMP = true;
#endif // _DEBUG #endif
} }
private:
void SetWRITE_DEPTH_TO_DESTALPHA( int i ) int m_nBLENDTINTBYBASEALPHA;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); bool m_bBLENDTINTBYBASEALPHA;
m_nWRITE_DEPTH_TO_DESTALPHA = i; #endif
#ifdef _DEBUG public:
m_bWRITE_DEPTH_TO_DESTALPHA = true; void SetBLENDTINTBYBASEALPHA( int i )
#endif // _DEBUG {
} Assert( i >= 0 && i <= 1 );
m_nBLENDTINTBYBASEALPHA = i;
void SetFLASHLIGHTSHADOWS( int i ) #ifdef _DEBUG
{ m_bBLENDTINTBYBASEALPHA = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nFLASHLIGHTSHADOWS = i; }
#ifdef _DEBUG void SetBLENDTINTBYBASEALPHA( bool i )
m_bFLASHLIGHTSHADOWS = true; {
#endif // _DEBUG m_nBLENDTINTBYBASEALPHA = i ? 1 : 0;
} #ifdef _DEBUG
m_bBLENDTINTBYBASEALPHA = true;
skin_ps30_Dynamic_Index() #endif
{ }
m_nWRITEWATERFOGTODESTALPHA = 0; public:
m_nPIXELFOGTYPE = 0; skin_ps30_Static_Index( )
m_nNUM_LIGHTS = 0; {
m_nWRITE_DEPTH_TO_DESTALPHA = 0; #ifdef _DEBUG
m_nFLASHLIGHTSHADOWS = 0; m_bCONVERT_TO_SRGB = false;
#ifdef _DEBUG #endif // _DEBUG
m_bWRITEWATERFOGTODESTALPHA = false; m_nCONVERT_TO_SRGB = 0;
m_bPIXELFOGTYPE = false; #ifdef _DEBUG
m_bNUM_LIGHTS = false; m_bCUBEMAP = false;
m_bWRITE_DEPTH_TO_DESTALPHA = false; #endif // _DEBUG
m_bFLASHLIGHTSHADOWS = false; m_nCUBEMAP = 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bSELFILLUM = false;
#endif // _DEBUG
int GetIndex() const m_nSELFILLUM = 0;
{ #ifdef _DEBUG
Assert( m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bNUM_LIGHTS && m_bWRITE_DEPTH_TO_DESTALPHA && m_bFLASHLIGHTSHADOWS ); m_bSELFILLUMFRESNEL = false;
return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nNUM_LIGHTS ) + ( 20 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 40 * m_nFLASHLIGHTSHADOWS ) + 0; #endif // _DEBUG
} m_nSELFILLUMFRESNEL = 0;
}; #ifdef _DEBUG
m_bFLASHLIGHT = false;
#define shaderDynamicTest_skin_ps30 psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS #endif // _DEBUG
m_nFLASHLIGHT = 0;
#ifdef _DEBUG
#endif // SKIN_PS30_H m_bLIGHTWARPTEXTURE = false;
#endif // _DEBUG
m_nLIGHTWARPTEXTURE = 0;
#ifdef _DEBUG
m_bPHONGWARPTEXTURE = false;
#endif // _DEBUG
m_nPHONGWARPTEXTURE = 0;
#ifdef _DEBUG
m_bWRINKLEMAP = false;
#endif // _DEBUG
m_nWRINKLEMAP = 0;
#ifdef _DEBUG
m_bDETAIL_BLEND_MODE = false;
#endif // _DEBUG
m_nDETAIL_BLEND_MODE = 0;
#ifdef _DEBUG
m_bDETAILTEXTURE = false;
#endif // _DEBUG
m_nDETAILTEXTURE = 0;
#ifdef _DEBUG
m_bRIMLIGHT = false;
#endif // _DEBUG
m_nRIMLIGHT = 0;
#ifdef _DEBUG
m_bFLASHLIGHTDEPTHFILTERMODE = false;
#endif // _DEBUG
m_nFLASHLIGHTDEPTHFILTERMODE = 0;
#ifdef _DEBUG
m_bFASTPATH_NOBUMP = false;
#endif // _DEBUG
m_nFASTPATH_NOBUMP = 0;
#ifdef _DEBUG
m_bBLENDTINTBYBASEALPHA = false;
#endif // _DEBUG
m_nBLENDTINTBYBASEALPHA = 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_bCONVERT_TO_SRGB && m_bCUBEMAP && m_bSELFILLUM && m_bSELFILLUMFRESNEL && m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bPHONGWARPTEXTURE && m_bWRINKLEMAP && m_bDETAIL_BLEND_MODE && m_bDETAILTEXTURE && m_bRIMLIGHT && m_bFLASHLIGHTDEPTHFILTERMODE && m_bFASTPATH_NOBUMP && m_bBLENDTINTBYBASEALPHA;
Assert( bAllStaticVarsDefined );
#endif // _DEBUG
return ( 160 * m_nCONVERT_TO_SRGB ) + ( 160 * m_nCUBEMAP ) + ( 320 * m_nSELFILLUM ) + ( 640 * m_nSELFILLUMFRESNEL ) + ( 1280 * m_nFLASHLIGHT ) + ( 2560 * m_nLIGHTWARPTEXTURE ) + ( 5120 * m_nPHONGWARPTEXTURE ) + ( 10240 * m_nWRINKLEMAP ) + ( 20480 * m_nDETAIL_BLEND_MODE ) + ( 143360 * m_nDETAILTEXTURE ) + ( 286720 * m_nRIMLIGHT ) + ( 573440 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 1720320 * m_nFASTPATH_NOBUMP ) + ( 3440640 * m_nBLENDTINTBYBASEALPHA ) + 0;
}
};
#define shaderStaticTest_skin_ps30 psh_forgot_to_set_static_CONVERT_TO_SRGB + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_SELFILLUMFRESNEL + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_LIGHTWARPTEXTURE + psh_forgot_to_set_static_PHONGWARPTEXTURE + psh_forgot_to_set_static_WRINKLEMAP + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_RIMLIGHT + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_FASTPATH_NOBUMP + psh_forgot_to_set_static_BLENDTINTBYBASEALPHA + 0
class skin_ps30_Dynamic_Index
{
private:
int m_nWRITEWATERFOGTODESTALPHA;
#ifdef _DEBUG
bool m_bWRITEWATERFOGTODESTALPHA;
#endif
public:
void SetWRITEWATERFOGTODESTALPHA( int i )
{
Assert( i >= 0 && i <= 1 );
m_nWRITEWATERFOGTODESTALPHA = i;
#ifdef _DEBUG
m_bWRITEWATERFOGTODESTALPHA = true;
#endif
}
void SetWRITEWATERFOGTODESTALPHA( bool i )
{
m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
#ifdef _DEBUG
m_bWRITEWATERFOGTODESTALPHA = true;
#endif
}
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
}
private:
int m_nNUM_LIGHTS;
#ifdef _DEBUG
bool m_bNUM_LIGHTS;
#endif
public:
void SetNUM_LIGHTS( int i )
{
Assert( i >= 0 && i <= 4 );
m_nNUM_LIGHTS = i;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
void SetNUM_LIGHTS( bool i )
{
m_nNUM_LIGHTS = i ? 1 : 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
private:
int m_nWRITE_DEPTH_TO_DESTALPHA;
#ifdef _DEBUG
bool m_bWRITE_DEPTH_TO_DESTALPHA;
#endif
public:
void SetWRITE_DEPTH_TO_DESTALPHA( int i )
{
Assert( i >= 0 && i <= 1 );
m_nWRITE_DEPTH_TO_DESTALPHA = i;
#ifdef _DEBUG
m_bWRITE_DEPTH_TO_DESTALPHA = true;
#endif
}
void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
{
m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
#ifdef _DEBUG
m_bWRITE_DEPTH_TO_DESTALPHA = true;
#endif
}
private:
int m_nFLASHLIGHTSHADOWS;
#ifdef _DEBUG
bool m_bFLASHLIGHTSHADOWS;
#endif
public:
void SetFLASHLIGHTSHADOWS( int i )
{
Assert( i >= 0 && i <= 1 );
m_nFLASHLIGHTSHADOWS = i;
#ifdef _DEBUG
m_bFLASHLIGHTSHADOWS = true;
#endif
}
void SetFLASHLIGHTSHADOWS( bool i )
{
m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
#ifdef _DEBUG
m_bFLASHLIGHTSHADOWS = true;
#endif
}
private:
int m_nPHONG_USE_EXPONENT_FACTOR;
#ifdef _DEBUG
bool m_bPHONG_USE_EXPONENT_FACTOR;
#endif
public:
void SetPHONG_USE_EXPONENT_FACTOR( int i )
{
Assert( i >= 0 && i <= 1 );
m_nPHONG_USE_EXPONENT_FACTOR = i;
#ifdef _DEBUG
m_bPHONG_USE_EXPONENT_FACTOR = true;
#endif
}
void SetPHONG_USE_EXPONENT_FACTOR( bool i )
{
m_nPHONG_USE_EXPONENT_FACTOR = i ? 1 : 0;
#ifdef _DEBUG
m_bPHONG_USE_EXPONENT_FACTOR = true;
#endif
}
public:
skin_ps30_Dynamic_Index()
{
#ifdef _DEBUG
m_bWRITEWATERFOGTODESTALPHA = false;
#endif // _DEBUG
m_nWRITEWATERFOGTODESTALPHA = 0;
#ifdef _DEBUG
m_bPIXELFOGTYPE = false;
#endif // _DEBUG
m_nPIXELFOGTYPE = 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = false;
#endif // _DEBUG
m_nNUM_LIGHTS = 0;
#ifdef _DEBUG
m_bWRITE_DEPTH_TO_DESTALPHA = false;
#endif // _DEBUG
m_nWRITE_DEPTH_TO_DESTALPHA = 0;
#ifdef _DEBUG
m_bFLASHLIGHTSHADOWS = false;
#endif // _DEBUG
m_nFLASHLIGHTSHADOWS = 0;
#ifdef _DEBUG
m_bPHONG_USE_EXPONENT_FACTOR = false;
#endif // _DEBUG
m_nPHONG_USE_EXPONENT_FACTOR = 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_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bNUM_LIGHTS && m_bWRITE_DEPTH_TO_DESTALPHA && m_bFLASHLIGHTSHADOWS && m_bPHONG_USE_EXPONENT_FACTOR;
Assert( bAllDynamicVarsDefined );
#endif // _DEBUG
return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nNUM_LIGHTS ) + ( 20 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 40 * m_nFLASHLIGHTSHADOWS ) + ( 80 * m_nPHONG_USE_EXPONENT_FACTOR ) + 0;
}
};
#define shaderDynamicTest_skin_ps30 psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + psh_forgot_to_set_dynamic_PHONG_USE_EXPONENT_FACTOR + 0

View file

@ -1,132 +1,187 @@
// ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!! #include "shaderlib/cshader.h"
// $USE_STATIC_CONTROL_FLOW && ( $NUM_LIGHTS > 0 ) class skin_vs20_Static_Index
// defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH {
private:
#ifndef SKIN_VS20_H int m_nUSE_STATIC_CONTROL_FLOW;
#define SKIN_VS20_H #ifdef _DEBUG
bool m_bUSE_STATIC_CONTROL_FLOW;
#include "shaderapi/ishaderapi.h" #endif
#include "shaderapi/ishadershadow.h" public:
#include "materialsystem/imaterialvar.h" void SetUSE_STATIC_CONTROL_FLOW( int i )
{
class skin_vs20_Static_Index Assert( i >= 0 && i <= 1 );
{ m_nUSE_STATIC_CONTROL_FLOW = i;
unsigned int m_nUSE_STATIC_CONTROL_FLOW : 2; #ifdef _DEBUG
#ifdef _DEBUG m_bUSE_STATIC_CONTROL_FLOW = true;
bool m_bUSE_STATIC_CONTROL_FLOW : 1; #endif
#endif // _DEBUG }
public: void SetUSE_STATIC_CONTROL_FLOW( bool i )
void SetUSE_STATIC_CONTROL_FLOW( int i ) {
{ m_nUSE_STATIC_CONTROL_FLOW = i ? 1 : 0;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nUSE_STATIC_CONTROL_FLOW = i; m_bUSE_STATIC_CONTROL_FLOW = true;
#ifdef _DEBUG #endif
m_bUSE_STATIC_CONTROL_FLOW = true; }
#endif // _DEBUG public:
} skin_vs20_Static_Index( )
{
skin_vs20_Static_Index() #ifdef _DEBUG
{ m_bUSE_STATIC_CONTROL_FLOW = false;
m_nUSE_STATIC_CONTROL_FLOW = 0; #endif // _DEBUG
#ifdef _DEBUG m_nUSE_STATIC_CONTROL_FLOW = 0;
m_bUSE_STATIC_CONTROL_FLOW = false; }
#endif // _DEBUG int GetIndex()
} {
// Asserts to make sure that we aren't using any skipped combinations.
int GetIndex() const // Asserts to make sure that we are setting all of the combination vars.
{ #ifdef _DEBUG
Assert( m_bUSE_STATIC_CONTROL_FLOW ); bool bAllStaticVarsDefined = m_bUSE_STATIC_CONTROL_FLOW;
return ( 48 * m_nUSE_STATIC_CONTROL_FLOW ) + 0; Assert( bAllStaticVarsDefined );
} #endif // _DEBUG
}; return ( 48 * m_nUSE_STATIC_CONTROL_FLOW ) + 0;
}
#define shaderStaticTest_skin_vs20 vsh_forgot_to_set_static_USE_STATIC_CONTROL_FLOW };
#define shaderStaticTest_skin_vs20 vsh_forgot_to_set_static_USE_STATIC_CONTROL_FLOW + 0
class skin_vs20_Dynamic_Index
class skin_vs20_Dynamic_Index {
{ private:
unsigned int m_nCOMPRESSED_VERTS : 2; int m_nCOMPRESSED_VERTS;
unsigned int m_nDOWATERFOG : 2; #ifdef _DEBUG
unsigned int m_nSKINNING : 2; bool m_bCOMPRESSED_VERTS;
unsigned int m_nLIGHTING_PREVIEW : 2; #endif
unsigned int m_nNUM_LIGHTS : 2; public:
#ifdef _DEBUG void SetCOMPRESSED_VERTS( int i )
bool m_bCOMPRESSED_VERTS : 1; {
bool m_bDOWATERFOG : 1; Assert( i >= 0 && i <= 1 );
bool m_bSKINNING : 1; m_nCOMPRESSED_VERTS = i;
bool m_bLIGHTING_PREVIEW : 1; #ifdef _DEBUG
bool m_bNUM_LIGHTS : 1; m_bCOMPRESSED_VERTS = true;
#endif // _DEBUG #endif
public: }
void SetCOMPRESSED_VERTS( int i ) void SetCOMPRESSED_VERTS( bool i )
{ {
Assert( i >= 0 && i <= 1 ); m_nCOMPRESSED_VERTS = i ? 1 : 0;
m_nCOMPRESSED_VERTS = i; #ifdef _DEBUG
#ifdef _DEBUG m_bCOMPRESSED_VERTS = true;
m_bCOMPRESSED_VERTS = true; #endif
#endif // _DEBUG }
} private:
int m_nDOWATERFOG;
void SetDOWATERFOG( int i ) #ifdef _DEBUG
{ bool m_bDOWATERFOG;
Assert( i >= 0 && i <= 1 ); #endif
m_nDOWATERFOG = i; public:
#ifdef _DEBUG void SetDOWATERFOG( int i )
m_bDOWATERFOG = true; {
#endif // _DEBUG Assert( i >= 0 && i <= 1 );
} m_nDOWATERFOG = i;
#ifdef _DEBUG
void SetSKINNING( int i ) m_bDOWATERFOG = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nSKINNING = i; void SetDOWATERFOG( bool i )
#ifdef _DEBUG {
m_bSKINNING = true; m_nDOWATERFOG = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bDOWATERFOG = true;
#endif
void SetLIGHTING_PREVIEW( int i ) }
{ private:
Assert( i >= 0 && i <= 1 ); int m_nSKINNING;
m_nLIGHTING_PREVIEW = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bSKINNING;
m_bLIGHTING_PREVIEW = true; #endif
#endif // _DEBUG public:
} void SetSKINNING( int i )
{
void SetNUM_LIGHTS( int i ) Assert( i >= 0 && i <= 1 );
{ m_nSKINNING = i;
Assert( i >= 0 && i <= 2 ); #ifdef _DEBUG
m_nNUM_LIGHTS = i; m_bSKINNING = true;
#ifdef _DEBUG #endif
m_bNUM_LIGHTS = true; }
#endif // _DEBUG void SetSKINNING( bool i )
} {
m_nSKINNING = i ? 1 : 0;
skin_vs20_Dynamic_Index() #ifdef _DEBUG
{ m_bSKINNING = true;
m_nCOMPRESSED_VERTS = 0; #endif
m_nDOWATERFOG = 0; }
m_nSKINNING = 0; private:
m_nLIGHTING_PREVIEW = 0; int m_nLIGHTING_PREVIEW;
m_nNUM_LIGHTS = 0; #ifdef _DEBUG
#ifdef _DEBUG bool m_bLIGHTING_PREVIEW;
m_bCOMPRESSED_VERTS = false; #endif
m_bDOWATERFOG = false; public:
m_bSKINNING = false; void SetLIGHTING_PREVIEW( int i )
m_bLIGHTING_PREVIEW = false; {
m_bNUM_LIGHTS = false; Assert( i >= 0 && i <= 1 );
#endif // _DEBUG m_nLIGHTING_PREVIEW = i;
} #ifdef _DEBUG
m_bLIGHTING_PREVIEW = true;
int GetIndex() const #endif
{ }
Assert( m_bCOMPRESSED_VERTS && m_bDOWATERFOG && m_bSKINNING && m_bLIGHTING_PREVIEW && m_bNUM_LIGHTS ); void SetLIGHTING_PREVIEW( bool i )
return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDOWATERFOG ) + ( 4 * m_nSKINNING ) + ( 8 * m_nLIGHTING_PREVIEW ) + ( 16 * m_nNUM_LIGHTS ) + 0; {
} m_nLIGHTING_PREVIEW = i ? 1 : 0;
}; #ifdef _DEBUG
m_bLIGHTING_PREVIEW = true;
#define shaderDynamicTest_skin_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_DOWATERFOG + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_LIGHTING_PREVIEW + vsh_forgot_to_set_dynamic_NUM_LIGHTS #endif
}
private:
#endif // SKIN_VS20_H int m_nNUM_LIGHTS;
#ifdef _DEBUG
bool m_bNUM_LIGHTS;
#endif
public:
void SetNUM_LIGHTS( int i )
{
Assert( i >= 0 && i <= 2 );
m_nNUM_LIGHTS = i;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
void SetNUM_LIGHTS( bool i )
{
m_nNUM_LIGHTS = i ? 1 : 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = true;
#endif
}
public:
skin_vs20_Dynamic_Index()
{
#ifdef _DEBUG
m_bCOMPRESSED_VERTS = false;
#endif // _DEBUG
m_nCOMPRESSED_VERTS = 0;
#ifdef _DEBUG
m_bDOWATERFOG = false;
#endif // _DEBUG
m_nDOWATERFOG = 0;
#ifdef _DEBUG
m_bSKINNING = false;
#endif // _DEBUG
m_nSKINNING = 0;
#ifdef _DEBUG
m_bLIGHTING_PREVIEW = false;
#endif // _DEBUG
m_nLIGHTING_PREVIEW = 0;
#ifdef _DEBUG
m_bNUM_LIGHTS = false;
#endif // _DEBUG
m_nNUM_LIGHTS = 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_bCOMPRESSED_VERTS && m_bDOWATERFOG && m_bSKINNING && m_bLIGHTING_PREVIEW && m_bNUM_LIGHTS;
Assert( bAllDynamicVarsDefined );
#endif // _DEBUG
return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDOWATERFOG ) + ( 4 * m_nSKINNING ) + ( 8 * m_nLIGHTING_PREVIEW ) + ( 16 * m_nNUM_LIGHTS ) + 0;
}
};
#define shaderDynamicTest_skin_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_DOWATERFOG + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_LIGHTING_PREVIEW + vsh_forgot_to_set_dynamic_NUM_LIGHTS + 0

View file

@ -536,6 +536,27 @@ public:
m_bLIGHTING_PREVIEW = true; m_bLIGHTING_PREVIEW = true;
#endif #endif
} }
private:
int m_nSTATIC_LIGHT_LIGHTMAP;
#ifdef _DEBUG
bool m_bSTATIC_LIGHT_LIGHTMAP;
#endif
public:
void SetSTATIC_LIGHT_LIGHTMAP( int i )
{
Assert( i >= 0 && i <= 0 );
m_nSTATIC_LIGHT_LIGHTMAP = i;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = true;
#endif
}
void SetSTATIC_LIGHT_LIGHTMAP( bool i )
{
m_nSTATIC_LIGHT_LIGHTMAP = i ? 1 : 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = true;
#endif
}
public: public:
vertexlit_and_unlit_generic_ps20_Dynamic_Index() vertexlit_and_unlit_generic_ps20_Dynamic_Index()
{ {
@ -547,16 +568,20 @@ public:
m_bLIGHTING_PREVIEW = false; m_bLIGHTING_PREVIEW = false;
#endif // _DEBUG #endif // _DEBUG
m_nLIGHTING_PREVIEW = 0; m_nLIGHTING_PREVIEW = 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = false;
#endif // _DEBUG
m_nSTATIC_LIGHT_LIGHTMAP = 0;
} }
int GetIndex() int GetIndex()
{ {
// Asserts to make sure that we aren't using any skipped combinations. // 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. // Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG #ifdef _DEBUG
bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bLIGHTING_PREVIEW; // && m_bSTATIC_LIGHT_LIGHTMAP bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bLIGHTING_PREVIEW && m_bSTATIC_LIGHT_LIGHTMAP;
Assert( bAllDynamicVarsDefined ); Assert( bAllDynamicVarsDefined );
#endif // _DEBUG #endif // _DEBUG
return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nLIGHTING_PREVIEW ) + 0; return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nLIGHTING_PREVIEW ) + ( 6 * m_nSTATIC_LIGHT_LIGHTMAP ) + 0;
} }
}; };
#define shaderDynamicTest_vertexlit_and_unlit_generic_ps20 psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_LIGHTING_PREVIEW + 0 #define shaderDynamicTest_vertexlit_and_unlit_generic_ps20 psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_LIGHTING_PREVIEW + psh_forgot_to_set_dynamic_STATIC_LIGHT_LIGHTMAP + 0

View file

@ -1,263 +1,462 @@
// ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!! #include "shaderlib/cshader.h"
// ($SEPARATE_DETAIL_UVS) && ($SEAMLESS_DETAIL) class vertexlit_and_unlit_generic_vs30_Static_Index
// ($DONT_GAMMA_CONVERT_VERTEX_COLOR && ( ! $VERTEXCOLOR ) ) {
// defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH private:
int m_nVERTEXCOLOR;
#ifndef VERTEXLIT_AND_UNLIT_GENERIC_VS30_H #ifdef _DEBUG
#define VERTEXLIT_AND_UNLIT_GENERIC_VS30_H bool m_bVERTEXCOLOR;
#endif
#include "shaderapi/ishaderapi.h" public:
#include "shaderapi/ishadershadow.h" void SetVERTEXCOLOR( int i )
#include "materialsystem/imaterialvar.h" {
Assert( i >= 0 && i <= 1 );
class vertexlit_and_unlit_generic_vs30_Static_Index m_nVERTEXCOLOR = i;
{ #ifdef _DEBUG
unsigned int m_nVERTEXCOLOR : 2; m_bVERTEXCOLOR = true;
unsigned int m_nCUBEMAP : 2; #endif
unsigned int m_nHALFLAMBERT : 2; }
unsigned int m_nFLASHLIGHT : 2; void SetVERTEXCOLOR( bool i )
unsigned int m_nSEAMLESS_BASE : 2; {
unsigned int m_nSEAMLESS_DETAIL : 2; m_nVERTEXCOLOR = i ? 1 : 0;
unsigned int m_nSEPARATE_DETAIL_UVS : 2; #ifdef _DEBUG
unsigned int m_nDECAL : 2; m_bVERTEXCOLOR = true;
unsigned int m_nDONT_GAMMA_CONVERT_VERTEX_COLOR : 2; #endif
#ifdef _DEBUG }
bool m_bVERTEXCOLOR : 1; private:
bool m_bCUBEMAP : 1; int m_nCUBEMAP;
bool m_bHALFLAMBERT : 1; #ifdef _DEBUG
bool m_bFLASHLIGHT : 1; bool m_bCUBEMAP;
bool m_bSEAMLESS_BASE : 1; #endif
bool m_bSEAMLESS_DETAIL : 1; public:
bool m_bSEPARATE_DETAIL_UVS : 1; void SetCUBEMAP( int i )
bool m_bDECAL : 1; {
bool m_bDONT_GAMMA_CONVERT_VERTEX_COLOR : 1; Assert( i >= 0 && i <= 1 );
#endif // _DEBUG m_nCUBEMAP = i;
public: #ifdef _DEBUG
void SetVERTEXCOLOR( int i ) m_bCUBEMAP = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nVERTEXCOLOR = i; void SetCUBEMAP( bool i )
#ifdef _DEBUG {
m_bVERTEXCOLOR = true; m_nCUBEMAP = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bCUBEMAP = true;
#endif
void SetCUBEMAP( int i ) }
{ private:
Assert( i >= 0 && i <= 1 ); int m_nHALFLAMBERT;
m_nCUBEMAP = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bHALFLAMBERT;
m_bCUBEMAP = true; #endif
#endif // _DEBUG public:
} void SetHALFLAMBERT( int i )
{
void SetHALFLAMBERT( int i ) Assert( i >= 0 && i <= 1 );
{ m_nHALFLAMBERT = i;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nHALFLAMBERT = i; m_bHALFLAMBERT = true;
#ifdef _DEBUG #endif
m_bHALFLAMBERT = true; }
#endif // _DEBUG void SetHALFLAMBERT( bool i )
} {
m_nHALFLAMBERT = i ? 1 : 0;
void SetFLASHLIGHT( int i ) #ifdef _DEBUG
{ m_bHALFLAMBERT = true;
Assert( i >= 0 && i <= 1 ); #endif
m_nFLASHLIGHT = i; }
#ifdef _DEBUG private:
m_bFLASHLIGHT = true; int m_nFLASHLIGHT;
#endif // _DEBUG #ifdef _DEBUG
} bool m_bFLASHLIGHT;
#endif
void SetSEAMLESS_BASE( int i ) public:
{ void SetFLASHLIGHT( int i )
Assert( i >= 0 && i <= 1 ); {
m_nSEAMLESS_BASE = i; Assert( i >= 0 && i <= 1 );
#ifdef _DEBUG m_nFLASHLIGHT = i;
m_bSEAMLESS_BASE = true; #ifdef _DEBUG
#endif // _DEBUG m_bFLASHLIGHT = true;
} #endif
}
void SetSEAMLESS_DETAIL( int i ) void SetFLASHLIGHT( bool i )
{ {
Assert( i >= 0 && i <= 1 ); m_nFLASHLIGHT = i ? 1 : 0;
m_nSEAMLESS_DETAIL = i; #ifdef _DEBUG
#ifdef _DEBUG m_bFLASHLIGHT = true;
m_bSEAMLESS_DETAIL = true; #endif
#endif // _DEBUG }
} private:
int m_nSEAMLESS_BASE;
void SetSEPARATE_DETAIL_UVS( int i ) #ifdef _DEBUG
{ bool m_bSEAMLESS_BASE;
Assert( i >= 0 && i <= 1 ); #endif
m_nSEPARATE_DETAIL_UVS = i; public:
#ifdef _DEBUG void SetSEAMLESS_BASE( int i )
m_bSEPARATE_DETAIL_UVS = true; {
#endif // _DEBUG Assert( i >= 0 && i <= 1 );
} m_nSEAMLESS_BASE = i;
#ifdef _DEBUG
void SetDECAL( int i ) m_bSEAMLESS_BASE = true;
{ #endif
Assert( i >= 0 && i <= 1 ); }
m_nDECAL = i; void SetSEAMLESS_BASE( bool i )
#ifdef _DEBUG {
m_bDECAL = true; m_nSEAMLESS_BASE = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bSEAMLESS_BASE = true;
#endif
void SetDONT_GAMMA_CONVERT_VERTEX_COLOR( int i ) }
{ private:
Assert( i >= 0 && i <= 1 ); int m_nSEAMLESS_DETAIL;
m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = i; #ifdef _DEBUG
#ifdef _DEBUG bool m_bSEAMLESS_DETAIL;
m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = true; #endif
#endif // _DEBUG public:
} void SetSEAMLESS_DETAIL( int i )
{
vertexlit_and_unlit_generic_vs30_Static_Index() Assert( i >= 0 && i <= 1 );
{ m_nSEAMLESS_DETAIL = i;
m_nVERTEXCOLOR = 0; #ifdef _DEBUG
m_nCUBEMAP = 0; m_bSEAMLESS_DETAIL = true;
m_nHALFLAMBERT = 0; #endif
m_nFLASHLIGHT = 0; }
m_nSEAMLESS_BASE = 0; void SetSEAMLESS_DETAIL( bool i )
m_nSEAMLESS_DETAIL = 0; {
m_nSEPARATE_DETAIL_UVS = 0; m_nSEAMLESS_DETAIL = i ? 1 : 0;
m_nDECAL = 0; #ifdef _DEBUG
m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = 0; m_bSEAMLESS_DETAIL = true;
#ifdef _DEBUG #endif
m_bVERTEXCOLOR = false; }
m_bCUBEMAP = false; private:
m_bHALFLAMBERT = false; int m_nSEPARATE_DETAIL_UVS;
m_bFLASHLIGHT = false; #ifdef _DEBUG
m_bSEAMLESS_BASE = false; bool m_bSEPARATE_DETAIL_UVS;
m_bSEAMLESS_DETAIL = false; #endif
m_bSEPARATE_DETAIL_UVS = false; public:
m_bDECAL = false; void SetSEPARATE_DETAIL_UVS( int i )
m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = false; {
#endif // _DEBUG Assert( i >= 0 && i <= 1 );
} m_nSEPARATE_DETAIL_UVS = i;
#ifdef _DEBUG
int GetIndex() const m_bSEPARATE_DETAIL_UVS = true;
{ #endif
Assert( m_bVERTEXCOLOR && m_bCUBEMAP && m_bHALFLAMBERT && m_bFLASHLIGHT && m_bSEAMLESS_BASE && m_bSEAMLESS_DETAIL && m_bSEPARATE_DETAIL_UVS && m_bDECAL && m_bDONT_GAMMA_CONVERT_VERTEX_COLOR ); }
return ( 128 * m_nVERTEXCOLOR ) + ( 256 * m_nCUBEMAP ) + ( 512 * m_nHALFLAMBERT ) + ( 1024 * m_nFLASHLIGHT ) + ( 2048 * m_nSEAMLESS_BASE ) + ( 4096 * m_nSEAMLESS_DETAIL ) + ( 8192 * m_nSEPARATE_DETAIL_UVS ) + ( 16384 * m_nDECAL ) + ( 32768 * m_nDONT_GAMMA_CONVERT_VERTEX_COLOR ) + 0; void SetSEPARATE_DETAIL_UVS( bool i )
} {
}; m_nSEPARATE_DETAIL_UVS = i ? 1 : 0;
#ifdef _DEBUG
#define shaderStaticTest_vertexlit_and_unlit_generic_vs30 vsh_forgot_to_set_static_VERTEXCOLOR + vsh_forgot_to_set_static_CUBEMAP + vsh_forgot_to_set_static_HALFLAMBERT + vsh_forgot_to_set_static_FLASHLIGHT + vsh_forgot_to_set_static_SEAMLESS_BASE + vsh_forgot_to_set_static_SEAMLESS_DETAIL + vsh_forgot_to_set_static_SEPARATE_DETAIL_UVS + vsh_forgot_to_set_static_DECAL + vsh_forgot_to_set_static_DONT_GAMMA_CONVERT_VERTEX_COLOR m_bSEPARATE_DETAIL_UVS = true;
#endif
}
class vertexlit_and_unlit_generic_vs30_Dynamic_Index private:
{ int m_nDECAL;
unsigned int m_nCOMPRESSED_VERTS : 2; #ifdef _DEBUG
unsigned int m_nDYNAMIC_LIGHT : 2; bool m_bDECAL;
unsigned int m_nSTATIC_LIGHT : 2; #endif
unsigned int m_nDOWATERFOG : 2; public:
unsigned int m_nSKINNING : 2; void SetDECAL( int i )
unsigned int m_nLIGHTING_PREVIEW : 2; {
unsigned int m_nMORPHING : 2; Assert( i >= 0 && i <= 1 );
#ifdef _DEBUG m_nDECAL = i;
bool m_bCOMPRESSED_VERTS : 1; #ifdef _DEBUG
bool m_bDYNAMIC_LIGHT : 1; m_bDECAL = true;
bool m_bSTATIC_LIGHT : 1; #endif
bool m_bDOWATERFOG : 1; }
bool m_bSKINNING : 1; void SetDECAL( bool i )
bool m_bLIGHTING_PREVIEW : 1; {
bool m_bMORPHING : 1; m_nDECAL = i ? 1 : 0;
#endif // _DEBUG #ifdef _DEBUG
public: m_bDECAL = true;
void SetCOMPRESSED_VERTS( int i ) #endif
{ }
Assert( i >= 0 && i <= 1 ); private:
m_nCOMPRESSED_VERTS = i; int m_nDONT_GAMMA_CONVERT_VERTEX_COLOR;
#ifdef _DEBUG #ifdef _DEBUG
m_bCOMPRESSED_VERTS = true; bool m_bDONT_GAMMA_CONVERT_VERTEX_COLOR;
#endif // _DEBUG #endif
} public:
void SetDONT_GAMMA_CONVERT_VERTEX_COLOR( int i )
void SetDYNAMIC_LIGHT( int i ) {
{ Assert( i >= 0 && i <= 1 );
Assert( i >= 0 && i <= 1 ); m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = i;
m_nDYNAMIC_LIGHT = i; #ifdef _DEBUG
#ifdef _DEBUG m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = true;
m_bDYNAMIC_LIGHT = true; #endif
#endif // _DEBUG }
} void SetDONT_GAMMA_CONVERT_VERTEX_COLOR( bool i )
{
void SetSTATIC_LIGHT( int i ) m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = i ? 1 : 0;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = true;
m_nSTATIC_LIGHT = i; #endif
#ifdef _DEBUG }
m_bSTATIC_LIGHT = true; public:
#endif // _DEBUG vertexlit_and_unlit_generic_vs30_Static_Index( )
} {
#ifdef _DEBUG
void SetDOWATERFOG( int i ) m_bVERTEXCOLOR = false;
{ #endif // _DEBUG
Assert( i >= 0 && i <= 1 ); m_nVERTEXCOLOR = 0;
m_nDOWATERFOG = i; #ifdef _DEBUG
#ifdef _DEBUG m_bCUBEMAP = false;
m_bDOWATERFOG = true; #endif // _DEBUG
#endif // _DEBUG m_nCUBEMAP = 0;
} #ifdef _DEBUG
m_bHALFLAMBERT = false;
void SetSKINNING( int i ) #endif // _DEBUG
{ m_nHALFLAMBERT = 0;
Assert( i >= 0 && i <= 1 ); #ifdef _DEBUG
m_nSKINNING = i; m_bFLASHLIGHT = false;
#ifdef _DEBUG #endif // _DEBUG
m_bSKINNING = true; m_nFLASHLIGHT = 0;
#endif // _DEBUG #ifdef _DEBUG
} m_bSEAMLESS_BASE = false;
#endif // _DEBUG
void SetLIGHTING_PREVIEW( int i ) m_nSEAMLESS_BASE = 0;
{ #ifdef _DEBUG
Assert( i >= 0 && i <= 1 ); m_bSEAMLESS_DETAIL = false;
m_nLIGHTING_PREVIEW = i; #endif // _DEBUG
#ifdef _DEBUG m_nSEAMLESS_DETAIL = 0;
m_bLIGHTING_PREVIEW = true; #ifdef _DEBUG
#endif // _DEBUG m_bSEPARATE_DETAIL_UVS = false;
} #endif // _DEBUG
m_nSEPARATE_DETAIL_UVS = 0;
void SetMORPHING( int i ) #ifdef _DEBUG
{ m_bDECAL = false;
Assert( i >= 0 && i <= 1 ); #endif // _DEBUG
m_nMORPHING = i; m_nDECAL = 0;
#ifdef _DEBUG #ifdef _DEBUG
m_bMORPHING = true; m_bDONT_GAMMA_CONVERT_VERTEX_COLOR = false;
#endif // _DEBUG #endif // _DEBUG
} m_nDONT_GAMMA_CONVERT_VERTEX_COLOR = 0;
}
vertexlit_and_unlit_generic_vs30_Dynamic_Index() int GetIndex()
{ {
m_nCOMPRESSED_VERTS = 0; // Asserts to make sure that we aren't using any skipped combinations.
m_nDYNAMIC_LIGHT = 0; // Asserts to make sure that we are setting all of the combination vars.
m_nSTATIC_LIGHT = 0; #ifdef _DEBUG
m_nDOWATERFOG = 0; bool bAllStaticVarsDefined = m_bVERTEXCOLOR && m_bCUBEMAP && m_bHALFLAMBERT && m_bFLASHLIGHT && m_bSEAMLESS_BASE && m_bSEAMLESS_DETAIL && m_bSEPARATE_DETAIL_UVS && m_bDECAL && m_bDONT_GAMMA_CONVERT_VERTEX_COLOR;
m_nSKINNING = 0; Assert( bAllStaticVarsDefined );
m_nLIGHTING_PREVIEW = 0; #endif // _DEBUG
m_nMORPHING = 0; return ( 256 * m_nVERTEXCOLOR ) + ( 512 * m_nCUBEMAP ) + ( 1024 * m_nHALFLAMBERT ) + ( 2048 * m_nFLASHLIGHT ) + ( 4096 * m_nSEAMLESS_BASE ) + ( 8192 * m_nSEAMLESS_DETAIL ) + ( 16384 * m_nSEPARATE_DETAIL_UVS ) + ( 32768 * m_nDECAL ) + ( 65536 * m_nDONT_GAMMA_CONVERT_VERTEX_COLOR ) + 0;
#ifdef _DEBUG }
m_bCOMPRESSED_VERTS = false; };
m_bDYNAMIC_LIGHT = false; #define shaderStaticTest_vertexlit_and_unlit_generic_vs30 vsh_forgot_to_set_static_VERTEXCOLOR + vsh_forgot_to_set_static_CUBEMAP + vsh_forgot_to_set_static_HALFLAMBERT + vsh_forgot_to_set_static_FLASHLIGHT + vsh_forgot_to_set_static_SEAMLESS_BASE + vsh_forgot_to_set_static_SEAMLESS_DETAIL + vsh_forgot_to_set_static_SEPARATE_DETAIL_UVS + vsh_forgot_to_set_static_DECAL + vsh_forgot_to_set_static_DONT_GAMMA_CONVERT_VERTEX_COLOR + 0
m_bSTATIC_LIGHT = false; class vertexlit_and_unlit_generic_vs30_Dynamic_Index
m_bDOWATERFOG = false; {
m_bSKINNING = false; private:
m_bLIGHTING_PREVIEW = false; int m_nCOMPRESSED_VERTS;
m_bMORPHING = false; #ifdef _DEBUG
#endif // _DEBUG bool m_bCOMPRESSED_VERTS;
} #endif
public:
int GetIndex() const void SetCOMPRESSED_VERTS( int i )
{ {
Assert( m_bCOMPRESSED_VERTS && m_bDYNAMIC_LIGHT && m_bSTATIC_LIGHT && m_bDOWATERFOG && m_bSKINNING && m_bLIGHTING_PREVIEW && m_bMORPHING ); Assert( i >= 0 && i <= 1 );
return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDYNAMIC_LIGHT ) + ( 4 * m_nSTATIC_LIGHT ) + ( 8 * m_nDOWATERFOG ) + ( 16 * m_nSKINNING ) + ( 32 * m_nLIGHTING_PREVIEW ) + ( 64 * m_nMORPHING ) + 0; m_nCOMPRESSED_VERTS = i;
} #ifdef _DEBUG
}; m_bCOMPRESSED_VERTS = true;
#endif
#define shaderDynamicTest_vertexlit_and_unlit_generic_vs30 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_DYNAMIC_LIGHT + vsh_forgot_to_set_dynamic_STATIC_LIGHT + vsh_forgot_to_set_dynamic_DOWATERFOG + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_LIGHTING_PREVIEW + vsh_forgot_to_set_dynamic_MORPHING }
void SetCOMPRESSED_VERTS( bool i )
{
#endif // VERTEXLIT_AND_UNLIT_GENERIC_VS30_H m_nCOMPRESSED_VERTS = i ? 1 : 0;
#ifdef _DEBUG
m_bCOMPRESSED_VERTS = true;
#endif
}
private:
int m_nDYNAMIC_LIGHT;
#ifdef _DEBUG
bool m_bDYNAMIC_LIGHT;
#endif
public:
void SetDYNAMIC_LIGHT( int i )
{
Assert( i >= 0 && i <= 1 );
m_nDYNAMIC_LIGHT = i;
#ifdef _DEBUG
m_bDYNAMIC_LIGHT = true;
#endif
}
void SetDYNAMIC_LIGHT( bool i )
{
m_nDYNAMIC_LIGHT = i ? 1 : 0;
#ifdef _DEBUG
m_bDYNAMIC_LIGHT = true;
#endif
}
private:
int m_nSTATIC_LIGHT_VERTEX;
#ifdef _DEBUG
bool m_bSTATIC_LIGHT_VERTEX;
#endif
public:
void SetSTATIC_LIGHT_VERTEX( int i )
{
Assert( i >= 0 && i <= 1 );
m_nSTATIC_LIGHT_VERTEX = i;
#ifdef _DEBUG
m_bSTATIC_LIGHT_VERTEX = true;
#endif
}
void SetSTATIC_LIGHT_VERTEX( bool i )
{
m_nSTATIC_LIGHT_VERTEX = i ? 1 : 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_VERTEX = true;
#endif
}
private:
int m_nSTATIC_LIGHT_LIGHTMAP;
#ifdef _DEBUG
bool m_bSTATIC_LIGHT_LIGHTMAP;
#endif
public:
void SetSTATIC_LIGHT_LIGHTMAP( int i )
{
Assert( i >= 0 && i <= 1 );
m_nSTATIC_LIGHT_LIGHTMAP = i;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = true;
#endif
}
void SetSTATIC_LIGHT_LIGHTMAP( bool i )
{
m_nSTATIC_LIGHT_LIGHTMAP = i ? 1 : 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = true;
#endif
}
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
}
private:
int m_nSKINNING;
#ifdef _DEBUG
bool m_bSKINNING;
#endif
public:
void SetSKINNING( int i )
{
Assert( i >= 0 && i <= 1 );
m_nSKINNING = i;
#ifdef _DEBUG
m_bSKINNING = true;
#endif
}
void SetSKINNING( bool i )
{
m_nSKINNING = i ? 1 : 0;
#ifdef _DEBUG
m_bSKINNING = true;
#endif
}
private:
int m_nLIGHTING_PREVIEW;
#ifdef _DEBUG
bool m_bLIGHTING_PREVIEW;
#endif
public:
void SetLIGHTING_PREVIEW( int i )
{
Assert( i >= 0 && i <= 1 );
m_nLIGHTING_PREVIEW = i;
#ifdef _DEBUG
m_bLIGHTING_PREVIEW = true;
#endif
}
void SetLIGHTING_PREVIEW( bool i )
{
m_nLIGHTING_PREVIEW = i ? 1 : 0;
#ifdef _DEBUG
m_bLIGHTING_PREVIEW = true;
#endif
}
private:
int m_nMORPHING;
#ifdef _DEBUG
bool m_bMORPHING;
#endif
public:
void SetMORPHING( int i )
{
Assert( i >= 0 && i <= 1 );
m_nMORPHING = i;
#ifdef _DEBUG
m_bMORPHING = true;
#endif
}
void SetMORPHING( bool i )
{
m_nMORPHING = i ? 1 : 0;
#ifdef _DEBUG
m_bMORPHING = true;
#endif
}
public:
vertexlit_and_unlit_generic_vs30_Dynamic_Index()
{
#ifdef _DEBUG
m_bCOMPRESSED_VERTS = false;
#endif // _DEBUG
m_nCOMPRESSED_VERTS = 0;
#ifdef _DEBUG
m_bDYNAMIC_LIGHT = false;
#endif // _DEBUG
m_nDYNAMIC_LIGHT = 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_VERTEX = false;
#endif // _DEBUG
m_nSTATIC_LIGHT_VERTEX = 0;
#ifdef _DEBUG
m_bSTATIC_LIGHT_LIGHTMAP = false;
#endif // _DEBUG
m_nSTATIC_LIGHT_LIGHTMAP = 0;
#ifdef _DEBUG
m_bDOWATERFOG = false;
#endif // _DEBUG
m_nDOWATERFOG = 0;
#ifdef _DEBUG
m_bSKINNING = false;
#endif // _DEBUG
m_nSKINNING = 0;
#ifdef _DEBUG
m_bLIGHTING_PREVIEW = false;
#endif // _DEBUG
m_nLIGHTING_PREVIEW = 0;
#ifdef _DEBUG
m_bMORPHING = false;
#endif // _DEBUG
m_nMORPHING = 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_bCOMPRESSED_VERTS && m_bDYNAMIC_LIGHT && m_bSTATIC_LIGHT_VERTEX && m_bSTATIC_LIGHT_LIGHTMAP && m_bDOWATERFOG && m_bSKINNING && m_bLIGHTING_PREVIEW && m_bMORPHING;
Assert( bAllDynamicVarsDefined );
#endif // _DEBUG
return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDYNAMIC_LIGHT ) + ( 4 * m_nSTATIC_LIGHT_VERTEX ) + ( 8 * m_nSTATIC_LIGHT_LIGHTMAP ) + ( 16 * m_nDOWATERFOG ) + ( 32 * m_nSKINNING ) + ( 64 * m_nLIGHTING_PREVIEW ) + ( 128 * m_nMORPHING ) + 0;
}
};
#define shaderDynamicTest_vertexlit_and_unlit_generic_vs30 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_DYNAMIC_LIGHT + vsh_forgot_to_set_dynamic_STATIC_LIGHT_VERTEX + vsh_forgot_to_set_dynamic_STATIC_LIGHT_LIGHTMAP + vsh_forgot_to_set_dynamic_DOWATERFOG + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_LIGHTING_PREVIEW + vsh_forgot_to_set_dynamic_MORPHING + 0

View file

@ -7,7 +7,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "BumpmappedEnvmap.inc" #include "bumpmappedenvmap.inc"
#include "lightmappedgeneric_vs11.inc" #include "lightmappedgeneric_vs11.inc"

View file

@ -7,8 +7,8 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "screenspaceeffect_vs11.inc" #include "ScreenSpaceEffect_vs11.inc"
#include "introscreenspaceeffect_ps11.inc" #include "IntroScreenSpaceEffect_ps11.inc"
DEFINE_FALLBACK_SHADER( IntroScreenSpaceEffect, IntroScreenSpaceEffect_dx80 ) DEFINE_FALLBACK_SHADER( IntroScreenSpaceEffect, IntroScreenSpaceEffect_dx80 )

View file

@ -8,7 +8,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "LightmappedGeneric_Decal.inc" #include "lightmappedgeneric_decal.inc"
#include "mathlib/bumpvects.h" #include "mathlib/bumpvects.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!

View file

@ -73,6 +73,12 @@ BEGIN_VS_SHADER( LightmappedGeneric,
SHADER_PARAM( OUTLINESTART1, SHADER_PARAM_TYPE_FLOAT, "0.0", "inner start value for outline") SHADER_PARAM( OUTLINESTART1, SHADER_PARAM_TYPE_FLOAT, "0.0", "inner start value for outline")
SHADER_PARAM( OUTLINEEND0, SHADER_PARAM_TYPE_FLOAT, "0.0", "inner end value for outline") SHADER_PARAM( OUTLINEEND0, SHADER_PARAM_TYPE_FLOAT, "0.0", "inner end value for outline")
SHADER_PARAM( OUTLINEEND1, SHADER_PARAM_TYPE_FLOAT, "0.0", "outer end value for outline") SHADER_PARAM( OUTLINEEND1, SHADER_PARAM_TYPE_FLOAT, "0.0", "outer end value for outline")
// Parallax cubemaps
SHADER_PARAM( ENVMAPPARALLAXENABLED, SHADER_PARAM_TYPE_BOOL, "0", "Enables parallax 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" )
END_SHADER_PARAMS END_SHADER_PARAMS
void SetupVars( LightmappedGeneric_DX9_Vars_t& info ) void SetupVars( LightmappedGeneric_DX9_Vars_t& info )
@ -134,6 +140,13 @@ END_SHADER_PARAMS
info.m_nOutlineStart1 = OUTLINESTART1; info.m_nOutlineStart1 = OUTLINESTART1;
info.m_nOutlineEnd0 = OUTLINEEND0; info.m_nOutlineEnd0 = OUTLINEEND0;
info.m_nOutlineEnd1 = OUTLINEEND1; info.m_nOutlineEnd1 = OUTLINEEND1;
// Parallax cubemaps
info.m_bEnableParallaxCubemaps = ENVMAPPARALLAXENABLED;
info.m_nEnvmapParallaxObb1 = ENVMAPPARALLAXOBB1;
info.m_nEnvmapParallaxObb2 = ENVMAPPARALLAXOBB2;
info.m_nEnvmapParallaxObb3 = ENVMAPPARALLAXOBB3;
info.m_nEnvmapOrigin = ENVMAPORIGIN;
} }
SHADER_FALLBACK SHADER_FALLBACK

View file

@ -14,6 +14,7 @@
#include "lightmappedgeneric_vs20.inc" #include "lightmappedgeneric_vs20.inc"
#include "lightmappedgeneric_ps20b.inc" #include "lightmappedgeneric_ps20b.inc"
#include "shaderlib/cshader.h"
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
ConVar mat_disable_lightwarp( "mat_disable_lightwarp", "0" ); ConVar mat_disable_lightwarp( "mat_disable_lightwarp", "0" );
@ -58,6 +59,13 @@ public:
void InitParamsLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, LightmappedGeneric_DX9_Vars_t &info ) void InitParamsLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, LightmappedGeneric_DX9_Vars_t &info )
{ {
// Parallax cubemaps
// Cubemap parallax correction requires all 4 lines (if the 2nd, 3rd, or 4th are undef, undef the first one (checking done on first var)
if ( info.m_bEnableParallaxCubemaps && !( params[info.m_nEnvmapParallaxObb2]->IsDefined() && params[info.m_nEnvmapParallaxObb3]->IsDefined() && params[info.m_nEnvmapOrigin]->IsDefined() ) )
{
params[info.m_nEnvmapParallaxObb1]->SetUndefined();
}
if ( g_pHardwareConfig->SupportsBorderColor() ) if ( g_pHardwareConfig->SupportsBorderColor() )
{ {
params[FLASHLIGHTTEXTURE]->SetStringValue( "effects/flashlight_border" ); params[FLASHLIGHTTEXTURE]->SetStringValue( "effects/flashlight_border" );
@ -313,6 +321,13 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
(info.m_nBlendModulateTexture != -1) && (info.m_nBlendModulateTexture != -1) &&
(params[info.m_nBlendModulateTexture]->IsTexture() ); (params[info.m_nBlendModulateTexture]->IsTexture() );
bool hasNormalMapAlphaEnvmapMask = IS_FLAG_SET( MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK ); bool hasNormalMapAlphaEnvmapMask = IS_FLAG_SET( MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK );
// Parallax cubemaps, enable only if explicit.
bool hasParallaxCorrection = info.m_bEnableParallaxCubemaps;
if ( hasParallaxCorrection )
{
hasParallaxCorrection = params[info.m_nEnvmapParallaxObb1]->IsDefined();
}
if ( hasFlashlight && !IsX360() ) if ( hasFlashlight && !IsX360() )
{ {
@ -547,34 +562,36 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
if ( g_pHardwareConfig->SupportsPixelShaders_2_b() ) if ( g_pHardwareConfig->SupportsPixelShaders_2_b() )
{ {
DECLARE_STATIC_PIXEL_SHADER( lightmappedgeneric_ps20b ); DECLARE_STATIC_PIXEL_SHADER_NEW( lightmappedgeneric_ps20b );
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURE2, hasBaseTexture2 ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASETEXTURE2, hasBaseTexture2 );
SET_STATIC_PIXEL_SHADER_COMBO( DETAILTEXTURE, hasDetailTexture ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( DETAILTEXTURE, hasDetailTexture );
SET_STATIC_PIXEL_SHADER_COMBO( BUMPMAP, bumpmap_variant ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( BUMPMAP, bumpmap_variant );
SET_STATIC_PIXEL_SHADER_COMBO( BUMPMAP2, hasBump2 ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( BUMPMAP2, hasBump2 );
SET_STATIC_PIXEL_SHADER_COMBO( BUMPMASK, hasBumpMask ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( BUMPMASK, hasBumpMask );
SET_STATIC_PIXEL_SHADER_COMBO( DIFFUSEBUMPMAP, hasDiffuseBumpmap ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( DIFFUSEBUMPMAP, hasDiffuseBumpmap );
SET_STATIC_PIXEL_SHADER_COMBO( CUBEMAP, hasEnvmap ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( CUBEMAP, hasEnvmap );
SET_STATIC_PIXEL_SHADER_COMBO( ENVMAPMASK, hasEnvmapMask ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( ENVMAPMASK, hasEnvmapMask );
SET_STATIC_PIXEL_SHADER_COMBO( BASEALPHAENVMAPMASK, hasBaseAlphaEnvmapMask ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASEALPHAENVMAPMASK, hasBaseAlphaEnvmapMask );
SET_STATIC_PIXEL_SHADER_COMBO( SELFILLUM, hasSelfIllum ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( SELFILLUM, hasSelfIllum );
SET_STATIC_PIXEL_SHADER_COMBO( NORMALMAPALPHAENVMAPMASK, hasNormalMapAlphaEnvmapMask ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( NORMALMAPALPHAENVMAPMASK, hasNormalMapAlphaEnvmapMask );
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURENOENVMAP, params[info.m_nBaseTextureNoEnvmap]->GetIntValue() ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASETEXTURENOENVMAP, params[info.m_nBaseTextureNoEnvmap]->GetIntValue() );
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURE2NOENVMAP, params[info.m_nBaseTexture2NoEnvmap]->GetIntValue() ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASETEXTURE2NOENVMAP, params[info.m_nBaseTexture2NoEnvmap]->GetIntValue() );
SET_STATIC_PIXEL_SHADER_COMBO( WARPLIGHTING, hasLightWarpTexture ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( WARPLIGHTING, hasLightWarpTexture );
SET_STATIC_PIXEL_SHADER_COMBO( FANCY_BLENDING, bHasBlendModulateTexture ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( FANCY_BLENDING, bHasBlendModulateTexture );
SET_STATIC_PIXEL_SHADER_COMBO( MASKEDBLENDING, bMaskedBlending); SET_STATIC_PIXEL_SHADER_NEW_COMBO( MASKEDBLENDING, bMaskedBlending);
SET_STATIC_PIXEL_SHADER_COMBO( RELIEF_MAPPING, bReliefMapping ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( RELIEF_MAPPING, bReliefMapping );
SET_STATIC_PIXEL_SHADER_COMBO( SEAMLESS, bSeamlessMapping ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( SEAMLESS, bSeamlessMapping );
SET_STATIC_PIXEL_SHADER_COMBO( OUTLINE, bHasOutline ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( OUTLINE, bHasOutline );
SET_STATIC_PIXEL_SHADER_COMBO( SOFTEDGES, bHasSoftEdges ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( SOFTEDGES, bHasSoftEdges );
SET_STATIC_PIXEL_SHADER_COMBO( DETAIL_BLEND_MODE, nDetailBlendMode ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( DETAIL_BLEND_MODE, nDetailBlendMode );
SET_STATIC_PIXEL_SHADER_COMBO( NORMAL_DECODE_MODE, (int) NORMAL_DECODE_NONE ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( NORMAL_DECODE_MODE, (int) NORMAL_DECODE_NONE );
SET_STATIC_PIXEL_SHADER_COMBO( NORMALMASK_DECODE_MODE, (int) NORMAL_DECODE_NONE ); SET_STATIC_PIXEL_SHADER_NEW_COMBO( NORMALMASK_DECODE_MODE, (int) NORMAL_DECODE_NONE );
#ifdef _X360 #ifdef _X360
SET_STATIC_PIXEL_SHADER_COMBO( FLASHLIGHT, hasFlashlight); SET_STATIC_PIXEL_SHADER_NEW_COMBO( FLASHLIGHT, hasFlashlight);
#endif #endif
SET_STATIC_PIXEL_SHADER( lightmappedgeneric_ps20b ); // Parallax cubemaps enabled for 2_0b and onwards
SET_STATIC_PIXEL_SHADER_NEW_COMBO( PARALLAXCORRECT, hasParallaxCorrection );
SET_STATIC_PIXEL_SHADER_NEW( lightmappedgeneric_ps20b );
} }
else else
{ {
@ -602,6 +619,7 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
SET_STATIC_PIXEL_SHADER_COMBO( NORMAL_DECODE_MODE, 0 ); // No normal compression with ps_2_0 (yikes!) SET_STATIC_PIXEL_SHADER_COMBO( NORMAL_DECODE_MODE, 0 ); // No normal compression with ps_2_0 (yikes!)
SET_STATIC_PIXEL_SHADER_COMBO( NORMALMASK_DECODE_MODE, 0 ); // No normal compression with ps_2_0 SET_STATIC_PIXEL_SHADER_COMBO( NORMALMASK_DECODE_MODE, 0 ); // No normal compression with ps_2_0
SET_STATIC_PIXEL_SHADER( lightmappedgeneric_ps20 ); SET_STATIC_PIXEL_SHADER( lightmappedgeneric_ps20 );
printf("sucks\n");
} }
// HACK HACK HACK - enable alpha writes all the time so that we have them for // HACK HACK HACK - enable alpha writes all the time so that we have them for
// underwater stuff and writing depth to dest alpha // underwater stuff and writing depth to dest alpha
@ -857,6 +875,28 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
pContextData->m_SemiStaticCmdsOut.BindTexture( pShader, SHADER_SAMPLER3, info.m_nBlendModulateTexture, -1 ); pContextData->m_SemiStaticCmdsOut.BindTexture( pShader, SHADER_SAMPLER3, info.m_nBlendModulateTexture, -1 );
} }
// Parallax cubemaps
if ( hasParallaxCorrection )
{
pContextData->m_SemiStaticCmdsOut.SetPixelShaderConstant( 21, params[info.m_nEnvmapOrigin]->GetVecValue() );
float *vecs[3];
vecs[0] = const_cast<float *>( params[info.m_nEnvmapParallaxObb1]->GetVecValue() );
vecs[1] = const_cast<float *>( params[info.m_nEnvmapParallaxObb2]->GetVecValue() );
vecs[2] = const_cast<float *>( params[info.m_nEnvmapParallaxObb3]->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;
pContextData->m_SemiStaticCmdsOut.SetPixelShaderConstant( 22, &matrix[0][0], 4 );
}
pContextData->m_SemiStaticCmdsOut.End(); pContextData->m_SemiStaticCmdsOut.End();
} }
} }
@ -917,17 +957,17 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
float envmapContrast = params[info.m_nEnvmapContrast]->GetFloatValue(); float envmapContrast = params[info.m_nEnvmapContrast]->GetFloatValue();
if ( g_pHardwareConfig->SupportsPixelShaders_2_b() ) if ( g_pHardwareConfig->SupportsPixelShaders_2_b() )
{ {
DECLARE_DYNAMIC_PIXEL_SHADER( lightmappedgeneric_ps20b ); DECLARE_DYNAMIC_PIXEL_SHADER_NEW( lightmappedgeneric_ps20b );
SET_DYNAMIC_PIXEL_SHADER_COMBO( FASTPATH, bPixelShaderFastPath || pContextData->m_bPixelShaderForceFastPathBecauseOutline ); SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( FASTPATH, bPixelShaderFastPath || pContextData->m_bPixelShaderForceFastPathBecauseOutline );
SET_DYNAMIC_PIXEL_SHADER_COMBO( FASTPATHENVMAPCONTRAST, bPixelShaderFastPath && envmapContrast == 1.0f ); SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( FASTPATHENVMAPCONTRAST, bPixelShaderFastPath && envmapContrast == 1.0f );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
// Don't write fog to alpha if we're using translucency // Don't write fog to alpha if we're using translucency
SET_DYNAMIC_PIXEL_SHADER_COMBO( WRITE_DEPTH_TO_DESTALPHA, bWriteDepthToAlpha ); SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( WRITE_DEPTH_TO_DESTALPHA, bWriteDepthToAlpha );
SET_DYNAMIC_PIXEL_SHADER_COMBO( WRITEWATERFOGTODESTALPHA, bWriteWaterFogToAlpha ); SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( WRITEWATERFOGTODESTALPHA, bWriteWaterFogToAlpha );
SET_DYNAMIC_PIXEL_SHADER_COMBO( LIGHTING_PREVIEW, nFixedLightingMode ); SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( LIGHTING_PREVIEW, nFixedLightingMode );
SET_DYNAMIC_PIXEL_SHADER_CMD( DynamicCmdsOut, lightmappedgeneric_ps20b ); SET_DYNAMIC_PIXEL_SHADER_NEW_CMD( DynamicCmdsOut, lightmappedgeneric_ps20b );
} }
else else
{ {

View file

@ -86,7 +86,12 @@ struct LightmappedGeneric_DX9_Vars_t
int m_nOutlineStart1; int m_nOutlineStart1;
int m_nOutlineEnd0; int m_nOutlineEnd0;
int m_nOutlineEnd1; int m_nOutlineEnd1;
// Parallax cubemaps
bool m_bEnableParallaxCubemaps;
int m_nEnvmapParallaxObb1;
int m_nEnvmapParallaxObb2;
int m_nEnvmapParallaxObb3;
int m_nEnvmapOrigin;
}; };
void InitParamsLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, LightmappedGeneric_DX9_Vars_t &info ); void InitParamsLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, LightmappedGeneric_DX9_Vars_t &info );

View file

@ -100,7 +100,11 @@ const float4 g_FlashlightAttenuationFactors : register( c13 );
const float3 g_FlashlightPos : register( c14 ); const float3 g_FlashlightPos : register( c14 );
const float4x4 g_FlashlightWorldToTexture : register( c15 ); // through c18 const float4x4 g_FlashlightWorldToTexture : register( c15 ); // through c18
const float4 g_ShadowTweaks : register( c19 ); const float4 g_ShadowTweaks : register( c19 );
// Parallax cubemaps
#if ( PARALLAXCORRECT )
const float3 g_CubemapPos : register( c21 );
const float4x4 g_ObbMatrix : register( c22 ); // Through c25
#endif
sampler BaseTextureSampler : register( s0 ); sampler BaseTextureSampler : register( s0 );
sampler LightmapSampler : register( s1 ); sampler LightmapSampler : register( s1 );
@ -530,7 +534,26 @@ HALF4 main( PS_INPUT i ) : COLOR
HALF fresnel = 1.0 - dot( worldSpaceNormal, eyeVect ); HALF fresnel = 1.0 - dot( worldSpaceNormal, eyeVect );
fresnel = pow( fresnel, 5.0 ); fresnel = pow( fresnel, 5.0 );
fresnel = fresnel * g_OneMinusFresnelReflection + g_FresnelReflection; fresnel = fresnel * g_OneMinusFresnelReflection + g_FresnelReflection;
// Parallax correction (2_0b and beyond)
// Adapted from http://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
#if !( defined( SHADER_MODEL_PS_1_1 ) || defined( SHADER_MODEL_PS_1_4 ) || defined( SHADER_MODEL_PS_2_0 ) )
#if ( PARALLAXCORRECT )
float3 worldPos = i.worldPos_projPosZ.xyz;
float3 positionLS = mul( float4( worldPos, 1 ), g_ObbMatrix );
float3 rayLS = mul( reflectVect, (float3x3)g_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 - g_CubemapPos;
#endif
#endif
specularLighting = ENV_MAP_SCALE * texCUBE( EnvmapSampler, reflectVect ); specularLighting = ENV_MAP_SCALE * texCUBE( EnvmapSampler, reflectVect );
specularLighting *= specularFactor; specularLighting *= specularFactor;

View file

@ -24,6 +24,7 @@
// STATIC: "NORMALMASK_DECODE_MODE" "0..0" [PC] // STATIC: "NORMALMASK_DECODE_MODE" "0..0" [PC]
// STATIC: "DETAIL_BLEND_MODE" "0..11" // STATIC: "DETAIL_BLEND_MODE" "0..11"
// STATIC: "FLASHLIGHT" "0..1" [ps20b] [XBOX] // STATIC: "FLASHLIGHT" "0..1" [ps20b] [XBOX]
// STATIC: "PARALLAXCORRECT" "0..1"
// DYNAMIC: "FASTPATHENVMAPCONTRAST" "0..1" // DYNAMIC: "FASTPATHENVMAPCONTRAST" "0..1"
// DYNAMIC: "FASTPATH" "0..1" // DYNAMIC: "FASTPATH" "0..1"
@ -54,6 +55,8 @@
// SKIP: ($DETAIL_BLEND_MODE == 8 ) || ($DETAIL_BLEND_MODE == 9 ) // SKIP: ($DETAIL_BLEND_MODE == 8 ) || ($DETAIL_BLEND_MODE == 9 )
// SKIP ($DETAIL_BLEND_MODE == 10 ) && ($BUMPMAP == 0 ) // SKIP ($DETAIL_BLEND_MODE == 10 ) && ($BUMPMAP == 0 )
// SKIP ($DETAIL_BLEND_MODE == 11 ) && ($BUMPMAP != 0 ) // SKIP ($DETAIL_BLEND_MODE == 11 ) && ($BUMPMAP != 0 )
// SKIP: $PARALLAXCORRECT && !$CUBEMAP
// SKIP: $PARALLAXCORRECT [ps20]
#include "lightmappedgeneric_ps2_3_x.h" #include "lightmappedgeneric_ps2_3_x.h"

View file

@ -59,7 +59,7 @@ BEGIN_VS_SHADER_FLAGS( Occlusion_DX9, "Help for Occlusion", SHADER_NOT_EDITABLE
SET_STATIC_PIXEL_SHADER( white_ps20 ); SET_STATIC_PIXEL_SHADER( white_ps20 );
// Workaround for weird AMD bug - if sRGB write isn't enabled here then sRGB write enable in subsequent world rendering passes will randomly not take effect (even though we're enabling it) in the driver. // Workaround for weird AMD bug - if sRGB write isn't enabled here then sRGB write enable in subsequent world rendering passes will randomly not take effect (even though we're enabling it) in the driver.
if ( ( IsLinux() || IsWindows() || IsBSD() ) && gl_amd_occlusion_workaround.GetBool() ) if ( ( IsLinux() || IsWindows() ) && gl_amd_occlusion_workaround.GetBool() )
{ {
pShaderShadow->EnableSRGBWrite( true ); pShaderShadow->EnableSRGBWrite( true );
} }

View file

@ -8,7 +8,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "ParticleSphere_vs11.inc" #include "particlesphere_vs11.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -132,16 +132,15 @@ BEGIN_VS_SHADER_FLAGS( ParticleSphere_DX9, "Help for BumpmappedEnvMap", SHADER_N
// (It does this by seeing if the intensity*1/distSqr is > 1. If so, then it scales it so // (It does this by seeing if the intensity*1/distSqr is > 1. If so, then it scales it so
// it is equal to 1). // it is equal to 1).
const float *f = params[LIGHT_COLOR]->GetVecValue(); const float *f = params[LIGHT_COLOR]->GetVecValue();
Vector4D vLightColor( f[0], f[1], f[2], 0.f ); Vector vLightColor( f[0], f[1], f[2] );
float flScale = max( vLightColor.x, max( vLightColor.y, vLightColor.z ) ); float flScale = max( vLightColor.x, max( vLightColor.y, vLightColor.z ) );
if ( flScale < 0.01f ) if ( flScale < 0.01f )
flScale = 0.01f; flScale = 0.01f;
float vScaleVec[3] = { flScale, flScale, flScale };
Vector4D vScaleVec = { flScale, flScale, flScale, 0.f };
vLightColor /= flScale; vLightColor /= flScale;
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_1, vLightColor.Base() ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_1, vLightColor.Base() );
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_2, vScaleVec.Base() ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_2, vScaleVec );
pShaderAPI->SetPixelShaderFogParams( PSREG_FOG_PARAMS ); pShaderAPI->SetPixelShaderFogParams( PSREG_FOG_PARAMS );

View file

@ -8,8 +8,8 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "Refract_model_vs11.inc" #include "refract_model_vs11.inc"
#include "Refract_world_vs11.inc" #include "refract_world_vs11.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -8,7 +8,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "ShadowModel.inc" #include "shadowmodel.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -8,9 +8,9 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "ShatteredGlass.inc" #include "shatteredglass.inc"
#include "ShatteredGlass_EnvMap.inc" #include "shatteredglass_envmap.inc"
#include "ShatteredGlass_EnvMapSphere.inc" #include "shatteredglass_envmapsphere.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -23,7 +23,7 @@
static ConVar mat_fullbright( "mat_fullbright", "0", FCVAR_CHEAT ); static ConVar mat_fullbright( "mat_fullbright", "0", FCVAR_CHEAT );
static ConVar r_lightwarpidentity( "r_lightwarpidentity", "0", FCVAR_CHEAT ); static ConVar r_lightwarpidentity( "r_lightwarpidentity", "0", FCVAR_CHEAT );
static ConVar r_rimlight( "r_rimlight", "1", FCVAR_CHEAT ); static ConVar r_rimlight( "r_rimlight", "1", FCVAR_NONE );
// Textures may be bound to the following samplers: // Textures may be bound to the following samplers:
// SHADER_SAMPLER0 Base (Albedo) / Gloss in alpha // SHADER_SAMPLER0 Base (Albedo) / Gloss in alpha
@ -270,6 +270,9 @@ void DrawSkin_DX9_Internal( CBaseVSShader *pShader, IMaterialVar** params, IShad
float flTintReplacementAmount = GetFloatParam( info.m_nTintReplacesBaseColor, params ); float flTintReplacementAmount = GetFloatParam( info.m_nTintReplacesBaseColor, params );
float flPhongExponentFactor = ( info.m_nPhongExponentFactor != -1 ) ? GetFloatParam( info.m_nPhongExponentFactor, params ) : 0.0f;
const bool bHasPhongExponentFactor = flPhongExponentFactor != 0.0f;
BlendType_t nBlendType= pShader->EvaluateBlendRequirements( bBlendTintByBaseAlpha ? -1 : info.m_nBaseTexture, true ); BlendType_t nBlendType= pShader->EvaluateBlendRequirements( bBlendTintByBaseAlpha ? -1 : info.m_nBaseTexture, true );
bool bFullyOpaque = (nBlendType != BT_BLENDADD) && (nBlendType != BT_BLEND) && !bIsAlphaTested && !bHasFlashlight; //dest alpha is free for special use bool bFullyOpaque = (nBlendType != BT_BLENDADD) && (nBlendType != BT_BLEND) && !bIsAlphaTested && !bHasFlashlight; //dest alpha is free for special use
@ -676,6 +679,7 @@ void DrawSkin_DX9_Internal( CBaseVSShader *pShader, IMaterialVar** params, IShad
SET_DYNAMIC_PIXEL_SHADER_COMBO( WRITE_DEPTH_TO_DESTALPHA, bWriteDepthToAlpha ); SET_DYNAMIC_PIXEL_SHADER_COMBO( WRITE_DEPTH_TO_DESTALPHA, bWriteDepthToAlpha );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows ); SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PHONG_USE_EXPONENT_FACTOR, bHasPhongExponentFactor );
SET_DYNAMIC_PIXEL_SHADER( skin_ps20b ); SET_DYNAMIC_PIXEL_SHADER( skin_ps20b );
} }
#ifndef _X360 #ifndef _X360
@ -697,6 +701,7 @@ void DrawSkin_DX9_Internal( CBaseVSShader *pShader, IMaterialVar** params, IShad
SET_DYNAMIC_PIXEL_SHADER_COMBO( WRITE_DEPTH_TO_DESTALPHA, bWriteDepthToAlpha ); SET_DYNAMIC_PIXEL_SHADER_COMBO( WRITE_DEPTH_TO_DESTALPHA, bWriteDepthToAlpha );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows ); SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PHONG_USE_EXPONENT_FACTOR, bHasPhongExponentFactor );
SET_DYNAMIC_PIXEL_SHADER( skin_ps30 ); SET_DYNAMIC_PIXEL_SHADER( skin_ps30 );
bool bUnusedTexCoords[3] = { false, false, !pShaderAPI->IsHWMorphingEnabled() || !bIsDecal }; bool bUnusedTexCoords[3] = { false, false, !pShaderAPI->IsHWMorphingEnabled() || !bIsDecal };
@ -806,15 +811,23 @@ void DrawSkin_DX9_Internal( CBaseVSShader *pShader, IMaterialVar** params, IShad
float vSpecularTint[4] = {1, 1, 1, 4}; float vSpecularTint[4] = {1, 1, 1, 4};
pShaderAPI->GetWorldSpaceCameraPosition( vEyePos_SpecExponent ); pShaderAPI->GetWorldSpaceCameraPosition( vEyePos_SpecExponent );
// Use the alpha channel of the normal map for the exponent by default // If we have a phong exponent factor, then use that as a multiplier against the texture.
vEyePos_SpecExponent[3] = -1.f; if ( bHasPhongExponentFactor )
if ( (info.m_nPhongExponent != -1) && params[info.m_nPhongExponent]->IsDefined() )
{ {
float fValue = params[info.m_nPhongExponent]->GetFloatValue(); vEyePos_SpecExponent[3] = flPhongExponentFactor;
if ( fValue > 0.f ) }
else
{
// Use the alpha channel of the normal map for the exponent by default
vEyePos_SpecExponent[3] = -1.f;
if ( (info.m_nPhongExponent != -1) && params[info.m_nPhongExponent]->IsDefined() )
{ {
// Nonzero value in material overrides map channel float fValue = params[info.m_nPhongExponent]->GetFloatValue();
vEyePos_SpecExponent[3] = fValue; if ( fValue > 0.f )
{
// Nonzero value in material overrides map channel
vEyePos_SpecExponent[3] = fValue;
}
} }
} }

View file

@ -24,6 +24,8 @@
// DYNAMIC: "WRITE_DEPTH_TO_DESTALPHA" "0..1" [ps30] // DYNAMIC: "WRITE_DEPTH_TO_DESTALPHA" "0..1" [ps30]
// DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps20b] // DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps20b]
// DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps30] // DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps30]
// DYNAMIC: "PHONG_USE_EXPONENT_FACTOR" "0..0" [ps20]
// DYNAMIC: "PHONG_USE_EXPONENT_FACTOR" "0..1" [ps20b] [ps30] [PC]
// SKIP: ($PIXELFOGTYPE == 0) && ($WRITEWATERFOGTODESTALPHA != 0) // SKIP: ($PIXELFOGTYPE == 0) && ($WRITEWATERFOGTODESTALPHA != 0)
@ -76,7 +78,9 @@ const float4 g_EyePos_SpecExponent : register( PSREG_EYEPOS_SPEC_EXPONENT );
const float4 g_FogParams : register( PSREG_FOG_PARAMS ); const float4 g_FogParams : register( PSREG_FOG_PARAMS );
const float4 g_FlashlightAttenuationFactors_RimMask : register( PSREG_FLASHLIGHT_ATTENUATION ); // On non-flashlight pass, x has rim mask control const float4 g_FlashlightAttenuationFactors_RimMask : register( PSREG_FLASHLIGHT_ATTENUATION ); // On non-flashlight pass, x has rim mask control
const float4 g_FlashlightPos_RimBoost : register( PSREG_FLASHLIGHT_POSITION_RIM_BOOST ); const float4 g_FlashlightPos_RimBoost : register( PSREG_FLASHLIGHT_POSITION_RIM_BOOST );
const float4x4 g_FlashlightWorldToTexture : register( PSREG_FLASHLIGHT_TO_WORLD_TEXTURE ); #if FLASHLIGHT
const float4x4 g_FlashlightWorldToTexture : register( PSREG_FLASHLIGHT_TO_WORLD_TEXTURE );
#endif
const float4 g_FresnelSpecParams : register( PSREG_FRESNEL_SPEC_PARAMS ); // xyz are fresnel, w is specular boost const float4 g_FresnelSpecParams : register( PSREG_FRESNEL_SPEC_PARAMS ); // xyz are fresnel, w is specular boost
const float4 g_SpecularRimParams : register( PSREG_SPEC_RIM_PARAMS ); // xyz are specular tint color, w is rim power const float4 g_SpecularRimParams : register( PSREG_SPEC_RIM_PARAMS ); // xyz are specular tint color, w is rim power
PixelShaderLightInfo cLightInfo[3] : register( PSREG_LIGHT_INFO_ARRAY ); // 2 registers each - 6 registers total (4th light spread across w's) PixelShaderLightInfo cLightInfo[3] : register( PSREG_LIGHT_INFO_ARRAY ); // 2 registers each - 6 registers total (4th light spread across w's)
@ -96,6 +100,7 @@ const float4 g_ShaderControls : register( PSREG_CONSTANT_27 ); // x is
#define g_fTintReplacementControl g_ShaderControls.z #define g_fTintReplacementControl g_ShaderControls.z
#define g_fInvertPhongMask g_ShaderControls.w #define g_fInvertPhongMask g_ShaderControls.w
sampler BaseTextureSampler : register( s0 ); // Base map, selfillum in alpha sampler BaseTextureSampler : register( s0 ); // Base map, selfillum in alpha
sampler SpecularWarpSampler : register( s1 ); // Specular warp sampler (for iridescence etc) sampler SpecularWarpSampler : register( s1 ); // Specular warp sampler (for iridescence etc)
sampler DiffuseWarpSampler : register( s2 ); // Lighting warp sampler (1D texture for diffuse lighting modification) sampler DiffuseWarpSampler : register( s2 ); // Lighting warp sampler (1D texture for diffuse lighting modification)
@ -119,7 +124,6 @@ sampler DetailSampler : register( s13 ); // detail texture
sampler SelfIllumMaskSampler : register( s14 ); // selfillummask sampler SelfIllumMaskSampler : register( s14 ); // selfillummask
struct PS_INPUT struct PS_INPUT
{ {
float4 baseTexCoordDetailTexCoord : TEXCOORD0; // xy=base zw=detail float4 baseTexCoordDetailTexCoord : TEXCOORD0; // xy=base zw=detail
@ -258,7 +262,11 @@ float4 main( PS_INPUT i ) : COLOR
[flatten] [flatten]
#endif #endif
#if ( PHONG_USE_EXPONENT_FACTOR )
fSpecExp = ( 1.0f + g_EyePos_SpecExponent.w * vSpecExpMap.r );
#else
fSpecExp = (g_EyePos_SpecExponent.w >= 0.0) ? g_EyePos_SpecExponent.w : (1.0f + 149.0f * vSpecExpMap.r); fSpecExp = (g_EyePos_SpecExponent.w >= 0.0) ? g_EyePos_SpecExponent.w : (1.0f + 149.0f * vSpecExpMap.r);
#endif
// If constant tint is negative, tint with albedo, based upon scalar tint map // If constant tint is negative, tint with albedo, based upon scalar tint map
#if defined( _X360 ) #if defined( _X360 )
@ -286,15 +294,17 @@ float4 main( PS_INPUT i ) : COLOR
} }
else else
{ {
float4 flashlightSpacePosition = mul( float4( vWorldPos, 1.0f ), g_FlashlightWorldToTexture ); #if FLASHLIGHT
float4 flashlightSpacePosition = mul( float4( vWorldPos, 1.0f ), g_FlashlightWorldToTexture );
DoSpecularFlashlight( g_FlashlightPos, vWorldPos, flashlightSpacePosition, worldSpaceNormal, DoSpecularFlashlight( g_FlashlightPos, vWorldPos, flashlightSpacePosition, worldSpaceNormal,
g_FlashlightAttenuationFactors.xyz, g_FlashlightAttenuationFactors.w, g_FlashlightAttenuationFactors.xyz, g_FlashlightAttenuationFactors.w,
FlashlightSampler, ShadowDepthSampler, NormalizeRandRotSampler, FLASHLIGHTDEPTHFILTERMODE, FLASHLIGHTSHADOWS, true, vProjPos.xy / vProjPos.z, FlashlightSampler, ShadowDepthSampler, NormalizeRandRotSampler, FLASHLIGHTDEPTHFILTERMODE, FLASHLIGHTSHADOWS, true, vProjPos.xy / vProjPos.z,
fSpecExp, vEyeDir, bDoSpecularWarp, SpecularWarpSampler, fFresnelRanges, g_EnvmapTint_ShadowTweaks, fSpecExp, vEyeDir, bDoSpecularWarp, SpecularWarpSampler, fFresnelRanges, g_EnvmapTint_ShadowTweaks,
// These two values are output // These two values are output
diffuseLighting, specularLighting ); diffuseLighting, specularLighting );
#endif
} }
// If we didn't already apply Fresnel to specular warp, modulate the specular // If we didn't already apply Fresnel to specular warp, modulate the specular

View file

@ -120,7 +120,6 @@ $Project "stdshader_dx9"
$File "particlelitgeneric_dx9.cpp" $File "particlelitgeneric_dx9.cpp"
$File "particlelitgeneric_dx9_helper.cpp" $File "particlelitgeneric_dx9_helper.cpp"
$File "particlesphere_dx9.cpp" $File "particlesphere_dx9.cpp"
$File "pbr_dx9.cpp"
$File "portal.cpp" $File "portal.cpp"
$File "portalstaticoverlay.cpp" $File "portalstaticoverlay.cpp"
$File "portal_refract.cpp" $File "portal_refract.cpp"
@ -213,7 +212,6 @@ $Project "stdshader_dx9"
$File "shader_constant_register_map.h" $File "shader_constant_register_map.h"
$File "skin_dx9_helper.h" $File "skin_dx9_helper.h"
$File "particlelitgeneric_dx9_helper.h" $File "particlelitgeneric_dx9_helper.h"
$File "pbr_common_ps2_3_x.h"
$File "vertexlitgeneric_dx95_helper.h" $File "vertexlitgeneric_dx95_helper.h"
$File "vortwarp_vs20_helper.h" $File "vortwarp_vs20_helper.h"
$File "worldvertextransition_dx8_helper.h" $File "worldvertextransition_dx8_helper.h"
@ -246,4 +244,4 @@ $Project "stdshader_dx9"
$Shaders "stdshader_dx9_20b.txt" $Shaders "stdshader_dx9_20b.txt"
$Shaders "stdshader_dx9_30.txt" $Shaders "stdshader_dx9_30.txt"
//$Shaders "stdshader_dx10.txt" //$Shaders "stdshader_dx10.txt"
} }

View file

@ -272,9 +272,6 @@ particlesphere_vs11.fxc
particlesphere_ps2x.fxc particlesphere_ps2x.fxc
particlesphere_vs20.fxc particlesphere_vs20.fxc
pbr_ps20b.fxc
pbr_vs20b.fxc
portal_ps11.fxc portal_ps11.fxc
portal_vs11.fxc portal_vs11.fxc
portal_ps2x.fxc portal_ps2x.fxc

View file

@ -26,8 +26,6 @@ morphaccumulate_vs30.fxc
morphaccumulate_ps30.fxc morphaccumulate_ps30.fxc
morphweight_vs30.fxc morphweight_vs30.fxc
morphweight_ps30.fxc morphweight_ps30.fxc
pbr_ps30.fxc
pbr_vs30.fxc
pyro_vision_ps2x.fxc pyro_vision_ps2x.fxc
pyro_vision_vs20.fxc pyro_vision_vs20.fxc
skin_vs20.fxc skin_vs20.fxc

View file

@ -6,7 +6,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "Teeth.inc" #include "teeth.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -8,7 +8,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "UnlitTwoTexture.inc" #include "unlittwotexture.inc"
#include "cloak_blended_pass_helper.h" #include "cloak_blended_pass_helper.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!

View file

@ -31,6 +31,9 @@
// DYNAMIC: "LIGHTING_PREVIEW" "0..0" [XBOX] // DYNAMIC: "LIGHTING_PREVIEW" "0..0" [XBOX]
// DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps20b] // DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps20b]
// DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps30] // DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps30]
// DYNAMIC: "STATIC_LIGHT_LIGHTMAP" "0..1" [ps20b] [ps30]
// DYNAMIC: "STATIC_LIGHT_LIGHTMAP" "0..0" [ps20]
// DYNAMIC: "DEBUG_LUXELS" "0..1" [ps20b] [ps30]
// detail blend mode 6 = ps20b only // detail blend mode 6 = ps20b only
// SKIP: $DETAIL_BLEND_MODE == 6 [ps20] // SKIP: $DETAIL_BLEND_MODE == 6 [ps20]
@ -71,6 +74,9 @@
// SKIP: $CUBEMAP_SPHERE_LEGACY && ($CUBEMAP == 0) // SKIP: $CUBEMAP_SPHERE_LEGACY && ($CUBEMAP == 0)
// Debugging luxels only makes sense if we have lightmaps on this geometry.
// SKIP: ($STATIC_LIGHT_LIGHTMAP == 0) && ($DEBUG_LUXELS == 1)
#include "common_flashlight_fxc.h" #include "common_flashlight_fxc.h"
#include "common_vertexlitgeneric_dx9.h" #include "common_vertexlitgeneric_dx9.h"
@ -105,6 +111,7 @@ sampler FlashlightSampler : register( s7 );
sampler ShadowDepthSampler : register( s8 ); // Flashlight shadow depth map sampler sampler ShadowDepthSampler : register( s8 ); // Flashlight shadow depth map sampler
sampler DepthSampler : register( s10 ); //depth buffer sampler for depth blending sampler DepthSampler : register( s10 ); //depth buffer sampler for depth blending
sampler SelfIllumMaskSampler : register( s11 ); // selfillummask sampler SelfIllumMaskSampler : register( s11 ); // selfillummask
sampler LightMapSampler : register( s12 );
struct PS_INPUT struct PS_INPUT
{ {
@ -167,6 +174,10 @@ const float4 g_OutlineParams : register( c9 );
const float3 g_DetailTint : register( c10 ); const float3 g_DetailTint : register( c10 );
#endif #endif
#if DEBUG_LUXELS
const float4 g_LuxelScale : register( c11 );
#endif
// Calculate unified fog // Calculate unified fog
float CalcPixelFogFactorConst( float fPixelFogType, const float4 fogParams, const float flEyePosZ, const float flWorldPosZ, const float flProjPosZ ) float CalcPixelFogFactorConst( float fPixelFogType, const float4 fogParams, const float flEyePosZ, const float flWorldPosZ, const float flProjPosZ )
@ -331,12 +342,24 @@ float4 main( PS_INPUT i ) : COLOR
} }
float3 diffuseLighting = float3( 1.0f, 1.0f, 1.0f ); float3 diffuseLighting = float3( 1.0f, 1.0f, 1.0f );
if( bDiffuseLighting || bVertexColor && !( bVertexColor && bDiffuseLighting ) ) if( bDiffuseLighting || bVertexColor )
{ {
diffuseLighting = i.color.rgb; diffuseLighting = i.color.rgb;
} }
#if STATIC_LIGHT_LIGHTMAP
// This matches the behavior of vertex lighting, which multiplies by cOverbright (which is not accessible here)
// And converts from Gamma space to Linear space before being used.
float2 lightmapTexCoords = i.baseTexCoord.xy;
#if DEBUG_LUXELS
lightmapTexCoords.xy *= g_LuxelScale.xy;
#endif
float3 f3LightmapColor = GammaToLinear( 2.0f * tex2D( LightMapSampler, lightmapTexCoords ).rgb );
diffuseLighting = f3LightmapColor;
#endif
float3 albedo = baseColor; float3 albedo = baseColor;
if (bBlendTintByBaseAlpha) if (bBlendTintByBaseAlpha)
{ {
float3 tintedColor = albedo * g_DiffuseModulation.rgb; float3 tintedColor = albedo * g_DiffuseModulation.rgb;

View file

@ -12,7 +12,8 @@
// STATIC: "DONT_GAMMA_CONVERT_VERTEX_COLOR" "0..1" // STATIC: "DONT_GAMMA_CONVERT_VERTEX_COLOR" "0..1"
// DYNAMIC: "COMPRESSED_VERTS" "0..1" // DYNAMIC: "COMPRESSED_VERTS" "0..1"
// DYNAMIC: "DYNAMIC_LIGHT" "0..1" // DYNAMIC: "DYNAMIC_LIGHT" "0..1"
// DYNAMIC: "STATIC_LIGHT" "0..1" // DYNAMIC: "STATIC_LIGHT_VERTEX" "0..1"
// DYNAMIC: "STATIC_LIGHT_LIGHTMAP" "0..1"
// DYNAMIC: "DOWATERFOG" "0..1" // DYNAMIC: "DOWATERFOG" "0..1"
// DYNAMIC: "SKINNING" "0..1" // DYNAMIC: "SKINNING" "0..1"
// DYNAMIC: "LIGHTING_PREVIEW" "0..1" [PC] // DYNAMIC: "LIGHTING_PREVIEW" "0..1" [PC]
@ -125,7 +126,7 @@ VS_OUTPUT main( const VS_INPUT v )
VS_OUTPUT o = ( VS_OUTPUT )0; VS_OUTPUT o = ( VS_OUTPUT )0;
bool bDynamicLight = DYNAMIC_LIGHT ? true : false; bool bDynamicLight = DYNAMIC_LIGHT ? true : false;
bool bStaticLight = STATIC_LIGHT ? true : false; bool bStaticLight = STATIC_LIGHT_VERTEX ? true : false;
bool bDoLighting = !g_bVertexColor && (bDynamicLight || bStaticLight); bool bDoLighting = !g_bVertexColor && (bDynamicLight || bStaticLight);
float4 vPosition = v.vPos; float4 vPosition = v.vPos;

View file

@ -8,8 +8,8 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "VertexLitGeneric_vs11.inc" #include "vertexlitgeneric_vs11.inc"
#include "VertexLitGeneric_SelfIllumOnly.inc" #include "vertexlitgeneric_selfillumonly.inc"
#include "emissive_scroll_blended_pass_helper.h" #include "emissive_scroll_blended_pass_helper.h"
#include "flesh_interior_blended_pass_helper.h" #include "flesh_interior_blended_pass_helper.h"
#include "cloak_blended_pass_helper.h" #include "cloak_blended_pass_helper.h"

View file

@ -41,6 +41,7 @@ BEGIN_VS_SHADER( VertexLitGeneric, "Help for VertexLitGeneric" )
SHADER_PARAM( SELFILLUMFRESNELMINMAXEXP, SHADER_PARAM_TYPE_VEC4, "0", "Self illum fresnel min, max, exp" ) SHADER_PARAM( SELFILLUMFRESNELMINMAXEXP, SHADER_PARAM_TYPE_VEC4, "0", "Self illum fresnel min, max, exp" )
SHADER_PARAM( ALPHATESTREFERENCE, SHADER_PARAM_TYPE_FLOAT, "0.0", "" ) SHADER_PARAM( ALPHATESTREFERENCE, SHADER_PARAM_TYPE_FLOAT, "0.0", "" )
SHADER_PARAM( FLASHLIGHTNOLAMBERT, SHADER_PARAM_TYPE_BOOL, "0", "Flashlight pass sets N.L=1.0" ) SHADER_PARAM( FLASHLIGHTNOLAMBERT, SHADER_PARAM_TYPE_BOOL, "0", "Flashlight pass sets N.L=1.0" )
SHADER_PARAM( LIGHTMAP, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "lightmap texture--will be bound by the engine")
// Debugging term for visualizing ambient data on its own // Debugging term for visualizing ambient data on its own
SHADER_PARAM( AMBIENTONLY, SHADER_PARAM_TYPE_INTEGER, "0", "Control drawing of non-ambient light ()" ) SHADER_PARAM( AMBIENTONLY, SHADER_PARAM_TYPE_INTEGER, "0", "Control drawing of non-ambient light ()" )
@ -53,6 +54,7 @@ BEGIN_VS_SHADER( VertexLitGeneric, "Help for VertexLitGeneric" )
SHADER_PARAM( PHONGFRESNELRANGES, SHADER_PARAM_TYPE_VEC3, "[0 0.5 1]", "Parameters for remapping fresnel output" ) SHADER_PARAM( PHONGFRESNELRANGES, SHADER_PARAM_TYPE_VEC3, "[0 0.5 1]", "Parameters for remapping fresnel output" )
SHADER_PARAM( PHONGBOOST, SHADER_PARAM_TYPE_FLOAT, "1.0", "Phong overbrightening factor (specular mask channel should be authored to account for this)" ) SHADER_PARAM( PHONGBOOST, SHADER_PARAM_TYPE_FLOAT, "1.0", "Phong overbrightening factor (specular mask channel should be authored to account for this)" )
SHADER_PARAM( PHONGEXPONENTTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "Phong Exponent map" ) SHADER_PARAM( PHONGEXPONENTTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "Phong Exponent map" )
SHADER_PARAM( PHONGEXPONENTFACTOR, SHADER_PARAM_TYPE_FLOAT, "0.0", "When using a phong exponent texture, this will be multiplied by the 0..1 that comes out of the texture." )
SHADER_PARAM( PHONG, SHADER_PARAM_TYPE_BOOL, "0", "enables phong lighting" ) SHADER_PARAM( PHONG, SHADER_PARAM_TYPE_BOOL, "0", "enables phong lighting" )
SHADER_PARAM( BASEMAPALPHAPHONGMASK, SHADER_PARAM_TYPE_INTEGER, "0", "indicates that there is no normal map and that the phong mask is in base alpha" ) SHADER_PARAM( BASEMAPALPHAPHONGMASK, SHADER_PARAM_TYPE_INTEGER, "0", "indicates that there is no normal map and that the phong mask is in base alpha" )
SHADER_PARAM( INVERTPHONGMASK, SHADER_PARAM_TYPE_INTEGER, "0", "invert the phong mask (0=full phong, 1=no phong)" ) SHADER_PARAM( INVERTPHONGMASK, SHADER_PARAM_TYPE_INTEGER, "0", "invert the phong mask (0=full phong, 1=no phong)" )
@ -163,6 +165,7 @@ BEGIN_VS_SHADER( VertexLitGeneric, "Help for VertexLitGeneric" )
info.m_nEnvmapSaturation = ENVMAPSATURATION; info.m_nEnvmapSaturation = ENVMAPSATURATION;
info.m_nAlphaTestReference = ALPHATESTREFERENCE; info.m_nAlphaTestReference = ALPHATESTREFERENCE;
info.m_nFlashlightNoLambert = FLASHLIGHTNOLAMBERT; info.m_nFlashlightNoLambert = FLASHLIGHTNOLAMBERT;
info.m_nLightmap = LIGHTMAP;
info.m_nFlashlightTexture = FLASHLIGHTTEXTURE; info.m_nFlashlightTexture = FLASHLIGHTTEXTURE;
info.m_nFlashlightTextureFrame = FLASHLIGHTTEXTUREFRAME; info.m_nFlashlightTextureFrame = FLASHLIGHTTEXTUREFRAME;
@ -178,6 +181,7 @@ BEGIN_VS_SHADER( VertexLitGeneric, "Help for VertexLitGeneric" )
info.m_nDiffuseWarpTexture = LIGHTWARPTEXTURE; info.m_nDiffuseWarpTexture = LIGHTWARPTEXTURE;
info.m_nPhongWarpTexture = PHONGWARPTEXTURE; info.m_nPhongWarpTexture = PHONGWARPTEXTURE;
info.m_nPhongBoost = PHONGBOOST; info.m_nPhongBoost = PHONGBOOST;
info.m_nPhongExponentFactor = PHONGEXPONENTFACTOR;
info.m_nPhongFresnelRanges = PHONGFRESNELRANGES; info.m_nPhongFresnelRanges = PHONGFRESNELRANGES;
info.m_nPhong = PHONG; info.m_nPhong = PHONG;
info.m_nBaseMapAlphaPhongMask = BASEMAPALPHAPHONGMASK; info.m_nBaseMapAlphaPhongMask = BASEMAPALPHAPHONGMASK;

View file

@ -32,6 +32,7 @@
static ConVar mat_fullbright( "mat_fullbright","0", FCVAR_CHEAT ); static ConVar mat_fullbright( "mat_fullbright","0", FCVAR_CHEAT );
static ConVar r_lightwarpidentity( "r_lightwarpidentity","0", FCVAR_CHEAT ); static ConVar r_lightwarpidentity( "r_lightwarpidentity","0", FCVAR_CHEAT );
static ConVar mat_luxels( "mat_luxels", "0", FCVAR_CHEAT );
static inline bool WantsSkinShader( IMaterialVar** params, const VertexLitGeneric_DX9_Vars_t &info ) static inline bool WantsSkinShader( IMaterialVar** params, const VertexLitGeneric_DX9_Vars_t &info )
@ -382,7 +383,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
bool bIsAlphaTested = IS_FLAG_SET( MATERIAL_VAR_ALPHATEST ) != 0; bool bIsAlphaTested = IS_FLAG_SET( MATERIAL_VAR_ALPHATEST ) != 0;
bool bHasDiffuseWarp = (!bHasFlashlight || IsX360() ) && hasDiffuseLighting && (info.m_nDiffuseWarpTexture != -1) && params[info.m_nDiffuseWarpTexture]->IsTexture(); bool bHasDiffuseWarp = (!bHasFlashlight || IsX360() ) && hasDiffuseLighting && (info.m_nDiffuseWarpTexture != -1) && params[info.m_nDiffuseWarpTexture]->IsTexture();
bool bHasLightmapTexture = IsTextureSet( info.m_nLightmap, params );
bool bHasMatLuxel = bHasLightmapTexture && mat_luxels.GetBool();
//bool bNoCull = IS_FLAG_SET( MATERIAL_VAR_NOCULL ); //bool bNoCull = IS_FLAG_SET( MATERIAL_VAR_NOCULL );
bool bFlashlightNoLambert = false; bool bFlashlightNoLambert = false;
@ -622,6 +624,11 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
pShaderShadow->EnableTexture( SHADER_SAMPLER11, true ); // self illum mask pShaderShadow->EnableTexture( SHADER_SAMPLER11, true ); // self illum mask
} }
// Always enable this sampler, used for lightmaps depending on the dynamic combo.
// Lightmaps are generated in gamma space, but not sRGB, so leave that disabled. Conversion is done in the shader.
pShaderShadow->EnableTexture( SHADER_SAMPLER12, true );
bool bSRGBWrite = true; bool bSRGBWrite = true;
if( (info.m_nLinearWrite != -1) && (params[info.m_nLinearWrite]->GetIntValue() == 1) ) if( (info.m_nLinearWrite != -1) && (params[info.m_nLinearWrite]->GetIntValue() == 1) )
{ {
@ -1188,12 +1195,32 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
// Set up light combo state // Set up light combo state
LightState_t lightState = {0, false, false}; LightState_t lightState = { 0, false, false, false };
if ( bVertexLitGeneric && (!bHasFlashlight || IsX360() ) ) if ( bVertexLitGeneric && (!bHasFlashlight || IsX360() ) )
{ {
pShaderAPI->GetDX9LightState( &lightState ); pShaderAPI->GetDX9LightState( &lightState );
} }
// Override the lighting desired if we have a lightmap set!
if ( bHasLightmapTexture )
{
lightState.m_bStaticLightVertex = false;
lightState.m_bStaticLightTexel = true;
// Usual case, not debugging.
if (!bHasMatLuxel)
{
pShader->BindTexture(SHADER_SAMPLER12, info.m_nLightmap);
}
else
{
float dimensions[] = { 0.0f, 0.0f, 0.0f, 0.0f };
DynamicCmdsOut.BindStandardTexture( SHADER_SAMPLER12, TEXTURE_DEBUG_LUXELS );
pShader->GetTextureDimensions( &dimensions[0], &dimensions[1], info.m_nLightmap );
DynamicCmdsOut.SetPixelShaderConstant( 11, dimensions, 1 );
}
}
MaterialFogMode_t fogType = pShaderAPI->GetSceneFogMode(); MaterialFogMode_t fogType = pShaderAPI->GetSceneFogMode();
int fogIndex = ( fogType == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ? 1 : 0; int fogIndex = ( fogType == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ? 1 : 0;
int numBones = pShaderAPI->GetCurrentNumBones(); int numBones = pShaderAPI->GetCurrentNumBones();
@ -1289,7 +1316,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs20 ); DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs20 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() );
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_VERTEX, lightState.m_bStaticLightVertex ? 1 : 0 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0);
SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex );
SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( SET_DYNAMIC_VERTEX_SHADER_COMBO(
@ -1306,6 +1334,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
// SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); // SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows ); SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows );
SET_DYNAMIC_PIXEL_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 );
SET_DYNAMIC_PIXEL_SHADER_COMBO( DEBUG_LUXELS, bHasMatLuxel ? 1 : 0 );
SET_DYNAMIC_PIXEL_SHADER_COMBO( SET_DYNAMIC_PIXEL_SHADER_COMBO(
LIGHTING_PREVIEW, LIGHTING_PREVIEW,
pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) ); pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) );
@ -1315,6 +1345,7 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
{ {
DECLARE_DYNAMIC_PIXEL_SHADER( vertexlit_and_unlit_generic_ps20 ); DECLARE_DYNAMIC_PIXEL_SHADER( vertexlit_and_unlit_generic_ps20 );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
SET_DYNAMIC_PIXEL_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 );
SET_DYNAMIC_PIXEL_SHADER_COMBO( SET_DYNAMIC_PIXEL_SHADER_COMBO(
LIGHTING_PREVIEW, LIGHTING_PREVIEW,
pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) ); pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) );
@ -1328,7 +1359,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs30 ); DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs30 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() );
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_VERTEX, lightState.m_bStaticLightVertex ? 1 : 0 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex );
SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( LIGHTING_PREVIEW, SET_DYNAMIC_VERTEX_SHADER_COMBO( LIGHTING_PREVIEW,
@ -1340,6 +1372,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
DECLARE_DYNAMIC_PIXEL_SHADER( vertexlit_and_unlit_generic_ps30 ); DECLARE_DYNAMIC_PIXEL_SHADER( vertexlit_and_unlit_generic_ps30 );
// SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); // SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows ); SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows );
SET_DYNAMIC_PIXEL_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 );
SET_DYNAMIC_PIXEL_SHADER_COMBO( DEBUG_LUXELS, bHasMatLuxel ? 1 : 0 );
SET_DYNAMIC_PIXEL_SHADER_COMBO( LIGHTING_PREVIEW, SET_DYNAMIC_PIXEL_SHADER_COMBO( LIGHTING_PREVIEW,
pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) ); pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) );
SET_DYNAMIC_PIXEL_SHADER_CMD( DynamicCmdsOut, vertexlit_and_unlit_generic_ps30 ); SET_DYNAMIC_PIXEL_SHADER_CMD( DynamicCmdsOut, vertexlit_and_unlit_generic_ps30 );

View file

@ -54,6 +54,7 @@ struct VertexLitGeneric_DX9_Vars_t
int m_nFlashlightNoLambert; int m_nFlashlightNoLambert;
int m_nFlashlightTexture; int m_nFlashlightTexture;
int m_nFlashlightTextureFrame; int m_nFlashlightTextureFrame;
int m_nLightmap;
int m_nSelfIllumTint; int m_nSelfIllumTint;
int m_nSelfIllumFresnel; int m_nSelfIllumFresnel;
@ -67,6 +68,7 @@ struct VertexLitGeneric_DX9_Vars_t
int m_nPhongWarpTexture; int m_nPhongWarpTexture;
int m_nPhongBoost; int m_nPhongBoost;
int m_nPhongFresnelRanges; int m_nPhongFresnelRanges;
int m_nPhongExponentFactor;
int m_nSelfIllumEnvMapMask_Alpha; int m_nSelfIllumEnvMapMask_Alpha;
int m_nAmbientOnly; int m_nAmbientOnly;
int m_nHDRColorScale; int m_nHDRColorScale;
@ -130,7 +132,6 @@ struct VertexLitGeneric_DX9_Vars_t
int m_nBlendTintByBaseAlpha; int m_nBlendTintByBaseAlpha;
int m_nTintReplacesBaseColor; int m_nTintReplacesBaseColor;
}; };
void InitParamsVertexLitGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, bool bVertexLitGeneric, VertexLitGeneric_DX9_Vars_t &info ); void InitParamsVertexLitGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, bool bVertexLitGeneric, VertexLitGeneric_DX9_Vars_t &info );

View file

@ -161,7 +161,7 @@ BEGIN_VS_SHADER( VortWarp_dx8,
pShaderAPI->SetPixelShaderConstant( 5, c5, 1 ); pShaderAPI->SetPixelShaderConstant( 5, c5, 1 );
float curTime = pShaderAPI->CurrentTime(); float curTime = pShaderAPI->CurrentTime();
float selfIllumScroll[4] = { .11f * curTime, .124f * curTime, 0.0f, 0.0f }; float selfIllumScroll[4] = { .11f * curTime, .124 * curTime, 0.0f, 0.0f };
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, selfIllumScroll, 1 ); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, selfIllumScroll, 1 );
vortwarp_vs11_Dynamic_Index vshIndex; vortwarp_vs11_Dynamic_Index vshIndex;

View file

@ -9,9 +9,9 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "mathlib/vmatrix.h" #include "mathlib/vmatrix.h"
#include "Water_vs11.inc" #include "water_vs11.inc"
#include "WaterCheapPerVertexFresnel_vs11.inc" #include "watercheappervertexfresnel_vs11.inc"
#include "WaterCheap_vs11.inc" #include "watercheap_vs11.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -8,8 +8,8 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "mathlib/vmatrix.h" #include "mathlib/vmatrix.h"
#include "Water_ps14.inc" #include "water_ps14.inc"
#include "WaterCheap_vs14.inc" #include "watercheap_vs14.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -8,7 +8,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "WorldVertexAlpha.inc" #include "worldvertexalpha.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -119,6 +119,7 @@ BEGIN_VS_SHADER( WorldVertexTransition_DX9, "Help for WorldVertexTransition" )
info.m_nSelfShadowedBumpFlag = SSBUMP; info.m_nSelfShadowedBumpFlag = SSBUMP;
info.m_nSeamlessMappingScale = SEAMLESS_SCALE; info.m_nSeamlessMappingScale = SEAMLESS_SCALE;
info.m_nAlphaTestReference = -1; info.m_nAlphaTestReference = -1;
info.m_bEnableParallaxCubemaps = false;
} }
SHADER_FALLBACK SHADER_FALLBACK

View file

@ -7,7 +7,7 @@
#include "BaseVSShader.h" #include "BaseVSShader.h"
#include "ScreenSpaceEffect.inc" #include "screenspaceeffect.inc"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"

View file

@ -351,6 +351,7 @@ inline bool CShader_IsFlag2Set( IMaterialVar **params, MaterialVarFlags2_t _flag
#define BEGIN_INHERITED_SHADER( _name, _base, _help ) BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, 0 ) #define BEGIN_INHERITED_SHADER( _name, _base, _help ) BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, 0 )
#define END_INHERITED_SHADER END_SHADER } #define END_INHERITED_SHADER END_SHADER }
#ifndef NEW_SHADER_COMPILE
// psh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_PIXEL_SHADER // psh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_PIXEL_SHADER
#define DECLARE_DYNAMIC_PIXEL_SHADER( shader ) \ #define DECLARE_DYNAMIC_PIXEL_SHADER( shader ) \
int declaredynpixshader_ ## shader ## _missingcurlybraces = 0; \ int declaredynpixshader_ ## shader ## _missingcurlybraces = 0; \
@ -488,5 +489,243 @@ inline bool CShader_IsFlag2Set( IMaterialVar **params, MaterialVarFlags2_t _flag
NOTE_UNUSED( vsh_testAllCombos ); \ NOTE_UNUSED( vsh_testAllCombos ); \
NOTE_UNUSED( vsh ## shader ); \ NOTE_UNUSED( vsh ## shader ); \
pShaderShadow->SetVertexShader( #shader, _vshIndex.GetIndex() ) pShaderShadow->SetVertexShader( #shader, _vshIndex.GetIndex() )
#else
// psh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_PIXEL_SHADER
#define DECLARE_DYNAMIC_PIXEL_SHADER( shader ) \
shader ## _Dynamic_Index _pshIndex( pShaderAPI ); \
constexpr int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_VERTEX_SHADER
#define DECLARE_DYNAMIC_VERTEX_SHADER( shader ) \
shader ## _Dynamic_Index _vshIndex( pShaderAPI ); \
constexpr int vsh ## shader = 1
// psh ## shader is used here to generate a warning if you don't ever call SET_STATIC_PIXEL_SHADER
#define DECLARE_STATIC_PIXEL_SHADER( shader ) \
shader ## _Static_Index _pshIndex( pShaderShadow, params ); \
constexpr int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_STATIC_VERTEX_SHADER
#define DECLARE_STATIC_VERTEX_SHADER( shader ) \
shader ## _Static_Index _vshIndex( pShaderShadow, params ); \
constexpr int vsh ## shader = 1
// psh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_PIXEL_SHADER block.
#define SET_DYNAMIC_PIXEL_SHADER_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
constexpr int psh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_PIXEL_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_VERTEX_SHADER block.
#define SET_DYNAMIC_VERTEX_SHADER_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
constexpr int vsh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_VERTEX_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_PIXEL_SHADER block.
#define SET_STATIC_PIXEL_SHADER_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
constexpr int psh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_PIXEL_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_VERTEX_SHADER block.
#define SET_STATIC_VERTEX_SHADER_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
constexpr int vsh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_VERTEX_SHADER_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_testAllCombos adds up all of the psh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_DYNAMIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_PIXEL_SHADER( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderAPI->SetPixelShaderIndex( _pshIndex.GetIndex() )
#define SET_DYNAMIC_PIXEL_SHADER_CMD( cmdstream, shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
cmdstream.SetPixelShaderIndex( _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_DYNAMIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_VERTEX_SHADER( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderAPI->SetVertexShaderIndex( _vshIndex.GetIndex() )
#define SET_DYNAMIC_VERTEX_SHADER_CMD( cmdstream, shader ) \
static_assert( shaderDynamicTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
cmdstream.SetVertexShaderIndex( _vshIndex.GetIndex() )
// psh_testAllCombos adds up all of the psh_forgot_to_set_static_ ## var's from
// SET_STATIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_STATIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_STATIC_PIXEL_SHADER( shader ) \
static_assert( ( shaderStaticTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderShadow->SetPixelShader( #shader, _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_static_ ## var's from
// SET_STATIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_STATIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_STATIC_VERTEX_SHADER( shader ) \
static_assert( shaderStaticTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderShadow->SetVertexShader( #shader, _vshIndex.GetIndex() )
#endif
// psh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_PIXEL_SHADER
#define DECLARE_DYNAMIC_PIXEL_SHADER_NEW( shader ) \
shader ## _Dynamic_Index _pshIndex( pShaderAPI ); \
constexpr int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_VERTEX_SHADER_NEW
#define DECLARE_DYNAMIC_VERTEX_SHADER_NEW( shader ) \
shader ## _Dynamic_Index _vshIndex( pShaderAPI ); \
constexpr int vsh ## shader = 1
// psh ## shader is used here to generate a warning if you don't ever call SET_STATIC_PIXEL_SHADER_NEW
#define DECLARE_STATIC_PIXEL_SHADER_NEW( shader ) \
shader ## _Static_Index _pshIndex( pShaderShadow, params ); \
constexpr int psh ## shader = 1
// vsh ## shader is used here to generate a warning if you don't ever call SET_STATIC_VERTEX_SHADER_NEW
#define DECLARE_STATIC_VERTEX_SHADER_NEW( shader ) \
shader ## _Static_Index _vshIndex( pShaderShadow, params ); \
constexpr int vsh ## shader = 1
// psh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_PIXEL_SHADER_NEW block.
#define SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
constexpr int psh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_VERTEX_SHADER_NEW block.
#define SET_DYNAMIC_VERTEX_SHADER_NEW_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
constexpr int vsh_forgot_to_set_dynamic_ ## var = 1
#define SET_DYNAMIC_VERTEX_SHADER_NEW_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_PIXEL_SHADER_NEW block.
#define SET_STATIC_PIXEL_SHADER_NEW_COMBO( var, val ) \
_pshIndex.Set ## var( ( val ) ); \
constexpr int psh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_PIXEL_SHADER_NEW_COMBO_OVERRIDE_DEFAULT( var, val ) \
_pshIndex.Set ## var( ( val ) );
// vsh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_VERTEX_SHADER_NEW block.
#define SET_STATIC_VERTEX_SHADER_NEW_COMBO( var, val ) \
_vshIndex.Set ## var( ( val ) ); \
constexpr int vsh_forgot_to_set_static_ ## var = 1
#define SET_STATIC_VERTEX_SHADER_NEW_COMBO_OVERRIDE_DEFAULT( var, val ) \
_vshIndex.Set ## var( ( val ) );
// psh_testAllCombos adds up all of the psh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_DYNAMIC_PIXEL_SHADER_NEW
// was called for this particular shader.
#define SET_DYNAMIC_PIXEL_SHADER_NEW( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderAPI->SetPixelShaderIndex( _pshIndex.GetIndex() )
#define SET_DYNAMIC_PIXEL_SHADER_NEW_CMD( cmdstream, shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
cmdstream.SetPixelShaderIndex( _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_VERTEX_SHADER_NEW_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_DYNAMIC_VERTEX_SHADER_NEW
// was called for this particular shader.
#define SET_DYNAMIC_VERTEX_SHADER_NEW( shader ) \
static_assert( ( shaderDynamicTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderAPI->SetVertexShaderIndex( _vshIndex.GetIndex() )
#define SET_DYNAMIC_VERTEX_SHADER_NEW_CMD( cmdstream, shader ) \
static_assert( shaderDynamicTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
cmdstream.SetVertexShaderIndex( _vshIndex.GetIndex() )
// psh_testAllCombos adds up all of the psh_forgot_to_set_static_ ## var's from
// SET_STATIC_PIXEL_SHADER_NEW_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_STATIC_PIXEL_SHADER_NEW
// was called for this particular shader.
#define SET_STATIC_PIXEL_SHADER_NEW( shader ) \
static_assert( ( shaderStaticTest_ ## shader ) != 0, "Missing combo!" ); \
static_assert( psh ## shader != 0, "Not pixel shader!" ); \
pShaderShadow->SetPixelShader( #shader, _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_static_ ## var's from
// SET_STATIC_VERTEX_SHADER_NEW_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_STATIC_VERTEX_SHADER_NEW
// was called for this particular shader.
#define SET_STATIC_VERTEX_SHADER_NEW( shader ) \
static_assert( shaderStaticTest_ ## shader != 0, "Missing combo!" ); \
static_assert( vsh ## shader != 0, "Not vertex shader!" ); \
pShaderShadow->SetVertexShader( #shader, _vshIndex.GetIndex() )
#endif // CSHADER_H #endif // CSHADER_H

View file

@ -76,7 +76,7 @@ struct CubemapSideData_t
}; };
static CubemapSideData_t s_aCubemapSideData[MAX_MAP_BRUSHSIDES]; static CubemapSideData_t s_aCubemapSideData[MAX_MAP_BRUSHSIDES];
char *g_pParallaxObbStrs[MAX_MAP_CUBEMAPSAMPLES];
inline bool SideHasCubemapAndWasntManuallyReferenced( int iSide ) inline bool SideHasCubemapAndWasntManuallyReferenced( int iSide )
@ -85,8 +85,10 @@ inline bool SideHasCubemapAndWasntManuallyReferenced( int iSide )
} }
void Cubemap_InsertSample( const Vector& origin, int size ) void Cubemap_InsertSample( const Vector &origin, int size, char *pParallaxObbStr = "" )
{ {
g_pParallaxObbStrs[g_nCubemapSamples] = pParallaxObbStr;
dcubemapsample_t *pSample = &g_CubemapSamples[g_nCubemapSamples]; dcubemapsample_t *pSample = &g_CubemapSamples[g_nCubemapSamples];
pSample->origin[0] = ( int )origin[0]; pSample->origin[0] = ( int )origin[0];
pSample->origin[1] = ( int )origin[1]; pSample->origin[1] = ( int )origin[1];
@ -528,7 +530,7 @@ static void GeneratePatchedName( const char *pMaterialName, const PatchInfo_t &i
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Patches the $envmap for a material and all its dependents, returns true if any patching happened // Patches the $envmap for a material and all its dependents, returns true if any patching happened
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, const PatchInfo_t &info, const char *pCubemapTexture ) static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, const PatchInfo_t &info, const char *pCubemapTexture, const char *pParallaxObbMatrix = "" )
{ {
// Do *NOT* patch the material if there is an $envmap specified and it's not 'env_cubemap' // Do *NOT* patch the material if there is an $envmap specified and it's not 'env_cubemap'
@ -546,7 +548,7 @@ static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, cons
const char *pDependentMaterial = FindDependentMaterial( pMaterialName, &pDependentMaterialVar ); const char *pDependentMaterial = FindDependentMaterial( pMaterialName, &pDependentMaterialVar );
if ( pDependentMaterial ) if ( pDependentMaterial )
{ {
bDependentMaterialPatched = PatchEnvmapForMaterialAndDependents( pDependentMaterial, info, pCubemapTexture ); bDependentMaterialPatched = PatchEnvmapForMaterialAndDependents( pDependentMaterial, info, pCubemapTexture, pParallaxObbMatrix );
} }
// If we have neither to patch, we're done // If we have neither to patch, we're done
@ -557,7 +559,7 @@ static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, cons
char pPatchedMaterialName[1024]; char pPatchedMaterialName[1024];
GeneratePatchedName( pMaterialName, info, true, pPatchedMaterialName, 1024 ); GeneratePatchedName( pMaterialName, info, true, pPatchedMaterialName, 1024 );
MaterialPatchInfo_t pPatchInfo[2]; MaterialPatchInfo_t pPatchInfo[6];
int nPatchCount = 0; int nPatchCount = 0;
if ( bShouldPatchEnvCubemap ) if ( bShouldPatchEnvCubemap )
{ {
@ -578,7 +580,30 @@ static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, cons
++nPatchCount; ++nPatchCount;
} }
CreateMaterialPatch( pMaterialName, pPatchedMaterialName, nPatchCount, pPatchInfo, PATCH_REPLACE ); // Parallax cubemap matrix
CUtlVector<char *> matRowList;
if ( pParallaxObbMatrix[0] != '\0' )
{
V_SplitString( pParallaxObbMatrix, ";", matRowList );
pPatchInfo[nPatchCount].m_pKey = "$envMapParallaxOBB1";
pPatchInfo[nPatchCount].m_pValue = matRowList[0];
++nPatchCount;
pPatchInfo[nPatchCount].m_pKey = "$envMapParallaxOBB2";
pPatchInfo[nPatchCount].m_pValue = matRowList[1];
++nPatchCount;
pPatchInfo[nPatchCount].m_pKey = "$envMapParallaxOBB3";
pPatchInfo[nPatchCount].m_pValue = matRowList[2];
++nPatchCount;
pPatchInfo[nPatchCount].m_pKey = "$envMapOrigin";
pPatchInfo[nPatchCount].m_pValue = matRowList[3];
++nPatchCount;
}
CreateMaterialPatch( pMaterialName, pPatchedMaterialName, nPatchCount, pPatchInfo, PATCH_INSERT );
// Clean up parallax stuff
matRowList.PurgeAndDeleteElements();
return true; return true;
} }
@ -597,7 +622,7 @@ static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, cons
// default (skybox) cubemap into this file so the cubemap doesn't have the pink checkerboard at // default (skybox) cubemap into this file so the cubemap doesn't have the pink checkerboard at
// runtime before they run buildcubemaps. // runtime before they run buildcubemaps.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static int Cubemap_CreateTexInfo( int originalTexInfo, int origin[3] ) static int Cubemap_CreateTexInfo( int originalTexInfo, int origin[3], int cubemapIndex )
{ {
// Don't make cubemap tex infos for nodes // Don't make cubemap tex infos for nodes
if ( originalTexInfo == TEXINFO_NODE ) if ( originalTexInfo == TEXINFO_NODE )
@ -638,9 +663,16 @@ static int Cubemap_CreateTexInfo( int originalTexInfo, int origin[3] )
char pTextureName[1024]; char pTextureName[1024];
GeneratePatchedName( "c", info, false, pTextureName, 1024 ); GeneratePatchedName( "c", info, false, pTextureName, 1024 );
// Append origin info if this cubemap has a parallax OBB
char originAppendedString[1024] = "";
if ( g_pParallaxObbStrs[cubemapIndex][0] != '\0' )
{
Q_snprintf( originAppendedString, 1024, "%s;[%d %d %d]", g_pParallaxObbStrs[cubemapIndex], origin[0], origin[1], origin[2] );
}
// Hook the texture into the material and all dependent materials // Hook the texture into the material and all dependent materials
// but if no hooking was necessary, exit out // but if no hooking was necessary, exit out
if ( !PatchEnvmapForMaterialAndDependents( pMaterialName, info, pTextureName ) ) if ( !PatchEnvmapForMaterialAndDependents( pMaterialName, info, pTextureName, originAppendedString ) )
return originalTexInfo; return originalTexInfo;
// Store off the name of the cubemap that we need to create since we successfully patched // Store off the name of the cubemap that we need to create since we successfully patched
@ -730,7 +762,7 @@ void Cubemap_FixupBrushSidesMaterials( void )
} }
#endif #endif
pSide->texinfo = Cubemap_CreateTexInfo( pSide->texinfo, g_CubemapSamples[cubemapID].origin ); pSide->texinfo = Cubemap_CreateTexInfo( pSide->texinfo, g_CubemapSamples[cubemapID].origin, cubemapID );
if ( pSide->pMapDisp ) if ( pSide->pMapDisp )
{ {
pSide->pMapDisp->face.texinfo = pSide->texinfo; pSide->pMapDisp->face.texinfo = pSide->texinfo;
@ -946,7 +978,7 @@ void Cubemap_AttachDefaultCubemapToSpecularSides( void )
Assert( pSide->texinfo == pSide->pMapDisp->face.texinfo ); Assert( pSide->texinfo == pSide->pMapDisp->face.texinfo );
} }
#endif #endif
pSide->texinfo = Cubemap_CreateTexInfo( pSide->texinfo, g_CubemapSamples[iCubemap].origin ); pSide->texinfo = Cubemap_CreateTexInfo( pSide->texinfo, g_CubemapSamples[iCubemap].origin, iCubemap );
if ( pSide->pMapDisp ) if ( pSide->pMapDisp )
{ {
pSide->pMapDisp->face.texinfo = pSide->texinfo; pSide->pMapDisp->face.texinfo = pSide->texinfo;

View file

@ -5,6 +5,7 @@
// $NoKeywords: $ // $NoKeywords: $
//=============================================================================// //=============================================================================//
#include "matrixinvert.h"
#include "vbsp.h" #include "vbsp.h"
#include "map_shared.h" #include "map_shared.h"
#include "disp_vbsp.h" #include "disp_vbsp.h"
@ -1617,17 +1618,97 @@ ChunkFileResult_t CMapFile::LoadEntityCallback(CChunkFile *pFile, int nParam)
{ {
if( ( g_nDXLevel == 0 ) || ( g_nDXLevel >= 70 ) ) if( ( g_nDXLevel == 0 ) || ( g_nDXLevel >= 70 ) )
{ {
const char *pSideListStr = ValueForKey( mapent, "sides" ); const char* pSideListStr = ValueForKey( mapent, "sides" );
char *pParallaxObbStr = ValueForKey( mapent, "parallaxobb" );
int size; int size;
size = IntForKey( mapent, "cubemapsize" ); size = IntForKey( mapent, "cubemapsize" );
Cubemap_InsertSample( mapent->origin, size ); Cubemap_InsertSample( mapent->origin, size, pParallaxObbStr );
Cubemap_SaveBrushSides( pSideListStr );
} }
// clear out this entity // clear out this entity
mapent->epairs = NULL; mapent->epairs = NULL;
return(ChunkFile_Ok); return(ChunkFile_Ok);
} }
//
// parallax_obb brushes are removed after the transformation matrix is found and saved into
// the entity's data (ent will be removed after data transferred to patched materials)
//
if ( !strcmp( "parallax_obb", pClassName ) )
{
matrix3x4_t obbMatrix, invObbMatrix;
SetIdentityMatrix( obbMatrix );
SetIdentityMatrix( invObbMatrix );
// Get corner and its 3 edges (scaled, local x, y, and z axes)
mapbrush_t *brush = &mapbrushes[mapent->firstbrush];
Vector corner, x, y, z;
// Find first valid winding (with these whiles, if not enough valid windings then identity matrix is passed through to VMTs)
int i = 0;
while ( i < brush->numsides )
{
winding_t *wind = brush->original_sides[i].winding;
if ( !wind )
{
i++;
continue;
}
corner = wind->p[0];
y = wind->p[1] - corner;
z = wind->p[3] - corner;
x = CrossProduct( y, z ).Normalized();
i++;
break;
}
// Skip second valid winding (opposite face from first, unusable for finding Z's length)
while ( i < brush->numsides )
{
winding_t *wind = brush->original_sides[i].winding;
if ( !wind )
{
i++;
continue;
}
i++;
break;
}
// Find third valid winding
while ( i < brush->numsides )
{
winding_t *wind = brush->original_sides[i].winding;
if ( !wind )
{
i++;
continue;
}
// Find length of X
// Start with diagonal, then scale X by the projection of diag onto X
Vector diag = wind->p[0] - wind->p[2];
x *= abs( DotProduct( diag, x ) );
// Build transformation matrix (what is needed to turn a [0,0,0] - [1,1,1] cube into this brush)
MatrixSetColumn( x, 0, obbMatrix );
MatrixSetColumn( y, 1, obbMatrix );
MatrixSetColumn( z, 2, obbMatrix );
MatrixSetColumn( corner, 3, obbMatrix );
// Find inverse (we need the world to local matrix, "transformationmatrix" is kind of a misnomer)
MatrixInversion( obbMatrix, invObbMatrix );
break;
}
char szMatrix[1024];
Q_snprintf( szMatrix, 1024, "[%f %f %f %f];[%f %f %f %f];[%f %f %f %f]", invObbMatrix[0][0], invObbMatrix[0][1], invObbMatrix[0][2], invObbMatrix[0][3], invObbMatrix[1][0], invObbMatrix[1][1], invObbMatrix[1][2], invObbMatrix[1][3], invObbMatrix[2][0], invObbMatrix[2][1], invObbMatrix[2][2], invObbMatrix[2][3] );
SetKeyValue( mapent, "transformationmatrix", szMatrix );
return ( ChunkFile_Ok );
}
if ( !strcmp( "test_sidelist", pClassName ) ) if ( !strcmp( "test_sidelist", pClassName ) )
{ {
ConvertSideList(mapent, "sides"); ConvertSideList(mapent, "sides");
@ -2611,6 +2692,28 @@ bool LoadMapFile( const char *pszFileName )
if ((eResult == ChunkFile_Ok) || (eResult == ChunkFile_EOF)) if ((eResult == ChunkFile_Ok) || (eResult == ChunkFile_EOF))
{ {
// Fill out parallax obb matrix array
for ( int i = 0; i < g_nCubemapSamples; i++ )
{
if ( g_pParallaxObbStrs[i][0] != '\0' )
{
entity_t *obbEnt = EntityByName( g_pParallaxObbStrs[i] );
g_pParallaxObbStrs[i] = ValueForKey( obbEnt, "transformationmatrix" );
}
}
// Remove parallax_obb entities (in a nice slow linear search)
for ( int i = 0; i < g_MainMap->num_entities; i++ )
{
entity_t *mapent = &g_MainMap->entities[i];
const char *pClassName = ValueForKey( mapent, "classname" );
if ( !strcmp( "parallax_obb", pClassName ) )
{
mapent->numbrushes = 0;
mapent->epairs = NULL;
}
}
// Update the overlay/side list(s). // Update the overlay/side list(s).
Overlay_UpdateSideLists( g_LoadingMap->m_StartMapOverlays ); Overlay_UpdateSideLists( g_LoadingMap->m_StartMapOverlays );
OverlayTransition_UpdateSideLists( g_LoadingMap->m_StartMapWaterOverlays ); OverlayTransition_UpdateSideLists( g_LoadingMap->m_StartMapWaterOverlays );

View file

@ -607,7 +607,8 @@ void SaveVertexNormals( void );
//============================================================================= //=============================================================================
// cubemap.cpp // cubemap.cpp
void Cubemap_InsertSample( const Vector& origin, int size ); extern char *g_pParallaxObbStrs[MAX_MAP_CUBEMAPSAMPLES];
void Cubemap_InsertSample( const Vector &origin, int size, char *pParallaxObbStr );
void Cubemap_CreateDefaultCubemaps( void ); void Cubemap_CreateDefaultCubemaps( void );
void Cubemap_SaveBrushSides( const char *pSideListStr ); void Cubemap_SaveBrushSides( const char *pSideListStr );
void Cubemap_FixupBrushSidesMaterials( void ); void Cubemap_FixupBrushSidesMaterials( void );