# SoVertexShape.h

    00001 #ifndef COIN_SOVERTEXSHAPE_H
    00002 #define COIN_SOVERTEXSHAPE_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/nodes/SoSubNode.h>
    00028 #include <Inventor/nodes/SoShape.h>
    00029 #include <Inventor/fields/SoSFNode.h>
    00030 #ifndef COIN_INTERNAL
    00031 // For Open Inventor compatibility.
    00032 #include <Inventor/nodes/SoVertexProperty.h>
    00033 #endif // !COIN_INTERNAL
    00034
    00035 class SoNormalBundle;
    00036 class SoNormalCache;
    00037 class SbVec3f;
    00038 class SoTextureCoordinateElement;
    00039 class SoCoordinateElement;
    00040 class SoVertexShapeP;
    00041
    00042 class COIN_DLL_API SoVertexShape : public SoShape {
    00043   typedef SoShape inherited;
    00044
    00045   SO_NODE_ABSTRACT_HEADER(SoVertexShape);
    00046
    00047 public:
    00048   static void initClass(void);
    00049
    00050   SoSFNode vertexProperty;
    00051
    00052   virtual void notify(SoNotList * nl);
    00053   virtual SbBool generateDefaultNormals(SoState * state,
    00054                                         SoNormalBundle * bundle);
    00055   virtual SbBool generateDefaultNormals(SoState * state,
    00056                                         SoNormalCache * cache);
    00057   virtual void write(SoWriteAction * action);
    00058
    00059 protected:
    00060   SoVertexShape(void);
    00061   virtual ~SoVertexShape();
    00062
    00063   virtual SbBool shouldGLRender(SoGLRenderAction * action);
    00064
    00065   void setNormalCache(SoState * const state,
    00066                       const int num, const SbVec3f * normals);
    00067   SoNormalCache * getNormalCache(void) const;
    00068
    00069   SoNormalCache * generateAndReadLockNormalCache(SoState * const state);
    00070   void getVertexData(SoState * state,
    00071                      const SoCoordinateElement *& coords,
    00072                      const SbVec3f *& normals,
    00073                      const SbBool neednormals);
    00074
    00075   void readLockNormalCache(void);
    00076   void readUnlockNormalCache(void);
    00077
    00078 private:
    00079   void writeLockNormalCache(void);
    00080   void writeUnlockNormalCache(void);
    00081   SoVertexShapeP * pimpl;
    00082 };
    00083
    00084 #endif // !COIN_SOVERTEXSHAPE_H