Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoRayPickAction.h
Go to the documentation of this file.
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25** Modified by : Nick Thompson (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51#ifndef _SO_RAY_PICK_ACTION_
52#define _SO_RAY_PICK_ACTION_
53
54#include <Inventor/SoLists.h>
57#include <Inventor/SbBox.h>
59
60class PickedPointListImpl;
61class HomTransfData;
62class SoDeviceContext;
63
65//
66// Class: SoRayPickAction
67//
68// Picking action that intersects a ray with objects in the scene
69// graph. The ray can be specified by calling setPoint() with a point
70// in a viewport in a rendering window or by calling setRay() with a
71// world-space ray. In the setPoint() case, a valid camera must be
72// encountered in the graph to set up the mapping to world space.
73//
74// The "pickAll" flag indicates whether all intersections along the
75// ray should be returned (sorted by distance from the starting point
76// of the ray), or just the closest one. In either case, the
77// intersections are returned as an SoPickedPointList. Each
78// intersection can be examined by accessing the appropriate
79// SoPickedPoint in the list. The SoPickedPoint class provides
80// methods to get the intersection point, normal, and other info.
81//
83
350
352
353 public:
354
361 static void setStereoMode(SoCamera::StereoMode stereoMode);
362
366
372 SoRayPickAction(const SbViewportRegion &viewportRegion);
373
382 virtual void clearApplyResult();
383
384 // Destructor
385#ifndef HIDDEN_FROM_DOC
386 virtual ~SoRayPickAction();
387#endif // HIDDEN_FROM_DOC
388
390 //
391 // Setting up the action before it is applied:
392 //
393
402
418
419 // EDGE_PICKING,
420 // FACE_PICKING
421 };
422
428 void setPickingMode(PickingMode pickingMode);
429
434
443 virtual void setPoint(const SbVec2s &viewportPoint);
444
453 virtual void setPoint(const SbVec2f &viewportPoint);
454
459 const SbVec2s& getPoint() const { return VPPoint; }
460
466 const SbVec2f& getPointFloat() const { return VPPointFloat; }
467
475 virtual void setNormalizedPoint(const SbVec2f &normPoint);
476
487 { return normVPPoint; }
488
509 void setRadius(float radius);
510
514 float getRadius() const
515 { return VPRadius; }
516
534 virtual void setRay(const SbVec3f &start, const SbVec3f &direction,
535 float nearDistance = -1.0,
536 float farDistance = -1.0);
537
557 virtual void setRay(float fovy, const SbVec3f &start, const SbVec3f &direction,
558 float nearDistance = -1.0,
559 float farDistance = -1.0);
560
565 void setPickAll(SbBool flag)
566 { pickAll = flag; }
567
573 { return pickAll; }
574
576 //
577 // Examining results after the action is applied:
578 //
579
588
606 SoPickedPoint *getPickedPoint(int index = 0) const;
607SoDEPRECATED
618
629
635
642 static void enableTriangleCulling(SbBool flag) ;
643
644
649 { return s_triangleCullingEnabled; }
650
657
663
669
675
690
695 { return m_conicPickVolume; }
696
698 virtual void apply( SoNode* node );
699
701 virtual void apply( SoPath* path );
702
704 virtual void apply(const SoPathList &pathList, SbBool obeysRules = FALSE) { SoAction::apply(pathList, obeysRules); }
705
706
707 private:
708
709 // If a ray was not defined with setRay(), this causes the world
710 // space pick ray to be computed from the screen space point and
711 // radius, using the current view specification from the state.
712 // This is typically done when a camera is encountered during
713 // traversal.
714 void computeWorldSpaceRay();
715
716 // This returns TRUE if the action has had a world space ray set
717 // or computed
718 SbBool hasWorldSpaceRay() const;
719
720 // This is called by shapes to set up object space picking. It
721 // uses the current state matrices to determine how to map between
722 // world and object spaces. It should be called before calling any
723 // of the intersection methods.
724 // The second form takes a matrix to concatenate with the current
725 // objToWorld matrix. It can be used, for example, if a shape has
726 // sizing or positioning info built into it.
727 //
728 // These methods are also in charge of resetting the cached picked point
729 // shape path, so the application must call the appropriate one once for
730 // any shape that redefines the rayPick method before calling addIntersection().
731 void setObjectSpace();
732 void setObjectSpace(const SbMatrix &matrix);
733
734 // These intersect the current object-space ray with a variety of
735 // primitives: triangle, line, point, bounding-box. Intersection
736 // with a triangle uses only the ray, while intersection with a
737 // line or point uses the cone or cylinder around the ray. The
738 // intersection with a bounding-box uses the cone/cylinder also,
739 // since the contents of the box may be lines or points. NOTE: you
740 // must call setObjectSpace() before calling any of these.
741
742 // Triangle: returns intersection point, barycentric coordinates,
743 // and whether the front side (defined by right-hand-rule) was hit.
744 SbBool intersect(const SbVec3f &v0,
745 const SbVec3f &v1,
746 const SbVec3f &v2,
747 SbVec3f &intersection, SbVec3f &barycentric,
748 SbBool &front) ;
749
750 // Line:
751 SbBool intersect(const SbVec3f &v0, const SbVec3f &v1,
752 SbVec3f &intersection) const;
753
754 // Point:
755 SbBool intersect(const SbVec3f &point) const;
756
763 inline SbBool intersect(const SbBox3f &box, SbBool useFullViewVolume = TRUE)
764 {
765 SbXfBox3f xbox(box);
766 return intersect(xbox, useFullViewVolume);
767 }
768
775 SbBool intersect(const SbXfBox3f &box, SbBool useFullViewVolume = TRUE);
776
777
778 // Returns an SbViewVolume that represents the object-space ray to
779 // pick along. The projection point of the view volume is the
780 // starting point of the ray. The projection direction is the
781 // direction of the ray. The distance to the near plane is the
782 // same as the distance to the near plane for the ray. The
783 // distance to the far plane is the sum of the near distance and
784 // the depth of the view volume.
785 const SbViewVolume &getViewVolume() const
786 { return objVol; }
787
788 // Returns SbLine that can be used for other intersection tests.
789 // The line's position is the starting point and the direction is
790 // the direction of the ray. Given an intersection with this ray,
791 // you can call isBetweenPlanes() to see if the intersection is
792 // between the near and far clipping planes.
793 const SbLine &getLine() const
794 { return objLine; }
795
796 // Returns TRUE if the given object-space intersection point is
797 // between the near and far planes of the object-space view
798 // volume, as well as any clipping planes that have been defined.
799 // This test can be used to determine whether the point of
800 // intersection of the ray with an object is valid with respect to
801 // the clipping planes.
802 SbBool isBetweenPlanes(const SbVec3f &intersection) const;
803
813 SoPickedPoint *addIntersection(const SbVec3f &objectSpacePoint);
814
815 // Adds an SoPickedPoint instance representing the given object
816 // space point to the current list and returns a pointer to it. If
817 // pickAll is TRUE, this inserts the instance in correct sorted
818 // order. If it is FALSE, it replaces the one instance in the list
819 // only if the new one is closer; if the new one is farther away,
820 // no instance is created and NULL is returned, meaning that no
821 // more work has to be done to set up the SoPickedPoint.
822 SoPickedPoint *addIntersection_ ( const SbVec3f &objectSpacePoint, PickedPointListImpl* ppimplptr );
823 SoPickedPoint *addIntersection_( SoPickedPoint *pp, PickedPointListImpl* ppimplptr );
824 SoPickedPoint *addIntersection_( SoPickedPoint *pp );
825
826
827 // Get PickedPoints during a traversal without sorting them by distance
828 // this method must be used instead of the getPickedPointList
829 // that should be used instead only AFTER the rayPick traversal is completed
830 SoPickedPoint *getUnsortedPickedPoint( int i ) const;
831
832 // Use preferably this method to get just the number of picked points
833 // instead of getPickedPointList()->getLenght(), for performance reason
834 int getPickedPointsListLength() const;
835
836 private:
837 // Initiates action on graph
838 virtual void beginTraversal(SoNode *node);
839
840 private:
841 static void initClass();
842 static void exitClass();
843
844 // return whether OIV_PICK_OPTIM is set to TRUE
845 static SbBool isPickOptimSet()
846 { return s_useAlternateIntersection; }
847
848 // utility method to test if culling occurs because of clipping planes
849 // worldCoord is used to use world coordinates instead of object space coordinates
850 static bool isPtCulledByClippingPlanes( const SbVec3f &worldPt, SoState *state, bool worldCoord = true );
851
852 // utility method to test if culling occurs because of clipping planes
853 // worldCoord is used to use world coordinates instead of object space coordinates
854 static bool isBboxCompletelyCulledByClippingPlanes( const SbBox3d& worldBBox, SoState* state, bool worldCoord = true );
855 // worldCoord is used to use world coordinates instead of object space coordinates
856 static bool isBboxCompletelyCulledByClippingPlanes( const SbBox3f& worldBBox, SoState* state, bool worldCoord = true );
857 // worldCoord is used to use world coordinates instead of object space coordinates
858 static bool arePointsCulledByAClippingPlane( const std::vector< SbVec3f>& pointVector, SoState* state, bool worldCoord = true );
859
865 enum PickedProperties
866 {
868 NORMALS = 1 << 0,
870 TEXCOORDS = 1 << 1,
871
873 ALL = ~0
874 };
875
879 void enablePickedProperties(const enum PickedProperties pickedProperty, const SbBool enable);
880
884 SbBool isPickedPropertiesEnabled(const enum PickedProperties pickedProperty) const;
885
886 // Returns TRUE if the two SoPickedPoint are the same.
887 SbBool isEqual(const SoPickedPoint *pp0, const SoPickedPoint *pp1) const;
888
889 // Returns TRUE if the first intersection point is closer to the
890 // starting point of the ray than the second.
891 SbBool isCloser(const SoPickedPoint *pp0, const SoPickedPoint *pp1) const;
892 SbBool isCloser(const SbVec3f& p0, const SbVec3f& p1) const;
893
894 // get depth for ray picking sorting
895 double getDepth(const SbVec3f& p0) const;
896
897 //interface exposed to share SoPath among SoPickedPoints
898 inline void resetCurrPathCache();
899
900 enum PointPositionClassification
901 {
902 INSIDE = 0,
903 BEHIND_FAR = 1,
904 BEFORE_NEAR = 2,
905 BESIDE_LEFT = 3,
906 BESIDE_RIGHT = 4,
907 UNDER_BOTTOM = 5,
908 ABOVE_TOP = 6
909 };
910
911 PointPositionClassification homogeneSpaceIntersection( const SbVec3f &point, SbVec4f &pPoint ) const;
912 SoPath *getClonedCurrPath();
913
914 static bool isMTPickingActive();
915
916 // get VPradius in pixels (even if it was provided in world coords)
917 float getVPRadiusPixel() const ;
918
919 /* Because picking points should take care of pointSize without modifying
920 * the internal projection matrix,
921 * a distosion depending of the size of viewPortRegion is introduced
922 * This distorsion can be computed from pointSize
923 * By default pointSize is (0, 0)
924 * Normal usage should be setPointSizeForPicking( WidthInPixels, HeightInPixels)
925 * WARNING: Don't forget to restore previous pointSize after your traversal to avoid side effect
926 */
927 void setPointSizeForPicking( float pointWidth, float pointHeight);
928
929 // Same as previous with an SbVec2f
930 void setPointSizeForPicking( const SbVec2f & pointSize)
931 { setPointSizeForPicking(pointSize[0], pointSize[1]); }
932
933 // Return current pointSize for picking points
934 SbVec2f getPointSizeForPicking()
935 { return SbVec2f( m_pointWidthForPicking, m_pointHeightForPicking ); }
936
937 struct GPUPickInfo
938 {
939 bool isValid = false;
940 SbVec3f modelPosition;
941 uint32_t shapeId = 0;
942 uint32_t faceId = 0;
943 float distToPickCenter = 0.f;
944 };
945
946 bool canGPUPick() const;
947
948 // Render the scene with GPU Picking data attached and
949 // retrieve the picking data from the GPU
950 // The data can be accessed via getGPUPickingInfo()
951 void renderGPUPickingScene( SoDeviceContext* ctx );
952
953 // Return the picking informations (faceId, shapeId, Position)
954 // for the selected point. If the scene changed since the last
955 // GPU picking, call renderGPUPickingScene() first.
956 std::vector<GPUPickInfo> getGPUPickInfo( SoDeviceContext* ctx ) const;
957
958 private:
959 SbBool lineWasSet; // TRUE if a world-space line was set
960 SbBool rayWasComputed; // TRUE if ray computed by camera
961 SbBool pickAll; // Pick all objects or just closest
962 SbVec2s VPPoint; // Point in viewport coordinates
963 SbVec2f VPPointFloat; // Point in viewport coordinates
964 SbVec2f normVPPoint; // Point in normalized vp coordinates
965 SbBool normPointSet; // TRUE if setNormalizedPoint called
966 float VPRadius; // Radius in viewport space pixels
967 SbMatrix objToWorld; // Object-to-world space matrix
968 SbMatrix worldToObj; // World-to-object space matrix
969
970 // The ray is defined as an SbViewVolume as in the
971 // SoPickRayElement, and is usually stored in an instance of the
972 // element. This stores the ray if it is set using setRay().
973 SbViewVolume worldVol;
974
975 // Users can specify negative near and far distances to indicate
976 // that picks should not be clipped to those planes. These flags
977 // store that info, since the distances in the view volume can't
978 // be negative.
979 SbBool clipToNear, clipToFar;
980
981 // These store the object-space ray info as a view volume and a
982 // line. See the comments on getViewVolume() and getLine().
983 SbLine objLine; // Line representing ray
984 SbLined objLineD;
985 SbViewVolume objVol; // View volume representing ray
986
987 // If the caller passes a matrix to setObjectSpace(), the inverse
988 // of it is stored here so the object-space angle can be computed
989 // correctly later. The extraMatrixSet flag is set to TRUE in this
990 // case.
991 SbBool extraMatrixSet;
992 SbMatrix extraMatrix;
993
994 // Computes matrices to go between object and world space
995 void computeMatrices();
996
997 // Computes object-space view volume and line
998 void computeObjVolAndLine();
999
1000 // updates RayBBox and WMat
1001 void setUpRayBBoxAndWMat( const SbVec3f &centerPt );
1002
1003 void evalCenterPts( SbVec3f &centerPt, SbVec3d &centerPtD, SbVec3d &projPtD );
1004
1005 // get VPRadius in world coordinates (even if it was provided in pixels)
1006 float getVPRadiusWorld() const ;
1007
1008 // Computes distance t of a point along a ray: point = start + t * direction.
1009 // The point has to be on the ray for this to work
1010 static float rayDistance(const SbVec3f &start,
1011 const SbVec3f &direction,
1012 const SbVec3f &point);
1013
1014 // Set commons properties of the action (called by the setRay method)
1015 void setRayCommonProperties (const SbVec3f &start, const SbVec3f &direction,
1016 float fovy, float aspectRatio = 1.0f, float nearDistance=-1.0f, float farDistance=-1.0f);
1017
1018 // Initialize some members variable when a new point in viewport has been set
1019 void initializeMembersAfterVPPointSet(bool normalizedPointSet);
1020
1021
1022
1023 // check if the intersection is inside conic picking volume
1024 inline SbBool isInConicPickingVolume( const SbVec3f &intersection ) const;
1025
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 );
1029
1030 // Store the current ray bounding box for triangle culling
1031 SbBool m_canUseTriangleCulling;
1032 SbBox3f m_rayBBox ;
1033
1034
1035 // store the current viewvolume matrix and near far in homogene space
1036 // to optimize intersection computation
1037 SbMatrixd m_wmat;
1038 double m_wnear;
1039 double m_wfar;
1040 HomTransfData *m_htdta;
1041
1042 // Indicate if triangle are culled by ray frustum.
1043 SbBool canUseTriangleCulling() const
1044 { return (s_triangleCullingEnabled && m_canUseTriangleCulling); }
1045
1046 static SbBool s_triangleCullingEnabled ;
1047
1048 // generate all picked point properties? (OIV_PICK_GENERATE_ALL_PROPERTIES)
1049 static SbBool s_generateAllPickedProperties;
1050
1051 //
1052 static SoCamera::StereoMode s_stereoMode;
1053
1054 // Use faster intersection method (OIV_PICK_OPTIM)
1055 static SbBool s_useAlternateIntersection;
1056
1057 // Force the raypick action to take ray radius in account
1058 SbBool m_bEnableRadiusForTriangles;
1059
1060 // Store ray properties
1061 SbVec3f m_direction;
1062 SbVec3f m_start;
1063
1064private:
1068 template<typename SO_NODE_OR_SO_PATH> void commonApply(SO_NODE_OR_SO_PATH* nodeOrPath);
1069
1070 float getCorrectedVPRadius() const;
1071
1072 int m_pickedPropertiesMask;
1073 PickingMode m_pickingMode;
1074
1075 int m_VPRadiusState; // how VPRadius has been initialized
1076
1077 // data buffered for the lineWasSet case
1078 float m_fovy;
1079 float m_nearDistance;
1080 float m_farDistance;
1081 float m_aspectRatio;
1082
1083 // to force pick volume to be a cone (perspective pick) or a cylinder (orthogonal pick)
1084 SbBool m_conicPickVolume;
1085
1086 PickedPointListImpl *m_pickedPointListlImpl;
1087
1088 // Only computed by setPointSizeForPicking()
1089 // Only used in homogeneSpaceIntersection()
1090 // Store picking error depending of viewPort
1091 float m_pointPickingErrorX;
1092 float m_pointPickingErrorY;
1093 // Store extended pick trap depending of pointSize
1094 float m_projSpaceWidth;
1095 float m_projSpaceHeight;
1096 // Store pointSize for picking point
1097 float m_pointWidthForPicking;
1098 float m_pointHeightForPicking;
1099
1100 uint64_t m_applyId;
1101 uint64_t m_lastGPUPickRenderApplyId;
1102};
1103
1104inline
1106{
1107 m_bEnableRadiusForTriangles = flag;
1108}
1109
1110inline
1112{
1113 return m_bEnableRadiusForTriangles;
1114}
1115#endif /* _SO_RAY_PICK_ACTION_ */
1116
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void *unused=NULL)
void start()
#define SO_ACTION_HEADER(className)
Definition SoSubAction.h:69
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box class.
Definition SbBox.h:972
3D box class.
Definition SbBox.h:649
Directed line in 3D.
Definition SbLine.h:57
Directed line in 3D (double precision).
Definition SbLine.h:182
4x4 matrix class.
Definition SbMatrix.h:309
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4x4 matrix class...
Definition SbMatrix.h:756
2D vector class.
Definition SbVec.h:76
2D vector class.
Definition SbVec.h:700
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
Definition SbVec.h:1214
3D vector class.
Definition SbVec.h:932
4D vector class.
Definition SbVec.h:2214
3D viewing volume class.
Class for representing a viewport.
3D box with an associated transformation matrix.
Definition SbBox.h:1250
virtual void apply(SoNode *node)
Initiates an action on the graph defined by a node.
StereoMode
Stereo mode.
Definition SoCamera.h:518
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Abstract base class for all database nodes.
Definition SoNode.h:145
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Maintains a list of pointers to paths.
Definition SoPathList.h:81
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,...
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87