aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/test_vshader.glsl
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 14:35:44 -0700
committerValerio Virgillito2012-07-09 14:35:44 -0700
commit84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch)
tree3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /assets/shaders/test_vshader.glsl
parentc0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff)
parent40c6eb2c06b34f65a74d59ef9687251952858bab (diff)
downloadninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts: js/components/gradientpicker.reel/gradientpicker.js js/components/tools-properties/text-properties.reel/text-properties.js js/document/views/base.js js/document/views/design.js js/helper-classes/3D/StageLine.js js/helper-classes/3D/draw-utils.js js/lib/drawing/world.js js/lib/geom/circle.js js/lib/geom/line.js js/lib/geom/rectangle.js js/lib/geom/shape-primitive.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/flag-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/water-material.js js/panels/Materials/materials-library-panel.reel/materials-library-panel.html js/panels/Materials/materials-library-panel.reel/materials-library-panel.js js/panels/Materials/materials-popup.reel/materials-popup.html js/panels/Materials/materials-popup.reel/materials-popup.js js/tools/LineTool.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'assets/shaders/test_vshader.glsl')
-rwxr-xr-xassets/shaders/test_vshader.glsl62
1 files changed, 31 insertions, 31 deletions
diff --git a/assets/shaders/test_vshader.glsl b/assets/shaders/test_vshader.glsl
index 8bf9ee74..22c91590 100755
--- a/assets/shaders/test_vshader.glsl
+++ b/assets/shaders/test_vshader.glsl
@@ -46,8 +46,8 @@ uniform mat4 u_vShadowLight;
46uniform vec3 u_lightPos; 46uniform vec3 u_lightPos;
47 47
48// varyings 48// varyings
49varying vec4 vNormal; // w = texcoord.x 49varying vec4 vNormal; // w = texcoord.x
50varying vec4 vECPos; // w = texcoord.y 50varying vec4 vECPos; // w = texcoord.y
51varying vec3 vEyePos; 51varying vec3 vEyePos;
52varying vec4 vShadowCoord; 52varying vec4 vShadowCoord;
53varying vec2 vEnvTexCoord; 53varying vec2 vEnvTexCoord;
@@ -56,18 +56,18 @@ varying float vDiffuseIntensity;
56#ifdef PC 56#ifdef PC
57void main() 57void main()
58{ 58{
59 vNormal.w = texcoord.x; 59 vNormal.w = texcoord.x;
60 vECPos.w = texcoord.y; 60 vECPos.w = texcoord.y;
61 vEyePos = u_eye; 61 vEyePos = u_eye;
62 62
63// position normals and vert 63// position normals and vert
64 vECPos.xyz = (u_mvMatrix*vec4(vert, 1.0)).xyz; 64 vECPos.xyz = (u_mvMatrix*vec4(vert, 1.0)).xyz;
65 vNormal.xyz = (u_normalMatrix*vec4(normal, 0.0)).xyz; 65 vNormal.xyz = (u_normalMatrix*vec4(normal, 0.0)).xyz;
66 66
67// pass along the geo 67// pass along the geo
68 gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0); 68 gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0);
69 69
70 mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix; 70 mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix;
71 vShadowCoord = shadowMat * vec4(vert, 1.0); 71 vShadowCoord = shadowMat * vec4(vert, 1.0);
72} 72}
73#endif 73#endif
@@ -76,31 +76,31 @@ void main()
76 76
77void main() 77void main()
78{ 78{
79 vNormal.w = texcoord.x; 79 vNormal.w = texcoord.x;
80 vECPos.w = texcoord.y; 80 vECPos.w = texcoord.y;
81 vEyePos = u_eye; 81 vEyePos = u_eye;
82 82
83// position normals and vert 83// position normals and vert
84 vECPos.xyz = (u_mvMatrix*vec4(vert, 1.0)).xyz; 84 vECPos.xyz = (u_mvMatrix*vec4(vert, 1.0)).xyz;
85 vNormal.xyz = (u_normalMatrix*vec4(normal, 0.0)).xyz; 85 vNormal.xyz = (u_normalMatrix*vec4(normal, 0.0)).xyz;
86
87// pass along the geo
88 gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0);
86 89
87// pass along the geo 90 //mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix;
88 gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0);
89
90 //mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix;
91 //vShadowCoord = shadowMat * vec4(vert, 1.0); 91 //vShadowCoord = shadowMat * vec4(vert, 1.0);
92 92
93 // normal mapping 93 // normal mapping
94 vec3 normal = normalize(vNormal.xyz); 94 vec3 normal = normalize(vNormal.xyz);
95 95
96 // create envmap coordinates 96 // create envmap coordinates
97 vec3 r = reflect( vec3(vECPos.xyz - u_eye.xyz), normal); 97 vec3 r = reflect( vec3(vECPos.xyz - u_eye.xyz), normal);
98 float m = 2.0 * length(r); 98 float m = 2.0 * length(r);
99 vEnvTexCoord = vec2(r.x/m + 0.5, r.y/m + 0.5); 99 vEnvTexCoord = vec2(r.x/m + 0.5, r.y/m + 0.5);
100 100
101 vec3 lightDirection = normalize(u_lightPos - vECPos.xyz); 101 vec3 lightDirection = normalize(u_lightPos - vECPos.xyz);
102 vDiffuseIntensity = max(0.0, dot(normal, lightDirection)); 102 vDiffuseIntensity = max(0.0, dot(normal, lightDirection));
103 103
104} 104}
105 105
106#endif 106#endif