diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-08-16 07:14:35 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-08-16 07:14:35 +0300 |
commit | 6c0334496d50aaf4e11dcda7ed642fac565d6145 (patch) | |
tree | aa6e7aeef9b00ba46910c30bd85fedbc53df39a0 /src/datavis3d/engine/shaders/surfaceFlat.vert | |
parent | 3288b23502c195d03e097cb372a22f3a1ac4ba87 (diff) | |
parent | 29f6433606cebe3299e9915ae32bae7dfaed2770 (diff) |
Merge remote-tracking branch 'origin/develop'
Change-Id: I544af544ecd946cdcccfe9c17d03e47f8d0c1151
Diffstat (limited to 'src/datavis3d/engine/shaders/surfaceFlat.vert')
-rw-r--r-- | src/datavis3d/engine/shaders/surfaceFlat.vert | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/datavis3d/engine/shaders/surfaceFlat.vert b/src/datavis3d/engine/shaders/surfaceFlat.vert new file mode 100644 index 00000000..24c9b9a3 --- /dev/null +++ b/src/datavis3d/engine/shaders/surfaceFlat.vert @@ -0,0 +1,30 @@ +#version 150 + +attribute highp vec3 vertexPosition_mdl; +attribute highp vec2 vertexUV; +attribute highp vec3 vertexNormal_mdl; + +uniform highp mat4 MVP; +uniform highp mat4 V; +uniform highp mat4 M; +uniform highp mat4 itM; +uniform highp vec3 lightPosition_wrld; + +varying highp vec2 UV; +varying highp vec3 position_wrld; +flat out highp vec3 normal_cmr; +varying highp vec3 eyeDirection_cmr; +varying highp vec3 lightDirection_cmr; +varying highp vec3 coords_mdl; + +void main() { + gl_Position = MVP * vec4(vertexPosition_mdl, 1.0); + coords_mdl = vertexPosition_mdl; + position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz; + vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz; + eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr; + vec3 lightPosition_cmr = (V * vec4(lightPosition_wrld, 1.0)).xyz; + lightDirection_cmr = lightPosition_cmr + eyeDirection_cmr; + normal_cmr = (V * itM * vec4(vertexNormal_mdl, 0.0)).xyz; + UV = vertexUV; +} |