# SoMarkerSet.h

    00001 #ifndef COIN_SOMARKERSET_H
    00002 #define COIN_SOMARKERSET_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/SoPointSet.h>
    00029 #include <Inventor/fields/SoMFInt32.h>
    00030
    00031 class COIN_DLL_API SoMarkerSet : public SoPointSet {
    00032   typedef SoPointSet inherited;
    00033
    00034   SO_NODE_HEADER(SoMarkerSet);
    00035
    00036 public:
    00037   static void initClass(void);
    00038   SoMarkerSet(void);
    00039
    00040   enum MarkerType {
    00041     NONE = -1,
    00042     CROSS_5_5, PLUS_5_5, MINUS_5_5, SLASH_5_5, BACKSLASH_5_5, BAR_5_5,
    00043     STAR_5_5, Y_5_5, LIGHTNING_5_5, WELL_5_5,
    00044
    00045     CIRCLE_LINE_5_5, SQUARE_LINE_5_5, DIAMOND_LINE_5_5, TRIANGLE_LINE_5_5,
    00046     RHOMBUS_LINE_5_5, HOURGLASS_LINE_5_5, SATELLITE_LINE_5_5,
    00047     PINE_TREE_LINE_5_5, CAUTION_LINE_5_5, SHIP_LINE_5_5,
    00048
    00049     CIRCLE_FILLED_5_5, SQUARE_FILLED_5_5, DIAMOND_FILLED_5_5,
    00050     TRIANGLE_FILLED_5_5, RHOMBUS_FILLED_5_5, HOURGLASS_FILLED_5_5,
    00051     SATELLITE_FILLED_5_5, PINE_TREE_FILLED_5_5, CAUTION_FILLED_5_5,
    00052     SHIP_FILLED_5_5,
    00053
    00054     CROSS_7_7, PLUS_7_7, MINUS_7_7, SLASH_7_7, BACKSLASH_7_7, BAR_7_7,
    00055     STAR_7_7, Y_7_7, LIGHTNING_7_7, WELL_7_7,
    00056
    00057     CIRCLE_LINE_7_7, SQUARE_LINE_7_7, DIAMOND_LINE_7_7, TRIANGLE_LINE_7_7,
    00058     RHOMBUS_LINE_7_7, HOURGLASS_LINE_7_7, SATELLITE_LINE_7_7,
    00059     PINE_TREE_LINE_7_7, CAUTION_LINE_7_7, SHIP_LINE_7_7,
    00060
    00061     CIRCLE_FILLED_7_7, SQUARE_FILLED_7_7, DIAMOND_FILLED_7_7,
    00062     TRIANGLE_FILLED_7_7, RHOMBUS_FILLED_7_7, HOURGLASS_FILLED_7_7,
    00063     SATELLITE_FILLED_7_7, PINE_TREE_FILLED_7_7, CAUTION_FILLED_7_7,
    00064     SHIP_FILLED_7_7,
    00065
    00066     CROSS_9_9, PLUS_9_9, MINUS_9_9, SLASH_9_9, BACKSLASH_9_9, BAR_9_9,
    00067     STAR_9_9, Y_9_9, LIGHTNING_9_9, WELL_9_9,
    00068
    00069     CIRCLE_LINE_9_9, SQUARE_LINE_9_9, DIAMOND_LINE_9_9, TRIANGLE_LINE_9_9,
    00070     RHOMBUS_LINE_9_9, HOURGLASS_LINE_9_9, SATELLITE_LINE_9_9,
    00071     PINE_TREE_LINE_9_9, CAUTION_LINE_9_9, SHIP_LINE_9_9,
    00072
    00073     CIRCLE_FILLED_9_9, SQUARE_FILLED_9_9, DIAMOND_FILLED_9_9,
    00074     TRIANGLE_FILLED_9_9, RHOMBUS_FILLED_9_9, HOURGLASS_FILLED_9_9,
    00075     SATELLITE_FILLED_9_9, PINE_TREE_FILLED_9_9, CAUTION_FILLED_9_9,
    00076     SHIP_FILLED_9_9,
    00077     NUM_MARKERS /* must be last, and is _not_ a marker :) */
    00078   };
    00079
    00080   SoMFInt32 markerIndex;
    00081
    00082   virtual void GLRender(SoGLRenderAction * action);
    00083   virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
    00084
    00085   static int getNumDefinedMarkers(void);
    00086   static void addMarker(int idx, const SbVec2s & size,
    00087                         const unsigned char * bytes, SbBool isLSBFirst = TRUE,
    00088                         SbBool isUpToDown = TRUE);
    00089   static SbBool getMarker(int idx, SbVec2s & size,
    00090                           const unsigned char *& bytes, SbBool & isLSBFirst);
    00091   static SbBool removeMarker(int idx);
    00092   static SbBool isMarkerBitSet(int idx, int bitNumber);
    00093
    00094 protected:
    00095   virtual ~SoMarkerSet();
    00096
    00097 private:
    00098   enum Binding {
    00099     OVERALL = 0,
    00100     PER_VERTEX
    00101   };
    00102   Binding findMaterialBinding(SoState * const state) const;
    00103 };
    00104
    00105 #endif // !COIN_SOMARKERSET_H