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-2019 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_LINE_SET_ 00051 #define _SO_LINE_SET_ 00052 00053 #include <Inventor/fields/SoMFInt32.h> 00054 #include <Inventor/nodes/SoNonIndexedShape.h> 00055 #include <Inventor/SbPImpl.h> 00056 00057 class SoState; 00058 class SoTextureCoordinateBundle; 00059 class SoTextureCoordinate3Bundle; 00060 class SoTangentBundle; 00061 00062 SO_PIMPL_PUBLIC_DECLARATION(SoLineSet) 00063 00064 00065 // 00066 // Class: SoLineSet 00067 // 00068 // Set of (poly)lines. Each line consists of 2 or more vertices, 00069 // taken in order from the current coordinates, which are joined to 00070 // form segments. The startIndex field gives the starting coordinate 00071 // index for the first line. If materials, normals or tangents are bound to 00072 // vertices, they will begin at that index, as well; otherwise, they 00073 // will start at index 0. The number of vertices in each polyline is 00074 // determined by successive entries in the numVertices field. 00075 // 00077 00078 00079 // Deprecated feature; specifying USE_REST_OF_VERTICES as the last 00080 // value in the numVertices field will use all the points in the 00081 // coordinate array. 00082 #define SO_LINE_SET_USE_REST_OF_VERTICES (-1) 00083 00084 00189 class SoLineSet : public SoNonIndexedShape 00190 { 00191 SO_NODE_HEADER(SoLineSet); 00192 SO_PIMPL_PUBLIC_HEADER(SoLineSet) 00193 00194 public: 00198 SoMFInt32 numVertices; 00199 00203 SoLineSet(); 00204 00205 private: 00206 00208 virtual void GLRender( SoGLRenderAction* action ); 00209 00214 virtual void getBoundingBox( SoGetBoundingBoxAction* action ); 00215 00217 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action ); 00218 00225 virtual void generateDefaultTangents( SoState* state, 00226 const SbVec3f* coords, 00227 int numCoords, 00228 SoTangentBundle* tb, 00229 SbBool storeRef = FALSE ); 00230 private: 00231 00232 inline int getNumPolyLines() const { return numVertices.getNum(); } 00233 00235 static void initClass(); 00237 static void exitClass(); 00238 00239 // return num vertices 00240 virtual int getNumVert( SoState* state = NULL ); 00241 00243 virtual void notify( SoNotList* list ); 00244 00245 //return number of primitives 00246 virtual int getNumPrim( SoState* state = NULL ); 00247 00248 private: 00249 // Generates line segments representing line set 00250 virtual void generatePrimitives( SoAction* action ); 00251 00252 // check if normal should be generated or not. 00253 virtual void shouldGenerateNormals( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle ); 00254 00255 // setup lazy element 00256 virtual void setupLazyElement(SoGLRenderAction *action, const SoShapeStyleElement *shapeStyle); 00257 00258 //Free memory 00259 virtual void exitRender( SoState* state,int stateFlag, 00260 SoTextureCoordinateBundle* tcb, 00261 SoTextureCoordinate3Bundle* tc3b ); 00262 00263 // count the number of primitives in the shape 00264 virtual void countPrim( SoState* state = NULL ); 00265 00266 // really do the rendering part 00267 virtual void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle ); 00268 00269 // says that rendering is PointOrLine 00270 virtual SbBool isRenderingPointsOrLines( SoGLRenderAction* action ); 00271 00272 // Overrides standard method to create an SoLineDetail instance 00273 virtual SoDetail* createLineSegmentDetail( SoRayPickAction* action, 00274 const SoPrimitiveVertex* v1, 00275 const SoPrimitiveVertex* v2, 00276 SoPickedPoint* pp ); 00277 00279 virtual ~SoLineSet(); 00280 00281 }; 00282 00283 inline SbBool 00284 SoLineSet::isRenderingPointsOrLines( SoGLRenderAction* ) 00285 { 00286 return TRUE; 00287 } 00288 00289 #endif /* _SO_LINE_SET_ */ 00290 00291