Added Parallax Corrected Cubemaps
This commit is contained in:
parent
75bf03a4bc
commit
9342f27ae2
19 changed files with 863 additions and 712 deletions
BIN
devtools/bin/ShaderCompile.exe
Normal file
BIN
devtools/bin/ShaderCompile.exe
Normal file
Binary file not shown.
31
devtools/bin/process_shaders.ps1
Normal file
31
devtools/bin/process_shaders.ps1
Normal 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()
|
|
@ -590,7 +590,7 @@ jmp_buf host_enddemo;
|
|||
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_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_speeds( "host_speeds","0", 0, "Show general system running times." ); // set for running times
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ char const *GetImpactDecal( C_BaseEntity *pEntity, int iMaterial, int iDamageTyp
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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
|
||||
{
|
||||
|
|
2
gamedata
2
gamedata
|
@ -1 +1 @@
|
|||
Subproject commit eb380ec60ead23d5be47d89c36e321c6a066d42c
|
||||
Subproject commit cb20bc91be258e948787a9bee8fd99c1cf658612
|
BIN
materialsystem/stdshaders/ShaderCompile.exe
Normal file
BIN
materialsystem/stdshaders/ShaderCompile.exe
Normal file
Binary file not shown.
|
@ -44,8 +44,8 @@ REM PC SHADERS
|
|||
REM ****************
|
||||
if /i "%ALLSHADERS_CONFIG%" == "pc" (
|
||||
%BUILD_SHADER% stdshader_dx9_20b
|
||||
%BUILD_SHADER% stdshader_dx9_20b_new -dx9_30
|
||||
%BUILD_SHADER% stdshader_dx9_30 -dx9_30 -force30
|
||||
%BUILD_SHADER% stdshader_dx9_20b_new
|
||||
%BUILD_SHADER% stdshader_dx9_30 -force30
|
||||
rem %BUILD_SHADER% stdshader_dx10 -dx10
|
||||
)
|
||||
|
||||
|
|
|
@ -9,62 +9,37 @@ set TTEXE=time /t
|
|||
:no_ttexe_end
|
||||
|
||||
echo.
|
||||
rem echo ==================== buildshaders %* ==================
|
||||
echo ==================== buildshaders %* ==================
|
||||
%TTEXE% -cur-Q
|
||||
set tt_start=%ERRORLEVEL%
|
||||
set tt_chkpt=%tt_start%
|
||||
|
||||
|
||||
REM ****************
|
||||
REM usage: buildshaders <shaderProjectName> [-x360]
|
||||
REM usage: buildshaders <shaderProjectName>
|
||||
REM ****************
|
||||
|
||||
setlocal
|
||||
set arg_filename=%1
|
||||
rem set shadercompilecommand=echo shadercompile.exe -mpi_graphics -mpi_TrackEvents
|
||||
set shadercompilecommand=shadercompile.exe
|
||||
set shadercompileworkers=128
|
||||
set x360_args=
|
||||
set targetdir=..\..\..\game\hl2\shaders
|
||||
set shadercompilecommand=ShaderCompile.exe
|
||||
set targetdir=shaders
|
||||
set SrcDirBase=..\..
|
||||
set ChangeToDir=../../../game/bin
|
||||
set shaderDir=shaders
|
||||
set SDKArgs=
|
||||
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
|
||||
set SDKArgs=-local
|
||||
|
||||
if "%1" == "" goto usage
|
||||
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
|
||||
:set_force30_arg
|
||||
set DIRECTX_FORCE_MODEL=30
|
||||
set IS30=1
|
||||
goto set_force_end
|
||||
:set_force_end
|
||||
|
||||
if /i "%2" == "-x360" goto set_x360_args
|
||||
if /i "%2" == "-game" goto set_mod_args
|
||||
goto build_shaders
|
||||
|
||||
|
@ -73,47 +48,43 @@ REM USAGE
|
|||
REM ****************
|
||||
:usage
|
||||
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 " sourceDir is where the source code is (where it will find scripts and compilers)."
|
||||
echo "ex : buildshaders myshaders"
|
||||
echo "ex : buildshaders myshaders -game c:\steam\steamapps\sourcemods\mymod -source c:\mymod\src"
|
||||
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 MOD ARGS - look for -game or the vproject environment variable
|
||||
REM ****************
|
||||
:set_mod_args
|
||||
|
||||
if not exist %sourcesdk%\bin\shadercompile.exe goto NoShaderCompile
|
||||
set ChangeToDir=%sourcesdk%\bin
|
||||
if not exist "..\..\devtools\bin\ShaderCompile.exe" goto NoShaderCompile
|
||||
set ChangeToDir=%SrcDirBase%\devtools\bin\
|
||||
|
||||
if /i "%4" NEQ "-source" goto NoSourceDirSpecified
|
||||
set SrcDirBase=%~5
|
||||
|
||||
REM ** use the -game parameter to tell us where to put the files
|
||||
set targetdir=%~3\shaders
|
||||
set SDKArgs=-nompi -game "%~3"
|
||||
|
||||
if not exist "%~3\gameinfo.txt" goto InvalidGameDirectory
|
||||
|
||||
if not exist "%inputbase%.txt" goto InvalidInputFile
|
||||
|
||||
goto build_shaders
|
||||
|
||||
REM ****************
|
||||
REM ERRORS
|
||||
REM ****************
|
||||
:InvalidGameDirectory
|
||||
echo -
|
||||
echo Error: "%~3" is not a valid game directory.
|
||||
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
|
||||
|
||||
:NoSourceDirSpecified
|
||||
|
@ -122,9 +93,7 @@ goto usage
|
|||
goto end
|
||||
|
||||
:NoShaderCompile
|
||||
echo -
|
||||
echo - ERROR: shadercompile.exe doesn't exist in %sourcesdk%\bin
|
||||
echo -
|
||||
echo - ERROR: ShaderCompile.exe doesn't exist in devtools\bin
|
||||
goto end
|
||||
|
||||
REM ****************
|
||||
|
@ -137,115 +106,35 @@ rem echo %inputbase%
|
|||
rem echo --------------------------------
|
||||
REM make sure that target dirs exist
|
||||
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%\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.
|
||||
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
|
||||
|
||||
|
||||
REM ****************
|
||||
REM Revert any targets (vcs or inc) that are opened for integrate.
|
||||
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%
|
||||
set SHVER=20b
|
||||
if defined IS30 (
|
||||
set SHVER=30
|
||||
)
|
||||
|
||||
REM ****************
|
||||
REM Deal with perforce operations for inc files
|
||||
REM ****************
|
||||
if exist inclist.txt if not "%VALVE_NO_AUTO_P4_SHADERS%" == "1" (
|
||||
echo Executing perforce operations on .inc files.
|
||||
perl ..\..\devtools\bin\p4autocheckout.pl inclist.txt "Shader Auto Checkout INC" . %SHADERINCPATH%
|
||||
)
|
||||
title %1 %SHVER%
|
||||
|
||||
echo Building inc files and worklist for %inputbase%...
|
||||
|
||||
set DYNAMIC=
|
||||
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 Add the executables to the worklist.
|
||||
REM ****************
|
||||
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 PC Shader copy
|
||||
REM Publish the generated files to the output dir using XCOPY
|
||||
REM This batch file may have been invoked standalone or slaved (master does final smart mirror copy)
|
||||
REM ****************
|
||||
:DoXCopy
|
||||
if not "%dynamic_shaders%" == "1" (
|
||||
if exist makefile.%inputbase%.copy echo Publishing shaders to target...
|
||||
if exist makefile.%inputbase%.copy perl %SrcDirBase%\devtools\bin\copyshaders.pl makefile.%inputbase%.copy %x360_args%
|
||||
)
|
||||
|
||||
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/...
|
||||
if not exist "%targetdir%" md "%targetdir%"
|
||||
if not "%targetdir%"=="%shaderDir%" xcopy %shaderDir%\*.* "%targetdir%" /e /y
|
||||
)
|
||||
goto end
|
||||
|
||||
REM ****************
|
||||
REM END
|
||||
|
@ -254,5 +143,4 @@ REM ****************
|
|||
|
||||
|
||||
%TTEXE% -diff %tt_start%
|
||||
echo.
|
||||
|
||||
echo.
|
File diff suppressed because it is too large
Load diff
|
@ -73,6 +73,12 @@ BEGIN_VS_SHADER( LightmappedGeneric,
|
|||
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( 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
|
||||
|
||||
void SetupVars( LightmappedGeneric_DX9_Vars_t& info )
|
||||
|
@ -134,6 +140,13 @@ END_SHADER_PARAMS
|
|||
info.m_nOutlineStart1 = OUTLINESTART1;
|
||||
info.m_nOutlineEnd0 = OUTLINEEND0;
|
||||
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
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "lightmappedgeneric_vs20.inc"
|
||||
#include "lightmappedgeneric_ps20b.inc"
|
||||
|
||||
#include "shaderlib/cshader.h"
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
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 )
|
||||
{
|
||||
// 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() )
|
||||
{
|
||||
params[FLASHLIGHTTEXTURE]->SetStringValue( "effects/flashlight_border" );
|
||||
|
@ -313,6 +321,13 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
|||
(info.m_nBlendModulateTexture != -1) &&
|
||||
(params[info.m_nBlendModulateTexture]->IsTexture() );
|
||||
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() )
|
||||
{
|
||||
|
@ -547,34 +562,36 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
|||
|
||||
if ( g_pHardwareConfig->SupportsPixelShaders_2_b() )
|
||||
{
|
||||
DECLARE_STATIC_PIXEL_SHADER( lightmappedgeneric_ps20b );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURE2, hasBaseTexture2 );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( DETAILTEXTURE, hasDetailTexture );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BUMPMAP, bumpmap_variant );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BUMPMAP2, hasBump2 );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BUMPMASK, hasBumpMask );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( DIFFUSEBUMPMAP, hasDiffuseBumpmap );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( CUBEMAP, hasEnvmap );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( ENVMAPMASK, hasEnvmapMask );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASEALPHAENVMAPMASK, hasBaseAlphaEnvmapMask );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( SELFILLUM, hasSelfIllum );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( NORMALMAPALPHAENVMAPMASK, hasNormalMapAlphaEnvmapMask );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURENOENVMAP, params[info.m_nBaseTextureNoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURE2NOENVMAP, params[info.m_nBaseTexture2NoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( WARPLIGHTING, hasLightWarpTexture );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( FANCY_BLENDING, bHasBlendModulateTexture );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( MASKEDBLENDING, bMaskedBlending);
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( RELIEF_MAPPING, bReliefMapping );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( SEAMLESS, bSeamlessMapping );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( OUTLINE, bHasOutline );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( SOFTEDGES, bHasSoftEdges );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( DETAIL_BLEND_MODE, nDetailBlendMode );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( NORMAL_DECODE_MODE, (int) NORMAL_DECODE_NONE );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( NORMALMASK_DECODE_MODE, (int) NORMAL_DECODE_NONE );
|
||||
DECLARE_STATIC_PIXEL_SHADER_NEW( lightmappedgeneric_ps20b );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASETEXTURE2, hasBaseTexture2 );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( DETAILTEXTURE, hasDetailTexture );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( BUMPMAP, bumpmap_variant );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( BUMPMAP2, hasBump2 );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( BUMPMASK, hasBumpMask );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( DIFFUSEBUMPMAP, hasDiffuseBumpmap );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( CUBEMAP, hasEnvmap );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( ENVMAPMASK, hasEnvmapMask );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASEALPHAENVMAPMASK, hasBaseAlphaEnvmapMask );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( SELFILLUM, hasSelfIllum );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( NORMALMAPALPHAENVMAPMASK, hasNormalMapAlphaEnvmapMask );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASETEXTURENOENVMAP, params[info.m_nBaseTextureNoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( BASETEXTURE2NOENVMAP, params[info.m_nBaseTexture2NoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( WARPLIGHTING, hasLightWarpTexture );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( FANCY_BLENDING, bHasBlendModulateTexture );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( MASKEDBLENDING, bMaskedBlending);
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( RELIEF_MAPPING, bReliefMapping );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( SEAMLESS, bSeamlessMapping );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( OUTLINE, bHasOutline );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( SOFTEDGES, bHasSoftEdges );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( DETAIL_BLEND_MODE, nDetailBlendMode );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( NORMAL_DECODE_MODE, (int) NORMAL_DECODE_NONE );
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( NORMALMASK_DECODE_MODE, (int) NORMAL_DECODE_NONE );
|
||||
#ifdef _X360
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( FLASHLIGHT, hasFlashlight);
|
||||
SET_STATIC_PIXEL_SHADER_NEW_COMBO( FLASHLIGHT, hasFlashlight);
|
||||
#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
|
||||
{
|
||||
|
@ -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( NORMALMASK_DECODE_MODE, 0 ); // No normal compression with ps_2_0
|
||||
SET_STATIC_PIXEL_SHADER( lightmappedgeneric_ps20 );
|
||||
printf("sucks\n");
|
||||
}
|
||||
// HACK HACK HACK - enable alpha writes all the time so that we have them for
|
||||
// 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 );
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
@ -917,17 +957,17 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
|||
float envmapContrast = params[info.m_nEnvmapContrast]->GetFloatValue();
|
||||
if ( g_pHardwareConfig->SupportsPixelShaders_2_b() )
|
||||
{
|
||||
DECLARE_DYNAMIC_PIXEL_SHADER( lightmappedgeneric_ps20b );
|
||||
SET_DYNAMIC_PIXEL_SHADER_COMBO( FASTPATH, bPixelShaderFastPath || pContextData->m_bPixelShaderForceFastPathBecauseOutline );
|
||||
SET_DYNAMIC_PIXEL_SHADER_COMBO( FASTPATHENVMAPCONTRAST, bPixelShaderFastPath && envmapContrast == 1.0f );
|
||||
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
|
||||
DECLARE_DYNAMIC_PIXEL_SHADER_NEW( lightmappedgeneric_ps20b );
|
||||
SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( FASTPATH, bPixelShaderFastPath || pContextData->m_bPixelShaderForceFastPathBecauseOutline );
|
||||
SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( FASTPATHENVMAPCONTRAST, bPixelShaderFastPath && envmapContrast == 1.0f );
|
||||
SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
|
||||
|
||||
// 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_COMBO( WRITEWATERFOGTODESTALPHA, bWriteWaterFogToAlpha );
|
||||
SET_DYNAMIC_PIXEL_SHADER_COMBO( LIGHTING_PREVIEW, nFixedLightingMode );
|
||||
SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( WRITE_DEPTH_TO_DESTALPHA, bWriteDepthToAlpha );
|
||||
SET_DYNAMIC_PIXEL_SHADER_NEW_COMBO( WRITEWATERFOGTODESTALPHA, bWriteWaterFogToAlpha );
|
||||
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
|
||||
{
|
||||
|
|
|
@ -86,7 +86,12 @@ struct LightmappedGeneric_DX9_Vars_t
|
|||
int m_nOutlineStart1;
|
||||
int m_nOutlineEnd0;
|
||||
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 );
|
||||
|
|
|
@ -100,7 +100,11 @@ const float4 g_FlashlightAttenuationFactors : register( c13 );
|
|||
const float3 g_FlashlightPos : register( c14 );
|
||||
const float4x4 g_FlashlightWorldToTexture : register( c15 ); // through c18
|
||||
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 LightmapSampler : register( s1 );
|
||||
|
@ -530,7 +534,26 @@ HALF4 main( PS_INPUT i ) : COLOR
|
|||
HALF fresnel = 1.0 - dot( worldSpaceNormal, eyeVect );
|
||||
fresnel = pow( fresnel, 5.0 );
|
||||
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 *= specularFactor;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
// STATIC: "NORMALMASK_DECODE_MODE" "0..0" [PC]
|
||||
// STATIC: "DETAIL_BLEND_MODE" "0..11"
|
||||
// STATIC: "FLASHLIGHT" "0..1" [ps20b] [XBOX]
|
||||
// STATIC: "PARALLAXCORRECT" "0..1"
|
||||
|
||||
// DYNAMIC: "FASTPATHENVMAPCONTRAST" "0..1"
|
||||
// DYNAMIC: "FASTPATH" "0..1"
|
||||
|
@ -54,6 +55,8 @@
|
|||
// SKIP: ($DETAIL_BLEND_MODE == 8 ) || ($DETAIL_BLEND_MODE == 9 )
|
||||
// SKIP ($DETAIL_BLEND_MODE == 10 ) && ($BUMPMAP == 0 )
|
||||
// SKIP ($DETAIL_BLEND_MODE == 11 ) && ($BUMPMAP != 0 )
|
||||
// SKIP: $PARALLAXCORRECT && !$CUBEMAP
|
||||
// SKIP: $PARALLAXCORRECT [ps20]
|
||||
|
||||
#include "lightmappedgeneric_ps2_3_x.h"
|
||||
|
||||
|
|
|
@ -119,6 +119,7 @@ BEGIN_VS_SHADER( WorldVertexTransition_DX9, "Help for WorldVertexTransition" )
|
|||
info.m_nSelfShadowedBumpFlag = SSBUMP;
|
||||
info.m_nSeamlessMappingScale = SEAMLESS_SCALE;
|
||||
info.m_nAlphaTestReference = -1;
|
||||
info.m_bEnableParallaxCubemaps = false;
|
||||
}
|
||||
|
||||
SHADER_FALLBACK
|
||||
|
|
|
@ -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 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
|
||||
#define DECLARE_DYNAMIC_PIXEL_SHADER( shader ) \
|
||||
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 ## shader ); \
|
||||
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
|
||||
|
|
|
@ -76,7 +76,7 @@ struct CubemapSideData_t
|
|||
};
|
||||
|
||||
static CubemapSideData_t s_aCubemapSideData[MAX_MAP_BRUSHSIDES];
|
||||
|
||||
char *g_pParallaxObbStrs[MAX_MAP_CUBEMAPSAMPLES];
|
||||
|
||||
|
||||
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];
|
||||
pSample->origin[0] = ( int )origin[0];
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
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'
|
||||
|
||||
|
@ -546,7 +548,7 @@ static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, cons
|
|||
const char *pDependentMaterial = FindDependentMaterial( pMaterialName, &pDependentMaterialVar );
|
||||
if ( pDependentMaterial )
|
||||
{
|
||||
bDependentMaterialPatched = PatchEnvmapForMaterialAndDependents( pDependentMaterial, info, pCubemapTexture );
|
||||
bDependentMaterialPatched = PatchEnvmapForMaterialAndDependents( pDependentMaterial, info, pCubemapTexture, pParallaxObbMatrix );
|
||||
}
|
||||
|
||||
// If we have neither to patch, we're done
|
||||
|
@ -557,7 +559,7 @@ static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, cons
|
|||
char pPatchedMaterialName[1024];
|
||||
GeneratePatchedName( pMaterialName, info, true, pPatchedMaterialName, 1024 );
|
||||
|
||||
MaterialPatchInfo_t pPatchInfo[2];
|
||||
MaterialPatchInfo_t pPatchInfo[6];
|
||||
int nPatchCount = 0;
|
||||
if ( bShouldPatchEnvCubemap )
|
||||
{
|
||||
|
@ -578,7 +580,30 @@ static bool PatchEnvmapForMaterialAndDependents( const char *pMaterialName, cons
|
|||
++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;
|
||||
}
|
||||
|
@ -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
|
||||
// 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
|
||||
if ( originalTexInfo == TEXINFO_NODE )
|
||||
|
@ -638,9 +663,16 @@ static int Cubemap_CreateTexInfo( int originalTexInfo, int origin[3] )
|
|||
char 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
|
||||
// but if no hooking was necessary, exit out
|
||||
if ( !PatchEnvmapForMaterialAndDependents( pMaterialName, info, pTextureName ) )
|
||||
if ( !PatchEnvmapForMaterialAndDependents( pMaterialName, info, pTextureName, originAppendedString ) )
|
||||
return originalTexInfo;
|
||||
|
||||
// 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
|
||||
|
||||
pSide->texinfo = Cubemap_CreateTexInfo( pSide->texinfo, g_CubemapSamples[cubemapID].origin );
|
||||
pSide->texinfo = Cubemap_CreateTexInfo( pSide->texinfo, g_CubemapSamples[cubemapID].origin, cubemapID );
|
||||
if ( pSide->pMapDisp )
|
||||
{
|
||||
pSide->pMapDisp->face.texinfo = pSide->texinfo;
|
||||
|
@ -946,7 +978,7 @@ void Cubemap_AttachDefaultCubemapToSpecularSides( void )
|
|||
Assert( pSide->texinfo == pSide->pMapDisp->face.texinfo );
|
||||
}
|
||||
#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 )
|
||||
{
|
||||
pSide->pMapDisp->face.texinfo = pSide->texinfo;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#include "matrixinvert.h"
|
||||
#include "vbsp.h"
|
||||
#include "map_shared.h"
|
||||
#include "disp_vbsp.h"
|
||||
|
@ -1617,17 +1618,97 @@ ChunkFileResult_t CMapFile::LoadEntityCallback(CChunkFile *pFile, int nParam)
|
|||
{
|
||||
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;
|
||||
size = IntForKey( mapent, "cubemapsize" );
|
||||
Cubemap_InsertSample( mapent->origin, size );
|
||||
Cubemap_SaveBrushSides( pSideListStr );
|
||||
Cubemap_InsertSample( mapent->origin, size, pParallaxObbStr );
|
||||
}
|
||||
// clear out this entity
|
||||
mapent->epairs = NULL;
|
||||
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 ) )
|
||||
{
|
||||
ConvertSideList(mapent, "sides");
|
||||
|
@ -2611,6 +2692,28 @@ bool LoadMapFile( const char *pszFileName )
|
|||
|
||||
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).
|
||||
Overlay_UpdateSideLists( g_LoadingMap->m_StartMapOverlays );
|
||||
OverlayTransition_UpdateSideLists( g_LoadingMap->m_StartMapWaterOverlays );
|
||||
|
|
|
@ -607,7 +607,8 @@ void SaveVertexNormals( void );
|
|||
|
||||
//=============================================================================
|
||||
// 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_SaveBrushSides( const char *pSideListStr );
|
||||
void Cubemap_FixupBrushSidesMaterials( void );
|
||||
|
|
Loading…
Reference in a new issue