diff options
author | Heikkinen Miikka <miikka.heikkinen@digia.com> | 2013-05-17 12:21:40 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-05-17 12:37:26 +0300 |
commit | 3dafad59b97532e8e68c0b7abca796f3a9527a6e (patch) | |
tree | 6dcb5bf6edc5aee39490b35db11202a20929d858 /src/datavis3d/engine/shaders/vertexShaderTexture | |
parent | 5963d52c1923cf2468c1fa4738e04a175196cc7d (diff) |
Added datavis3d back under src
Change-Id: I209e8b3228b2ce0085c897db6fb2ea78e93afa67
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavis3d/engine/shaders/vertexShaderTexture')
-rw-r--r-- | src/datavis3d/engine/shaders/vertexShaderTexture | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/datavis3d/engine/shaders/vertexShaderTexture b/src/datavis3d/engine/shaders/vertexShaderTexture new file mode 100644 index 00000000..01f922e0 --- /dev/null +++ b/src/datavis3d/engine/shaders/vertexShaderTexture @@ -0,0 +1,26 @@ +uniform highp mat4 MVP; +uniform highp mat4 V; +uniform highp mat4 M; +uniform highp mat4 itM; +uniform highp vec3 lightPosition_wrld; + +attribute highp vec3 vertexPosition_mdl; +attribute highp vec2 vertexUV; +attribute highp vec3 vertexNormal_mdl; + +varying highp vec2 UV; +varying highp vec3 position_wrld; +varying highp vec3 normal_cmr; +varying highp vec3 eyeDirection_cmr; +varying highp vec3 lightDirection_cmr; + +void main() { + gl_Position = MVP * vec4(vertexPosition_mdl, 1.0); + 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; +} |