varying vec2 texCoord;
uniform vec4 color;

uniform int abc;

uniform vec3 CameraRight;
uniform vec3 CameraUp;
uniform vec3 particleCenter;
uniform vec3 BillboardSize;

float rand(vec2 co){
    return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}

void main(void)
{
vec3 vertexPosition;

	//gl_Position = ftransform();
	//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	texCoord = gl_MultiTexCoord0.xy;

/*
vec3 vertexPosition =
    particleCenter_wordspace
    + CameraRight * squareVertices.x * BillboardSize.x
    + CameraUp * squareVertices.y * BillboardSize.y;
*/
/*
    vec3 vertexPosition =
        particleCenter
        + CameraRight * gl_Vertex.x * BillboardSize.x
        + CameraUp * gl_Vertex.y * BillboardSize.y;
*/

    //vertexPosition = particleCenter;
/*
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

    vertexPosition.x = gl_ModelViewProjectionMatrix * (particleCenter.x + gl_Vertex.x * BillboardSize.x);
    vertexPosition.y = gl_ModelViewProjectionMatrix * (particleCenter.y + gl_Vertex.y * BillboardSize.y);
    vertexPosition.z = gl_ModelViewProjectionMatrix * particleCenter.z;

    vertexPosition.x = CameraRight * (particleCenter.x + gl_Vertex.x * BillboardSize.x);
    vertexPosition.y = CameraUp * (particleCenter.y + gl_Vertex.y * BillboardSize.y);
    vertexPosition.z = gl_ModelViewProjectionMatrix * particleCenter.z;

*/
    vertexPosition =
    particleCenter
    + CameraRight * gl_Vertex.x * BillboardSize.x
    + CameraUp * gl_Vertex.y * BillboardSize.y/2.0f; //this /2.0f is a bug patch

    gl_Position = gl_ModelViewProjectionMatrix * vec4(vertexPosition.x,vertexPosition.y,vertexPosition.z,1.0f);

    //gl_Position = vec4(vertexPosition.x,vertexPosition.y,vertexPosition.z,1.0f);


    //vertexPosition.x *=2.0f;
    //vertexPosition.y *=3.0f;

/*
    //vec3 vertexPosition = particleCenter;
    vertexPosition.x = gl_Vertex.x*2.0f;;
    vertexPosition.y = gl_Vertex.y*1.5f;
    vertexPosition.z = gl_Vertex.z+5.0f;
*/
/*
vertexPosition=
CameraRight+
CameraUp+
particleCenter+
BillboardSize+
abc;

//    gl_Vertex.x = rand(vec2(gl_Vertex.x,gl_Vertex.z))/6.0f;
//    gl_Vertex.y = rand(vec2(gl_Vertex.y,gl_Vertex.x))/2.0f;
//    gl_Vertex.z = rand(vec2(gl_Vertex.x,gl_Vertex.y))*2.0f-1.5f;
    vertexPosition.x = rand(vec2(vertexPosition.x,vertexPosition.z))/6.0f;
    vertexPosition.y = rand(vec2(vertexPosition.y,vertexPosition.x))/2.0f;
    vertexPosition.z = rand(vec2(vertexPosition.x,vertexPosition.y))*2.0f-1.5f;

    gl_Position = vec4(vertexPosition.x,vertexPosition.y,vertexPosition.z,1.0f);
*/
}
