diff options
| author | Joe Ludwig <[email protected]> | 2013-12-23 14:58:45 -0800 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-12-23 15:00:03 -0800 |
| commit | 7309a5f13f63fdcc7b1e090f6c176113a9d95061 (patch) | |
| tree | ad65c7fbe46a3c70bdc0a1426e88247ce1b0d7f5 /mp/src/materialsystem/stdshaders/Refract_model_vs11.vsh | |
| parent | Merge pull request #182 from ardneran/master (diff) | |
| download | source-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/Refract_model_vs11.vsh')
| -rw-r--r-- | mp/src/materialsystem/stdshaders/Refract_model_vs11.vsh | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/mp/src/materialsystem/stdshaders/Refract_model_vs11.vsh b/mp/src/materialsystem/stdshaders/Refract_model_vs11.vsh new file mode 100644 index 00000000..a6eea2b7 --- /dev/null +++ b/mp/src/materialsystem/stdshaders/Refract_model_vs11.vsh @@ -0,0 +1,105 @@ +vs.1.1 + +# DYNAMIC: "DOWATERFOG" "0..1" +# DYNAMIC: "SKINNING" "0..1" + +;------------------------------------------------------------------------------ +; Constants specified by the app +; c0 = (0, 1, 2, 0.5) +; c1 = (1/2.2, 0, 0, 0) +; c2 = camera position *in world space* +; c4-c7 = modelViewProj matrix (transpose) +; c8-c11 = ViewProj matrix (transpose) +; c12-c15 = model->view matrix (transpose) +; c16 = [fogStart, fogEnd, fogRange, undefined] +; +; Vertex components (as specified in the vertex DECL) +; $vPos = Position +; $vTexCoord0.xy = TexCoord0 +;------------------------------------------------------------------------------ + +#include "macros.vsh" + +; Vertex components +; $vPos = Position +; $vNormal = normal +; $vTexCoord0.xy = TexCoord0 +; $vTangentS = S axis of Texture space +; $vTangentT = T axis of Texture space + +;------------------------------------------------------------------------------ +; Transform the position from world to view space +;------------------------------------------------------------------------------ + +alloc $worldPos +alloc $worldNormal +alloc $worldTangentS +alloc $worldTangentT + +&SkinPositionNormalAndTangentSpace( $worldPos, $worldNormal, + $worldTangentS, $worldTangentT ); + +alloc $projPos + +; Transform position from world to projection space +dp4 $projPos.x, $worldPos, $cViewProj0 +dp4 $projPos.y, $worldPos, $cViewProj1 +dp4 $projPos.z, $worldPos, $cViewProj2 +dp4 $projPos.w, $worldPos, $cViewProj3 + +&CalcFog( $worldPos, $projPos ); + +alloc $worldEyeVect + +; Get the eye vector in world space +add $worldEyeVect.xyz, -$worldPos, $cEyePos + +alloc $tangentEyeVect +; transform the eye vector to tangent space +dp3 oT3.x, $worldEyeVect, $worldTangentS +dp3 oT3.y, $worldEyeVect, $worldTangentT +dp3 oT3.z, $worldEyeVect, $worldNormal + +alloc $bumpTexCoord + +dp4 $bumpTexCoord.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_1 +dp4 $bumpTexCoord.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_2 + +; dudv map +mov oT0.xy, $bumpTexCoord + +; refract tint + alpha channel +mov oT2.xy, $bumpTexCoord +mov oT3.xy, $bumpTexCoord + +free $bumpTexCoord + +mov oPos, $projPos + +; special case perspective correct texture projection so that the texture fits exactly on the screen + +; flip Y by multiplying by -1 +mul $projPos.y, $projPos.y, $SHADER_SPECIFIC_CONST_4.w + +; transform from [-w,w] to [0,2*w] +; The reason this is w is because we are in perspective space/homogenous clip space. +add $projPos.xy, $projPos.xy, $projPos.w + +; transform from [0,2*w] to [0,w] +; We'll end up dividing by w in the pixel shader to get to [0,1] +mul $projPos.xy, $projPos.xy, $cHalf + +mov oT1.xy, $projPos.xy + +; emit w to both z and w in case the driver screws up and divides by z +mov oT1.z, $projPos.w +mov oT1.w, $projPos.w + +free $projPos +free $worldPos +free $worldEyeVect +free $tangentEyeVect +free $w +free $worldNormal +free $worldTangentS +free $worldTangentT |