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 ** Modified by : Gavin Bell (MMM yyyy) 00026 **=======================================================================*/ 00027 /*======================================================================= 00028 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00029 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00030 *** *** 00031 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00032 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00033 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00034 *** *** 00035 *** RESTRICTED RIGHTS LEGEND *** 00036 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00037 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00038 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00039 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00040 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00041 *** *** 00042 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00043 *** BORDEAUX, FRANCE *** 00044 *** ALL RIGHTS RESERVED *** 00045 **=======================================================================*/ 00046 /*======================================================================= 00047 ** Modified by : VSG (MMM YYYY) 00048 **=======================================================================*/ 00049 00050 00051 #ifndef _SO_FACE_SET_ 00052 #define _SO_FACE_SET_ 00053 00054 #include <Inventor/SbLinear.h> 00055 #include <Inventor/fields/SoMFInt32.h> 00056 #include <Inventor/nodes/SoNonIndexedShape.h> 00057 #include <Inventor/SbPImpl.h> 00058 00059 00061 // 00062 // Class: SoFaceSet 00063 // 00064 // Set of faces. Each face consists of 3 or more vertices, taken in 00065 // order from the current coordinates. The startIndex field gives the 00066 // starting coordinate index for the first face. The number of 00067 // vertices in each face is determined by successive entries in the 00068 // numVertices field. 00069 // 00071 00072 // This value, when used in the numVertices field, means that the 00073 // corresponding face should use the rest of the vertices 00074 #define SO_FACE_SET_USE_REST_OF_VERTICES (-1) 00075 00076 class SoNormalBundle; 00077 class SoState; 00078 class SoVolumeFaceSet; 00079 class IShapeVrtxImpl2ShapeVrtxAPI; 00080 00081 SO_PIMPL_PUBLIC_DECLARATION(SoFaceSet) 00082 00083 00228 class SoFaceSet : public SoNonIndexedShape 00229 { 00230 SO_NODE_HEADER(SoFaceSet); 00231 SO_PIMPL_PUBLIC_HEADER(SoFaceSet) 00232 00233 public: 00234 00238 SoMFInt32 numVertices; 00239 00243 SoFaceSet(); 00244 00245 private: 00246 // Implement actions 00247 virtual void GLRender( SoGLRenderAction* action ); 00248 00249 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action ); 00250 00251 // Generates default normals using the given normal bundle. 00252 // Returns TRUE. 00253 virtual void generateDefaultNormals( SoState* state, 00254 const SbVec3f* coords, 00255 int numCoords, 00256 SoNormalBundle* nb, 00257 SbBool storeRef = FALSE ); 00258 00260 virtual void shouldGenerateTangents( SoGLRenderAction* /*action*/, const SoShapeStyleElement* /*shapeStyle*/ ) {} 00261 00262 private: 00263 00264 static void initClass(); 00265 static void exitClass(); 00266 00267 virtual int getNumVert( SoState* state = NULL ); 00268 00269 virtual int getNumPrim( SoState* state = NULL ); 00270 00271 private: 00272 00273 //shape must check shape hints in GlRender 00274 virtual SbBool shouldCheckShapeHints(){ return TRUE; } 00275 00276 //Test function 00277 virtual SbBool shapeHintsTest( SoState* state = NULL ); 00278 00279 //Free memory 00280 virtual void exitRender( SoState* state, 00281 int stateFlag, 00282 SoTextureCoordinateBundle* tcb, 00283 SoTextureCoordinate3Bundle* tc3b); 00284 00285 virtual void countPrim( SoState* state = NULL ); 00286 00287 // Generates triangles representing faces 00288 virtual void generatePrimitives( SoAction* action ); 00289 00290 // render function 00291 void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle ); 00292 00293 // Overrides standard method to create an SoFaceDetail instance 00294 virtual SoDetail* createTriangleDetail( SoRayPickAction* action, 00295 const SoPrimitiveVertex* v1, 00296 const SoPrimitiveVertex* v2, 00297 const SoPrimitiveVertex* v3, 00298 SoPickedPoint* pp ); 00299 00300 ~SoFaceSet(); 00301 00302 //When tesselating complex polygons, keep the result cached 00303 virtual bool hasGeneratePrimitiveCache() 00304 { 00305 return true; 00306 } 00307 00308 private: 00309 00310 // set numTris/Quads/Faces to -1, checks SO_USE_REST_OF_VERTICES 00311 // when notified 00312 virtual void notify( SoNotList* list ); 00313 00314 private: 00315 00316 // This enum is used to indicate the current material or normal binding 00317 enum Binding { 00318 OVERALL, PER_FACE, PER_VERTEX 00319 }; 00320 00321 void commonConstructor(); 00322 00323 }; 00324 00325 #endif /* _SO_FACE_SET_ */ 00326 00327