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);
661 {
return s_triangleCullingEnabled; }
707 {
return m_conicPickVolume; }
726 void computeWorldSpaceRay();
730 SbBool hasWorldSpaceRay()
const;
743 void setObjectSpace();
744 void setObjectSpace(
const SbMatrix &matrix);
778 return intersect(xbox, useFullViewVolume);
805 const SbLine &getLine()
const
834 SoPickedPoint *addIntersection_ (
const SbVec3f &objectSpacePoint, PickedPointListImpl* ppimplptr );
846 int getPickedPointsListLength()
const;
850 virtual void beginTraversal(
SoNode *node);
853 static void initClass();
854 static void exitClass();
857 static SbBool isPickOptimSet()
858 {
return s_useAlternateIntersection; }
862 static bool isPtCulledByClippingPlanes(
const SbVec3f &worldPt,
SoState *state,
bool worldCoord =
true );
866 static bool isBboxCompletelyCulledByClippingPlanes(
const SbBox3d& worldBBox,
SoState* state,
bool worldCoord =
true );
868 static bool isBboxCompletelyCulledByClippingPlanes(
const SbBox3f& worldBBox,
SoState* state,
bool worldCoord =
true );
870 static bool arePointsCulledByAClippingPlane(
const std::vector< SbVec3f>& pointVector,
SoState* state,
bool worldCoord =
true );
877 enum PickedProperties
891 void enablePickedProperties(
const enum PickedProperties pickedProperty,
const SbBool enable);
896 SbBool isPickedPropertiesEnabled(
const enum PickedProperties pickedProperty)
const;
907 double getDepth(
const SbVec3f& p0)
const;
910 void resetCurrPathCache();
912 enum PointPositionClassification
923 PointPositionClassification homogeneSpaceIntersection(
const SbVec3f &point,
SbVec4f &pPoint )
const;
924 SoPath *getClonedCurrPath();
926 static bool isMTPickingActive();
929 float getVPRadiusPixel()
const ;
939 void setPointSizeForPicking(
float pointWidth,
float pointHeight);
942 void setPointSizeForPicking(
const SbVec2f & pointSize)
943 { setPointSizeForPicking(pointSize[0], pointSize[1]); }
946 SbVec2f getPointSizeForPicking()
947 {
return SbVec2f( m_pointWidthForPicking, m_pointHeightForPicking ); }
951 bool isValid =
false;
953 uint32_t shapeId = 0;
955 float distToPickCenter = 0.f;
958 bool canGPUPick()
const;
963 void collectGPUPickingPath();
967 const std::vector<GPUPickInfo>& getGPUPickInfo()
const;
990 SbBool clipToNear, clipToFar;
1006 void computeMatrices();
1009 void computeObjVolAndLine();
1012 void setUpRayBBoxAndWMat(
const SbVec3f ¢erPt );
1017 float getVPRadiusWorld()
const ;
1021 static float rayDistance(
const SbVec3f &start,
1026 void setRayCommonProperties (
const SbVec3f &start,
const SbVec3f &direction,
1027 float fovy,
float aspectRatio = 1.0f,
float nearDistance=-1.0f,
float farDistance=-1.0f);
1030 void initializeMembersAfterVPPointSet(
bool normalizedPointSet);
1035 inline SbBool isInConicPickingVolume(
const SbVec3f &intersection )
const;
1037 void initSetRayData (
const SbVec3f &start,
const SbVec3f &direction,
1038 float fovy,
float aspectRatio = 1.0f,
1039 float nearDistance = -1.0f,
float farDistance = -1.0f );
1042 SbBool m_canUseTriangleCulling;
1051 HomTransfData *m_htdta;
1054 SbBool canUseTriangleCulling()
const
1055 {
return (s_triangleCullingEnabled && m_canUseTriangleCulling); }
1057 static SbBool s_triangleCullingEnabled ;
1060 static SbBool s_generateAllPickedProperties;
1066 static SbBool s_useAlternateIntersection;
1069 SbBool m_bEnableRadiusForTriangles;
1079 template<
typename SO_NODE_OR_SO_PATH>
void commonApply(SO_NODE_OR_SO_PATH* nodeOrPath);
1081 float getCorrectedVPRadius()
const;
1083 int m_pickedPropertiesMask;
1086 int m_VPRadiusState;
1090 float m_nearDistance;
1091 float m_farDistance;
1092 float m_aspectRatio;
1095 SbBool m_conicPickVolume;
1097 PickedPointListImpl *m_pickedPointListlImpl;
1102 float m_pointPickingErrorX;
1103 float m_pointPickingErrorY;
1105 float m_projSpaceWidth;
1106 float m_projSpaceHeight;
1108 float m_pointWidthForPicking;
1109 float m_pointHeightForPicking;
1113 std::vector<SoRayPickAction::GPUPickInfo> m_gpuPickingInfos;
1118 void renderGPUPickingScene();
1123 void fillGPUPickInfos();
1129 m_bEnableRadiusForTriangles = flag;
1135 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,...