aboutsummaryrefslogtreecommitdiff
path: root/mp/src/materialsystem/stdshaders/eyes.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 /mp/src/materialsystem/stdshaders/eyes.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 'mp/src/materialsystem/stdshaders/eyes.vsh')
-rw-r--r--mp/src/materialsystem/stdshaders/eyes.vsh80
1 files changed, 80 insertions, 0 deletions
diff --git a/mp/src/materialsystem/stdshaders/eyes.vsh b/mp/src/materialsystem/stdshaders/eyes.vsh
new file mode 100644
index 00000000..58ae021d
--- /dev/null
+++ b/mp/src/materialsystem/stdshaders/eyes.vsh
@@ -0,0 +1,80 @@
+vs.1.1
+;------------------------------------------------------------------------------
+; $SHADER_SPECIFIC_CONST_0 = eyeball origin
+; $SHADER_SPECIFIC_CONST_1 = eyeball up * 0.5
+; $SHADER_SPECIFIC_CONST_2 = iris projection U
+; $SHADER_SPECIFIC_CONST_3 = iris projection V
+; $SHADER_SPECIFIC_CONST_4 = glint projection U
+; $SHADER_SPECIFIC_CONST_5 = glint projection V
+;------------------------------------------------------------------------------
+
+# STATIC: "HALF_LAMBERT" "0..1"
+# DYNAMIC: "DOWATERFOG" "0..1"
+# DYNAMIC: "LIGHT_COMBO" "0..21"
+# DYNAMIC: "SKINNING" "0..1"
+
+#include "macros.vsh"
+
+;------------------------------------------------------------------------------
+; Vertex blending (whacks r1-r7, positions in r7)
+;------------------------------------------------------------------------------
+&AllocateRegister( \$worldPos );
+&SkinPosition( $worldPos );
+
+;------------------------------------------------------------------------------
+; Transform the position from world to view space
+;------------------------------------------------------------------------------
+
+&AllocateRegister( \$projPos );
+
+dp4 $projPos.x, $worldPos, $cViewProj0
+dp4 $projPos.y, $worldPos, $cViewProj1
+dp4 $projPos.z, $worldPos, $cViewProj2
+dp4 $projPos.w, $worldPos, $cViewProj3
+mov oPos, $projPos
+
+;------------------------------------------------------------------------------
+; Normal is based on vertex position
+;------------------------------------------------------------------------------
+&AllocateRegister( \$worldNormal );
+&AllocateRegister( \$normalDotUp );
+
+sub $worldNormal, $worldPos, $SHADER_SPECIFIC_CONST_0 ; Normal = (Pos - Eye origin)
+dp3 $normalDotUp, $worldNormal, $SHADER_SPECIFIC_CONST_1 ; Normal -= 0.5f * (Normal dot Eye Up) * Eye Up
+mul $normalDotUp, $normalDotUp, $cHalf
+mad $worldNormal, -$normalDotUp, $SHADER_SPECIFIC_CONST_1, $worldNormal
+
+&FreeRegister( \$normalDotUp );
+
+; normalize the normal
+&Normalize( $worldNormal );
+
+;------------------------------------------------------------------------------
+; Lighting
+;------------------------------------------------------------------------------
+&DoLighting( $worldPos, $worldNormal );
+
+&FreeRegister( \$worldNormal );
+
+;------------------------------------------------------------------------------
+; Fog
+;------------------------------------------------------------------------------
+
+&CalcFog( $worldPos, $projPos );
+
+&FreeRegister( \$projPos );
+
+;------------------------------------------------------------------------------
+; Texture coordinates
+; Texture 0 is the base texture
+; Texture 1 is a planar projection used for the iris
+; Texture 2 is a planar projection used for the glint
+;------------------------------------------------------------------------------
+
+mov oT0, $vTexCoord0
+dp4 oT1.x, $SHADER_SPECIFIC_CONST_2, $worldPos
+dp4 oT1.y, $SHADER_SPECIFIC_CONST_3, $worldPos
+dp4 oT2.x, $SHADER_SPECIFIC_CONST_4, $worldPos
+dp4 oT2.y, $SHADER_SPECIFIC_CONST_5, $worldPos
+
+&FreeRegister( \$worldPos );