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-2020 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_VRMLDISK2D_ 00052 #define _SO_VRMLDISK2D_ 00053 00054 00055 #include <Inventor/SbLinear.h> 00056 #include <Inventor/fields/SoMFInt32.h> 00057 #include <Inventor/fields/SoSFFloat.h> 00058 #include <Inventor/fields/SoSFBool.h> 00059 #include <Inventor/VRMLnodes/SoVRMLGeometry.h> 00060 00061 00062 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00063 #include <SoDeprecationRules.h> 00064 #pragma push_macro("SoDEPRECATED_CLASS") 00065 #pragma push_macro("SoDEPRECATED_TYPEDEF") 00066 #undef SoDEPRECATED_CLASS 00067 #undef SoDEPRECATED_TYPEDEF 00068 #define SoDEPRECATED_CLASS(x,y) 00069 #define SoDEPRECATED_TYPEDEF(x,y) 00070 #endif 00071 00073 // 00074 // Class: SoVRMLDisk2D 00075 // 00076 // Specifies a circular disk. 00077 // 00079 00080 class SoNormalBundle; 00081 class SoDEPRECATED SoVRMLDisk2D : public SoVRMLGeometry { 00146 00147 SO_NODE_HEADER(SoVRMLDisk2D); 00148 00149 public: 00150 00151 // Fields 00157 SoSFFloat outerRadius; 00165 SoSFFloat innerRadius; 00171 SoSFBool solid; 00172 00176 SoVRMLDisk2D(); 00177 00178 private: 00179 // Implement actions 00180 virtual void GLRender(SoGLRenderAction *action); 00181 00182 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00183 virtual void generatePick(SoRayPickAction *action, SoNode *node); 00184 // Generates default normals using the given normal bundle. 00185 // Returns TRUE. 00186 virtual SbBool generateDefaultNormals(SoState *state, SoNormalBundle *nb); 00187 00188 // Computes bounding box of face set 00189 virtual void computeBBox(SoAction *action, SbBox3f &box, 00190 SbVec3f ¢er); 00191 00192 private: 00193 static void initClass(); 00194 static void exitClass(); 00195 00196 private: 00197 // This enum is used to indicate the current material or normal binding 00198 enum Binding { 00199 OVERALL, PER_FACE, PER_VERTEX 00200 }; 00201 // Generates triangles representing faces 00202 virtual void generatePrimitives(SoAction *action); 00203 00204 // Overrides standard method to create an SoFaceDetail instance 00205 virtual SoDetail * createTriangleDetail(SoRayPickAction *action, 00206 const SoPrimitiveVertex *v1, 00207 const SoPrimitiveVertex *v2, 00208 const SoPrimitiveVertex *v3, 00209 SoPickedPoint *pp); 00210 00211 ~SoVRMLDisk2D(); 00212 00213 // Called on notification of field change 00214 virtual void notify(SoNotList *list); 00215 00216 private: 00217 00218 SbVec3f *array; 00219 SbVec2f *texArray; 00220 Binding getNormalBinding(SoAction *action, 00221 SoNormalBundle *nb); 00222 00223 // Figures out normals, if necessary. 00224 SbBool figureNormals(SoState *state, SoNormalBundle *nb); 00225 00226 void setupPoints(SoAction *action); 00227 void setupSegmentAngle(SoAction *action); 00228 float step_angle[2]; 00229 00230 int numFaces, totalVertices; 00231 int num_points[2]; 00232 00233 SbBool nvNotifyEnabled; 00234 00235 // render function 00236 void doRendering(SoGLRenderAction *action, const SoShapeStyleElement* shapeStyle); 00237 00238 static const int AUTO_CACHE_FS_MIN_WITHOUT_VP; 00239 00240 static const int AUTO_CACHE_FS_MAX; 00241 }; 00242 00243 00244 00245 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00246 #pragma pop_macro("SoDEPRECATED_TYPEDEF") 00247 #pragma pop_macro("SoDEPRECATED_CLASS") 00248 #endif 00249 00250 #endif /* _SO_VRMLDISK2D_ */ 00251