1 /**************************************************************************\
2 * Copyright (c) Kongsberg Oil & Gas Technologies AS
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 \**************************************************************************/
32
33 /*!
34 \class SoPointDetail SoPointDetail.h Inventor/details/SoPointDetail.h
35 \brief The SoPointDetail class is for storing detailed information for a single 3D point.
36
37 \ingroup details
38
39 Instances of this class are used among other things for storing
40 information about the vertices of lines and polygons after pick
41 operations, and for storing information returned to tessellation
42 callbacks.
43
44 It contains indices into the vertex coordinate sets, along with
45 indices into material, texture and normal coordinates for the point.
46 */
47
48 #include <Inventor/details/SoPointDetail.h>
49 #include <Inventor/SbName.h>
50
51 SO_DETAIL_SOURCE(SoPointDetail);
52
53 /*!
54 Sets up an empty detail instance (all indices are equal to 0).
55 */
SoPointDetail(void)56 SoPointDetail::SoPointDetail(void)
57 : coordindex(0), matindex(0), normindex(0), texcoordindex(0)
58 {
59 }
60
61 /*!
62 Destructor.
63 */
~SoPointDetail()64 SoPointDetail::~SoPointDetail()
65 {
66 }
67
68 // Doc in superclass.
69 void
initClass(void)70 SoPointDetail::initClass(void)
71 {
72 SO_DETAIL_INIT_CLASS(SoPointDetail, SoDetail);
73 }
74
75 // Doc in superclass.
76 SoDetail *
copy(void) const77 SoPointDetail::copy(void) const
78 {
79 SoPointDetail * copy = new SoPointDetail;
80 *copy = *this;
81 return copy;
82 }
83
84 /*!
85 Returns index into coordinate set for the point's 3D coordinates.
86 */
87 int
getCoordinateIndex(void) const88 SoPointDetail::getCoordinateIndex(void) const
89 {
90 return this->coordindex;
91 }
92
93 /*!
94 Returns point's index into set of materials.
95 */
96 int
getMaterialIndex(void) const97 SoPointDetail::getMaterialIndex(void) const
98 {
99 return this->matindex;
100 }
101
102 /*!
103 Returns point's index into set of normals.
104 */
105 int
getNormalIndex(void) const106 SoPointDetail::getNormalIndex(void) const
107 {
108 return this->normindex;
109 }
110
111 /*!
112 Returns point's index into set of texture coordinates.
113 */
114 int
getTextureCoordIndex(void) const115 SoPointDetail::getTextureCoordIndex(void) const
116 {
117 return this->texcoordindex;
118 }
119
120 /*!
121 Used by client code for initializing the point detail instance.
122 */
123 void
setCoordinateIndex(const int idx)124 SoPointDetail::setCoordinateIndex(const int idx)
125 {
126 this->coordindex = idx;
127 }
128
129 /*!
130 Used by client code for initializing the point detail instance.
131 */
132 void
setMaterialIndex(const int idx)133 SoPointDetail::setMaterialIndex(const int idx)
134 {
135 this->matindex = idx;
136 }
137
138 /*!
139 Used by client code for initializing the point detail instance.
140 */
141 void
setNormalIndex(const int idx)142 SoPointDetail::setNormalIndex(const int idx)
143 {
144 this->normindex = idx;
145 }
146
147 /*!
148 Used by client code for initializing the point detail instance.
149 */
150 void
setTextureCoordIndex(const int idx)151 SoPointDetail::setTextureCoordIndex(const int idx)
152 {
153 this->texcoordindex = idx;
154 }
155