diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-05-08 12:46:49 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-05-08 13:30:48 +0300 |
commit | ee7f5d387934c46442ece1ea17566305ada94cef (patch) | |
tree | 90dd4d95ae2f83f66e2ee42608122a393f5be46c /src/engine/shaders/vertexShaderTexture | |
parent | 161232582e7f7e7e6e991def2fe87d78e668d08f (diff) |
Directory structure reorganized
Unnecessary subdirectory levels deleted from examples and src
Change-Id: I88892b4fc92784e706be2264eeb7d6208250a50f
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/engine/shaders/vertexShaderTexture')
-rw-r--r-- | src/engine/shaders/vertexShaderTexture | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/engine/shaders/vertexShaderTexture b/src/engine/shaders/vertexShaderTexture new file mode 100644 index 00000000..fb23b252 --- /dev/null +++ b/src/engine/shaders/vertexShaderTexture @@ -0,0 +1,23 @@ +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; +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; // Use modelMatrix's transposed inverse, as it's scaled + UV = vertexUV; +} |