From 7309a5f13f63fdcc7b1e090f6c176113a9d95061 Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Mon, 23 Dec 2013 14:58:45 -0800 Subject: Added many shader source files This should include the latest version of every shader that was in the 2007 SDK. It also includes a smattering of debug shaders, both VR distortion shaders, and other assorted shaders that will hopefully be useful. None of these new files are included in the game shader DLL project. If you need to modify one of these shaders for use in your mod you will need to rename it so that you don't collide with the version of that shader that lives in stdshader_dx9.dll. --- .../stdshaders/DebugDrawEnvmapMask.cpp | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 mp/src/materialsystem/stdshaders/DebugDrawEnvmapMask.cpp (limited to 'mp/src/materialsystem/stdshaders/DebugDrawEnvmapMask.cpp') diff --git a/mp/src/materialsystem/stdshaders/DebugDrawEnvmapMask.cpp b/mp/src/materialsystem/stdshaders/DebugDrawEnvmapMask.cpp new file mode 100644 index 00000000..9f3c34bf --- /dev/null +++ b/mp/src/materialsystem/stdshaders/DebugDrawEnvmapMask.cpp @@ -0,0 +1,94 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//===========================================================================// + +#include "BaseVSShader.h" +#include "debugdrawenvmapmask_vs20.inc" +#include "debugdrawenvmapmask_ps20.inc" +#include "debugdrawenvmapmask_ps20b.inc" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +BEGIN_VS_SHADER_FLAGS( DebugDrawEnvmapMask, "Help for DebugDrawEnvmapMask", SHADER_NOT_EDITABLE ) + + BEGIN_SHADER_PARAMS + SHADER_PARAM( SHOWALPHA, SHADER_PARAM_TYPE_INTEGER, "0", "" ) + END_SHADER_PARAMS + + SHADER_INIT_PARAMS() + { + SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING ); + } + + SHADER_INIT + { + } + + SHADER_FALLBACK + { + if( g_pHardwareConfig->GetDXSupportLevel() < 90 ) + { +// Assert( 0 ); + return "Wireframe"; + } + return 0; + } + + SHADER_DRAW + { + SHADOW_STATE + { + pShaderShadow->EnableTexture( SHADER_SAMPLER0, true ); + + // Set stream format (note that this shader supports compression) + unsigned int flags = VERTEX_POSITION | VERTEX_FORMAT_COMPRESSED; + int nTexCoordCount = 1; + int userDataSize = 0; + pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, NULL, userDataSize ); + + DECLARE_STATIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 ); + SET_STATIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 ); + + if( g_pHardwareConfig->SupportsPixelShaders_2_b() ) + { + DECLARE_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b ); + SET_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b ); + } + else + { + DECLARE_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 ); + SET_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 ); + } + } + DYNAMIC_STATE + { + int numBones = s_pShaderAPI->GetCurrentNumBones(); + + DECLARE_DYNAMIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); + SET_DYNAMIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 ); + + bool bShowAlpha = params[SHOWALPHA]->GetIntValue() ? true : false; + if( g_pHardwareConfig->SupportsPixelShaders_2_b() ) + { + DECLARE_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b ); + SET_DYNAMIC_PIXEL_SHADER_COMBO( SHOWALPHA, bShowAlpha ); + SET_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b ); + } + else + { + DECLARE_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 ); + SET_DYNAMIC_PIXEL_SHADER_COMBO( SHOWALPHA, bShowAlpha ); + SET_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 ); + } + + BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME ); + SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, BASETEXTURETRANSFORM ); + } + Draw(); + } +END_SHADER -- cgit v1.2.3