Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoPrimitiveVertex.h
1 #ifndef COIN_SOPRIMITIVEVERTEX_H
2 #define COIN_SOPRIMITIVEVERTEX_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/SbVec2f.h>
37 #include <Inventor/SbVec3f.h>
38 #include <Inventor/SbVec4f.h>
39 #include <Inventor/system/inttypes.h>
40 
41 class SoDetail;
42 
43 class COIN_DLL_API SoPrimitiveVertex {
44 public:
45  SoPrimitiveVertex(void);
47  ~SoPrimitiveVertex(void);
48 
49  SoPrimitiveVertex & operator = (const SoPrimitiveVertex & pv);
50 
51  const SbVec3f & getPoint(void) const { return point; }
52  const SbVec3f & getNormal(void) const { return normal; }
53  const SbVec4f & getTextureCoords(void) const { return textureCoords; }
54  int getMaterialIndex(void) const { return materialIndex; }
55  uint32_t getPackedColor(void) const { return packedColor; }
56  const SoDetail * getDetail(void) const { return detail; }
57 
58  void setPoint(const SbVec3f & pt) { point = pt; }
59  void setPoint(float x, float y, float z) { point.setValue(x, y, z); }
60  void setNormal(const SbVec3f & n) { normal = n; }
61  void setNormal(float nx, float ny, float nz) { normal.setValue(nx, ny, nz); }
62  void setTextureCoords(const SbVec2f & tex) { textureCoords.setValue(tex[0], tex[1], 0.0f, 1.0f); }
63  void setTextureCoords(float tx, float ty) { textureCoords.setValue(tx, ty, 0.0f, 1.0f); }
64  void setTextureCoords(const SbVec3f & tex) { textureCoords.setValue(tex[0], tex[1], tex[2], 1.0f); }
65  void setTextureCoords(float tx, float ty, float tz) { textureCoords.setValue(tx, ty, tz, 1.0f); }
66  void setTextureCoords(const SbVec4f & tex) { textureCoords = tex; }
67  void setTextureCoords(float tx, float ty, float tz, float tw) { textureCoords.setValue(tx, ty, tz, tw); }
68 
69  void setMaterialIndex(int index) { materialIndex = index; }
70  void setPackedColor(uint32_t rgba) { packedColor = rgba; }
71  void setDetail(SoDetail * d) { detail = d; }
72 
73 private:
74  SbVec3f point;
75  SbVec3f normal;
76  SbVec4f textureCoords;
77  int materialIndex;
78  SoDetail * detail;
79  uint32_t packedColor;
80 
81 }; // SoPrimitiveVertex
82 
83 #endif // !COIN_SOPRIMITIVEVERTEX_H
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition: SbVec2f.h:49
The SoPrimitiveVertex class represents a single vertex of a generated primitive.
Definition: SoPrimitiveVertex.h:43
The SbVec4f class is a 4 dimensional vector with floating point coordinates.
Definition: SbVec4f.h:49
const SbVec3f & getNormal(void) const
Definition: SoPrimitiveVertex.h:52
void setMaterialIndex(int index)
Definition: SoPrimitiveVertex.h:69
const SbVec3f & getPoint(void) const
Definition: SoPrimitiveVertex.h:51
SbVec4f & setValue(const float v[4])
Definition: SbVec4f.h:59
const SoDetail * getDetail(void) const
Definition: SoPrimitiveVertex.h:56
void setTextureCoords(const SbVec3f &tex)
Definition: SoPrimitiveVertex.h:64
void setTextureCoords(const SbVec2f &tex)
Definition: SoPrimitiveVertex.h:62
void setNormal(float nx, float ny, float nz)
Definition: SoPrimitiveVertex.h:61
int getMaterialIndex(void) const
Definition: SoPrimitiveVertex.h:54
void setNormal(const SbVec3f &n)
Definition: SoPrimitiveVertex.h:60
void setPackedColor(uint32_t rgba)
Definition: SoPrimitiveVertex.h:70
void setPoint(const SbVec3f &pt)
Definition: SoPrimitiveVertex.h:58
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:51
void setTextureCoords(const SbVec4f &tex)
Definition: SoPrimitiveVertex.h:66
void setTextureCoords(float tx, float ty)
Definition: SoPrimitiveVertex.h:63
void setDetail(SoDetail *d)
Definition: SoPrimitiveVertex.h:71
void setTextureCoords(float tx, float ty, float tz)
Definition: SoPrimitiveVertex.h:65
void setPoint(float x, float y, float z)
Definition: SoPrimitiveVertex.h:59
const SbVec4f & getTextureCoords(void) const
Definition: SoPrimitiveVertex.h:53
uint32_t getPackedColor(void) const
Definition: SoPrimitiveVertex.h:55
The SoDetail class is the superclass for all classes storing detailed information about particular sh...
Definition: SoDetail.h:39