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 /sp/src/materialsystem/stdshaders/WaterCheap_vs14.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 'sp/src/materialsystem/stdshaders/WaterCheap_vs14.vsh')
| -rw-r--r-- | sp/src/materialsystem/stdshaders/WaterCheap_vs14.vsh | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/sp/src/materialsystem/stdshaders/WaterCheap_vs14.vsh b/sp/src/materialsystem/stdshaders/WaterCheap_vs14.vsh new file mode 100644 index 00000000..0e5a1074 --- /dev/null +++ b/sp/src/materialsystem/stdshaders/WaterCheap_vs14.vsh @@ -0,0 +1,96 @@ +vs.1.1 + +# DYNAMIC: "DOWATERFOG" "0..1" + +#include "macros.vsh" + +;------------------------------------------------------------------------------ +; Vertex blending +;------------------------------------------------------------------------------ + +&AllocateRegister( \$worldPos ); + +; Transform position from object to world +dp4 $worldPos.x, $vPos, $cModel0 +dp4 $worldPos.y, $vPos, $cModel1 +dp4 $worldPos.z, $vPos, $cModel2 + +&AllocateRegister( \$projPos ); + +; Transform position from object to projection space +dp4 $projPos.x, $vPos, $cModelViewProj0 +dp4 $projPos.y, $vPos, $cModelViewProj1 +dp4 $projPos.z, $vPos, $cModelViewProj2 +dp4 $projPos.w, $vPos, $cModelViewProj3 + +mov oPos, $projPos + +;------------------------------------------------------------------------------ +; Fog +;------------------------------------------------------------------------------ +&CalcFog( $worldPos, $projPos ); + +&FreeRegister( \$projPos ); + +;------------------------------------------------------------------------------ +; Lighting +;------------------------------------------------------------------------------ + +; Transform tangent space basis vectors to env map space (world space) +; This will produce a set of vectors mapping from tangent space to env space +; We'll use this to transform normals from the normal map from tangent space +; to environment map space. +; NOTE: use dp3 here since the basis vectors are vectors, not points + +dp3 oT1.x, $vTangentS, $cModel0 +dp3 oT2.x, $vTangentS, $cModel1 +dp3 oT3.x, $vTangentS, $cModel2 + +dp3 oT1.y, $vTangentT, $cModel0 +dp3 oT2.y, $vTangentT, $cModel1 +dp3 oT3.y, $vTangentT, $cModel2 + +dp3 oT1.z, $vNormal, $cModel0 +dp3 oT2.z, $vNormal, $cModel1 +dp3 oT3.z, $vNormal, $cModel2 + +; Compute the vector from vertex to camera +&AllocateRegister( \$worldEyeVect ); +sub $worldEyeVect.xyz, $cEyePos, $worldPos +&FreeRegister( \$worldPos ); + +; eye vector +mov oT4.xyz, $worldEyeVect + +alloc $tangentEyeVect + +; transform the eye vector to tangent space +dp3 $tangentEyeVect.x, $worldEyeVect, $vTangentS +dp3 $tangentEyeVect.y, $worldEyeVect, $vTangentT +dp3 $tangentEyeVect.z, $worldEyeVect, $vNormal + +; Get the magnitude of worldEyeVect +dp3 $worldEyeVect.w, $worldEyeVect, $worldEyeVect +rsq $worldEyeVect.w, $worldEyeVect.w +rcp $worldEyeVect.w, $worldEyeVect.w + +; calculate the cheap water blend factor and stick it into oD0.a +; NOTE: This won't be perspective correct!!!!! +; OPTIMIZE: This could turn into a mad. +add $worldEyeVect.w, $worldEyeVect.w, -$SHADER_SPECIFIC_CONST_2.x +mul oD0, $worldEyeVect.w, $SHADER_SPECIFIC_CONST_2.y + +; stick the tangent space eye vector into oT5.xyz +mov oT5.xyz, $tangentEyeVect + +&FreeRegister( \$worldEyeVect ); +&FreeRegister( \$tangentEyeVect ); + +;------------------------------------------------------------------------------ +; Texture coordinates +;------------------------------------------------------------------------------ +dp4 oT0.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_0 +dp4 oT0.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_1 + + + |