diff options
author | Mika Salmela <mika.salmela@digia.com> | 2013-07-15 16:25:54 +0300 |
---|---|---|
committer | Mika Salmela <mika.salmela@digia.com> | 2013-07-15 16:26:52 +0300 |
commit | 2d4688233fbd551bae8f327215247985cd843958 (patch) | |
tree | 58444eb52c0077dbd2454b2eaf9224dc18ec47aa /src/datavis3d/engine/shaders/surfaceFlat.vert | |
parent | 6bc7fabac51ddac7b95ffd85a1eef748f9d2e592 (diff) |
Finally first visible surface.
Change-Id: Ib168cbb8cd636539aee62098b98e6e24a112dab6
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavis3d/engine/shaders/surfaceFlat.vert')
-rw-r--r-- | src/datavis3d/engine/shaders/surfaceFlat.vert | 29 |
1 files changed, 29 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..4adc511e --- /dev/null +++ b/src/datavis3d/engine/shaders/surfaceFlat.vert @@ -0,0 +1,29 @@ +#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 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; + //normal_cmr = vertexNormal_mdl; +} |