aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/media/opengl.vsh
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/media/opengl.vsh')
-rw-r--r--libraries/irrlicht-1.8/media/opengl.vsh118
1 files changed, 59 insertions, 59 deletions
diff --git a/libraries/irrlicht-1.8/media/opengl.vsh b/libraries/irrlicht-1.8/media/opengl.vsh
index 9cd71bf..73e6ce7 100644
--- a/libraries/irrlicht-1.8/media/opengl.vsh
+++ b/libraries/irrlicht-1.8/media/opengl.vsh
@@ -1,60 +1,60 @@
1!!ARBvp1.0 1!!ARBvp1.0
2# part of the Irrlicht Engine Shader example. 2# part of the Irrlicht Engine Shader example.
3# Please note that these example shaders don't do anything really useful. 3# Please note that these example shaders don't do anything really useful.
4# They only demonstrate that shaders can be used in Irrlicht. 4# They only demonstrate that shaders can be used in Irrlicht.
5 5
6#input 6#input
7ATTRIB InPos = vertex.position; 7ATTRIB InPos = vertex.position;
8ATTRIB InColor = vertex.color; 8ATTRIB InColor = vertex.color;
9ATTRIB InNormal = vertex.normal; 9ATTRIB InNormal = vertex.normal;
10ATTRIB InTexCoord = vertex.texcoord; 10ATTRIB InTexCoord = vertex.texcoord;
11 11
12#output 12#output
13OUTPUT OutPos = result.position; 13OUTPUT OutPos = result.position;
14OUTPUT OutColor = result.color; 14OUTPUT OutColor = result.color;
15OUTPUT OutTexCoord = result.texcoord; 15OUTPUT OutTexCoord = result.texcoord;
16 16
17PARAM MVP[4] = { state.matrix.mvp }; # modelViewProjection matrix. 17PARAM MVP[4] = { state.matrix.mvp }; # modelViewProjection matrix.
18TEMP Temp; 18TEMP Temp;
19TEMP TempColor; 19TEMP TempColor;
20TEMP TempNormal; 20TEMP TempNormal;
21TEMP TempPos; 21TEMP TempPos;
22 22
23#transform position to clip space 23#transform position to clip space
24DP4 Temp.x, MVP[0], InPos; 24DP4 Temp.x, MVP[0], InPos;
25DP4 Temp.y, MVP[1], InPos; 25DP4 Temp.y, MVP[1], InPos;
26DP4 Temp.z, MVP[2], InPos; 26DP4 Temp.z, MVP[2], InPos;
27DP4 Temp.w, MVP[3], InPos; 27DP4 Temp.w, MVP[3], InPos;
28 28
29#transform normal 29#transform normal
30DP3 TempNormal.x, InNormal.x, program.local[0]; 30DP3 TempNormal.x, InNormal.x, program.local[0];
31DP3 TempNormal.y, InNormal.y, program.local[1]; 31DP3 TempNormal.y, InNormal.y, program.local[1];
32DP3 TempNormal.z, InNormal.z, program.local[2]; 32DP3 TempNormal.z, InNormal.z, program.local[2];
33 33
34#renormalize normal 34#renormalize normal
35DP3 TempNormal.w, TempNormal, TempNormal; 35DP3 TempNormal.w, TempNormal, TempNormal;
36RSQ TempNormal.w, TempNormal.w; 36RSQ TempNormal.w, TempNormal.w;
37MUL TempNormal, TempNormal, TempNormal.w; 37MUL TempNormal, TempNormal, TempNormal.w;
38 38
39# calculate light vector 39# calculate light vector
40DP4 TempPos.x, InPos, program.local[10]; # vertex into world position 40DP4 TempPos.x, InPos, program.local[10]; # vertex into world position
41DP4 TempPos.y, InPos, program.local[11]; 41DP4 TempPos.y, InPos, program.local[11];
42DP4 TempPos.z, InPos, program.local[12]; 42DP4 TempPos.z, InPos, program.local[12];
43DP4 TempPos.w, InPos, program.local[13]; 43DP4 TempPos.w, InPos, program.local[13];
44 44
45ADD TempPos, program.local[8], -TempPos; # vtxpos - lightpos 45ADD TempPos, program.local[8], -TempPos; # vtxpos - lightpos
46 46
47# normalize light vector 47# normalize light vector
48DP3 TempPos.w, TempPos, TempPos; 48DP3 TempPos.w, TempPos, TempPos;
49RSQ TempPos.w, TempPos.w; 49RSQ TempPos.w, TempPos.w;
50MUL TempPos, TempPos, TempPos.w; 50MUL TempPos, TempPos, TempPos.w;
51 51
52# calculate light color 52# calculate light color
53DP3 TempColor, TempNormal, TempPos; # dp3 with negative light vector 53DP3 TempColor, TempNormal, TempPos; # dp3 with negative light vector
54LIT OutColor, TempColor; # clamp to zero if r3 < 0, r5 has diffuce component in r5.y 54LIT OutColor, TempColor; # clamp to zero if r3 < 0, r5 has diffuce component in r5.y
55MUL OutColor, TempColor.y, program.local[9]; # ouput diffuse color 55MUL OutColor, TempColor.y, program.local[9]; # ouput diffuse color
56MOV OutColor.w, 1.0; # we want alpha to be always 1 56MOV OutColor.w, 1.0; # we want alpha to be always 1
57MOV OutTexCoord, InTexCoord; # store texture coordinate 57MOV OutTexCoord, InTexCoord; # store texture coordinate
58MOV OutPos, Temp; 58MOV OutPos, Temp;
59 59
60END \ No newline at end of file 60END \ No newline at end of file