Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoPrimitiveVertex.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_PRIMITIVE_VERTEX_
51#define _SO_PRIMITIVE_VERTEX_
52
53#include <Inventor/SbLinear.h>
54
55class SoDetail;
56class SoPointDetail;
57class SoTextureCoordinateBundle;
58
60//
61// Class: SoPrimitiveVertex
62//
63// An SoPrimitiveVertex represents a vertex of a primitive (triangle,
64// line segment, point) that is being generated via the
65// SoCallbackAction.
66//
67// An SoPrimitiveVertex contains an object-space point, normal,
68// texture coordinates, material index, and a pointer to an instance
69// of some SoDetail subclass. This detail may contain more
70// information about the vertex, or may be a NULL pointer if there is
71// no such info.
72//
73// Instances of SoPrimitiveVertex are typically created on the stack
74// by shape classes while they are generating primitives. Anyone who
75// wants to save them as return values from SoCallbackAction should
76// probably make copies of them.
77//
79
99
100 public:
105
116
121
125 const SbVec3f & getPoint() const { return point; }
129 const SbVec3f & getNormal() const { return normal; }
133 const SbVec4f & getTextureCoords() const;
134
139 int getMaterialIndex() const { return materialIndex; }
140
145 const SoPointDetail * getPointDetail() const { return m_pointDetail; }
146
151 const SoDetail * getDetail() const { return detail; }
152
163
164 private:
165
166 // These methods are typically called by shape classes during
167 // primtiive generation
168
169 // These set the object space point, normal, and texture coordinates:
170 void setPoint(const SbVec3f &pt) { point = pt; }
171 void setNormal(const SbVec3f &norm) { normal = norm; }
172 void setTextureCoords( const SbVec4f &t ){ m_texCoords = t; }
173 void setTextureCoords( const SoTextureCoordinateBundle *tcb, int curCoord );
174
175 // Sets the material index. The index is set to 0 during construction.
176 void setMaterialIndex(int index) { materialIndex = index; }
177
178 // Sets the detail corresponding to the vertex. The pointer may be
179 // NULL, although it is set to NULL during construction.
180 void setDetail(SoDetail *d) { detail = d; }
181
182 // Sets the point detail corresponding to the vertex. The pointer may be NULL.
183 void setPointDetail(SoPointDetail *p) { m_pointDetail= p; }
184
185 private:
186 SbVec3f point; // Object-space point
187 SbVec3f normal; // Object-space normal
188 int materialIndex; // Material index
189 SoDetail* detail; // Extra detail info
190 SoPointDetail* m_pointDetail; //Point detail info
191
192 // Please see note in implementation
193 mutable const SoTextureCoordinateBundle* m_tcb;
194 mutable int m_currCoord;
195 mutable SbVec4f m_texCoords; // Object-space texture coordinates
196
197};
198
199#endif /* _SO_PRIMITIVE_VERTEX_ */
200
3D vector class.
Definition SbVec.h:932
4D vector class.
Definition SbVec.h:2214
Base class for describing detail information about a shape node.
Definition SoDetail.h:99
Stores detail information about vertex-based shapes made of points.
Represents a vertex of a generated primitive.
const SbVec3f & getNormal() const
Returns the normal in object space.
const SbVec3f & getPoint() const
Returns the surface point in object space.
SoPrimitiveVertex(const SoPrimitiveVertex &pv)
Constructor.
const SoPointDetail * getPointDetail() const
Returns the point detail giving more information about the vertex.
const SbVec4f & getTextureCoords() const
Returns the texture coordinates in object space.
SoPrimitiveVertex & operator=(const SoPrimitiveVertex &pv)
Copies the given vertex.
~SoPrimitiveVertex()
Destructor.
const SoDetail * getDetail() const
Returns the detail giving more information about the vertex.
SoPrimitiveVertex()
Default constructor.
int getMaterialIndex() const
Returns the index into the current set of materials of the material active at the vertex.