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-2019 BY FEI S.A.S, *** 00043 *** BORDEAUX, FRANCE *** 00044 *** ALL RIGHTS RESERVED *** 00045 **=======================================================================*/ 00046 /*======================================================================= 00047 ** Modified by : David Beilloin (Mar 2010) 00048 **=======================================================================*/ 00049 00050 00051 #ifndef _SO_INDEXED_LINE_SET_ 00052 #define _SO_INDEXED_LINE_SET_ 00053 00054 #include <Inventor/nodes/SoIndexedShape.h> 00055 #include <Inventor/SbPImpl.h> 00056 00057 class SoState; 00058 class SoTangentBundle; 00059 00060 SO_PIMPL_PUBLIC_DECLARATION(SoIndexedLineSet) 00061 00062 00063 // 00064 // Class: SoIndexedLineSet 00065 // 00066 // Indexed set of (poly)lines. Each line consists of 2 or more 00067 // vertices, each of which is denoted by an integer index (from the 00068 // coordIndex field) into the current coordinates. Depending on the 00069 // current material, normal and tangent binding values, the materials, 00070 // normals and tangents for the lines or vertices may be accessed in order or 00071 // indexed. If they are indexed, the materialIndex, normalIndex and tangentIndex 00072 // fields are used. Texture coordinates may also be indexed, using 00073 // the textureCoordIndex field. 00074 // 00076 00077 // This coordinate index indicates that the current line ends and the 00078 // next line begins 00079 #define SO_END_LINE_INDEX (-1) 00080 00186 class SoIndexedLineSet : public SoIndexedShape 00187 { 00188 SO_NODE_HEADER(SoIndexedLineSet); 00189 SO_PIMPL_PUBLIC_HEADER(SoIndexedLineSet) 00190 00191 public: 00192 // Inherits all fields 00193 00197 SoIndexedLineSet(); 00198 00199 private: 00201 virtual void GLRender( SoGLRenderAction* action ); 00202 00207 virtual void getBoundingBox( SoGetBoundingBoxAction* action ); 00208 00210 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action ); 00211 00218 virtual void generateDefaultTangents( SoState* state, 00219 const SbVec3f* coords, 00220 int numCoords, 00221 SoTangentBundle* tb, 00222 SbBool storeRef = FALSE ); 00223 private: 00224 00226 static void initClass(); 00228 static void exitClass(); 00229 00230 // return num lines for test 00231 virtual int getNumPrim( SoState* state = NULL ); 00232 00233 private: 00234 00235 // Generates line segments representing line set 00236 virtual void generatePrimitives( SoAction* action ); 00237 00238 // count the number of primitives in the shape 00239 virtual void countPrim( SoState* state = NULL ); 00240 00241 // really do the rendering part 00242 virtual void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle ); 00243 00244 virtual void callSetupIndices( SoState* state, const SoShapeStyleElement* shapeStyle, uint32_t useTexCoordsAnyway ); 00245 00246 // says wether to generate normals 00247 virtual void shouldGenerateNormals( SoGLRenderAction* action,const SoShapeStyleElement* shapeStyle ); 00248 00249 // setup lazy element 00250 virtual void setupLazyElement(SoGLRenderAction *action, const SoShapeStyleElement *shapeStyle); 00251 00252 // says that rendering is PointOrLine 00253 virtual SbBool isRenderingPointsOrLines( SoGLRenderAction* action ); 00254 00255 // Overrides standard method to create an SoLineDetail instance 00256 virtual SoDetail* createLineSegmentDetail( SoRayPickAction* action, 00257 const SoPrimitiveVertex* v1, 00258 const SoPrimitiveVertex* v2, 00259 SoPickedPoint* pp ); 00260 00262 virtual ~SoIndexedLineSet(); 00263 }; 00264 00265 inline SbBool 00266 SoIndexedLineSet::isRenderingPointsOrLines( SoGLRenderAction* ) 00267 { 00268 return TRUE; 00269 } 00270 00271 #endif /* _SO_INDEXED_LINE_SET_ */ 00272 00273 00274