summaryrefslogtreecommitdiff
path: root/src/glu/mesa/tess.h
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-07-11 14:11:04 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-07-11 14:11:04 +0000
commitf88602394d7cc340cc850622308ce1cbbff332a5 (patch)
tree0a23d3e19af28217550753d29535afafa39ccfea /src/glu/mesa/tess.h
parentf545e2aedde0d0c09c76a7e772b333163fddba17 (diff)
reverted to old tessellator (GLU 1.1)
Diffstat (limited to 'src/glu/mesa/tess.h')
-rw-r--r--src/glu/mesa/tess.h189
1 files changed, 83 insertions, 106 deletions
diff --git a/src/glu/mesa/tess.h b/src/glu/mesa/tess.h
index 5568183073..ddb9b30cb2 100644
--- a/src/glu/mesa/tess.h
+++ b/src/glu/mesa/tess.h
@@ -1,131 +1,108 @@
-/* $Id: tess.h,v 1.16 1999/12/06 09:39:34 gareth Exp $ */
+/* $Id: tess.h,v 1.17 2000/07/11 14:11:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.3
+ * Copyright (C) 1995-2000 Brian Paul
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * 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.
*
- * 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:
+ * 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.
*
- * 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.
+ * 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.
*/
-/*****************************************************************************
- *
- * GLU 1.3 Polygon Tessellation by Gareth Hughes <garethh@bell-labs.com>
- *
- *****************************************************************************/
-#ifndef __GLU_TESS_H__
-#define __GLU_TESS_H__
+/*
+ * This file is part of the polygon tesselation code contributed by
+ * Bogdan Sikorski
+ */
-#include <stdarg.h>
-#include <stdio.h>
-#include "gluP.h"
+#ifndef TESS_H
+#define TESS_H
-#include "tess_typedefs.h"
-#include "tess_macros.h"
-#include "tess_hash.h"
-#include "tess_heap.h"
-#if 0
-#include "tess_grid.h"
-#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "gluP.h"
+
+#define EPSILON 1e-06 /* epsilon for double precision compares */
-/*****************************************************************************
- * The GLUtesselator structure:
- *****************************************************************************/
-struct GLUtesselator
+typedef enum
{
- tess_callbacks_t callbacks;
- GLenum winding_rule;
- GLboolean boundary_only;
- GLdouble tolerance;
- GLenum orientation;
- void *data;
- GLint num_contours;
- tess_contour_t *contours, *last_contour;
- tess_contour_t *current_contour;
- GLdouble mins[2], maxs[2];
- GLint num_vertices;
- tess_vertex_t **sorted_vertices;
-#if 0
- tess_grid_t *grid; /* Not currently used... */
-#endif
- heap_t *ears;
- GLboolean edge_flag;
- GLuint label;
- tess_plane_t plane;
- GLenum error;
-};
+ 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;
-/*****************************************************************************
- * Common tessellation functions:
- *****************************************************************************/
-extern void tess_error_callback( GLUtesselator *, GLenum );
+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;
-extern GLdouble twice_contour_area( tess_contour_t *contour );
-extern void reverse_contour( tess_contour_t *contour );
-extern void delete_contour( tess_contour_t **contour );
+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;
-extern void contour_dump( tess_contour_t *contour );
+typedef struct polygon_str
+{
+ GLuint vertex_cnt;
+ GLdouble A, B, C, D;
+ GLdouble area;
+ GLenum orientation;
+ struct vertex_str *vertices, *last_vertex;
+}
+tess_polygon;
+struct GLUtriangulatorObj
+{
+ 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;
+};
-/*****************************************************************************
- * Debugging output:
- *****************************************************************************/
-#ifdef DEBUG
-extern int tess_dbg_level;
-#define DBG_LEVEL_BASE 1
-#define DBG_LEVEL_VERBOSE 10
-#define DBG_LEVEL_ENTEREXIT 20
+extern void tess_call_user_error(GLUtriangulatorObj *, GLenum);
+extern void tess_test_polygon(GLUtriangulatorObj *);
+extern void tess_find_contour_hierarchies(GLUtriangulatorObj *);
+extern void tess_handle_holes(GLUtriangulatorObj *);
+extern void tess_tesselate(GLUtriangulatorObj *);
+extern void tess_tesselate_with_edge_flag(GLUtriangulatorObj *);
-#ifdef _WIN32
-#define DBG_STREAM stdout
-#else
-#define DBG_STREAM stderr
-#endif
-#ifdef __GNUC__
-#define MSG( level, format, args... ) \
- if ( level <= tess_dbg_level ) { \
- fprintf( DBG_STREAM, "%9.9s:%d:\t ", __FILE__, __LINE__ ); \
- fprintf( DBG_STREAM, format, ## args ); \
- fflush( DBG_STREAM ); \
- }
-#else
-#define MSG tess_msg
-#endif /* __GNUC__ */
-
-#else
-#define MSG tess_msg
-#endif /* DEBUG */
-
-extern INLINE void tess_msg( GLint level, char *format, ... );
-extern INLINE void tess_info( char *file, GLint line );
-
-#ifdef __cplusplus
-}
#endif
-
-#endif /* __GLU_TESS_H__ */