51#ifndef _SO_RAY_PICK_ACTION_
52#define _SO_RAY_PICK_ACTION_
54#include <Inventor/SoLists.h>
55#include <Inventor/nodes/SoCamera.h>
56#include <Inventor/actions/SoPickAction.h>
57#include <Inventor/SbBox.h>
58#include <Inventor/lists/SoPickedPointList.h>
60class PickedPointListImpl;
397#ifndef HIDDEN_FROM_DOC
499 {
return normVPPoint; }
547 float nearDistance = -1.0,
548 float farDistance = -1.0);
570 float nearDistance = -1.0,
571 float farDistance = -1.0);
664 {
return s_triangleCullingEnabled; }
710 {
return m_conicPickVolume; }
729 void computeWorldSpaceRay();
733 SbBool hasWorldSpaceRay()
const;
746 void setObjectSpace();
747 void setObjectSpace(
const SbMatrix &matrix);
781 return intersect(xbox, useFullViewVolume);
808 const SbLine &getLine()
const
837 SoPickedPoint *addIntersection_ (
const SbVec3f &objectSpacePoint, PickedPointListImpl* ppimplptr );
849 int getPickedPointsListLength()
const;
853 virtual void beginTraversal(
SoNode *node);
856 static void initClass();
857 static void exitClass();
860 static SbBool isPickOptimSet()
861 {
return s_useAlternateIntersection; }
865 static bool isPtCulledByClippingPlanes(
const SbVec3f &worldPt,
SoState *state,
bool worldCoord =
true );
869 static bool isBboxCompletelyCulledByClippingPlanes(
const SbBox3d& worldBBox,
SoState* state,
bool worldCoord =
true );
871 static bool isBboxCompletelyCulledByClippingPlanes(
const SbBox3f& worldBBox,
SoState* state,
bool worldCoord =
true );
873 static bool arePointsCulledByAClippingPlane(
const std::vector< SbVec3f>& pointVector,
SoState* state,
bool worldCoord =
true );
880 enum PickedProperties
894 void enablePickedProperties(
const enum PickedProperties pickedProperty,
const SbBool enable);
899 SbBool isPickedPropertiesEnabled(
const enum PickedProperties pickedProperty)
const;
910 double getDepth(
const SbVec3f& p0)
const;
913 void resetCurrPathCache();
915 enum PointPositionClassification
926 PointPositionClassification homogeneSpaceIntersection(
const SbVec3f &point,
SbVec4f &pPoint )
const;
927 SoPath *getClonedCurrPath();
929 static bool isMTPickingActive();
932 float getVPRadiusPixel()
const ;
942 void setPointSizeForPicking(
float pointWidth,
float pointHeight);
945 void setPointSizeForPicking(
const SbVec2f & pointSize)
946 { setPointSizeForPicking(pointSize[0], pointSize[1]); }
949 SbVec2f getPointSizeForPicking()
950 {
return SbVec2f( m_pointWidthForPicking, m_pointHeightForPicking ); }
954 bool isValid =
false;
956 uint32_t shapeId = 0;
958 float distToPickCenter = 0.f;
961 bool canGPUPick()
const;
966 void collectGPUPickingPath();
970 const std::vector<GPUPickInfo>& getGPUPickInfo()
const;
972 PickedPointListImpl* getPickedPointListImpl()
const;
995 SbBool clipToNear, clipToFar;
1011 void computeMatrices();
1014 void computeObjVolAndLine();
1017 void setUpRayBBoxAndWMat(
const SbVec3f ¢erPt );
1022 float getVPRadiusWorld()
const ;
1026 static float rayDistance(
const SbVec3f &start,
1031 void setRayCommonProperties (
const SbVec3f &start,
const SbVec3f &direction,
1032 float fovy,
float aspectRatio = 1.0f,
float nearDistance=-1.0f,
float farDistance=-1.0f);
1035 void initializeMembersAfterVPPointSet(
bool normalizedPointSet);
1040 inline SbBool isInConicPickingVolume(
const SbVec3f &intersection )
const;
1042 void initSetRayData (
const SbVec3f &start,
const SbVec3f &direction,
1043 float fovy,
float aspectRatio = 1.0f,
1044 float nearDistance = -1.0f,
float farDistance = -1.0f );
1047 SbBool m_canUseTriangleCulling;
1056 HomTransfData *m_htdta;
1059 SbBool canUseTriangleCulling()
const
1060 {
return (s_triangleCullingEnabled && m_canUseTriangleCulling); }
1062 static SbBool s_triangleCullingEnabled ;
1065 static SbBool s_generateAllPickedProperties;
1071 static SbBool s_useAlternateIntersection;
1074 SbBool m_bEnableRadiusForTriangles;
1084 template<
typename SO_NODE_OR_SO_PATH>
void commonApply(SO_NODE_OR_SO_PATH* nodeOrPath);
1086 float getCorrectedVPRadius()
const;
1088 int m_pickedPropertiesMask;
1091 int m_VPRadiusState;
1095 float m_nearDistance;
1096 float m_farDistance;
1097 float m_aspectRatio;
1100 SbBool m_conicPickVolume;
1102 PickedPointListImpl *m_pickedPointListlImpl;
1107 float m_pointPickingErrorX;
1108 float m_pointPickingErrorY;
1110 float m_projSpaceWidth;
1111 float m_projSpaceHeight;
1113 float m_pointWidthForPicking;
1114 float m_pointHeightForPicking;
1118 std::vector<SoRayPickAction::GPUPickInfo> m_gpuPickingInfos;
1123 void renderGPUPickingScene();
1128 void fillGPUPickInfos();
1134 m_bEnableRadiusForTriangles = flag;
1140 return m_bEnableRadiusForTriangles;
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box class.
Directed line in 3D (double precision).
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4x4 matrix class...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
Class for representing a viewport.
3D box with an associated transformation matrix.
virtual void apply(SoNode *node)
Initiates an action on the graph defined by a node.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Abstract base class for all database nodes.
Path that points to a list of hierarchical nodes.
Maintains a list of pointers to paths.
Abstract base class for picking objects in a scene.
Represents point on surface of picked object.
Maintains a list of pointers to SoPickedPoint instances.
Intersects objects with a ray cast into scene.
virtual void setPoint(const SbVec2f &viewportPoint)
Float version of setPoint.
virtual void apply(SoNode *node)
Initiates an action on the graph defined by a node.
SbBool isConicPickVolume()
Returns TRUE if the picking volume is a conic shape (not a frustum).
void enableNormalsGeneration(const SbBool enable)
Enables generation of normal vectors for picked points.
void setPickingMode(PickingMode pickingMode)
Sets the picking mode.
const SbVec2f & getPointFloat() const
Float version of getPoint().
static SoCamera::StereoMode getStereoMode()
Returns the view used to perform pick when stereo is active.
virtual void apply(const SoPathList &pathList, SbBool obeysRules=FALSE)
Initiates an action on the graph defined by a list of paths.
void setPickAll(SbBool flag)
Sets whether the action will return all objects intersected or just the closest one.
virtual void setPoint(const SbVec2s &viewportPoint)
Sets the viewport point through which the ray passes, starting at the camera position.
SbBool isRadiusEnableForTriangles()
Returns whether the pick radius specified by setRadius is taken into account for picking on triangle-...
static void setStereoMode(SoCamera::StereoMode stereoMode)
Tells ray pick action in which view the pick occurs.
SbBool isPickAll() const
Returns whether the action will return all objects intersected or just the closest one.
virtual void clearApplyResult()
Clears the picked point list.
SoRayPickAction(const SbViewportRegion &viewportRegion)
Constructor takes viewport region to use for picking.
static SbBool isTriangleCulling()
Returns whether triangle culling is enabled.
void enableConicPickVolume(SbBool flag)
Controls the pick volume shape for picking with setRay().
const SbVec2s & getPoint() const
Gets the viewport point in pixels (returns the last value passed to setPoint).
static void enableTriangleCulling(SbBool flag)
Enables culling of triangles relative to the ray frustum.
void setRadius(float radius)
Sets the radius around the point.
void enableTexCoordsGeneration(const SbBool enable)
Enables generation of texture coordinates for picked points.
PickingMode getPickingMode() const
Returns the PickingMode used for the ray pick action.
virtual void apply(SoPath *path)
Initiates an action on the graph defined by a path.
virtual void setRay(float fovy, const SbVec3f &start, const SbVec3f &direction, float nearDistance=-1.0, float farDistance=-1.0)
Sets a world-space ray along which to pick in the the same way as the other version of setRay(),...
SbBool isNormalsGenerationEnabled() const
Returns whether generation of normal vectors is enabled for picked points.
SoPickedPoint * getPickedPoint(int index=0) const
Returns the indexed picked point from the list.
void enableRadiusForTriangles(SbBool flag)
Enable radius for triangle-based shape.
virtual void setRay(const SbVec3f &start, const SbVec3f &direction, float nearDistance=-1.0, float farDistance=-1.0)
Sets a world-space ray along which to pick.
SoDEPRECATED void clearPickedPointList()
Clears the picked point list.
@ POINT_PICKING
In this mode, Inventor finds all the vertices inside the pick radius.
@ DEFAULT
In the default mode, Inventor computes the intersection of the pick ray with geometry nodes (face,...
const SbVec2f getNormalizedPoint() const
Gets the viewport point in normalized coordinates [0..1] (returns the last value passed to setNormali...
SbBool isTexCoordsGenerationEnabled() const
Returns whether texture coordinate generation is enabled for picked points.
float getRadius() const
Gets the radius (in pixels) around the point.
const SoPickedPointList & getPickedPointList() const
Returns list of picked points.
virtual void setNormalizedPoint(const SbVec2f &normPoint)
Sets the viewport point in normalized coordinates, which range from (0,0) at the lower left to (1,...