summaryrefslogtreecommitdiff
path: root/materialsystem/stdshaders/lightingonly_vs20.fxc
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /materialsystem/stdshaders/lightingonly_vs20.fxc
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'materialsystem/stdshaders/lightingonly_vs20.fxc')
-rw-r--r--materialsystem/stdshaders/lightingonly_vs20.fxc74
1 files changed, 74 insertions, 0 deletions
diff --git a/materialsystem/stdshaders/lightingonly_vs20.fxc b/materialsystem/stdshaders/lightingonly_vs20.fxc
new file mode 100644
index 0000000..0c0cb3b
--- /dev/null
+++ b/materialsystem/stdshaders/lightingonly_vs20.fxc
@@ -0,0 +1,74 @@
+// STATIC: "HALFLAMBERT" "0..1"
+// STATIC: "USE_STATIC_CONTROL_FLOW" "0..1" [vs20]
+
+// DYNAMIC: "DOWATERFOG" "0..1"
+// DYNAMIC: "SKINNING" "0..1"
+// DYNAMIC: "DYNAMIC_LIGHT" "0..1"
+// DYNAMIC: "STATIC_LIGHT" "0..1"
+// DYNAMIC: "NUM_LIGHTS" "0..2" [vs20]
+
+// If using static control flow on Direct3D, we should use the NUM_LIGHTS=0 combo
+// SKIP: $USE_STATIC_CONTROL_FLOW && ( $NUM_LIGHTS > 0 ) [vs20]
+
+#include "common_vs_fxc.h"
+
+static const int g_FogType = DOWATERFOG;
+static const bool g_bHalfLambert = HALFLAMBERT ? true : false;
+static const int g_nSkinning = SKINNING;
+static const bool g_bDynamicLight = DYNAMIC_LIGHT ? true : false;
+static const bool g_bStaticLight = STATIC_LIGHT ? true : false;
+
+struct VS_INPUT
+{
+ float4 vPos : POSITION;
+ float4 vBoneWeights : BLENDWEIGHT;
+ float4 vBoneIndices : BLENDINDICES;
+ float4 vNormal : NORMAL;
+
+ float3 vSpecular : COLOR1;
+
+ float2 vTexCoord0 : TEXCOORD0;
+ float2 vTexCoord1 : TEXCOORD1;
+ float2 vTexCoord2 : TEXCOORD2;
+
+};
+
+struct VS_OUTPUT
+{
+ float4 vProjPos : POSITION;
+ float3 vColor0 : COLOR0;
+
+ float4 fogFactorW : COLOR1;
+
+#if !defined( _X360 )
+ float fog : FOG;
+#endif
+};
+
+
+VS_OUTPUT main( const VS_INPUT v )
+{
+ VS_OUTPUT o = ( VS_OUTPUT )0;
+
+ float3 vObjNormal;
+ DecompressVertex_Normal( v.vNormal, vObjNormal );
+
+ float3 worldPos, worldNormal;
+ SkinPositionAndNormal( g_bSkinning, v.vPos, vObjNormal, v.vBoneWeights, v.vBoneIndices, worldPos, worldNormal );
+
+ o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
+
+ o.fogFactorW = CalcFog( worldPos, o.vProjPos, g_FogType );
+#if !defined( _X360 )
+ o.fog = o.fogFactorW;
+#endif
+
+ // Compute vertex lighting
+#if ( USE_STATIC_CONTROL_FLOW ) || defined ( SHADER_MODEL_VS_3_0 )
+ o.vColor0 = DoLighting( worldPos, worldNormal, float3(0.0f, 0.0f, 0.0f), g_bStaticLight, g_bDynamicLight, g_bHalfLambert );
+#else
+ o.vColor0 = DoLightingUnrolled( worldPos, worldNormal, float3(0.0f, 0.0f, 0.0f), g_bStaticLight, g_bDynamicLight, g_bHalfLambert, NUM_LIGHTS );
+#endif
+
+ return o;
+} \ No newline at end of file