1f220fa62Smrg/* 2f220fa62Smrg * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) 3f220fa62Smrg * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. 4f220fa62Smrg * 5f220fa62Smrg * Permission is hereby granted, free of charge, to any person obtaining a 6f220fa62Smrg * copy of this software and associated documentation files (the "Software"), 7f220fa62Smrg * to deal in the Software without restriction, including without limitation 8f220fa62Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9f220fa62Smrg * and/or sell copies of the Software, and to permit persons to whom the 10f220fa62Smrg * Software is furnished to do so, subject to the following conditions: 11f220fa62Smrg * 12f220fa62Smrg * The above copyright notice including the dates of first publication and 13f220fa62Smrg * either this permission notice or a reference to 14f220fa62Smrg * http://oss.sgi.com/projects/FreeB/ 15f220fa62Smrg * shall be included in all copies or substantial portions of the Software. 16f220fa62Smrg * 17f220fa62Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18f220fa62Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19f220fa62Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20f220fa62Smrg * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21f220fa62Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 22f220fa62Smrg * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23f220fa62Smrg * SOFTWARE. 24f220fa62Smrg * 25f220fa62Smrg * Except as contained in this notice, the name of Silicon Graphics, Inc. 26f220fa62Smrg * shall not be used in advertising or otherwise to promote the sale, use or 27f220fa62Smrg * other dealings in this Software without prior written authorization from 28f220fa62Smrg * Silicon Graphics, Inc. 29f220fa62Smrg */ 30f220fa62Smrg 31f220fa62Smrg/* 32f220fa62Smrg * nurbstess.h 33f220fa62Smrg * 34f220fa62Smrg */ 35f220fa62Smrg 36f220fa62Smrg#ifndef __glunurbstess_h_ 37f220fa62Smrg#define __glunurbstess_h_ 38f220fa62Smrg 39f220fa62Smrg#include "mysetjmp.h" 40f220fa62Smrg#include "subdivider.h" 41f220fa62Smrg#include "renderhints.h" 42f220fa62Smrg#include "backend.h" 43f220fa62Smrg#include "maplist.h" 44f220fa62Smrg#include "reader.h" 45f220fa62Smrg#include "nurbsconsts.h" 46f220fa62Smrg 47f220fa62Smrgstruct Knotvector; 48f220fa62Smrgclass Quilt; 49f220fa62Smrgclass DisplayList; 50f220fa62Smrgclass BasicCurveEvaluator; 51f220fa62Smrgclass BasicSurfaceEvaluator; 52f220fa62Smrg 53f220fa62Smrgclass NurbsTessellator { 54f220fa62Smrgpublic: 55f220fa62Smrg NurbsTessellator( BasicCurveEvaluator &c, 56f220fa62Smrg BasicSurfaceEvaluator &e ); 57f220fa62Smrg virtual ~NurbsTessellator( void ); 58f220fa62Smrg 59f220fa62Smrg void getnurbsproperty( long, INREAL * ); 60f220fa62Smrg void getnurbsproperty( long, long, INREAL * ); 61f220fa62Smrg void setnurbsproperty( long, INREAL ); 62f220fa62Smrg void setnurbsproperty( long, long, INREAL ); 63f220fa62Smrg void setnurbsproperty( long, long, INREAL * ); 64f220fa62Smrg void setnurbsproperty( long, long, INREAL *, long, long ); 65f220fa62Smrg 66f220fa62Smrg // called before a tessellation begins/ends 67f220fa62Smrg virtual void bgnrender( void ); 68f220fa62Smrg virtual void endrender( void ); 69f220fa62Smrg 70f220fa62Smrg // called to make a display list of the output vertices 71f220fa62Smrg virtual void makeobj( int n ); 72f220fa62Smrg virtual void closeobj( void ); 73f220fa62Smrg 74f220fa62Smrg // called when a error occurs 75f220fa62Smrg virtual void errorHandler( int ); 76f220fa62Smrg 77f220fa62Smrg void bgnsurface( long ); 78f220fa62Smrg void endsurface( void ); 79f220fa62Smrg void bgntrim( void ); 80f220fa62Smrg void endtrim( void ); 81f220fa62Smrg void bgncurve( long ); 82f220fa62Smrg void endcurve( void ); 83f220fa62Smrg void pwlcurve( long, INREAL[], long, long ); 84f220fa62Smrg void nurbscurve( long, INREAL[], long, INREAL[], long, long ); 85f220fa62Smrg void nurbssurface( long, INREAL[], long, INREAL[], long, long, 86f220fa62Smrg INREAL[], long, long, long ); 87f220fa62Smrg 88f220fa62Smrg void defineMap( long, long, long ); 89f220fa62Smrg void redefineMaps( void ); 90f220fa62Smrg 91f220fa62Smrg // recording of input description 92f220fa62Smrg void discardRecording( void * ); 93f220fa62Smrg void * beginRecording( void ); 94f220fa62Smrg void endRecording( void ); 95f220fa62Smrg void playRecording( void * ); 96f220fa62Smrg 97f220fa62Smrg //for optimizing untrimmed nurbs in the case of domain distance sampling 98f220fa62Smrg void set_domain_distance_u_rate(REAL u_rate); 99f220fa62Smrg void set_domain_distance_v_rate(REAL v_rate); 100f220fa62Smrg void set_is_domain_distance_sampling(int flag); 101f220fa62Smrg 102f220fa62Smrg 103f220fa62Smrgprotected: 104f220fa62Smrg Renderhints renderhints; 105f220fa62Smrg Maplist maplist; 106f220fa62Smrg Backend backend; 107f220fa62Smrg 108f220fa62Smrgprivate: 109f220fa62Smrg 110f220fa62Smrg void resetObjects( void ); 111f220fa62Smrg int do_check_knots( Knotvector *, const char * ); 112f220fa62Smrg void do_nurbserror( int ); 113f220fa62Smrg void do_bgncurve( O_curve * ); 114f220fa62Smrg void do_endcurve( void ); 115f220fa62Smrg void do_freeall( void ); 116f220fa62Smrg void do_freecurveall( O_curve * ); 117f220fa62Smrg void do_freebgntrim( O_trim * ); 118f220fa62Smrg void do_freebgncurve( O_curve * ); 119f220fa62Smrg void do_freepwlcurve( O_pwlcurve * ); 120f220fa62Smrg void do_freenurbscurve( O_nurbscurve * ); 121f220fa62Smrg void do_freenurbssurface( O_nurbssurface * ); 122f220fa62Smrg void do_freebgnsurface( O_surface * ); 123f220fa62Smrg void do_bgnsurface( O_surface * ); 124f220fa62Smrg void do_endsurface( void ); 125f220fa62Smrg void do_bgntrim( O_trim * ); 126f220fa62Smrg void do_endtrim( void ); 127f220fa62Smrg void do_pwlcurve( O_pwlcurve * ); 128f220fa62Smrg void do_nurbscurve( O_nurbscurve * ); 129f220fa62Smrg void do_nurbssurface( O_nurbssurface * ); 130f220fa62Smrg void do_freenurbsproperty( Property * ); 131f220fa62Smrg void do_setnurbsproperty( Property * ); 132f220fa62Smrg void do_setnurbsproperty2( Property * ); 133f220fa62Smrg 134f220fa62Smrg Subdivider subdivider; 135f220fa62Smrg JumpBuffer* jumpbuffer; 136f220fa62Smrg Pool o_pwlcurvePool; 137f220fa62Smrg Pool o_nurbscurvePool; 138f220fa62Smrg Pool o_curvePool; 139f220fa62Smrg Pool o_trimPool; 140f220fa62Smrg Pool o_surfacePool; 141f220fa62Smrg Pool o_nurbssurfacePool; 142f220fa62Smrg Pool propertyPool; 143f220fa62Smrgpublic: 144f220fa62Smrg Pool quiltPool; 145f220fa62Smrgprivate: 146f220fa62Smrg TrimVertexPool extTrimVertexPool; 147f220fa62Smrg 148f220fa62Smrg int inSurface; /* bgnsurface seen */ 149f220fa62Smrg int inCurve; /* bgncurve seen */ 150f220fa62Smrg int inTrim; /* bgntrim seen */ 151f220fa62Smrg int isCurveModified; /* curve changed */ 152f220fa62Smrg int isTrimModified; /* trim curves changed */ 153f220fa62Smrg int isSurfaceModified; /* surface changed */ 154f220fa62Smrg int isDataValid; /* all data is good */ 155f220fa62Smrg int numTrims; /* valid trim regions */ 156f220fa62Smrg int playBack; 157f220fa62Smrg 158f220fa62Smrg O_trim** nextTrim; /* place to link o_trim */ 159f220fa62Smrg O_curve** nextCurve; /* place to link o_curve */ 160f220fa62Smrg O_nurbscurve** nextNurbscurve; /* place to link o_nurbscurve */ 161f220fa62Smrg O_pwlcurve** nextPwlcurve; /* place to link o_pwlcurve */ 162f220fa62Smrg O_nurbssurface** nextNurbssurface; /* place to link o_nurbssurface */ 163f220fa62Smrg 164f220fa62Smrg O_surface* currentSurface; 165f220fa62Smrg O_trim* currentTrim; 166f220fa62Smrg O_curve* currentCurve; 167f220fa62Smrg 168f220fa62Smrg DisplayList *dl; 169f220fa62Smrg 170f220fa62Smrg}; 171f220fa62Smrg 172f220fa62Smrg#endif /* __glunurbstess_h_ */ 173