Esempio n. 1
0
void GLU_APIENTRY gluTessVertex(GLUtesselator* tess, GLfloat coords[3], void* data)
{
   int i;
   int tooLarge=FALSE;
   GLfloat x, clamped[3];

   RequireState(tess, T_IN_CONTOUR);

   if (tess->emptyCache)
   {
      if (!EmptyCache(tess))
      {
         CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
         return;
      }
      tess->lastEdge=NULL;
   }

   for (i=0; i<3; ++i)
   {
      x=coords[i];
      if (x<-GLU_TESS_MAX_COORD)
      {
         x=-GLU_TESS_MAX_COORD;
         tooLarge=TRUE;
      }
      if (x>GLU_TESS_MAX_COORD)
      {
         x=GLU_TESS_MAX_COORD;
         tooLarge=TRUE;
      }
      clamped[i]=x;
   }
   if (tooLarge)
   {
      CALL_ERROR_OR_ERROR_DATA(GLU_TESS_COORD_TOO_LARGE);
   }

   if (tess->mesh==NULL)
   {
      if (tess->cacheCount<TESS_MAX_CACHE)
      {
         CacheVertex(tess, clamped, data);
         return;
      }
      if (!EmptyCache(tess))
      {
         CALL_ERROR_OR_ERROR_DATA(GLU_OUT_OF_MEMORY);
         return;
      }
   }

   if (!AddVertex(tess, clamped, data))
   {
      CALL_ERROR_OR_ERROR_DATA(GLU_OUT_OF_MEMORY);
   }
}
Esempio n. 2
0
void REGALWRATH_GLU_CALL
wrath_gluTessVertex( wrath_GLUtesselator *tess, const double coords[3], void *data )
{
  int i, tooLarge = FALSE;
  double x, clamped[3];

  RequireState( tess, T_IN_CONTOUR );

  if( tess->emptyCache ) {
    if ( !EmptyCache( tess ) ) {
       CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_OUT_OF_MEMORY );
       return;
    }
    tess->lastEdge = NULL;
  }
  for( i = 0; i < 3; ++i ) {
    x = coords[i];
    if( x < - WRATH_GLU_TESS_MAX_COORD ) {
      x = - WRATH_GLU_TESS_MAX_COORD;
      tooLarge = TRUE;
    }
    if( x > WRATH_GLU_TESS_MAX_COORD ) {
      x = WRATH_GLU_TESS_MAX_COORD;
      tooLarge = TRUE;
    }
    clamped[i] = x;
  }
  if( tooLarge ) {
    CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_TESS_COORD_TOO_LARGE );
  }

  if( tess->mesh == NULL ) {
    if( tess->cacheCount < TESS_MAX_CACHE ) {
      CacheVertex( tess, clamped, data );
      return;
    }
    if ( !EmptyCache( tess ) ) {
       CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_OUT_OF_MEMORY );
       return;
    }
  }
  if ( !AddVertex( tess, clamped, data ) ) {
       CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_OUT_OF_MEMORY );
  }
}
Esempio n. 3
0
void REGALFASTUIDRAW_GLU_CALL
fastuidraw_gluTessVertex( fastuidraw_GLUtesselator *tess, double x, double y, unsigned int data )
{
  int tooLarge = FALSE;

  RequireState( tess, T_IN_CONTOUR );

  if( tess->emptyCache ) {
    if ( !EmptyCache( tess ) ) {
       CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_OUT_OF_MEMORY );
       return;
    }
    tess->lastEdge = NULL;
  }

  checkTooLarge(&x, &tooLarge);
  checkTooLarge(&y, &tooLarge);


  if( tooLarge ) {
    CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_TESS_COORD_TOO_LARGE );
  }

  if( tess->mesh == NULL ) {
    if( tess->cacheCount < TESS_MAX_CACHE ) {
      CacheVertex( tess, x, y, data );
      return;
    }
    if ( !EmptyCache( tess ) ) {
       CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_OUT_OF_MEMORY );
       return;
    }
  }
  if ( !AddVertex( tess, x, y, data ) ) {
       CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_OUT_OF_MEMORY );
  }
}