struct gl_LightSourceParameters
{
  vec4 ambient;              // Aclarri   
  vec4 diffuse;              // Dcli   
  vec4 specular;             // Scli   
  vec4 position;             // Ppli   
  vec4 halfVector;           // Derived: Hi   
  vec3 spotDirection;        // Sdli   -- alignment->becomes vec4 according to std140 standard

  float spotExponent;        // Srli   
  float spotCutoff;          // Crli                              
                              // (range: [0.0,90.0], 180.0)   
  float spotCosCutoff;       // Derived: cos(Crli)                 
                              // (range: [1.0,0.0],-1.0)   
  float constantAttenuation; // K0   
  float linearAttenuation;   // K1   
  float quadraticAttenuation;// K2  

  float align0,align1;//,align2;// for alignment
};

struct gl_MaterialParameters  
{   
  vec4 emission;    // Ecm   
  vec4 ambient;     // Acm   
  vec4 diffuse;     // Dcm   
  vec4 specular;    // Scm   
  float shininess;  // Srm  
  float align0,align1,align2;// for alignment
};

struct gl_LightModelParameters
{
 vec4 ambient; // Acs
};

struct gl_LightModelProducts  
{    
  vec4 sceneColor; // Derived. Ecm + Acm * Acs  
};  


#define MAX_GL_LIGHTS     8
#define MAX_GL_CLIPPLANE  6

layout (std140, binding=0) uniform common_uniform_block
{
  gl_LightSourceParameters
    gl_LightSource[MAX_GL_LIGHTS];

  gl_LightModelParameters gl_LightModel;

  gl_MaterialParameters gl_FrontMaterial;
  gl_MaterialParameters gl_BackMaterial;

  gl_LightModelProducts gl_FrontLightModelProduct;  
  gl_LightModelProducts gl_BackLightModelProduct;    

  // our own clipplane
  vec4 gl_ClipPlane[MAX_GL_CLIPPLANE];

  mat4
    gl_ProjectionMatrix,
    gl_ModelViewMatrix;

  // derived matrices
  mat4
    gl_ModelViewProjectionMatrix,
    gl_ModelViewMatrixInverse;

  mat3
    gl_NormalMatrix;
};



