mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 14:16:50 +00:00
56 lines
1.4 KiB
GLSL
56 lines
1.4 KiB
GLSL
vs.1.1
|
|
|
|
# DYNAMIC: "DOWATERFOG" "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 $projPos
|
|
|
|
|
|
; Transform position from world to projection space
|
|
dp4 $projPos.x, $vPos, $cViewProj0
|
|
dp4 $projPos.y, $vPos, $cViewProj1
|
|
dp4 $projPos.z, $vPos, $cViewProj2
|
|
dp4 $projPos.w, $vPos, $cViewProj3
|
|
mov oPos, $projPos
|
|
|
|
dp4 $worldPos.z, $vPos, $cModel2
|
|
&CalcFog( $worldPos, $projPos );
|
|
|
|
free $projPos
|
|
free $worldPos
|
|
|
|
|
|
mov oD0, $vColor
|
|
|
|
mov oT0, $vTexCoord0
|
|
mov oT1, $vTexCoord1
|
|
mov oT2, $vTexCoord2
|