Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/database/include/Inventor/nodes/SoIndexedTriangleStripSet.h
Go to the documentation of this file.
00001 /*
00002  *
00003  *  Copyright (C) 2000 Silicon Graphics, Inc.  All Rights Reserved. 
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  Further, this software is distributed without any warranty that it is
00016  *  free of the rightful claim of any third person regarding infringement
00017  *  or the like.  Any license provided herein, whether implied or
00018  *  otherwise, applies only to this software file.  Patent licenses, if
00019  *  any, provided herein do not apply to combinations of this program with
00020  *  other software, or any other product whatsoever.
00021  * 
00022  *  You should have received a copy of the GNU Lesser General Public
00023  *  License along with this library; if not, write to the Free Software
00024  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  *  Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
00027  *  Mountain View, CA  94043, or:
00028  * 
00029  *  http://www.sgi.com 
00030  * 
00031  *  For further information regarding this notice, see: 
00032  * 
00033  *  http://oss.sgi.com/projects/GenInfo/NoticeExplan/
00034  *
00035  */
00036 
00037 
00038 /*
00039  * Copyright (C) 1990,91   Silicon Graphics, Inc.
00040  *
00041  _______________________________________________________________________
00042  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00043  |
00044  |   $Revision: 1.1.1.1 $
00045  |
00046  |   Description:
00047  |      This file defines the SoIndexedTriangleStripSet node class.
00048  |
00049  |   Author(s)          : Gavin Bell
00050  |
00051  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00052  _______________________________________________________________________
00053  */
00054 
00055 #ifndef  _SO_INDEXED_TRIANGLE_STRIP_SET_
00056 #define  _SO_INDEXED_TRIANGLE_STRIP_SET_
00057 
00058 #include <Inventor/nodes/SoIndexedShape.h>
00059 #include <Inventor/fields/SoSFNode.h>
00060 #include <Inventor/nodes/SoVertexProperty.h>
00061 class SoCoordinateElement;
00062 
00063 
00064 
00067 #define SO_END_STRIP_INDEX      (-1)
00068 
00069 class SoNormalBundle;
00070 class SoCoordinateElement;
00071 
00074 
00141 
00142 
00143 class INVENTOR_API SoIndexedTriangleStripSet : public SoIndexedShape {
00144 
00145     SO_NODE_HEADER(SoIndexedTriangleStripSet);
00146 
00147   public:
00148 
00150     SoIndexedTriangleStripSet();
00151 
00152   SoEXTENDER public:
00154     virtual void        GLRender(SoGLRenderAction *action);
00155 
00158     virtual SbBool      generateDefaultNormals(SoState *state,
00159                                                SoNormalBundle *nb);
00160                                                
00163     typedef void (SoIndexedTriangleStripSet::*PMTSS)(SoGLRenderAction *);
00164                                                   
00165   SoINTERNAL public:
00166     static void         initClass();
00167 
00169     enum Binding {
00170         OVERALL,
00171         PER_STRIP,      PER_STRIP_INDEXED,
00172         PER_TRIANGLE,   PER_TRIANGLE_INDEXED,
00173         PER_VERTEX,     PER_VERTEX_INDEXED
00174     };
00175     
00176   protected:
00178     virtual void        generatePrimitives(SoAction *action);
00179     
00180 
00182     virtual SoDetail *  createTriangleDetail(SoRayPickAction *action,
00183                                              const SoPrimitiveVertex *v1,
00184                                              const SoPrimitiveVertex *v2,
00185                                              const SoPrimitiveVertex *v3,
00186                                              SoPickedPoint *pp);
00187 
00188     ~SoIndexedTriangleStripSet();
00189 
00190   private:
00192     void GLRenderInternal( SoGLRenderAction * action, uint32_t useTexCoordsAnyway, const SoShapeStyleElement * shapeStyle);
00193 
00195     Binding             getMaterialBinding(SoAction *action);
00196     Binding             getNormalBinding(SoAction *action,
00197                                          SoNormalBundle &nb);
00198 
00201     SbBool              figureNormals(SoState *state, SoNormalBundle *nb);
00202     
00204     virtual void        notify(SoNotList *list);
00205     
00207     void countStripsAndTris();
00208     
00211     int         numStrips;
00212     int         numTriangles;
00213     int *       numVertices;
00214 
00221     void OmOn(SoGLRenderAction *); void OmOnT(SoGLRenderAction *);
00222     void OmPn(SoGLRenderAction *); void OmPnT(SoGLRenderAction *);
00223     void OmFn(SoGLRenderAction *); void OmFnT(SoGLRenderAction *);
00224     void OmVn(SoGLRenderAction *); void OmVnT(SoGLRenderAction *);
00225     void PmOn(SoGLRenderAction *); void PmOnT(SoGLRenderAction *);
00226     void PmPn(SoGLRenderAction *); void PmPnT(SoGLRenderAction *);
00227     void PmFn(SoGLRenderAction *); void PmFnT(SoGLRenderAction *);
00228     void PmVn(SoGLRenderAction *); void PmVnT(SoGLRenderAction *);
00229     void FmOn(SoGLRenderAction *); void FmOnT(SoGLRenderAction *);
00230     void FmPn(SoGLRenderAction *); void FmPnT(SoGLRenderAction *);
00231     void FmFn(SoGLRenderAction *); void FmFnT(SoGLRenderAction *);
00232     void FmVn(SoGLRenderAction *); void FmVnT(SoGLRenderAction *);
00233     void VmOn(SoGLRenderAction *); void VmOnT(SoGLRenderAction *);
00234     void VmPn(SoGLRenderAction *); void VmPnT(SoGLRenderAction *);
00235     void VmFn(SoGLRenderAction *); void VmFnT(SoGLRenderAction *);
00236     void VmVn(SoGLRenderAction *); void VmVnT(SoGLRenderAction *);
00237 
00239     static PMTSS renderFunc[32];
00240     
00241     
00242 };
00243 
00244 #endif /* _SO_INDEXED_TRIANGLE_STRIP_SET_ */