<arbvp>
  <variablemap variable="light 0 position" destination="register 0"/>
  <variablemap variable="light 0 diffuse" destination="register 1"/>
  <variablemap variable="light 0 specular" destination="register 2"/>
  <variablemap variable="light 0 attenuation" destination="register 3"/>
  
  <variablemap variable="mat diffuse" destination="register 4"/>
  <variablemap variable="mat ambient" destination="register 5"/>
  <variablemap variable="mat reflection" destination="register 6"/>
  <variablemap variable="mat flatcolor" destination="register 7"/>
  
  <variablemap variable="mat specular" destination="register 8"/>
  <program>
    <![CDATA[
      !!ARBvp1.0
      #---------------------------------------
      # Simple Vertex Lighting Program
      #---------------------------------------
      #Parameter definition
      PARAM mv[4]	     	= { state.matrix.modelview };
      PARAM mvi[4]	 	= { state.matrix.modelview.inverse };
      PARAM mvp[4]	     	= { state.matrix.mvp };
      PARAM lightPos   		= program.local[0];
      PARAM lightDiffuse 	= program.local[1];
      PARAM lightSpecular 	= program.local[2];
      PARAM lightAttenuation 	= program.local[3];
      PARAM bleh 	= {0, 0.5, 0.75, 1};
      
      PARAM materialDiffuse	= program.local[4];
      PARAM materialAmbient	= program.local[5];
      PARAM materialReflection	= program.local[6];
      PARAM materialFlatColor 	= program.local[7];
      PARAM materialSpecular 	= program.local[8];
      # Per vertex inputs
      ATTRIB iPos		= vertex.position;
      ATTRIB iCol0		= vertex.color;
      ATTRIB iNorm		= vertex.normal;
      ATTRIB iTex0		= vertex.texcoord;
      # Outputs
      OUTPUT oPos		= result.position;
      OUTPUT oCol0		= result.color;
      OUTPUT oLightDir	        = result.texcoord[0];
      OUTPUT oNormal		= result.texcoord[1];
      OUTPUT oTex0		= result.texcoord[2];
      # Temporaries
      TEMP objLight;
      
      #Transform vertex to viewspace
      DP4 oPos.x, mvp[0], iPos;
      DP4 oPos.y, mvp[1], iPos;
      DP4 oPos.z, mvp[2], iPos;
      DP4 oPos.w, mvp[3], iPos;
      
      #Just pass on texture-coordinate
      MOV oTex0, iTex0;
      
      #Transform light to object
      DP4 objLight.x, mvi[0], lightPos;
      DP4 objLight.y, mvi[1], lightPos;
      DP4 objLight.z, mvi[2], lightPos;
      DP4 objLight.w, mvi[3], lightPos;
      
      #Just pass on normal
      MOV oNormal, iNorm;
      
      #calculate vector from vertex to light in object-space
      ADD oLightDir, objLight, -iPos;
      
      #Just pass on diffuse color
      MOV oCol0, lightDiffuse;
      
      END
    ]]>
  </program>
</arbvp>
