summaryrefslogtreecommitdiffstats
path: root/src/glu/mesa/tess.h
diff options
context:
space:
mode:
authorGareth Hughes <[email protected]>1999-09-10 02:03:31 +0000
committerGareth Hughes <[email protected]>1999-09-10 02:03:31 +0000
commit2856b53e03a59d1a567a56b99450a44be1a60e13 (patch)
tree68e32d92cf522bf47db94e2f9074249a898a894b /src/glu/mesa/tess.h
parent2ba7c1cbe44ce7d8878e311ff22fe33da0cd6329 (diff)
Added GLU 1.3 tessellation (except winding rule code).
Diffstat (limited to 'src/glu/mesa/tess.h')
-rw-r--r--src/glu/mesa/tess.h185
1 files changed, 86 insertions, 99 deletions
diff --git a/src/glu/mesa/tess.h b/src/glu/mesa/tess.h
index 53d673ccbea..fe8296c976c 100644
--- a/src/glu/mesa/tess.h
+++ b/src/glu/mesa/tess.h
@@ -1,121 +1,108 @@
-/* $Id: tess.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
+/* $Id: tess.h,v 1.2 1999/09/10 02:03:31 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
-/*
- * $Log: tess.h,v $
- * Revision 1.1 1999/08/19 00:55:42 jtg
- * Initial revision
- *
- * Revision 1.5 1999/02/27 13:55:31 brianp
- * fixed BeOS-related GLU typedef problems
- *
- * Revision 1.4 1999/01/03 03:23:15 brianp
- * now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
- *
- * Revision 1.3 1997/10/29 02:02:20 brianp
- * various MS Windows compiler changes (David Bucciarelli, v20 3dfx driver)
+/*****************************************************************************
*
- * Revision 1.2 1997/05/24 13:30:58 brianp
- * added TESS_H multi-inclusion prevention test
+ * GLU 1.3 Polygon Tessellation by Gareth Hughes <[email protected]>
*
- * Revision 1.1 1996/09/27 01:19:39 brianp
- * Initial revision
- *
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
+ *****************************************************************************/
-#ifndef TESS_H
-#define TESS_H
+#ifndef __GLU_TESS_H__
+#define __GLU_TESS_H__
+#include <stdarg.h>
+#include <stdio.h>
#include "gluP.h"
-#define EPSILON 1e-06 /* epsilon for double precision compares */
-
-typedef enum
-{
- OXY,
- OYZ,
- OXZ
-} projection_type;
-
-typedef struct callbacks_str
-{
- void (GLCALLBACK *begin)( GLenum mode );
- void (GLCALLBACK *edgeFlag)( GLboolean flag );
- void (GLCALLBACK *vertex)( GLvoid *v );
- void (GLCALLBACK *end)( void );
- void (GLCALLBACK *error)( GLenum err );
-} tess_callbacks;
-
-typedef struct vertex_str
-{
- void *data;
- GLdouble location[3];
- GLdouble x,y;
- GLboolean edge_flag;
- struct vertex_str *shadow_vertex;
- struct vertex_str *next,*previous;
-} tess_vertex;
-
-typedef struct contour_str
-{
- GLenum type;
- GLuint vertex_cnt;
- GLdouble area;
- GLenum orientation;
- struct vertex_str *vertices,*last_vertex;
- struct contour_str *next,*previous;
-} tess_contour;
+#include "tess_typedefs.h"
+#include "tess_heap.h"
+#if 0
+#include "tess_grid.h"
+#endif
-typedef struct polygon_str
-{
- GLuint vertex_cnt;
- GLdouble A,B,C,D;
- GLdouble area;
- GLenum orientation;
- struct vertex_str *vertices,*last_vertex;
-} tess_polygon;
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*****************************************************************************
+ * The GLUtesselator structure:
+ *****************************************************************************/
struct GLUtesselator
{
- tess_contour *contours,*last_contour;
- GLuint contour_cnt;
- tess_callbacks callbacks;
- tess_polygon *current_polygon;
- GLenum error;
- GLdouble A,B,C,D;
- projection_type projection;
+ tess_callbacks_t callbacks;
+ GLboolean boundary_only;
+ GLenum winding_rule;
+ GLdouble tolerance;
+ tess_plane_t plane;
+ GLuint contour_count;
+ tess_contour_t *contours, *last_contour;
+ tess_contour_t *current_contour;
+ GLdouble mins[2], maxs[2];
+ GLuint vertex_count;
+ tess_vertex_t **sorted_vertices;
+#if 0
+ tess_grid_t *grid; /* Not currently used... */
+#endif
+ heap_t *heap;
+ GLenum error;
};
-extern void tess_call_user_error(GLUtriangulatorObj *,GLenum);
-
+/*****************************************************************************
+ * Tessellation error handler:
+ *****************************************************************************/
+extern void tess_error_callback( GLUtesselator *, GLenum, void * );
+
+
+/*****************************************************************************
+ * Debugging output: (to be removed...)
+ *****************************************************************************/
+extern int tess_debug_level;
+int vdebugstr( char *format_str, ... );
+
+#ifdef _DEBUG
+#define DEBUGP(level, body) \
+ do { \
+ if ( tess_debug_level >= level ) { \
+ vdebugstr( "%11.11s:%-5d ", __FILE__, __LINE__, level ); \
+ vdebugstr body; \
+ fflush ( stderr ); \
+ } \
+ } while ( 0 )
+#define DEBUGIF(level) do { if ( tess_debug_level >= level ) {
+#define DEBUGENDIF } } while ( 0 )
+#else
+#define DEBUGP(level, body)
+#define DEBUGIF(level) while(0) {
+#define DEBUGENDIF }
+#endif
+#ifdef __cplusplus
+}
#endif
+
+#endif // __GLU_TESS_H__