#version 120

varying vec2 texcoord;
varying vec4 glcolor;
varying float vDepth;

void main() {
    vec4 worldPos = gl_Vertex;
    worldPos.x += gl_Vertex.y * 0.0; // Lean in X per unit of height; adjust 0.3
    // worldPos.z += gl_Vertex.y * 0.3; // Uncomment this instead to lean in Z

    vec4 pos = gl_ModelViewMatrix * worldPos;
    vDepth = clamp(-pos.z / 48.0, 0.0, 1.0);

    gl_Position = gl_ProjectionMatrix * pos;
    texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
    glcolor  = gl_Color;
}
