📄 ch24p2_toonshadersilo.vs
字号:
vs.1.0
; ===========================================================================
;
; This vertex shader computes position, diffuse color (pass-thru), and two
; texture coordinates... one for the shade texture and one for the siloheutte
; (edge) texture.
;
; c0,c1,c2,c3 = combined world/view/proj matrix
; c4 = light position
; c5,c6,c7,c8 = world/view matrix
; c9 = constants (0.5,??,??,??)
;
; ===========================================================================
m4x4 r0, v0, c5 ; r0 = View space position
m3x3 r1, v1, c0 ; r1 = View space normal
m4x4 oPos, v0, c0 ; Spit out projected position
dp3 r2.x, r0, r0 ; Normalize r0 (position)
rsq r2.x, r2.x
mul r0, r0, r2.x
dp3 r1.w, r1, r1 ; Normalize normal
rsq r1.w, r1.w
mul r1, r1, r1.w
dp3 oT0.x, r1, c4 ; l dot n = shade tex idx
dp3 r3.x, r0, -r1 ; Compute dot product
mad oT1.x, r3.x, c9.x, c9.x ; Scale to [0,1] and store as tex idx
mov oD0, v4 ; diffuse color = v4 (pass-thru)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -