Open Inventor Reference
SoPickedPoint.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | This file defines the base SoPickedPoint class.
48 |
49 | Author(s) : Paul S. Strauss
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55#ifndef _SO_PICKED_POINT_
56#define _SO_PICKED_POINT_
57
58#include <Inventor/SbLinear.h>
60#include <Inventor/SoLists.h>
61
62class SoDetail;
64class SoPath;
65class SoState;
66
67
70
88
90
91 public:
92
95
98
102
105 const SbVec3f & getPoint() const { return worldPoint; }
108 const SbVec3f & getNormal() const { return worldNormal; }
111 const SbVec4f & getTextureCoords() const { return imageTexCoords; }
112
117 int getMaterialIndex() const { return materialIndex; }
118
120 SoPath * getPath() const { return path; }
121
125 bool isOnGeometry() const { return onGeometry; }
126
133
139 const SoDetail * getDetail(const SoNode *node = NULL) const;
140
146
147
148 SbMatrix getObjectToWorld(const SoNode *node = NULL) const;
149 SbMatrix getWorldToObject(const SoNode *node = NULL) const;
150 SbMatrix getObjectToImage(const SoNode *node = NULL) const;
151 SbMatrix getImageToObject(const SoNode *node = NULL) const;
152 SbVec3f getObjectPoint(const SoNode *node = NULL) const;
153 SbVec3f getObjectNormal(const SoNode *node = NULL) const;
154 SbVec4f getObjectTextureCoords(const SoNode *node=NULL) const;
155
157
158 SoEXTENDER public:
159
164
166 void setObjectNormal(const SbVec3f &normal);
167
169 void setObjectTextureCoords(const SbVec4f &texCoords);
170
172 void setMaterialIndex(int index) { materialIndex = index; }
173
177 void setDetail(SoDetail *detail, SoNode *node);
178
179 SoINTERNAL public:
180
182 SoPickedPoint(const SoPath *path, SoState *state,
183 const SbVec3f &objSpacePoint);
184
185 private:
187 static SoGetMatrixAction *matrixAction;
188
191 SbVec3f worldPoint;
192 SbVec3f worldNormal;
193 SbVec4f imageTexCoords;
194
196 SbViewportRegion vpRegion;
197
199 int materialIndex;
200
202 bool onGeometry;
203
205 SoPath *path;
206
209 SoDetailList details;
210
215 SoState *state;
216
218 int getNodeIndex(const SoNode *node) const;
219
221 void getMatrix(const SoNode *node) const;
222
224 static SbVec4f multVecMatrix4(const SbMatrix &m, const SbVec4f v);
225};
226
227#endif /* _SO_PICKED_POINT_ */
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition SbBasic.h:154
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
4x4 matrix class.
Definition SbLinear.h:823
3D vector class.
Definition SbLinear.h:120
4D vector class.
Definition SbLinear.h:559
Class for representing a viewport.
Maintains a list of instances of details.
Definition SoLists.h:333
Base class for describing detail information about a shape node.
Definition SoDetail.h:78
Computes transformation matrix for subgraph.
Abstract base class for all database nodes.
Definition SoNode.h:103
Path that points to a list of hierarchical nodes.
Definition SoPath.h:109
Represents point on surface of picked object.
SbMatrix getImageToObject(const SoNode *node=NULL) const
const SbVec3f & getPoint() const
These return the intersection point and surface normal in world space, and the texture coordinates in...
const SbVec4f & getTextureCoords() const
These return the intersection point and surface normal in world space, and the texture coordinates in...
const SbVec3f & getNormal() const
These return the intersection point and surface normal in world space, and the texture coordinates in...
void setObjectTextureCoords(const SbVec4f &texCoords)
Sets the texture coordinates in object space.
bool isOnGeometry() const
Returns whether the intersection is actually on the geometry of the character that was hit,...
SbMatrix getObjectToWorld(const SoNode *node=NULL) const
SbMatrix getObjectToImage(const SoNode *node=NULL) const
SoPickedPoint(const SoPath *path, SoState *state, const SbVec3f &objSpacePoint)
Copy constructor.
const SoDetail * getDetail(const SoNode *node=NULL) const
The following methods all take a pointer to a node in the returned path.
void setObjectNormal(const SbVec3f &normal)
NOTE: these methods should be called ONLY by the node that causes the SoPickedPoint instance to be cr...
SbVec4f getObjectTextureCoords(const SoNode *node=NULL) const
SbVec3f getObjectNormal(const SoNode *node=NULL) const
~SoPickedPoint()
Destructor.
int getMaterialIndex() const
Returns the index into the current set of materials of the material active at the intersection point.
SbVec3f getObjectPoint(const SoNode *node=NULL) const
SbMatrix getWorldToObject(const SoNode *node=NULL) const
SoPickedPoint * copy() const
Returns an instance that is a copy of this instance.
SoPath * getPath() const
Returns the path to the object that was intersected.
void setDetail(SoDetail *detail, SoNode *node)
Sets the detail corresponding to the given node in the path.
SoPickedPoint(const SoPickedPoint &pp)
Copy constructor.
void setMaterialIndex(int index)
Sets the material index.
An SoState collects and holds state while traversing a scene graph.
Definition SoState.h:82