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-2020 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_VRMLINDEXED_LINE_ 00051 #define _SO_VRMLINDEXED_LINE_ 00052 00053 #include <Inventor/fields/SoMFInt32.h> 00054 #include <Inventor/VRMLnodes/SoVRMLVertexLine.h> 00055 00056 00057 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00058 #include <SoDeprecationRules.h> 00059 #pragma push_macro("SoDEPRECATED_CLASS") 00060 #pragma push_macro("SoDEPRECATED_TYPEDEF") 00061 #undef SoDEPRECATED_CLASS 00062 #undef SoDEPRECATED_TYPEDEF 00063 #define SoDEPRECATED_CLASS(x,y) 00064 #define SoDEPRECATED_TYPEDEF(x,y) 00065 #endif 00066 00068 // 00069 // Class: SoVRMLIndexedLine 00070 // 00071 // Abstract indexed shape node class. All nodes derived from this 00072 // (such as SoVRMLIndexedFaceSet and SoVRMLIndexedLineSet) are shapes 00073 // that are constructed from vertices defined by indexing into the 00074 // current coordinates. The coordinate indices are stored in the 00075 // coordIndex field, which is used by all subclasses. 00076 // 00077 // One rule is used: all coordinate indices less than 0 may be used 00078 // for special purposes, such as to denote the end of a face or 00079 // polyline. This means that all indices < 0 can be ignored safely 00080 // when looking at vertices. 00081 // 00082 // Depending on the current material, normal, and texture coordinate 00083 // binding values, materials, normals, and texture coordinates may be 00084 // accessed in order or may be indexed using the colorIndex, 00085 // normalIndex, and textureCoordIndex fields. 00086 // 00088 class SoDEPRECATED SoVRMLIndexedLine : public SoVRMLVertexLine { 00124 00125 SO_NODE_ABSTRACT_HEADER(SoVRMLIndexedLine); 00126 00127 public: 00133 SoMFInt32 coordIndex; 00140 SoMFInt32 colorIndex; 00141 00142 private: 00143 // This handles bounding box computation for all shapes derived 00144 // from this class. It sets the bounding box to contain all 00145 // vertices of the shape, assuming that the shape uses the 00146 // coordinates indexed by all non-negative values in the 00147 // coordIndex field. It also sets the center to the average of the 00148 // vertices' coordinates. 00149 virtual void computeBBox(SoAction *action, SbBox3f &box, 00150 SbVec3f ¢er); 00151 00152 private: 00153 static void initClass(); 00154 static void exitClass(); 00155 00156 private: 00157 // Constructor - makes this abstract 00158 SoVRMLIndexedLine(); 00159 00160 // Returns TRUE if texture coordinates should be indexed 00161 //static SbBool areTexCoordsIndexed(SoAction *action); 00162 00163 // Starting at a given index in the coordIndex array, figure out 00164 // how many vertices there are before either the end of the array 00165 // or the next 'border' index 00166 int getNumVerts(int startCoord); 00167 00168 // Setup for fast rendering. This should be called by subclasses, 00169 // which can then use the textureI/colorI/normalI arrays (which 00170 // will either point to one of the coordIndex arrays, or to a 00171 // consective array of integers. This must be called AFTER the 00172 // vpCache has been filled in. 00173 void setupIndices(int numFaces); 00174 00175 // These must not be called unless setupIndices has been called first: 00176 //const int32_t * getNormalIndices() 00177 //{ return (normalI ? normalI : consecutiveIndices); } 00178 const int32_t * getColorIndices() 00179 { return (colorI ? colorI : consecutiveIndices); } 00180 //const int32_t * getTexCoordIndices() 00181 //{ return (texCoordI ? texCoordI : consecutiveIndices); } 00182 00183 // Returns the SoNormalBindingElement normalBinding enum based on 00184 // the normal field and normalPerVertex field. 00185 00186 // Keep indices up to date if things change 00187 virtual void notify(SoNotList *list); 00188 00189 virtual ~SoVRMLIndexedLine(); 00190 00191 private: 00192 // Internal routines used to allocate sequential indices so the 00193 // same rendering loops can be used for indexed or non-indexed 00194 // cases: 00195 void allocateSequential(int howMany); 00196 int32_t* allocateSequentialWithHoles(); 00197 00198 // These are filled in by the setupIndices routine: 00199 //const int32_t *texCoordI; 00200 const int32_t *colorI; 00201 //const int32_t *normalI; 00202 static int32_t *consecutiveIndices; 00203 static int numConsecutiveIndicesAllocated; 00204 00205 unsigned char materialBinding; 00206 //unsigned char normalBinding; 00207 //unsigned char texCoordBinding; 00208 }; 00209 00210 00211 00212 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00213 #pragma pop_macro("SoDEPRECATED_TYPEDEF") 00214 #pragma pop_macro("SoDEPRECATED_CLASS") 00215 #endif 00216 00217 #endif /* _SO_VRMLINDEXED_LINE_ */ 00218