3dexperiments/assets/shaders/particles.vs

29 lines
608 B
Plaintext
Raw Normal View History

precision mediump float;
attribute vec2 aVertexPosition;
uniform mat4 uModelMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;
varying vec2 uv1;
varying vec2 uv2;
varying float blend;
uniform vec2 uAtlasOffset1;
uniform vec2 uAtlasOffset2;
uniform vec2 uAtlasInfo;
void main() {
vec2 uv = aVertexPosition + vec2(0.5, 0.5);
uv.y = 1.0 - uv.y;
uv /= uAtlasInfo.x;
uv1 = uv + uAtlasOffset1;
uv2 = uv + uAtlasOffset2;
blend = uAtlasInfo.y;
vec4 worldPosition = uModelMatrix * vec4(aVertexPosition, 0.0, 1.0);
gl_Position = uProjectionMatrix * uViewMatrix * worldPosition;
}