aboutsummaryrefslogtreecommitdiff
path: root/sp/src/materialsystem/stdshaders/vertexlitgeneric_flashlight_vs11.vsh
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-12-23 14:58:45 -0800
committerJoe Ludwig <[email protected]>2013-12-23 15:00:03 -0800
commit7309a5f13f63fdcc7b1e090f6c176113a9d95061 (patch)
treead65c7fbe46a3c70bdc0a1426e88247ce1b0d7f5 /sp/src/materialsystem/stdshaders/vertexlitgeneric_flashlight_vs11.vsh
parentMerge pull request #182 from ardneran/master (diff)
downloadsource-sdk-2013-7309a5f13f63fdcc7b1e090f6c176113a9d95061.tar.xz
source-sdk-2013-7309a5f13f63fdcc7b1e090f6c176113a9d95061.zip
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.
Diffstat (limited to 'sp/src/materialsystem/stdshaders/vertexlitgeneric_flashlight_vs11.vsh')
-rw-r--r--sp/src/materialsystem/stdshaders/vertexlitgeneric_flashlight_vs11.vsh137
1 files changed, 137 insertions, 0 deletions
diff --git a/sp/src/materialsystem/stdshaders/vertexlitgeneric_flashlight_vs11.vsh b/sp/src/materialsystem/stdshaders/vertexlitgeneric_flashlight_vs11.vsh
new file mode 100644
index 00000000..a5810b5e
--- /dev/null
+++ b/sp/src/materialsystem/stdshaders/vertexlitgeneric_flashlight_vs11.vsh
@@ -0,0 +1,137 @@
+vs.1.1
+
+# DYNAMIC: "DOWATERFOG" "0..1"
+# DYNAMIC: "SKINNING" "0..1"
+# STATIC: "TEETH" "0..1"
+
+#include "macros.vsh"
+
+local( $worldPos, $worldNormal, $projPos );
+
+alloc $worldPos
+alloc $worldNormal
+alloc $projPos
+
+if( 0 )
+{
+ ; NOTE: Don't do this optimization anymore since it would mean a gazillion combos
+ ; Special case for static prop lighting. We can go directly from
+ ; world to proj space for position, with the exception of z, which
+ ; is needed for fogging *if* height fog is enabled.
+
+ ; NOTE: We don't use this path if $envmap is defined since we need
+ ; worldpos for envmapping.
+ dp4 $projPos.x, $vPos, $cModelViewProj0
+ dp4 $projPos.y, $vPos, $cModelViewProj1
+ dp4 $projPos.z, $vPos, $cModelViewProj2
+ dp4 $projPos.w, $vPos, $cModelViewProj3
+ ; normal
+ dp3 $worldNormal.x, $vNormal, $cModel0
+ dp3 $worldNormal.y, $vNormal, $cModel1
+ dp3 $worldNormal.z, $vNormal, $cModel2
+
+ ; Need this for height fog if it's enabled and for height clipping
+ dp4 $worldPos.z, $vPos, $cModel2
+}
+else
+{
+ &SkinPositionAndNormal( $worldPos, $worldNormal );
+
+ if( $SKINNING == 1 )
+ {
+ &Normalize( $worldNormal );
+ }
+
+ ;------------------------------------------------------------------------------
+ ; Transform the position from world to view space
+ ;------------------------------------------------------------------------------
+ dp4 $projPos.x, $worldPos, $cViewProj0
+ dp4 $projPos.y, $worldPos, $cViewProj1
+ dp4 $projPos.z, $worldPos, $cViewProj2
+ dp4 $projPos.w, $worldPos, $cViewProj3
+}
+
+mov oPos, $projPos
+
+;------------------------------------------------------------------------------
+; Fog
+;------------------------------------------------------------------------------
+&CalcFog( $worldPos, $projPos );
+
+; base tex coords
+dp4 oT1.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_6
+dp4 oT1.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_7
+
+; normal map coords
+;dp4 oT3.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_8
+;dp4 oT3.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_9
+
+; spotlight texcoords
+dp4 oT0.x, $worldPos, $SHADER_SPECIFIC_CONST_1
+dp4 oT0.y, $worldPos, $SHADER_SPECIFIC_CONST_2
+dp4 oT0.z, $worldPos, $SHADER_SPECIFIC_CONST_3
+dp4 oT0.w, $worldPos, $SHADER_SPECIFIC_CONST_4
+
+local( $worldPosToLightVector, $distFactors );
+
+alloc $worldPosToLightVector
+
+sub $worldPosToLightVector, $SHADER_SPECIFIC_CONST_0, $worldPos
+mov oT2, $worldPosToLightVector
+
+local( $distatten );
+alloc $distatten
+; $distatten = [ 1, 1/dist, 1/distsquared ]
+
+; dist squared
+dp3 $distatten.z, $worldPosToLightVector, $worldPosToLightVector
+
+; oodist
+rsq $distatten.y, $distatten.z
+
+mov $distatten.x, $cOne
+
+local( $dist );
+alloc $dist
+mul $dist.x, $distatten.z, $distatten.y
+
+rcp $distatten.z, $distatten.z ; 1/distsquared
+
+local( $endFalloffFactor );
+alloc $endFalloffFactor
+
+; ( dist - farZ )
+sub $endFalloffFactor.x, $dist.x, $SHADER_SPECIFIC_CONST_5.w
+; 1 / ( (0.6f * farZ) - farZ)
+mul $endFalloffFactor, $endFalloffFactor.x, $SHADER_SPECIFIC_CONST_0.w
+max $endFalloffFactor, $endFalloffFactor, $cZero
+min $endFalloffFactor, $endFalloffFactor, $cOne
+
+local( $vertAtten );
+alloc $vertAtten
+dp3 $vertAtten, $distatten, $SHADER_SPECIFIC_CONST_5
+mul $vertAtten, $vertAtten, $endFalloffFactor
+
+if( $TEETH )
+{
+ alloc $mouthAtten
+ dp3 $mouthAtten, $worldNormal.xyz, $SHADER_SPECIFIC_CONST_10.xyz
+ max $mouthAtten, $cZero, $mouthAtten
+ mul $mouthAtten, $mouthAtten, $SHADER_SPECIFIC_CONST_10.w
+ mul $vertAtten, $vertAtten, $mouthAtten
+ free $mouthAtten
+}
+
+mov oD0, $vertAtten
+
+mov oT3.xyz, $worldNormal.xyz
+
+
+free $dist
+free $endFalloffFactor
+free $worldPos
+free $worldNormal
+free $projPos
+free $worldPosToLightVector
+free $distatten
+free $vertAtten