tnl: s/INLINE/inline/
[mesa.git] / src / mesa / tnl / t_rasterpos.c
index 99b678745565ec1b622ca29d448f89b616605df9..0492490dfcf0ab4a6bad711b48c15f934db416fa 100644 (file)
 
 #include "main/glheader.h"
 #include "main/colormac.h"
-#include "main/context.h"
 #include "main/feedback.h"
 #include "main/light.h"
 #include "main/macros.h"
-#include "main/rastpos.h"
 #include "main/simple_list.h"
 #include "main/mtypes.h"
 
@@ -86,7 +84,7 @@ viewclip_point_z( const GLfloat v[] )
  * \return zero if the point was clipped, or one otherwise.
  */
 static GLuint
-userclip_point( GLcontext *ctx, const GLfloat v[] )
+userclip_point( struct gl_context *ctx, const GLfloat v[] )
 {
    GLuint p;
 
@@ -116,12 +114,11 @@ userclip_point( GLcontext *ctx, const GLfloat v[] )
  * \param Rindex returned color index
  */
 static void
-shade_rastpos(GLcontext *ctx,
+shade_rastpos(struct gl_context *ctx,
               const GLfloat vertex[4],
               const GLfloat normal[3],
               GLfloat Rcolor[4],
-              GLfloat Rspec[4],
-              GLfloat *Rindex)
+              GLfloat Rspec[4])
 {
    /*const*/ GLfloat (*base)[3] = ctx->Light._BaseColor;
    const struct gl_light *light;
@@ -245,28 +242,14 @@ shade_rastpos(GLcontext *ctx,
       ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib );
    }
 
-   if (ctx->Visual.rgbMode) {
-      Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F);
-      Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F);
-      Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F);
-      Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F);
-      Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F);
-      Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F);
-      Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F);
-      Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F);
-   }
-   else {
-      GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES];
-      GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT];
-      GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT];
-      GLfloat i = (ind[MAT_INDEX_AMBIENT]
-                  + diffuseCI * (1.0F-specularCI) * d_a
-                  + specularCI * s_a);
-      if (i > ind[MAT_INDEX_SPECULAR]) {
-        i = ind[MAT_INDEX_SPECULAR];
-      }
-      *Rindex = i;
-   }
+   Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F);
+   Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F);
+   Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F);
+   Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F);
+   Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F);
+   Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F);
+   Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F);
+   Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F);
 }
 
 
@@ -280,7 +263,7 @@ shade_rastpos(GLcontext *ctx,
  * \param texcoord  incoming texcoord and resulting texcoord
  */
 static void
-compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
+compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
                const GLfloat normal[3], GLuint unit, GLfloat texcoord[4])
 {
    const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -390,7 +373,7 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
  * \param vObj  vertex position in object space
  */
 void
-_tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4])
+_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
 {
    if (ctx->VertexProgram._Enabled) {
       /* XXX implement this */
@@ -470,21 +453,14 @@ _tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4])
          /* lighting */
          shade_rastpos( ctx, vObj, norm,
                         ctx->Current.RasterColor,
-                        ctx->Current.RasterSecondaryColor,
-                        &ctx->Current.RasterIndex );
+                        ctx->Current.RasterSecondaryColor );
       }
       else {
-         /* use current color or index */
-         if (ctx->Visual.rgbMode) {
-            COPY_4FV(ctx->Current.RasterColor,
-                     ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
-            COPY_4FV(ctx->Current.RasterSecondaryColor,
-                     ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
-         }
-         else {
-            ctx->Current.RasterIndex
-               = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
-         }
+         /* use current color */
+        COPY_4FV(ctx->Current.RasterColor,
+                 ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+        COPY_4FV(ctx->Current.RasterSecondaryColor,
+                 ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
       }
 
       /* texture coords */