Beispiel #1
0
wrath_gluDeleteTess( wrath_GLUtesselator *tess )
#endif
{
  RequireState( tess, T_DORMANT );
  memFree( tess );

  #if defined(WRATH_MALLOC_DEBUG) or defined(WRATH_NEW_DEBUG)
  {
    WRATHAutoLockMutex(tracker().m_mutex);

    tess_tracker::iterator iter;
    iter=tracker().find(tess);
    if(iter==tracker().end())
      {
         std::cerr << "Deletion from [" << file << ", " 
                   << line << "] of untracked GLU-Tessellator" 
                   << tess << "\n";
      }
    else
      {
        tracker().erase(iter);
      }

  }
  #endif

}
Beispiel #2
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);
   }
}
Beispiel #3
0
GLU_API void GLU_APIENTRY gluTessBeginPolygon(GLUtesselator* tess, void* data)
{
   RequireState(tess, T_DORMANT);

   tess->state=T_IN_POLYGON;
   tess->cacheCount=0;
   tess->emptyCache=FALSE;
   tess->mesh=NULL;

   tess->polygonData=data;
}
Beispiel #4
0
void REGALWRATH_GLU_CALL
wrath_gluTessBeginPolygon( wrath_GLUtesselator *tess, void *data )
{
  RequireState( tess, T_DORMANT );

  tess->state = T_IN_POLYGON;
  tess->cacheCount = 0;
  tess->emptyCache = FALSE;
  tess->mesh = NULL;

  tess->polygonData= data;
}
Beispiel #5
0
void REGALFASTUIDRAW_GLU_CALL
fastuidraw_gluTessBeginPolygon( fastuidraw_GLUtesselator *tess, void *data )
{
  RequireState( tess, T_DORMANT );

  tess->state = T_IN_POLYGON;
  tess->cacheCount = 0;
  tess->emptyCache = FALSE;
  tess->mesh = NULL;

  tess->polygonData= data;
}
Beispiel #6
0
void REGALGLU_CALL
gluTessBeginContour( GLUtesselator *tess )
{
  RequireState( tess, T_IN_POLYGON );

  tess->state = T_IN_CONTOUR;
  tess->lastEdge = NULL;
  if( tess->cacheCount > 0 ) {
    /* Just set a flag so we don't get confused by empty contours
     * -- these can be generated accidentally with the obsolete
     * NextContour() interface.
     */
    tess->emptyCache = TRUE;
  }
}
Beispiel #7
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 );
  }
}
Beispiel #8
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 );
  }
}
Beispiel #9
0
void REGALGLU_CALL
gluDeleteTess( GLUtesselator *tess )
{
  RequireState( tess, T_DORMANT );
  memFree( tess );
}
Beispiel #10
0
void GLAPIENTRY
gluTessEndContour( GLUtesselator *tess )
{
  RequireState( tess, T_IN_CONTOUR );
  tess->state = T_IN_POLYGON;
}
Beispiel #11
0
void GLAPIENTRY
gluDeleteTess( GLUtesselator *tess )
{
  RequireState( tess, T_DORMANT );
  memFree( tess );
}
Beispiel #12
0
void REGALWRATH_GLU_CALL
wrath_gluTessEndContour( wrath_GLUtesselator *tess )
{
  RequireState( tess, T_IN_CONTOUR );
  tess->state = T_IN_POLYGON;
}
Beispiel #13
0
void REGALGLU_CALL
gluTessEndContour( GLUtesselator *tess )
{
  RequireState( tess, T_IN_CONTOUR );
  tess->state = T_IN_POLYGON;
}
Beispiel #14
0
void  gluesTessEndContour(GLUEStesselator* tess)
{
   RequireState(tess, T_IN_CONTOUR);
   tess->state=T_IN_POLYGON;
}
Beispiel #15
0
void  gluesDeleteTess(GLUEStesselator* tess)
{
   RequireState(tess, T_DORMANT);
   memFree(tess);
}
Beispiel #16
0
void __stdcall
gluTessEndContour( GLUtesselator *tess )
{
  RequireState( tess, T_IN_CONTOUR );
  tess->state = T_IN_POLYGON;
}
Beispiel #17
0
void __stdcall
gluDeleteTess( GLUtesselator *tess )
{
  RequireState( tess, T_DORMANT );
  memFree( tess );
}
Beispiel #18
0
void REGALFASTUIDRAW_GLU_CALL
fastuidraw_gluTessEndContour( fastuidraw_GLUtesselator *tess )
{
  RequireState( tess, T_IN_CONTOUR );
  tess->state = T_IN_POLYGON;
}
Beispiel #19
0
void REGALGLU_CALL
gluTessEndPolygon( GLUtesselator *tess )
{
  GLUmesh *mesh;

  if (setjmp(tess->env) != 0) { 
     /* come back here if out of memory */
     CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
     return;
  }

  RequireState( tess, T_IN_POLYGON );
  tess->state = T_DORMANT;

  if( tess->mesh == NULL ) {
    if( ! tess->flagBoundary && tess->callMesh == &noMesh ) {

      /* Try some special code to make the easy cases go quickly
       * (eg. convex polygons).  This code does NOT handle multiple contours,
       * intersections, edge flags, and of course it does not generate
       * an explicit mesh either.
       */
      if( __gl_renderCache( tess )) {
	tess->polygonData= NULL;
	return;
      }
    }
    if ( !EmptyCache( tess ) ) longjmp(tess->env,1); /* could've used a label*/
  }

  /* Determine the polygon normal and project vertices onto the plane
   * of the polygon.
   */
  __gl_projectPolygon( tess );

  /* __gl_computeInterior( tess ) computes the planar arrangement specified
   * by the given contours, and further subdivides this arrangement
   * into regions.  Each region is marked "inside" if it belongs
   * to the polygon, according to the rule given by tess->windingRule.
   * Each interior region is guaranteed be monotone.
   */
  if ( !__gl_computeInterior( tess ) ) {
     longjmp(tess->env,1);	/* could've used a label */
  }

  mesh = tess->mesh;
  if( ! tess->fatalError ) {
    int rc = 1;

    /* If the user wants only the boundary contours, we throw away all edges
     * except those which separate the interior from the exterior.
     * Otherwise we tessellate all the regions marked "inside".
     */
    if( tess->boundaryOnly ) {
      rc = __gl_meshSetWindingNumber( mesh, 1, TRUE );
    } else {
      rc = __gl_meshTessellateInterior( mesh );
    }
    if (rc == 0) longjmp(tess->env,1);	/* could've used a label */

    __gl_meshCheckMesh( mesh );

    if( tess->callBegin != &noBegin || tess->callEnd != &noEnd
       || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag
       || tess->callBeginData != &__gl_noBeginData
       || tess->callEndData != &__gl_noEndData
       || tess->callVertexData != &__gl_noVertexData
       || tess->callEdgeFlagData != &__gl_noEdgeFlagData )
    {
      if( tess->boundaryOnly ) {
	__gl_renderBoundary( tess, mesh );  /* output boundary contours */
      } else {
	__gl_renderMesh( tess, mesh );	   /* output strips and fans */
      }
    }
    if( tess->callMesh != &noMesh ) {

      /* Throw away the exterior faces, so that all faces are interior.
       * This way the user doesn't have to check the "inside" flag,
       * and we don't need to even reveal its existence.  It also leaves
       * the freedom for an implementation to not generate the exterior
       * faces in the first place.
       */
      __gl_meshDiscardExterior( mesh );
      (*tess->callMesh)( mesh );		/* user wants the mesh itself */
      tess->mesh = NULL;
      tess->polygonData= NULL;
      return;
    }
  }
  __gl_meshDeleteMesh( mesh );
  tess->polygonData= NULL;
  tess->mesh = NULL;
}
Beispiel #20
0
void REGALFASTUIDRAW_GLU_CALL
fastuidraw_gluDeleteTess_release( fastuidraw_GLUtesselator *tess )
{
  RequireState( tess, T_DORMANT );
  memFree( tess );
}