Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SoMarkerSet.h
1 #ifndef COIN_SOMARKERSET_H
2 #define COIN_SOMARKERSET_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/nodes/SoSubNode.h>
37 #include <Inventor/nodes/SoPointSet.h>
38 #include <Inventor/fields/SoMFInt32.h>
39 
40 class COIN_DLL_API SoMarkerSet : public SoPointSet {
41  typedef SoPointSet inherited;
42 
44 
45 public:
46  static void initClass(void);
47  SoMarkerSet(void);
48 
49  enum MarkerType {
50  NONE = -1,
51  CROSS_5_5, PLUS_5_5, MINUS_5_5, SLASH_5_5, BACKSLASH_5_5, BAR_5_5,
52  STAR_5_5, Y_5_5, LIGHTNING_5_5, WELL_5_5,
53 
54  CIRCLE_LINE_5_5, SQUARE_LINE_5_5, DIAMOND_LINE_5_5, TRIANGLE_LINE_5_5,
55  RHOMBUS_LINE_5_5, HOURGLASS_LINE_5_5, SATELLITE_LINE_5_5,
56  PINE_TREE_LINE_5_5, CAUTION_LINE_5_5, SHIP_LINE_5_5,
57 
58  CIRCLE_FILLED_5_5, SQUARE_FILLED_5_5, DIAMOND_FILLED_5_5,
59  TRIANGLE_FILLED_5_5, RHOMBUS_FILLED_5_5, HOURGLASS_FILLED_5_5,
60  SATELLITE_FILLED_5_5, PINE_TREE_FILLED_5_5, CAUTION_FILLED_5_5,
61  SHIP_FILLED_5_5,
62 
63  CROSS_7_7, PLUS_7_7, MINUS_7_7, SLASH_7_7, BACKSLASH_7_7, BAR_7_7,
64  STAR_7_7, Y_7_7, LIGHTNING_7_7, WELL_7_7,
65 
66  CIRCLE_LINE_7_7, SQUARE_LINE_7_7, DIAMOND_LINE_7_7, TRIANGLE_LINE_7_7,
67  RHOMBUS_LINE_7_7, HOURGLASS_LINE_7_7, SATELLITE_LINE_7_7,
68  PINE_TREE_LINE_7_7, CAUTION_LINE_7_7, SHIP_LINE_7_7,
69 
70  CIRCLE_FILLED_7_7, SQUARE_FILLED_7_7, DIAMOND_FILLED_7_7,
71  TRIANGLE_FILLED_7_7, RHOMBUS_FILLED_7_7, HOURGLASS_FILLED_7_7,
72  SATELLITE_FILLED_7_7, PINE_TREE_FILLED_7_7, CAUTION_FILLED_7_7,
73  SHIP_FILLED_7_7,
74 
75  CROSS_9_9, PLUS_9_9, MINUS_9_9, SLASH_9_9, BACKSLASH_9_9, BAR_9_9,
76  STAR_9_9, Y_9_9, LIGHTNING_9_9, WELL_9_9,
77 
78  CIRCLE_LINE_9_9, SQUARE_LINE_9_9, DIAMOND_LINE_9_9, TRIANGLE_LINE_9_9,
79  RHOMBUS_LINE_9_9, HOURGLASS_LINE_9_9, SATELLITE_LINE_9_9,
80  PINE_TREE_LINE_9_9, CAUTION_LINE_9_9, SHIP_LINE_9_9,
81 
82  CIRCLE_FILLED_9_9, SQUARE_FILLED_9_9, DIAMOND_FILLED_9_9,
83  TRIANGLE_FILLED_9_9, RHOMBUS_FILLED_9_9, HOURGLASS_FILLED_9_9,
84  SATELLITE_FILLED_9_9, PINE_TREE_FILLED_9_9, CAUTION_FILLED_9_9,
85  SHIP_FILLED_9_9,
86  NUM_MARKERS /* must be last, and is _not_ a marker :) */
87  };
88 
90 
91  virtual void GLRender(SoGLRenderAction * action);
92  virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
93 
94  static int getNumDefinedMarkers(void);
95  static void addMarker(int idx, const SbVec2s & size,
96  const unsigned char * bytes, SbBool isLSBFirst = TRUE,
97  SbBool isUpToDown = TRUE);
98  static SbBool getMarker(int idx, SbVec2s & size,
99  const unsigned char *& bytes, SbBool & isLSBFirst);
100  static SbBool removeMarker(int idx);
101  static SbBool isMarkerBitSet(int idx, int bitNumber);
102 
103 protected:
104  virtual ~SoMarkerSet();
105 
106 private:
107  enum Binding {
108  OVERALL = 0,
109  PER_VERTEX
110  };
111  Binding findMaterialBinding(SoState * const state) const;
112 };
113 
114 #endif // !COIN_SOMARKERSET_H
The SoBase class is the top-level superclass for a number of class-hierarchies.
Definition: SoBase.h:45
MarkerType
Definition: SoMarkerSet.h:49
virtual void GLRender(SoGLRenderAction *action)
Definition: SoPointSet.cpp:200
The SoMFInt32 class is a container for 32-bit integer values.
Definition: SoMFInt32.h:39
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition: SoPointSet.cpp:330
The SoState class manages the Coin scene graph traversal state data.
Definition: SoState.h:44
static void initClass(void)
Definition: SoPointSet.cpp:154
#define SO_NODE_HEADER(classname)
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition: SoGetPrimitiveCountAction.h:44
The SoMarkerSet class displays a set of 2D bitmap markers in 3D.
Definition: SoMarkerSet.h:40
The SoPointSet class is used to display a set of 3D points.
Definition: SoPointSet.h:40
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition: SbVec2s.h:51
SoMFInt32 markerIndex
Definition: SoMarkerSet.h:89
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition: SoGLRenderAction.h:50