2019-12-29 12:58:53 +00:00
|
|
|
precision mediump float;
|
|
|
|
|
|
|
|
attribute vec2 aVertexPosition;
|
|
|
|
|
|
|
|
uniform mat4 uModelMatrix;
|
|
|
|
uniform mat4 uViewMatrix;
|
|
|
|
uniform mat4 uProjectionMatrix;
|
2019-12-29 15:18:37 +00:00
|
|
|
uniform vec3 uCameraPosition;
|
|
|
|
uniform vec3 uLightPosition;
|
2019-12-29 12:58:53 +00:00
|
|
|
|
|
|
|
varying vec4 clipSpace;
|
|
|
|
varying vec2 uv;
|
2019-12-29 15:18:37 +00:00
|
|
|
varying vec3 toCameraVector;
|
|
|
|
varying vec3 fromLightVector;
|
2019-12-29 12:58:53 +00:00
|
|
|
|
2019-12-29 15:18:37 +00:00
|
|
|
const float tiling = 8.0;
|
2019-12-29 12:58:53 +00:00
|
|
|
|
|
|
|
void main() {
|
2019-12-29 15:18:37 +00:00
|
|
|
vec4 worldPosition = uModelMatrix * vec4(aVertexPosition.x, 0.0, aVertexPosition.y, 1.0);
|
|
|
|
clipSpace = uProjectionMatrix * uViewMatrix * worldPosition;
|
2019-12-29 12:58:53 +00:00
|
|
|
gl_Position = clipSpace;
|
2019-12-29 15:18:37 +00:00
|
|
|
uv = (aVertexPosition / 2.0 + 0.5) * tiling;
|
|
|
|
toCameraVector = uCameraPosition - worldPosition.xyz;
|
|
|
|
fromLightVector = worldPosition.xyz - uLightPosition;
|
2019-12-29 12:58:53 +00:00
|
|
|
}
|