Example #1
0
void vbo_exec_do_EvalCoord1f(struct vbo_exec_context *exec, GLfloat u)
{
    GLuint attr;

    for (attr = 1; attr <= VBO_ATTRIB_TEX7; attr++) {
        struct gl_1d_map *map = exec->eval.map1[attr].map;
        if (map) {
            GLfloat uu = (u - map->u1) * map->du;
            GLfloat data[4];

            ASSIGN_4V(data, 0, 0, 0, 1);

            _math_horner_bezier_curve(map->Points, data, uu,
                                      exec->eval.map1[attr].sz,
                                      map->Order);

            COPY_SZ_4V( exec->vtx.attrptr[attr],
                        exec->vtx.attrsz[attr],
                        data );
        }
    }

    /** Vertex -- EvalCoord1f is a noop if this map not enabled:
     **/
    if (exec->eval.map1[0].map) {
        struct gl_1d_map *map = exec->eval.map1[0].map;
        GLfloat uu = (u - map->u1) * map->du;
        GLfloat vertex[4];

        ASSIGN_4V(vertex, 0, 0, 0, 1);

        _math_horner_bezier_curve(map->Points, vertex, uu,
                                  exec->eval.map1[0].sz,
                                  map->Order);

        if (exec->eval.map1[0].sz == 4)
            CALL_Vertex4fv(GET_DISPATCH(), ( vertex ));
        else
            CALL_Vertex3fv(GET_DISPATCH(), ( vertex ));
    }
}
Example #2
0
File: api_eval.c Project: aosm/X11
static void do_EvalCoord1f(GLcontext* ctx, GLfloat u)
{

   /** Color Index **/
   if (ctx->Eval.Map1Index) 
   {
      GLfloat findex;
      struct gl_1d_map *map = &ctx->EvalMap.Map1Index;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, &findex, uu, 1, map->Order);
      glIndexi( (GLint) findex );
   }

   /** Color **/
   if (ctx->Eval.Map1Color4) {
      GLfloat fcolor[4];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Color4;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, fcolor, uu, 4, map->Order);
      glColor4fv( fcolor );
   }

   /** Normal Vector **/
   if (ctx->Eval.Map1Normal) {
      GLfloat normal[3];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Normal;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, normal, uu, 3, map->Order);
      glNormal3fv( normal );
   }

   /** Texture Coordinates **/
   if (ctx->Eval.Map1TextureCoord4) {
      GLfloat texcoord[4];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Texture4;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, texcoord, uu, 4, map->Order);
      glTexCoord4fv( texcoord );
   }
   else if (ctx->Eval.Map1TextureCoord3) {
      GLfloat texcoord[4];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Texture3;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, texcoord, uu, 3, map->Order);
      glTexCoord3fv( texcoord );
   }
   else if (ctx->Eval.Map1TextureCoord2) {
      GLfloat texcoord[4];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Texture2;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, texcoord, uu, 2, map->Order);
      glTexCoord2fv( texcoord );
   }
   else if (ctx->Eval.Map1TextureCoord1) {
      GLfloat texcoord[4];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Texture1;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, texcoord, uu, 1, map->Order);
      glTexCoord1fv( texcoord );
   }
  
   /** Vertex **/
   if (ctx->Eval.Map1Vertex4) 
   {
      GLfloat vertex[4];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Vertex4;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, vertex, uu, 4, map->Order);
      glVertex4fv( vertex );
   }
   else if (ctx->Eval.Map1Vertex3) 
   {
      GLfloat vertex[4];
      struct gl_1d_map *map = &ctx->EvalMap.Map1Vertex3;
      GLfloat uu = (u - map->u1) * map->du;
      _math_horner_bezier_curve(map->Points, vertex, uu, 3, map->Order);
      glVertex3fv( vertex );
   }
}