Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoShape.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SOSHAPE_H
00021 #define COIN_SOSHAPE_H
00022 
00023 #include <Inventor/nodes/SoSubNode.h>
00024 #include <Inventor/SbMatrix.h>
00025 #include <Inventor/SbVec2s.h>
00026 #include <Inventor/SbBox3f.h>
00027 
00028 class SoPrimitiveVertex;
00029 class SoDetail;
00030 class SoPickedPoint;
00031 class SoFaceDetail;
00032 class SoState;
00033 class SoTextureCoordinateElement;
00034 class SbVec2f;
00035 class SoMaterialBundle;
00036 
00037 
00038 class COIN_DLL_API SoShape : public SoNode {
00039   typedef SoNode inherited;
00040 
00041   SO_NODE_ABSTRACT_HEADER(SoShape);
00042 
00043 public:
00044   static void initClass(void);
00045 
00046   enum TriangleShape {
00047     TRIANGLE_STRIP, TRIANGLE_FAN, TRIANGLES, POLYGON,
00048     // The rest of the enums are not part of the original Inventor API.
00049     QUADS, QUAD_STRIP, POINTS, LINES, LINE_STRIP
00050   };
00051 
00052   virtual SbBool affectsState(void) const;
00053 
00054   virtual void getBoundingBox(SoGetBoundingBoxAction * action);
00055   virtual void GLRender(SoGLRenderAction * action);
00056   virtual void rayPick(SoRayPickAction * action);
00057   virtual void callback(SoCallbackAction * action);
00058   virtual void computeBBox(SoAction * action, SbBox3f & box,
00059                            SbVec3f & center) =  0;
00060   virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
00061 
00062   static void getScreenSize(SoState * const state, const SbBox3f & boundingbox,
00063                             SbVec2s & rectsize);
00064   static float getDecimatedComplexity(SoState * state, float complexity);
00065 
00066 protected:
00067   SoShape(void);
00068   virtual ~SoShape();
00069 
00070   float getComplexityValue(SoAction * action);
00071   virtual void generatePrimitives(SoAction * action) =  0;
00072   virtual SbBool shouldGLRender(SoGLRenderAction * action);
00073   void beginSolidShape(SoGLRenderAction * action);
00074   void endSolidShape(SoGLRenderAction * action);
00075   void GLRenderBoundingBox(SoGLRenderAction * action);
00076   SbBool shouldPrimitiveCount(SoGetPrimitiveCountAction * action);
00077 
00078   SbBool shouldRayPick(SoRayPickAction * const action);
00079   void computeObjectSpaceRay(SoRayPickAction * const action);
00080   void computeObjectSpaceRay(SoRayPickAction * const action,
00081                              const SbMatrix & matrix);
00082   virtual SoDetail * createTriangleDetail(SoRayPickAction * action,
00083                                           const SoPrimitiveVertex * v1,
00084                                           const SoPrimitiveVertex * v2,
00085                                           const SoPrimitiveVertex * v3,
00086                                           SoPickedPoint * pp);
00087   virtual SoDetail * createLineSegmentDetail(SoRayPickAction * action,
00088                                              const SoPrimitiveVertex * v1,
00089                                              const SoPrimitiveVertex * v2,
00090                                              SoPickedPoint * pp);
00091   virtual SoDetail * createPointDetail(SoRayPickAction * action,
00092                                        const SoPrimitiveVertex * v,
00093                                        SoPickedPoint * pp);
00094 
00095   void invokeTriangleCallbacks(SoAction * const action,
00096                                const SoPrimitiveVertex * const v1,
00097                                const SoPrimitiveVertex * const v2,
00098                                const SoPrimitiveVertex * const v3);
00099   void invokeLineSegmentCallbacks(SoAction * const action,
00100                                   const SoPrimitiveVertex * const v1,
00101                                   const SoPrimitiveVertex * const v2);
00102   void invokePointCallbacks(SoAction * const action,
00103                             const SoPrimitiveVertex * const v);
00104   void beginShape(SoAction * const action, const TriangleShape shapetype,
00105                   SoDetail * const detail = NULL);
00106   void shapeVertex(const SoPrimitiveVertex * const v);
00107   void endShape(void);
00108 
00109   void generateVertex(SoPrimitiveVertex * const pv,
00110                       const SbVec3f & point,
00111                       const SbBool useTexFunc,
00112                       const SoTextureCoordinateElement * const tce,
00113                       const float s,
00114                       const float t,
00115                       const SbVec3f & normal);
00116 
00117 private:
00118   void rayPickBoundingBox(SoRayPickAction * action);
00119   friend class shapePrimitiveData;         // internal class
00120   friend class so_generate_prim_private;   // a very private class
00121 };
00122 
00123 #endif // !COIN_SOSHAPE_H

Generated at Tue Mar 5 03:31:17 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001