1 #ifndef COIN_SOPICKEDPOINT_H 2 #define COIN_SOPICKEDPOINT_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/SbBasic.h> 37 #include <Inventor/SbVec3f.h> 38 #include <Inventor/SbVec4f.h> 39 #include <Inventor/lists/SoDetailList.h> 40 #include <Inventor/SbViewportRegion.h> 41 42 class SoPath; 43 class SoDetail; 44 class SoNode; 45 class SoState; 46 class SbMatrix; 47 48 class COIN_DLL_API SoPickedPoint { 49 public: 50 SoPickedPoint(const SoPickedPoint & pp); 51 SoPickedPoint(const SoPath * const path, SoState * const state, 52 const SbVec3f & objSpacePoint); 53 ~SoPickedPoint(); 54 SoPickedPoint *copy() const; 55 const SbVec3f &getPoint() const; 56 const SbVec3f &getNormal() const; 57 const SbVec4f &getTextureCoords() const; 58 int getMaterialIndex() const; 59 SoPath *getPath() const; 60 SbBool isOnGeometry() const; 61 const SoDetail *getDetail(const SoNode * const node = NULL) const; 62 const SbMatrix &getObjectToWorld(const SoNode * const node = NULL) const; 63 const SbMatrix &getWorldToObject(const SoNode * const node = NULL) const; 64 const SbMatrix &getObjectToImage(const SoNode * const node = NULL) const; 65 const SbMatrix &getImageToObject(const SoNode * const node = NULL) const; 66 SbVec3f getObjectPoint(const SoNode * const node = NULL) const; 67 SbVec3f getObjectNormal(const SoNode * const node = NULL) const; 68 SbVec4f getObjectTextureCoords(const SoNode * const node = NULL) const; 69 70 void setObjectNormal(const SbVec3f &normal); 71 void setObjectTextureCoords(const SbVec4f &texCoords); 72 void setMaterialIndex(const int index); 73 void setDetail(SoDetail * detail, SoNode * node); 74 75 private: 76 77 SbVec3f point, objPoint; 78 SbVec3f normal, objNormal; 79 SbVec4f texCoords, objTexCoords; 80 int materialIndex; 81 SoPath *path; 82 SbBool onGeometry; 83 SoDetailList detailList; 84 SoState *state; 85 SbViewportRegion viewport; 86 87 class SoGetMatrixAction *getMatrixAction() const; 88 void applyMatrixAction(const SoNode * const node) const; 89 }; 90 91 #endif // !COIN_SOPICKEDPOINT_H 92