#version 100

// GLES port of engine/shaders/main.vert - the one real difference is
// gl_Vertex, a desktop-only compatibility-profile builtin that doesn't
// exist in GLES at all, replaced with an explicit "position" attribute
// (see android/engine-patches/03-android-opengl-es-render.patch's
// CreateShader() change, which binds it to attribute location 0 to match
// the vertex arrays OpenGL.cc's GLES immediate-mode emulation submits).
precision mediump float;

attribute vec4 position;
attribute vec2 texcoords;
attribute float light;
attribute vec4 color;

varying vec2 TexCoords;
varying float Light;
varying vec4 Color;

uniform mat4 view;
uniform mat4 proj;

// GLES has no glPointSize() (desktop-only, set from
// opengl_begin_stars()) - point size must come from this builtin
// instead. Only read by the rasterizer for GL_POINTS draws (i.e. only
// matters for star.frag); harmless left unset for the other two shaders
// built from this same vertex shader (main.vert). See
// android/engine-patches/04-android-opengl-es-render.patch's
// questshock_glPointSize()/questshock_glEnd().
uniform float pointSize;

void main() {
    TexCoords = texcoords;
    Light = light;
    Color = color;
    gl_Position = proj * view * position;
    gl_PointSize = pointSize;
}
