diff options
author | hwc487 | 2012-07-09 16:08:02 -0700 |
---|---|---|
committer | hwc487 | 2012-07-09 16:08:02 -0700 |
commit | 5085d0f67df89a21715308956004164597a6ba79 (patch) | |
tree | 2c896163143a66331205a39b0a3b1b45d51bf12a /assets/shaders/test_vshader.glsl | |
parent | 51f1691f792dbda9b740ded8aa0457c9406db156 (diff) | |
parent | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (diff) | |
download | ninja-5085d0f67df89a21715308956004164597a6ba79.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into GridFixes
Conflicts:
js/helper-classes/3D/StageLine.js
Diffstat (limited to 'assets/shaders/test_vshader.glsl')
-rwxr-xr-x | assets/shaders/test_vshader.glsl | 62 |
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; | |||
46 | uniform vec3 u_lightPos; | 46 | uniform vec3 u_lightPos; |
47 | 47 | ||
48 | // varyings | 48 | // varyings |
49 | varying vec4 vNormal; // w = texcoord.x | 49 | varying vec4 vNormal; // w = texcoord.x |
50 | varying vec4 vECPos; // w = texcoord.y | 50 | varying vec4 vECPos; // w = texcoord.y |
51 | varying vec3 vEyePos; | 51 | varying vec3 vEyePos; |
52 | varying vec4 vShadowCoord; | 52 | varying vec4 vShadowCoord; |
53 | varying vec2 vEnvTexCoord; | 53 | varying vec2 vEnvTexCoord; |
@@ -56,18 +56,18 @@ varying float vDiffuseIntensity; | |||
56 | #ifdef PC | 56 | #ifdef PC |
57 | void main() | 57 | void 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 | ||
77 | void main() | 77 | void 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 |