/*
 * File: SmoothedDiscShader.vert.txt
 * Shader for drawing of basic parameterized smoothed discs.
 *
 * This is the vertex shader. It takes the attributes (parameters)
 * provided by the Screen('DrawTexture(s)') command, performs some
 * basic calculations on it - the calculations that only need to be
 * done once per  patch and that can be reliably carried out
 * at sufficient numeric precision in a vertex shader - then it passes
 * results of computations and other attributes as 'varying' parameters
 * to the fragment shader.
 *
 * Copyright 2016, Ian Andolina <http://github.com/iandol>, licenced under the MIT Licence
 *
 */

/* Attributes passed from Screen(): See the ProceduralShadingAPI.m file for infos: */
attribute vec4 modulateColor;

/* Information passed to the fragment shader: Attributes and precalculated per patch constants: */
varying vec4 baseColor;

void main()
{
    /* Apply standard geometric transformations to patch: */
    gl_Position = ftransform();

    gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
    
    /* Premultiply the wanted Contrast to the color: */
    baseColor = modulateColor;
}