1 ; part of the Irrlicht Engine Shader example.
\r
2 ; This Direct3D9 vertex shader will be loaded by the engine.
\r
3 ; Please note that these example shaders don't do anything really useful.
\r
4 ; They only demonstrate that shaders can be used in Irrlicht.
\r
8 dcl_position v0; ; declare position
\r
9 dcl_normal v1; ; declare normal
\r
10 dcl_color v2; ; declare color
\r
11 dcl_texcoord0 v3; ; declare texture coordinate
\r
13 ; transpose and transform position to clip space
\r
15 mad r0, v0.y, c5, r0
\r
16 mad r0, v0.z, c6, r0
\r
24 ; renormalize normal
\r
29 ; calculate light vector
\r
30 m4x4 r6, v0, c10 ; vertex into world position
\r
31 add r2, c8, -r6 ; vtxpos - lightpos
\r
33 ; normalize light vector
\r
38 ; calculate light color
\r
39 dp3 r3, r1, r2 ; dp3 with negative light vector
\r
40 lit r5, r3 ; clamp to zero if r3 < 0, r5 has diffuce component in r5.y
\r
41 mul oD0, r5.y, c9 ; ouput diffuse color
\r
42 mov oT0, v3 ; store texture coordinates