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 : 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 00056 class SoState; 00057 00059 // 00060 // Class: SoIndexedLineSet 00061 // 00062 // Indexed set of (poly)lines. Each line consists of 2 or more 00063 // vertices, each of which is denoted by an integer index (from the 00064 // coordIndex field) into the current coordinates. Depending on the 00065 // current material and normal binding values, the materials and 00066 // normals for the lines or vertices may be accessed in order or 00067 // indexed. If they are indexed, the materialIndex and normalIndex 00068 // fields are used. Texture coordinates may also be indexed, using 00069 // the textureCoordIndex field. 00070 // 00072 00073 // This coordinate index indicates that the current line ends and the 00074 // next line begins 00075 #define SO_END_LINE_INDEX (-1) 00076 00165 class SoIndexedLineSet : public SoIndexedShape { 00166 00167 SO_NODE_HEADER(SoIndexedLineSet); 00168 00169 public: 00170 // Inherits all fields 00171 00175 SoIndexedLineSet(); 00176 00177 private: 00179 virtual void GLRender(SoGLRenderAction *action); 00180 00185 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00186 00188 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00189 00190 private: 00191 00193 static void initClass(); 00195 static void exitClass(); 00196 00197 private: 00198 // Generates line segments representing line set 00199 virtual void generatePrimitives(SoAction *action); 00200 00201 // count the number of primitives in the shape 00202 virtual void countPrim(); 00203 00204 // really do the rendering part 00205 virtual void doRendering(SoGLRenderAction *action, const SoShapeStyleElement* shapeStyle); 00206 00207 virtual void callSetupIndices(const SoShapeStyleElement* shapeStyle,uint32_t useTexCoordsAnyway); 00208 00209 // invalid test 00210 virtual SbBool numPrimInvalid(){return numPolylines < 0 ;} 00211 00212 // return num lines for test 00213 virtual int getNumPrim(){return numPolylines;} 00214 00215 // says wether to generate normals 00216 virtual void shouldGenerateNormals(SoGLRenderAction *action,const SoShapeStyleElement *shapeStyle); 00217 00218 00219 // says that rendering is PointOrLine 00220 virtual SbBool isRenderingPointsOrLines(SoGLRenderAction *action); 00221 00222 // Overrides standard method to create an SoLineDetail instance 00223 virtual SoDetail * createLineSegmentDetail(SoRayPickAction *action, 00224 const SoPrimitiveVertex *v1, 00225 const SoPrimitiveVertex *v2, 00226 SoPickedPoint *pp); 00227 00229 virtual ~SoIndexedLineSet(); 00230 00232 virtual void notify(SoNotList *list); 00233 private: 00234 // This enum is used to indicate the current material or normal binding 00235 enum Binding { 00236 OVERALL, 00237 PER_SEGMENT, PER_SEGMENT_INDEXED, 00238 PER_LINE, PER_LINE_INDEXED, 00239 PER_VERTEX, PER_VERTEX_INDEXED 00240 }; 00241 00242 // Returns current material or normal binding from action's state 00243 static Binding getMaterialBinding(SoAction *action); 00244 static Binding getNormalBinding(SoAction *action); 00245 00246 00247 // Number of polylines, number of line segments, and vertices per polyline 00248 int numSegments; 00249 int numPolylines; 00250 int * numVertices; 00251 00252 }; 00253 00254 inline SbBool 00255 SoIndexedLineSet::isRenderingPointsOrLines(SoGLRenderAction *) 00256 { 00257 return TRUE; 00258 } 00259 00260 #endif /* _SO_INDEXED_LINE_SET_ */ 00261 00262 00263