Coin: SoMarkerSet.h Source File

| 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
43 SO_NODE_HEADER(SoMarkerSet);
44
45public:
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
89 SoMFInt32 markerIndex;
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
103protected:
104 virtual ~SoMarkerSet();
105
106private:
107 enum Binding {
108 OVERALL = 0,
109 PER_VERTEX
110 };
111 Binding findMaterialBinding(SoState * const state) const;
112};
113
114#endif // !COIN_SOMARKERSET_H
SbVec2s
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51
SoGLRenderAction
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:50
SoGetPrimitiveCountAction
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition SoGetPrimitiveCountAction.h:44
SoMFInt32
The SoMFInt32 class is a container for 32-bit integer values.
Definition SoMFInt32.h:39
SoMarkerSet::getNumDefinedMarkers
static int getNumDefinedMarkers(void)
Definition SoMarkerSet.cpp:1319
SoMarkerSet::removeMarker
static SbBool removeMarker(int idx)
Definition SoMarkerSet.cpp:1492
SoMarkerSet::addMarker
static void addMarker(int idx, const SbVec2s &size, const unsigned char *bytes, SbBool isLSBFirst=TRUE, SbBool isUpToDown=TRUE)
Definition SoMarkerSet.cpp:1427
SoMarkerSet::getMarker
static SbBool getMarker(int idx, SbVec2s &size, const unsigned char *&bytes, SbBool &isLSBFirst)
Definition SoMarkerSet.cpp:1470
SoMarkerSet::SoMarkerSet
SoMarkerSet(void)
Definition SoMarkerSet.cpp:125
SoMarkerSet::isMarkerBitSet
static SbBool isMarkerBitSet(int idx, int bitNumber)
Definition SoMarkerSet.cpp:1507
SoMarkerSet::markerIndex
SoMFInt32 markerIndex
Definition SoMarkerSet.h:89
SoMarkerSet::MarkerType
MarkerType
Definition SoMarkerSet.h:49
SoPointSet::GLRender
virtual void GLRender(SoGLRenderAction *action)
Definition SoPointSet.cpp:200
SoPointSet::initClass
static void initClass(void)
Definition SoPointSet.cpp:154
SoPointSet::SoPointSet
SoPointSet(void)
Definition SoPointSet.cpp:136
SoPointSet::getPrimitiveCount
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition SoPointSet.cpp:330
SoState
The SoState class manages the Coin scene graph traversal state data.
Definition SoState.h:44
SO_NODE_HEADER
#define SO_NODE_HEADER(classname)
Definition Coin_macros.dox:50