home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 April
/
Chip_2003-04_cd1.bin
/
sharewar
/
hardinfo
/
download
/
HARDiNFO.msi
/
_5CC773416CB2C53EF4E7EDFFA72CD337
/
_D4FC300A4ADD4CF39107E373DB2FFF30
< prev
next >
Wrap
Text File
|
2000-10-02
|
2KB
|
65 lines
vs.1.0
;------------------------------------------------------------------------------
; Constants specified by the app
; c0 = ( 0, 0, 0, 0 )
; c1 = ( 1, 0.5, 2, 4 )
; c4-c7 = world-view-projection matrix
; c8-c11 = world-view matrix
; c12-c15 = view matrix
; c20 = light direction
; c21 = material diffuse color * light diffuse color
; c22 = material ambient color
; c28 = projection matrix
;
; Vertex components (as specified in the vertex DECL)
; v0 = Position
; v3 = Normal
; v6 = Texcoords
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Vertex transformation
;------------------------------------------------------------------------------
; Transform to view space (world matrix is identity)
m4x4 r9, v0, c12
; Transform to projection space
m4x4 r10, r9, c28
; Store output position
mov oPos, r10
;------------------------------------------------------------------------------
; Lighting calculation
;------------------------------------------------------------------------------
dp3 r1.x, v3, c20 ; r1 = normal dot light
max r1, r1.x, c0.x ; if dot < 0 then dot = 0
mul r0, r1.x, c21 ; Multiply with diffuse
add r0, r0, c22 ; Add in ambient
min oD0, r0, c1.x ; clamp if > 1
;------------------------------------------------------------------------------
; Texture coordinates
;------------------------------------------------------------------------------
; Copy tex coords
mov oT0.xy, v6
;------------------------------------------------------------------------------
; Fog calculation
;------------------------------------------------------------------------------
; compute fog factor f = (fog_end - dist)*(1/(fog_end-fog_start))
add r0.x, -r9.z, c23.y
mul r0.x, r0.x, c23.z
max r0.x, r0.x, c0.x ; clamp fog to > 0.0
min oFog.x, r0.x, c1.x ; clamp fog to < 1.0