/* glu.h */

/*
 * Mesa 3-D graphics library
 * Version:  1.2
 * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
 *
 * 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.
 */


/*
$Id: glu.h,v 1.11 1995/05/30 13:13:03 brianp Exp $

$Log: glu.h,v $
 * Revision 1.11  1995/05/30  13:13:03  brianp
 * added GLU_TRUE, GLU_FALSE, GLU_NURBS_ERRORxx, etc.
 *
 * Revision 1.10  1995/05/29  20:08:38  brianp
 * added gluGetNurbsProperty() prototype
 *
 * Revision 1.9  1995/05/24  13:43:30  brianp
 * added gluBeginTrim, gluEndTrim, gluPwlCurve
 *
 * Revision 1.8  1995/05/22  17:03:21  brianp
 * Release 1.2
 *
 * Revision 1.7  1995/05/16  18:03:22  brianp
 * renamed GLU_EDGEFLAG to GLU_EDGE_FLAG
 * renamed quadric, triangulator and nurbs structs
 *
 * Revision 1.6  1995/04/28  20:04:57  brianp
 * added stuff for Bogdan Sikorski's polygon tesselator
 *
 * Revision 1.5  1995/04/28  14:50:50  brianp
 * moved structs to their respective .c files
 *
 * Revision 1.4  1995/04/18  15:50:19  brianp
 * changed GLenum arguments to GLUenum, added ErrorFunc to quadric object
 *
 * Revision 1.3  1995/04/17  14:41:26  brianp
 * added GLU version 1.1 function: gluGetString
 *
 * Revision 1.2  1995/03/04  19:45:47  brianp
 * 1.1 beta revision
 *
 * Revision 1.1  1995/02/28  21:21:03  brianp
 * Initial revision
 *
 */


#ifndef GLU_H
#define GLU_H


#ifdef __cplusplus
extern "C" {
#endif


#include "GL/gl.h"


#define GLU_VERSION_1_1


#define GLU_TRUE   GL_TRUE
#define GLU_FALSE  GL_FALSE


typedef enum {
	/* Quadric draw styles */
	GLU_FILL,
	GLU_LINE,
	GLU_SILHOUETTE,
	GLU_POINT,
	GLU_OUTLINE_PATCH,
	GLU_OUTLINE_POLYGON,

	/* Quadric orientation */
	GLU_OUTSIDE,
	GLU_INSIDE,

	/* Normal vectors */
	GLU_NONE,
	GLU_FLAT,
	GLU_SMOOTH,

	/* NURBS */
	GLU_SAMPLING_TOLERANCE,
	GLU_DISPLAY_MODE,
	GLU_CULLING,
	GLU_AUTO_LOAD_MATRIX,
	GLU_MAP1_TRIM_2,
	GLU_MAP1_TRIM_3,

	/* Tesselator */
	GLU_BEGIN,
	GLU_VERTEX,
	GLU_EDGE_FLAG,
	GLU_END,
	GLU_EXTERIOR,
	GLU_INTERIOR,
	GLU_CCW,
	GLU_CW,
	GLU_UNKNOWN,

	/* New in GLU 1.1 */
	GLU_EXTENSIONS,
	GLU_VERSION,

	/* Errors */
	GLU_INVALID_ENUM,
	GLU_INVALID_VALUE,
	GLU_OUT_OF_MEMORY,
	GLU_ERROR,
	GLU_NO_ERROR,
	GLU_TESS_ERROR1,	/* missing gluEndPolygon */
	GLU_TESS_ERROR2,	/* missing gluBeginPolygon */
	GLU_TESS_ERROR3,	/* misoriented contour */
	GLU_TESS_ERROR4,	/* vertex/edge intersection */
	GLU_TESS_ERROR5,	/* misoriented or self-intersecting loops */
	GLU_TESS_ERROR6,	/* coincident vertices */
	GLU_TESS_ERROR7,	/* all vertices collinear */
	GLU_TESS_ERROR8,	/* intersecting edges */
	GLU_TESS_ERROR9,	/* not coplanar contours */
	GLU_NURBS_ERROR1,
	GLU_NURBS_ERROR2,
	GLU_NURBS_ERROR3,
	GLU_NURBS_ERROR4,
	GLU_NURBS_ERROR5,
	GLU_NURBS_ERROR6,
	GLU_NURBS_ERROR7,
	GLU_NURBS_ERROR8,
	GLU_NURBS_ERROR9,
	GLU_NURBS_ERROR10,
	GLU_NURBS_ERROR11,
	GLU_NURBS_ERROR12,
	GLU_NURBS_ERROR13,
	GLU_NURBS_ERROR14,
	GLU_NURBS_ERROR15,
	GLU_NURBS_ERROR16,
	GLU_NURBS_ERROR17,
	GLU_NURBS_ERROR18,
	GLU_NURBS_ERROR19,
	GLU_NURBS_ERROR20,
	GLU_NURBS_ERROR21,
	GLU_NURBS_ERROR22,
	GLU_NURBS_ERROR23,
	GLU_NURBS_ERROR24,
	GLU_NURBS_ERROR25,
	GLU_NURBS_ERROR26,
	GLU_NURBS_ERROR27,
	GLU_NURBS_ERROR28,
	GLU_NURBS_ERROR29,
	GLU_NURBS_ERROR30,
	GLU_NURBS_ERROR31,
	GLU_NURBS_ERROR32,
	GLU_NURBS_ERROR33,
	GLU_NURBS_ERROR34,
	GLU_NURBS_ERROR35,
	GLU_NURBS_ERROR36,
	GLU_NURBS_ERROR37
} GLUenum;


typedef struct GLUquadricObj GLUquadricObj;

typedef struct GLUtriangulatorObj GLUtriangulatorObj;

typedef struct GLUnurbsObj GLUnurbsObj;



/*
 *
 * Miscellaneous functions
 *
 */

extern void gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
		       GLdouble centerx, GLdouble centery, GLdouble centerz,
		       GLdouble upx, GLdouble upy, GLdouble upz );


