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_VRML_LINE_SET_ 00052 #define _SO_VRML_LINE_SET_ 00053 00054 #include <Inventor/fields/SoMFInt32.h> 00055 #include <Inventor/VRMLnodes/SoVRMLNode.h> 00056 00057 00058 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00059 #include <SoDeprecationRules.h> 00060 #pragma push_macro("SoDEPRECATED_CLASS") 00061 #pragma push_macro("SoDEPRECATED_TYPEDEF") 00062 #undef SoDEPRECATED_CLASS 00063 #undef SoDEPRECATED_TYPEDEF 00064 #define SoDEPRECATED_CLASS(x,y) 00065 #define SoDEPRECATED_TYPEDEF(x,y) 00066 #endif 00067 00068 class SoState; 00069 class SoPrimitiveVertex; 00070 00072 // 00073 // Class: SoVRMLIndexedLineSet 00074 // 00075 // Indexed set of (poly)lines. Each line consists of 2 or more 00076 // vertices, each of which is denoted by an integer index (from the 00077 // coordIndex field) into the current coordinates. Depending on the 00078 // current material and normal binding values, the materials and 00079 // normals for the lines or vertices may be accessed in order or 00080 // indexed. If they are indexed, the colorlIndex and normalIndex 00081 // fields are used. Texture coordinates may also be indexed, using 00082 // the textureCoordIndex field. 00083 // 00085 00086 // This coordinate index indicates that the current line ends and the 00087 // next line begins 00088 #define SO_END_LINE_INDEX (-1) 00089 class SoDEPRECATED SoVRMLLineSet : public SoVRMLNode { 00163 00164 SO_NODE_HEADER(SoVRMLLineSet); 00165 00166 public: 00167 // Fields 00168 00173 SoSFNode coord; 00178 SoSFNode color; 00183 SoMFInt32 vertexCount; 00187 SoVRMLLineSet(); 00188 00189 private: 00190 // Implements actions 00191 virtual void GLRender(SoGLRenderAction *action); 00192 virtual void generatePick(SoRayPickAction *action, SoNode *node); 00193 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00194 00195 00196 // Redefine this to tell open caches that they contain lines 00197 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00198 00199 //Typedef of pointer to method on IndexedLineSet; 00200 //This will be used to simplify declaration and initialization. 00201 typedef void (SoVRMLLineSet::*PMILS)(SoGLRenderAction *); 00202 00203 private: 00204 static void initClass(); 00205 static void exitClass(); 00206 00207 private: 00208 // This enum is used to indicate the current material binding 00209 enum Binding { 00210 OVERALL, 00211 PER_SEGMENT, PER_SEGMENT_INDEXED, 00212 PER_LINE, PER_LINE_INDEXED, 00213 PER_VERTEX, PER_VERTEX_INDEXED 00214 }; 00215 // Generates line segments representing line set 00216 virtual void generatePrimitives(SoAction *action); 00217 00218 // Overrides standard method to create an SoLineDetail instance 00219 virtual SoDetail * createLineSegmentDetail(SoRayPickAction *action, 00220 const SoPrimitiveVertex *v1, 00221 const SoPrimitiveVertex *v2, 00222 SoPickedPoint *pp); 00223 virtual ~SoVRMLLineSet(); 00224 00225 private: 00226 // Returns current material or normal binding from action's state 00227 static Binding getMaterialBinding(SoAction *action); 00228 //static Binding getNormalBinding(SoAction *action); 00229 00230 // Reset numVertices/numSegments/numPolylines when notified 00231 virtual void notify(SoNotList *list); 00232 00233 // Fill in numPolylines, numSegments 00234 void countPolylinesAndSegments(); 00235 00236 // Number of polylines, number of line segments, and vertices per polyline 00237 00238 int numSegments; 00239 int numPolylines; 00240 int * numVertices; 00241 00242 // Returns TRUE if normal binding is AUTO and there aren't enough 00243 // PER_VERTEX normals, in which case we turn off lighting and draw 00244 // BASE_COLOR. 00245 //wouldGenerateNormals(SoState *state); 00246 00247 // 32 different render functions; names are formed like this: 00248 // Om -- overall material Pm -- per part material 00249 // Fm -- per face material Vm -- per vertex material 00250 // On -- overall normal Pm -- per part normal 00251 // Fn -- per face normal Vm -- per vertex normal 00252 // T -- per vertex texture coordinates 00253 void OmOn(SoGLRenderAction *); void OmOnT(SoGLRenderAction *); 00254 void OmPn(SoGLRenderAction *); void OmPnT(SoGLRenderAction *); 00255 void OmFn(SoGLRenderAction *); void OmFnT(SoGLRenderAction *); 00256 void OmVn(SoGLRenderAction *); void OmVnT(SoGLRenderAction *); 00257 void PmOn(SoGLRenderAction *); void PmOnT(SoGLRenderAction *); 00258 void PmPn(SoGLRenderAction *); void PmPnT(SoGLRenderAction *); 00259 void PmFn(SoGLRenderAction *); void PmFnT(SoGLRenderAction *); 00260 void PmVn(SoGLRenderAction *); void PmVnT(SoGLRenderAction *); 00261 void FmOn(SoGLRenderAction *); void FmOnT(SoGLRenderAction *); 00262 void FmPn(SoGLRenderAction *); void FmPnT(SoGLRenderAction *); 00263 void FmFn(SoGLRenderAction *); void FmFnT(SoGLRenderAction *); 00264 void FmVn(SoGLRenderAction *); void FmVnT(SoGLRenderAction *); 00265 void VmOn(SoGLRenderAction *); void VmOnT(SoGLRenderAction *); 00266 void VmPn(SoGLRenderAction *); void VmPnT(SoGLRenderAction *); 00267 void VmFn(SoGLRenderAction *); void VmFnT(SoGLRenderAction *); 00268 void VmVn(SoGLRenderAction *); void VmVnT(SoGLRenderAction *); 00269 00270 // Array of function pointers to render functions: 00271 static PMILS renderFunc[32]; 00272 00273 static const int AUTO_CACHE_MIN_WITHOUT_VP; 00274 static const int AUTO_CACHE_MAX; 00275 00276 }; 00277 00278 00279 00280 00281 #if defined(OIV_IGNORE_VRML_DEPRECATED) 00282 #pragma pop_macro("SoDEPRECATED_TYPEDEF") 00283 #pragma pop_macro("SoDEPRECATED_CLASS") 00284 #endif 00285 00286 #endif /* _SO_VRML_LINE_SET_ */ 00287