00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Paul S. Strauss (MMM yyyy) 00025 **=======================================================================*/ 00026 /*======================================================================= 00027 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00028 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00029 *** *** 00030 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00031 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00032 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00033 *** *** 00034 *** RESTRICTED RIGHTS LEGEND *** 00035 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00036 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00037 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00038 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00039 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00040 *** *** 00041 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00042 *** BORDEAUX, FRANCE *** 00043 *** ALL RIGHTS RESERVED *** 00044 **=======================================================================*/ 00045 /*======================================================================= 00046 ** Modified by : VSG (MMM YYYY) 00047 **=======================================================================*/ 00048 00049 00050 #ifndef _SO_TRIANGLE_STRIP_SET_ 00051 #define _SO_TRIANGLE_STRIP_SET_ 00052 00053 #include <Inventor/fields/SoMFInt32.h> 00054 #include <Inventor/nodes/SoNonIndexedShape.h> 00055 #include <Inventor/SbPImpl.h> 00056 00058 // 00059 // Class: SoTriangleStripSet 00060 // 00061 // Triangle strip set node. Each strip in the set consists of n 00062 // vertices located at consecutive entries in the current 00063 // coordinates. The startIndex field gives the starting coordinate 00064 // index for the first strip. If materials or normals are bound to 00065 // vertices, they will begin at that index, as well; otherwise, they 00066 // will start at index 0. The number of vertices in each strip is 00067 // determined by successive entries in the numVertices field. 00068 // 00070 00071 class SoCoordinateElement; 00072 class SoVolumeTriangleStripSet; 00073 00074 SO_PIMPL_PUBLIC_DECLARATION(SoTriangleStripSet) 00075 00076 // Deprecated feature; specifying USE_REST_OF_VERTICES as the last 00077 // value in the numVertices field will use all the points in the 00078 // coordinate array. 00079 #define SO_TRI_STRIP_SET_USE_REST_OF_VERTICES (-1) 00080 00165 class SoTriangleStripSet : public SoNonIndexedShape 00166 { 00167 SO_NODE_HEADER(SoTriangleStripSet); 00168 SO_PIMPL_PUBLIC_HEADER(SoTriangleStripSet) 00169 00170 public: 00171 // Fields 00176 SoMFInt32 numVertices; 00177 00181 SoTriangleStripSet(); 00182 00183 private: 00187 virtual void GLRender( SoGLRenderAction* action ); 00188 00193 virtual void generateDefaultNormals( SoState* state, 00194 const SbVec3f* coords, 00195 int numCoords, 00196 SoNormalBundle* nb, 00197 SbBool storeRef = FALSE); 00198 00200 virtual void shouldGenerateTangents( SoGLRenderAction* /*action*/, const SoShapeStyleElement* /*shapeStyle*/ ) {} 00201 00205 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action ); 00206 00207 private: 00208 // returns the number of PARTS 00209 int getNumStrips() const; 00210 00211 static void initClass(); 00212 static void exitClass(); 00213 00214 //Typedef of pointer to method on TriangleStripSet; 00215 //This will be used to simplify declaration and initialization. 00216 typedef void (SoTriangleStripSet::*PMTSS)(SoGLRenderAction *); 00217 00218 // return num vertices for test 00219 virtual int getNumVert( SoState* state = NULL ); 00220 00221 //return number of primitives 00222 virtual int getNumPrim( SoState* state = NULL ); 00223 00224 private: 00225 00226 // Generates triangles representing strips 00227 virtual void generatePrimitives( SoAction* action ); 00228 00229 //Free memory 00230 virtual void exitRender( SoState* state, 00231 int stateFlag, 00232 SoTextureCoordinateBundle* tcb, 00233 SoTextureCoordinate3Bundle* tc3b); 00234 00235 // count primitives 00236 virtual void countPrim( SoState* state = NULL ); 00237 00238 // render function 00239 void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle); 00240 00241 // Overrides standard method to create an SoFaceDetail instance 00242 virtual SoDetail* createTriangleDetail( SoRayPickAction* action, 00243 const SoPrimitiveVertex* v1, 00244 const SoPrimitiveVertex* v2, 00245 const SoPrimitiveVertex* v3, 00246 SoPickedPoint* pp); 00247 00248 virtual ~SoTriangleStripSet(); 00249 00250 private: 00251 // Blow vpCache when vertexProperty field changes: 00252 virtual void notify( SoNotList* list ); 00253 00254 private: 00255 00256 static const int AUTO_CACHE_TSS_MIN_WITHOUT_VP; 00257 static const int AUTO_CACHE_TSS_MAX; 00258 }; 00259 00260 #endif /* _SO_TRIANGLE_STRIP_SET_ */ 00261 00262 00263