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;
385#ifndef HIDDEN_FROM_DOC
487 {
return normVPPoint; }
535 float nearDistance = -1.0,
536 float farDistance = -1.0);
558 float nearDistance = -1.0,
559 float farDistance = -1.0);
649 {
return s_triangleCullingEnabled; }
695 {
return m_conicPickVolume; }
714 void computeWorldSpaceRay();
718 SbBool hasWorldSpaceRay()
const;
731 void setObjectSpace();
732 void setObjectSpace(
const SbMatrix &matrix);
766 return intersect(xbox, useFullViewVolume);
793 const SbLine &getLine()
const
822 SoPickedPoint *addIntersection_ (
const SbVec3f &objectSpacePoint, PickedPointListImpl* ppimplptr );
834 int getPickedPointsListLength()
const;
838 virtual void beginTraversal(
SoNode *node);
841 static void initClass();
842 static void exitClass();
845 static SbBool isPickOptimSet()
846 {
return s_useAlternateIntersection; }
850 static bool isPtCulledByClippingPlanes(
const SbVec3f &worldPt,
SoState *state,
bool worldCoord =
true );
854 static bool isBboxCompletelyCulledByClippingPlanes(
const SbBox3d& worldBBox,
SoState* state,
bool worldCoord =
true );
856 static bool isBboxCompletelyCulledByClippingPlanes(
const SbBox3f& worldBBox,
SoState* state,
bool worldCoord =
true );
858 static bool arePointsCulledByAClippingPlane(
const std::vector< SbVec3f>& pointVector,
SoState* state,
bool worldCoord =
true );
865 enum PickedProperties
879 void enablePickedProperties(
const enum PickedProperties pickedProperty,
const SbBool enable);
884 SbBool isPickedPropertiesEnabled(
const enum PickedProperties pickedProperty)
const;
895 double getDepth(
const SbVec3f& p0)
const;
898 inline void resetCurrPathCache();
900 enum PointPositionClassification
911 PointPositionClassification homogeneSpaceIntersection(
const SbVec3f &point,
SbVec4f &pPoint )
const;
912 SoPath *getClonedCurrPath();
914 static bool isMTPickingActive();
917 float getVPRadiusPixel()
const ;
927 void setPointSizeForPicking(
float pointWidth,
float pointHeight);
930 void setPointSizeForPicking(
const SbVec2f & pointSize)
931 { setPointSizeForPicking(pointSize[0], pointSize[1]); }
934 SbVec2f getPointSizeForPicking()
935 {
return SbVec2f( m_pointWidthForPicking, m_pointHeightForPicking ); }
939 bool isValid =
false;
941 uint32_t shapeId = 0;
943 float distToPickCenter = 0.f;
946 bool canGPUPick()
const;
979 SbBool clipToNear, clipToFar;
995 void computeMatrices();
998 void computeObjVolAndLine();
1001 void setUpRayBBoxAndWMat(
const SbVec3f ¢erPt );
1006 float getVPRadiusWorld()
const ;
1010 static float rayDistance(
const SbVec3f &start,
1015 void setRayCommonProperties (
const SbVec3f &start,
const SbVec3f &direction,
1016 float fovy,
float aspectRatio = 1.0f,
float nearDistance=-1.0f,
float farDistance=-1.0f);
1019 void initializeMembersAfterVPPointSet(
bool normalizedPointSet);
1024 inline SbBool isInConicPickingVolume(
const SbVec3f &intersection )
const;
1026 void initSetRayData (
const SbVec3f &start,
const SbVec3f &direction,
1027 float fovy,
float aspectRatio = 1.0f,
1028 float nearDistance = -1.0f,
float farDistance = -1.0f );
1031 SbBool m_canUseTriangleCulling;
1040 HomTransfData *m_htdta;
1043 SbBool canUseTriangleCulling()
const
1044 {
return (s_triangleCullingEnabled && m_canUseTriangleCulling); }
1046 static SbBool s_triangleCullingEnabled ;
1049 static SbBool s_generateAllPickedProperties;
1055 static SbBool s_useAlternateIntersection;
1058 SbBool m_bEnableRadiusForTriangles;
1068 template<
typename SO_NODE_OR_SO_PATH>
void commonApply(SO_NODE_OR_SO_PATH* nodeOrPath);
1070 float getCorrectedVPRadius()
const;
1072 int m_pickedPropertiesMask;
1075 int m_VPRadiusState;
1079 float m_nearDistance;
1080 float m_farDistance;
1081 float m_aspectRatio;
1084 SbBool m_conicPickVolume;
1086 PickedPointListImpl *m_pickedPointListlImpl;
1091 float m_pointPickingErrorX;
1092 float m_pointPickingErrorY;
1094 float m_projSpaceWidth;
1095 float m_projSpaceHeight;
1097 float m_pointWidthForPicking;
1098 float m_pointHeightForPicking;
1101 uint64_t m_lastGPUPickRenderApplyId;
1107 m_bEnableRadiusForTriangles = flag;
1113 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,...