Open Inventor Release 2024.2.2
 
Loading...
Searching...
No Matches
SoRayPickAction.h
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-2024 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>
55#include <Inventor/nodes/SoCamera.h>
56#include <Inventor/actions/SoPickAction.h>
57#include <Inventor/SbBox.h>
58#include <Inventor/lists/SoPickedPointList.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
362
363 SO_ACTION_HEADER(SoRayPickAction);
364
365 public:
366
373 static void setStereoMode(SoCamera::StereoMode stereoMode);
374
378
384 SoRayPickAction(const SbViewportRegion &viewportRegion);
385
394 virtual void clearApplyResult();
395
396 // Destructor
397#ifndef HIDDEN_FROM_DOC
398 virtual ~SoRayPickAction();
399#endif // HIDDEN_FROM_DOC
400
402 //
403 // Setting up the action before it is applied:
404 //
405
414
430
431 // EDGE_PICKING,
432 // FACE_PICKING
433 };
434
440 void setPickingMode(PickingMode pickingMode);
441
446
455 virtual void setPoint(const SbVec2s &viewportPoint);
456
465 virtual void setPoint(const SbVec2f &viewportPoint);
466
471 const SbVec2s& getPoint() const { return VPPoint; }
472
478 const SbVec2f& getPointFloat() const { return VPPointFloat; }
479
487 virtual void setNormalizedPoint(const SbVec2f &normPoint);
488
499 { return normVPPoint; }
500
521 void setRadius(float radius);
522
526 float getRadius() const
527 { return VPRadius; }
528
546 virtual void setRay(const SbVec3f &start, const SbVec3f &direction,
547 float nearDistance = -1.0,
548 float farDistance = -1.0);
549
569 virtual void setRay(float fovy, const SbVec3f &start, const SbVec3f &direction,
570 float nearDistance = -1.0,
571 float farDistance = -1.0);
572
577 void setPickAll(SbBool flag)
578 { pickAll = flag; }
579
585 { return pickAll; }
586
588 //
589 // Examining results after the action is applied:
590 //
591
600
618 SoPickedPoint *getPickedPoint(int index = 0) const;
619SoDEPRECATED
630 {
632 }
633
644
650
657 static void enableTriangleCulling(SbBool flag) ;
658
659
664 { return s_triangleCullingEnabled; }
665
672
677 void enableNormalsGeneration(const SbBool enable);
678
684
690
705
710 { return m_conicPickVolume; }
711
713 virtual void apply( SoNode* node );
714
716 virtual void apply( SoPath* path );
717
719 virtual void apply(const SoPathList &pathList, SbBool obeysRules = FALSE) { SoAction::apply(pathList, obeysRules); }
720
721
722 private:
723
724 // If a ray was not defined with setRay(), this causes the world
725 // space pick ray to be computed from the screen space point and
726 // radius, using the current view specification from the state.
727 // This is typically done when a camera is encountered during
728 // traversal.
729 void computeWorldSpaceRay();
730
731 // This returns TRUE if the action has had a world space ray set
732 // or computed
733 SbBool hasWorldSpaceRay() const;
734
735 // This is called by shapes to set up object space picking. It
736 // uses the current state matrices to determine how to map between
737 // world and object spaces. It should be called before calling any
738 // of the intersection methods.
739 // The second form takes a matrix to concatenate with the current
740 // objToWorld matrix. It can be used, for example, if a shape has
741 // sizing or positioning info built into it.
742 //
743 // These methods are also in charge of resetting the cached picked point
744 // shape path, so the application must call the appropriate one once for
745 // any shape that redefines the rayPick method before calling addIntersection().
746 void setObjectSpace();
747 void setObjectSpace(const SbMatrix &matrix);
748
749 // These intersect the current object-space ray with a variety of
750 // primitives: triangle, line, point, bounding-box. Intersection
751 // with a triangle uses only the ray, while intersection with a
752 // line or point uses the cone or cylinder around the ray. The
753 // intersection with a bounding-box uses the cone/cylinder also,
754 // since the contents of the box may be lines or points. NOTE: you
755 // must call setObjectSpace() before calling any of these.
756
757 // Triangle: returns intersection point, barycentric coordinates,
758 // and whether the front side (defined by right-hand-rule) was hit.
759 SbBool intersect(const SbVec3f &v0,
760 const SbVec3f &v1,
761 const SbVec3f &v2,
762 SbVec3f &intersection, SbVec3f &barycentric,
763 SbBool &front) ;
764
765 // Line:
766 SbBool intersect(const SbVec3f &v0, const SbVec3f &v1,
767 SbVec3f &intersection) const;
768
769 // Point:
770 SbBool intersect(const SbVec3f &point) const;
771
778 inline SbBool intersect(const SbBox3f &box, SbBool useFullViewVolume = TRUE)
779 {
780 SbXfBox3f xbox(box);
781 return intersect(xbox, useFullViewVolume);
782 }
783
790 SbBool intersect(const SbXfBox3f &box, SbBool useFullViewVolume = TRUE);
791
792
793 // Returns an SbViewVolume that represents the object-space ray to
794 // pick along. The projection point of the view volume is the
795 // starting point of the ray. The projection direction is the
796 // direction of the ray. The distance to the near plane is the
797 // same as the distance to the near plane for the ray. The
798 // distance to the far plane is the sum of the near distance and
799 // the depth of the view volume.
800 const SbViewVolume &getViewVolume() const
801 { return objVol; }
802
803 // Returns SbLine that can be used for other intersection tests.
804 // The line's position is the starting point and the direction is
805 // the direction of the ray. Given an intersection with this ray,
806 // you can call isBetweenPlanes() to see if the intersection is
807 // between the near and far clipping planes.
808 const SbLine &getLine() const
809 { return objLine; }
810
811 // Returns TRUE if the given object-space intersection point is
812 // between the near and far planes of the object-space view
813 // volume, as well as any clipping planes that have been defined.
814 // This test can be used to determine whether the point of
815 // intersection of the ray with an object is valid with respect to
816 // the clipping planes.
817 SbBool isBetweenPlanes(const SbVec3f &intersection) const;
818
828 SoPickedPoint *addIntersection(const SbVec3f &objectSpacePoint);
829
830 // Adds an SoPickedPoint instance representing the given object
831 // space point to the current list and returns a pointer to it. If
832 // pickAll is TRUE, this inserts the instance in correct sorted
833 // order. If it is FALSE, it replaces the one instance in the list
834 // only if the new one is closer; if the new one is farther away,
835 // no instance is created and NULL is returned, meaning that no
836 // more work has to be done to set up the SoPickedPoint.
837 SoPickedPoint *addIntersection_ ( const SbVec3f &objectSpacePoint, PickedPointListImpl* ppimplptr );
838 SoPickedPoint *addIntersection_( SoPickedPoint *pp, PickedPointListImpl* ppimplptr );
839 SoPickedPoint *addIntersection_( SoPickedPoint *pp );
840
841
842 // Get PickedPoints during a traversal without sorting them by distance
843 // this method must be used instead of the getPickedPointList
844 // that should be used instead only AFTER the rayPick traversal is completed
845 SoPickedPoint *getUnsortedPickedPoint( int i ) const;
846
847 // Use preferably this method to get just the number of picked points
848 // instead of getPickedPointList()->getLenght(), for performance reason
849 int getPickedPointsListLength() const;
850
851 private:
852 // Initiates action on graph
853 virtual void beginTraversal(SoNode *node);
854
855 private:
856 static void initClass();
857 static void exitClass();
858
859 // return whether OIV_PICK_OPTIM is set to TRUE
860 static SbBool isPickOptimSet()
861 { return s_useAlternateIntersection; }
862
863 // utility method to test if culling occurs because of clipping planes
864 // worldCoord is used to use world coordinates instead of object space coordinates
865 static bool isPtCulledByClippingPlanes( const SbVec3f &worldPt, SoState *state, bool worldCoord = true );
866
867 // utility method to test if culling occurs because of clipping planes
868 // worldCoord is used to use world coordinates instead of object space coordinates
869 static bool isBboxCompletelyCulledByClippingPlanes( const SbBox3d& worldBBox, SoState* state, bool worldCoord = true );
870 // worldCoord is used to use world coordinates instead of object space coordinates
871 static bool isBboxCompletelyCulledByClippingPlanes( const SbBox3f& worldBBox, SoState* state, bool worldCoord = true );
872 // worldCoord is used to use world coordinates instead of object space coordinates
873 static bool arePointsCulledByAClippingPlane( const std::vector< SbVec3f>& pointVector, SoState* state, bool worldCoord = true );
874
880 enum PickedProperties
881 {
883 NORMALS = 1 << 0,
885 TEXCOORDS = 1 << 1,
886
888 ALL = ~0
889 };
890
894 void enablePickedProperties(const enum PickedProperties pickedProperty, const SbBool enable);
895
899 SbBool isPickedPropertiesEnabled(const enum PickedProperties pickedProperty) const;
900
901 // Returns TRUE if the two SoPickedPoint are the same.
902 SbBool isEqual(const SoPickedPoint *pp0, const SoPickedPoint *pp1) const;
903
904 // Returns TRUE if the first intersection point is closer to the
905 // starting point of the ray than the second.
906 SbBool isCloser(const SoPickedPoint *pp0, const SoPickedPoint *pp1) const;
907 SbBool isCloser(const SbVec3f& p0, const SbVec3f& p1) const;
908
909 // get depth for ray picking sorting
910 double getDepth(const SbVec3f& p0) const;
911
912 //interface exposed to share SoPath among SoPickedPoints
913 void resetCurrPathCache();
914
915 enum PointPositionClassification
916 {
917 INSIDE = 0,
918 BEHIND_FAR = 1,
919 BEFORE_NEAR = 2,
920 BESIDE_LEFT = 3,
921 BESIDE_RIGHT = 4,
922 UNDER_BOTTOM = 5,
923 ABOVE_TOP = 6
924 };
925
926 PointPositionClassification homogeneSpaceIntersection( const SbVec3f &point, SbVec4f &pPoint ) const;
927 SoPath *getClonedCurrPath();
928
929 static bool isMTPickingActive();
930
931 // get VPradius in pixels (even if it was provided in world coords)
932 float getVPRadiusPixel() const ;
933
934 /* Because picking points should take care of pointSize without modifying
935 * the internal projection matrix,
936 * a distosion depending of the size of viewPortRegion is introduced
937 * This distorsion can be computed from pointSize
938 * By default pointSize is (0, 0)
939 * Normal usage should be setPointSizeForPicking( WidthInPixels, HeightInPixels)
940 * WARNING: Don't forget to restore previous pointSize after your traversal to avoid side effect
941 */
942 void setPointSizeForPicking( float pointWidth, float pointHeight);
943
944 // Same as previous with an SbVec2f
945 void setPointSizeForPicking( const SbVec2f & pointSize)
946 { setPointSizeForPicking(pointSize[0], pointSize[1]); }
947
948 // Return current pointSize for picking points
949 SbVec2f getPointSizeForPicking()
950 { return SbVec2f( m_pointWidthForPicking, m_pointHeightForPicking ); }
951
952 struct GPUPickInfo
953 {
954 bool isValid = false;
955 SbVec3f modelPosition;
956 uint32_t shapeId = 0;
957 uint32_t faceId = 0;
958 float distToPickCenter = 0.f;
959 };
960
961 bool canGPUPick() const;
962
966 void collectGPUPickingPath();
967
968 // Return the picking informations (faceId, shapeId, Position)
969 // for the selected point.
970 const std::vector<GPUPickInfo>& getGPUPickInfo() const;
971
972 PickedPointListImpl* getPickedPointListImpl() const;
973
974 private:
975 SbBool lineWasSet; // TRUE if a world-space line was set
976 SbBool rayWasComputed; // TRUE if ray computed by camera
977 SbBool pickAll; // Pick all objects or just closest
978 SbVec2s VPPoint; // Point in viewport coordinates
979 SbVec2f VPPointFloat; // Point in viewport coordinates
980 SbVec2f normVPPoint; // Point in normalized vp coordinates
981 SbBool normPointSet; // TRUE if setNormalizedPoint called
982 float VPRadius; // Radius in viewport space pixels
983 SbMatrix objToWorld; // Object-to-world space matrix
984 SbMatrix worldToObj; // World-to-object space matrix
985
986 // The ray is defined as an SbViewVolume as in the
987 // SoPickRayElement, and is usually stored in an instance of the
988 // element. This stores the ray if it is set using setRay().
989 SbViewVolume worldVol;
990
991 // Users can specify negative near and far distances to indicate
992 // that picks should not be clipped to those planes. These flags
993 // store that info, since the distances in the view volume can't
994 // be negative.
995 SbBool clipToNear, clipToFar;
996
997 // These store the object-space ray info as a view volume and a
998 // line. See the comments on getViewVolume() and getLine().
999 SbLine objLine; // Line representing ray
1000 SbLined objLineD;
1001 SbViewVolume objVol; // View volume representing ray
1002
1003 // If the caller passes a matrix to setObjectSpace(), the inverse
1004 // of it is stored here so the object-space angle can be computed
1005 // correctly later. The extraMatrixSet flag is set to TRUE in this
1006 // case.
1007 SbBool extraMatrixSet;
1008 SbMatrix extraMatrix;
1009
1010 // Computes matrices to go between object and world space
1011 void computeMatrices();
1012
1013 // Computes object-space view volume and line
1014 void computeObjVolAndLine();
1015
1016 // updates RayBBox and WMat
1017 void setUpRayBBoxAndWMat( const SbVec3f &centerPt );
1018
1019 void evalCenterPts( SbVec3f &centerPt, SbVec3d &centerPtD, SbVec3d &projPtD );
1020
1021 // get VPRadius in world coordinates (even if it was provided in pixels)
1022 float getVPRadiusWorld() const ;
1023
1024 // Computes distance t of a point along a ray: point = start + t * direction.
1025 // The point has to be on the ray for this to work
1026 static float rayDistance(const SbVec3f &start,
1027 const SbVec3f &direction,
1028 const SbVec3f &point);
1029
1030 // Set commons properties of the action (called by the setRay method)
1031 void setRayCommonProperties (const SbVec3f &start, const SbVec3f &direction,
1032 float fovy, float aspectRatio = 1.0f, float nearDistance=-1.0f, float farDistance=-1.0f);
1033
1034 // Initialize some members variable when a new point in viewport has been set
1035 void initializeMembersAfterVPPointSet(bool normalizedPointSet);
1036
1037
1038
1039 // check if the intersection is inside conic picking volume
1040 inline SbBool isInConicPickingVolume( const SbVec3f &intersection ) const;
1041
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 );
1045
1046 // Store the current ray bounding box for triangle culling
1047 SbBool m_canUseTriangleCulling;
1048 SbBox3f m_rayBBox ;
1049
1050
1051 // store the current viewvolume matrix and near far in homogene space
1052 // to optimize intersection computation
1053 SbMatrixd m_wmat;
1054 double m_wnear;
1055 double m_wfar;
1056 HomTransfData *m_htdta;
1057
1058 // Indicate if triangle are culled by ray frustum.
1059 SbBool canUseTriangleCulling() const
1060 { return (s_triangleCullingEnabled && m_canUseTriangleCulling); }
1061
1062 static SbBool s_triangleCullingEnabled ;
1063
1064 // generate all picked point properties? (OIV_PICK_GENERATE_ALL_PROPERTIES)
1065 static SbBool s_generateAllPickedProperties;
1066
1067 //
1068 static SoCamera::StereoMode s_stereoMode;
1069
1070 // Use faster intersection method (OIV_PICK_OPTIM)
1071 static SbBool s_useAlternateIntersection;
1072
1073 // Force the raypick action to take ray radius in account
1074 SbBool m_bEnableRadiusForTriangles;
1075
1076 // Store ray properties
1077 SbVec3f m_direction;
1078 SbVec3f m_start;
1079
1080private:
1084 template<typename SO_NODE_OR_SO_PATH> void commonApply(SO_NODE_OR_SO_PATH* nodeOrPath);
1085
1086 float getCorrectedVPRadius() const;
1087
1088 int m_pickedPropertiesMask;
1089 PickingMode m_pickingMode;
1090
1091 int m_VPRadiusState; // how VPRadius has been initialized
1092
1093 // data buffered for the lineWasSet case
1094 float m_fovy;
1095 float m_nearDistance;
1096 float m_farDistance;
1097 float m_aspectRatio;
1098
1099 // to force pick volume to be a cone (perspective pick) or a cylinder (orthogonal pick)
1100 SbBool m_conicPickVolume;
1101
1102 PickedPointListImpl *m_pickedPointListlImpl;
1103
1104 // Only computed by setPointSizeForPicking()
1105 // Only used in homogeneSpaceIntersection()
1106 // Store picking error depending of viewPort
1107 float m_pointPickingErrorX;
1108 float m_pointPickingErrorY;
1109 // Store extended pick trap depending of pointSize
1110 float m_projSpaceWidth;
1111 float m_projSpaceHeight;
1112 // Store pointSize for picking point
1113 float m_pointWidthForPicking;
1114 float m_pointHeightForPicking;
1115
1117 SoPathList m_gpuPickingCollectionPaths;
1118 std::vector<SoRayPickAction::GPUPickInfo> m_gpuPickingInfos;
1119
1120 // Render the scene with GPU Picking data attached and
1121 // retrieve the picking data from the GPU
1122 // The data can be accessed via getGPUPickingInfo()
1123 void renderGPUPickingScene();
1124
1128 void fillGPUPickInfos();
1129};
1130
1131inline
1133{
1134 m_bEnableRadiusForTriangles = flag;
1135}
1136
1137inline
1139{
1140 return m_bEnableRadiusForTriangles;
1141}
1142#endif /* _SO_RAY_PICK_ACTION_ */
1143
<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