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 : Nick Thompson (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_VRMLBOX_ 00052 #define _SO_VRMLBOX_ 00053 00054 #include <Inventor/SbLinear.h> 00055 #include <Inventor/fields/SoSFVec3f.h> 00056 #include <Inventor/fields/SoSFBool.h> 00057 #include <Inventor/VRMLnodes/SoVRMLGeometry.h> 00058 00059 00060 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00061 #include <SoDeprecationRules.h> 00062 #pragma push_macro("SoDEPRECATED_CLASS") 00063 #pragma push_macro("SoDEPRECATED_TYPEDEF") 00064 #undef SoDEPRECATED_CLASS 00065 #undef SoDEPRECATED_TYPEDEF 00066 #define SoDEPRECATED_CLASS(x,y) 00067 #define SoDEPRECATED_TYPEDEF(x,y) 00068 #endif 00069 00071 // 00072 // Class: SoVRMLBox 00073 // 00074 // Simple cube. Default size is -1 to +1 in all 3 dimensions, but the 00075 // width, height, and depth fields can be used to change these. 00076 // 00078 class SoDEPRECATED SoVRMLBox : public SoVRMLGeometry { 00153 00154 SO_NODE_HEADER(SoVRMLBox); 00155 00156 public: 00157 // Fields 00161 SoSFVec3f size; // Size SoSFBool solid; 00176 SoVRMLBox(); 00177 00178 private: 00179 // Implements actions 00180 virtual void GLRender(SoGLRenderAction *action); 00181 virtual void generatePick(SoRayPickAction *action, SoNode *node); 00182 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00183 00184 // Computes bounding box of cube 00185 virtual void computeBBox(SoAction *action, SbBox3f &box, 00186 SbVec3f ¢er); 00187 00188 private: 00189 static void initClass(); 00190 static void exitClass(); 00191 00192 SB_THREAD_TLS_HEADER(); 00193 00194 private: 00195 // Generates triangles representing a cube 00196 virtual void generatePrimitives(SoAction *action); 00197 00198 // Overrides standard method to create an SoCubeDetail instance 00199 virtual SoDetail * createTriangleDetail(SoRayPickAction *action, 00200 const SoPrimitiveVertex *v1, 00201 const SoPrimitiveVertex *v2, 00202 const SoPrimitiveVertex *v3, 00203 SoPickedPoint *pp); 00204 00205 virtual ~SoVRMLBox(); 00206 00207 private: 00208 static SbVec3f coords[8]; // Corner coordinates 00209 static SbVec2f texCoords[4]; // Face corner texture coordinates 00210 static SbVec3f normals[6]; //Face normals 00211 static SbVec3f edgeNormals[12];// Edge normals (for wire-frame) 00212 static const SbVec3f *verts[6][4]; // Vertex references to coords 00213 00214 // This flag indicates whether picking is done on a real cube or a 00215 // cube that is just a bounding box representing another shape. If 00216 // this flag is TRUE, a pick on the cube should not generate a 00217 // detail, since the bounding box is not really in the picked path. 00218 SbBool pickingBoundingBox; 00219 00220 // Computes number of divisions per side based on complexity 00221 int computeNumDivisions(SoAction *action) const; 00222 00223 // Computes real half-width, -height, -depth 00224 void getSize(float &hWidth, 00225 float &hHeight, 00226 float &hDepth) const; 00227 00228 // These render the box 00229 void GLRenderGeneric(SoGLRenderAction *action, 00230 SbBool sendNormals, SbBool doTextures); 00231 void GLRenderNvertTnone(SoGLRenderAction *action); 00232 00233 // Thread static variables 00234 struct MTstruct { 00235 SbBool first; 00236 }; 00237 00238 // SoVRMLGeometry needs to get at the above methods 00239 friend class SoVRMLGeometry; 00240 }; 00241 00242 00243 00244 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00245 #pragma pop_macro("SoDEPRECATED_TYPEDEF") 00246 #pragma pop_macro("SoDEPRECATED_CLASS") 00247 #endif 00248 00249 #endif /* _SO_VRMLBOX_ */ 00250