extern void gluOrtho2D( GLdouble left, GLdouble right,
		        GLdouble bottom, GLdouble top );


extern void gluPerspective( GLdouble fovy, GLdouble aspect,
			    GLdouble zNear, GLdouble zFar );


extern void gluPickMatrix( GLdouble x, GLdouble y,
			   GLdouble width, GLdouble height,
			   GLint viewport[4] );

extern int gluProject( GLdouble objx, GLdouble objy, GLdouble objz,
		       const GLdouble modelMatrix[16],
		       const GLdouble projMatrix[16],
		       const GLint viewport[4],
		       GLdouble *winx, GLdouble *winy, GLdouble *winz );

extern int gluUnProject( GLdouble winx, GLdouble winy, GLdouble winz,
			 const GLdouble modelMatrix[16],
			 const GLdouble projMatrix[16],
			 const GLint viewport[4],
			 GLdouble *objx, GLdouble *objy, GLdouble *objz );

extern const GLubyte* gluErrorString( GLUenum errorCode );



/*
 *
 * Mipmapping and image scaling
 *
 */

extern int gluScaleImage( GLenum format,
			  GLint widthin, GLint heightin,
			  GLenum typein, const void *datain,
			  GLint widthout, GLint heightout,
			  GLenum typeout, void *dataout );

extern int gluBuild1DMipmaps( GLenum target, GLint components,
			      GLint width, GLenum format,
			      GLenum type, const void *data );

extern int gluBuild2DMipmaps( GLenum target, GLint components,
			      GLint width, GLint height, GLenum format,
			      GLenum type, const void *data );



/*
 *
 * Quadrics
 *
 */

extern GLUquadricObj *gluNewQuadric( void );

extern void gluDeleteQuadric( GLUquadricObj *state );

extern void gluQuadricDrawStyle( GLUquadricObj *quadObject,
				 GLUenum drawStyle );

extern void gluQuadricOrientation( GLUquadricObj *quadObject,
				   GLUenum orientation );

extern void gluQuadricNormals( GLUquadricObj *quadObject, GLUenum normals );

extern void gluQuadricTexture( GLUquadricObj *quadObject,
			       GLboolean textureCoords );

extern void gluQuadricCallback( GLUquadricObj *qobj,
			        GLUenum which, void (*fn)() );

extern void gluCylinder( GLUquadricObj *qobj,
			 GLdouble baseRadius,
			 GLdouble topRadius,
			 GLdouble height,
			 GLint slices, GLint stacks );

extern void gluSphere( GLUquadricObj *qobj,
		       GLdouble radius, GLint slices, GLint stacks );

extern void gluDisk( GLUquadricObj *qobj,
		     GLdouble innerRadius, GLdouble outerRadius,
		     GLint slices, GLint loops );

extern void gluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius,
			    GLdouble outerRadius, GLint slices, GLint loops,
			    GLdouble startAngle, GLdouble sweepAngle );



/*
 *
 * Nurbs
 *
 */

extern GLUnurbsObj *gluNewNurbsRenderer( void );

extern void gluDeleteNurbsRenderer( GLUnurbsObj *nobj );

extern void gluLoadSamplingMatrices( GLUnurbsObj *nobj,
				     const GLfloat modelMatrix[16],
				     const GLfloat projMatrix[16],
				     const GLint viewport[4] );

extern void gluNurbsProperty( GLUnurbsObj *nobj, GLUenum property,
			      GLfloat value );

extern void gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property,
				 GLfloat *value );

extern void gluBeginCurve( GLUnurbsObj *nobj );

extern void gluEndCurve( GLUnurbsObj * nobj );

extern void gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots, GLfloat *knot,
			   GLint stride, GLfloat *ctlarray, GLint order,
			   GLenum type );

extern void gluBeginSurface( GLUnurbsObj *nobj );

extern void gluEndSurface( GLUnurbsObj * nobj );

extern void gluNurbsSurface( GLUnurbsObj *nobj,
			     GLint sknot_count, GLfloat *sknot,
			     GLint tknot_count, GLfloat *tknot,
			     GLint s_stride, GLint t_stride,
			     GLfloat *ctlarray,
			     GLint sorder, GLint torder,
        	             GLenum type );

extern void gluBeginTrim( GLUnurbsObj *nobj );

extern void gluEndTrim( GLUnurbsObj *nobj );

extern void gluPwlCurve( GLUnurbsObj *nobj, GLint count, GLfloat *array,
			 GLint stride, GLenum type );

extern void gluNurbsCallback( GLUnurbsObj *nobj, GLenum which, void (*fn)() );



/*
 *
 * Polygon tesselation
 *
 */

extern GLUtriangulatorObj* gluNewTess( void );

extern void gluTessCallback( GLUtriangulatorObj *tobj, GLUenum which,
			      void (*fn)() );

extern void gluDeleteTess( GLUtriangulatorObj *tobj );

extern void gluBeginPolygon( GLUtriangulatorObj *tobj );

extern void gluEndPolygon( GLUtriangulatorObj *tobj );

extern void gluNextContour( GLUtriangulatorObj *tobj, GLUenum type );

extern void gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
			   void *data );



/*
 *
 * New functions in GLU 1.1
 *
 */

extern const GLubyte* gluGetString( GLUenum name );



#ifdef __cplusplus
}
#endif


#endif
