# SoVRMLVertexShape.h

    00001 /**************************************************************************\
    00002  *
    00003  *  This file is part of the Coin 3D visualization library.
    00004  *  Copyright (C) 1998-2003 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 General Public License
    00008  *  ("GPL") version 2 as published by the Free Software Foundation.
    00009  *  See the file LICENSE.GPL at the root directory of this source
    00010  *  distribution for additional information about the GNU GPL.
    00011  *
    00012  *  For using Coin with software that can not be combined with the GNU
    00013  *  GPL, and for taking advantage of the additional benefits of our
    00014  *  support services, please contact Systems in Motion about acquiring
    00015  *  a Coin Professional Edition License.
    00016  *
    00017  *  See <URL:http://www.coin3d.org> for  more information.
    00018  *
    00019  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00020  *  <URL:http://www.sim.no>.
    00021  *
    00022 \**************************************************************************/
    00023
    00024 #ifndef COIN_SOVRMLVERTEXSHAPE_H
    00025 #define COIN_SOVRMLVERTEXSHAPE_H
    00026
    00027 #include <Inventor/nodes/SoSubNode.h>
    00028 #include <Inventor/VRMLnodes/SoVRMLGeometry.h>
    00029 #include <Inventor/fields/SoSFNode.h>
    00030 #include <Inventor/fields/SoSFBool.h>
    00031 #include <Inventor/elements/SoMaterialBindingElement.h>
    00032
    00033 class SoNormalCache;
    00034 class SoNormalBundle;
    00035 class SoState;
    00036 class SoCoordinateElement;
    00037 class SoVRMLVertexShapeP;
    00038
    00039 class COIN_DLL_API SoVRMLVertexShape : public SoVRMLGeometry
    00040 {
    00041   typedef SoVRMLGeometry inherited;
    00042   SO_NODE_ABSTRACT_HEADER(SoVRMLVertexShape);
    00043
    00044 public:
    00045   static void initClass(void);
    00046
    00047   SoSFNode coord;
    00048   SoSFNode texCoord;
    00049   SoSFNode normal;
    00050   SoSFNode color;
    00051   SoSFBool colorPerVertex;
    00052   SoSFBool normalPerVertex;
    00053
    00054   enum Binding {
    00055     OVERALL             = SoMaterialBindingElement::OVERALL,
    00056     PER_PART            = SoMaterialBindingElement::PER_PART,
    00057     PER_PART_INDEXED    = SoMaterialBindingElement::PER_PART_INDEXED,
    00058     PER_FACE            = SoMaterialBindingElement::PER_FACE,
    00059     PER_FACE_INDEXED    = SoMaterialBindingElement::PER_FACE_INDEXED,
    00060     PER_VERTEX          = SoMaterialBindingElement::PER_VERTEX,
    00061     PER_VERTEX_INDEXED  = SoMaterialBindingElement::PER_VERTEX_INDEXED
    00062   };
    00063
    00064   virtual SbBool generateDefaultNormals(SoState * s, SoNormalBundle * nb);
    00065   virtual SbBool generateDefaultNormals(SoState * s, SoNormalCache * nc);
    00066
    00067   virtual void doAction(SoAction * action);
    00068   virtual void GLRender(SoGLRenderAction * action);
    00069   virtual void getBoundingBox(SoGetBoundingBoxAction * action);
    00070   virtual void callback(SoCallbackAction * action);
    00071   virtual void pick(SoPickAction * action);
    00072
    00073   virtual void notify(SoNotList * list);
    00074
    00075 protected:
    00076   SoVRMLVertexShape(void);
    00077   virtual ~SoVRMLVertexShape();
    00078
    00079   virtual SbBool shouldGLRender(SoGLRenderAction * action);
    00080
    00081   void setNormalCache(SoState * s, int numNormals, SbVec3f * normals);
    00082   SoNormalCache * getNormalCache(void) const;
    00083
    00084   SoNormalCache * generateAndReadLockNormalCache(SoState * const state);
    00085   void getVertexData(SoState * state,
    00086                      const SoCoordinateElement *& coords,
    00087                      const SbVec3f *& normals,
    00088                      const SbBool neednormals);
    00089
    00090   void readLockNormalCache(void);
    00091   void readUnlockNormalCache(void);
    00092
    00093 private:
    00094
    00095   void writeLockNormalCache(void);
    00096   void writeUnlockNormalCache(void);
    00097
    00098   SoVRMLVertexShapeP * pimpl;
    00099 }; // class SoVRMLVertexShape
    00100
    00101 #endif // ! COIN_SOVRMLVERTEXSHAPE_H