Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoDragger.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 Isaacs (MMM yyyy)
25** Modified by : David Mott (MMM yyyy)
26** Modified by : Howard Look (MMM yyyy)
27**=======================================================================*/
28/*=======================================================================
29 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
30 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
31 *** ***
32 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
33 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
34 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
35 *** ***
36 *** RESTRICTED RIGHTS LEGEND ***
37 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
38 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
39 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
40 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
41 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
42 *** ***
43 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
44 *** BORDEAUX, FRANCE ***
45 *** ALL RIGHTS RESERVED ***
46**=======================================================================*/
47/*=======================================================================
48** Modified by : VSG (MMM YYYY)
49**=======================================================================*/
50
51
52#ifndef _SO_DRAGGER_
53#define _SO_DRAGGER_
54
55#include <Inventor/SbBox.h>
56#include <Inventor/SbViewportRegion.h>
57#include <Inventor/SbLinear.h>
58#include <Inventor/nodekits/SoInteractionKit.h>
59#include <Inventor/misc/SoCallbackList.h>
60#include <Inventor/fields/SoSFBool.h>
61#include <Inventor/nodes/SoMatrixTransform.h>
62#include <Inventor/nodes/SoScale.h>
63
64
65class SoPickedPoint;
66class SoAction;
70class SoSearchAction;
71class SoEvent;
72class SoPath;
73class SoTempPath;
74class SbPList;
75
76class SoDragger; // forward reference
77
85typedef void SoDraggerCB(void *userData, SoDragger *dragger );
86
88//
89// Class: SoDragger
90//
91// Base class for draggers which are operated by a start (mouse down)
92// followed by dragging, followed by end (mouse up).
93//
95
538
539 SO_KIT_HEADER(SoDragger);
540
541 SO_KIT_CATALOG_ENTRY_HEADER(motionMatrix);
542
543 public:
544
549
559
560 // Dragger Callbacks
561 // In all cases, the callback data will be a pointer to the dragger
562 // that caused the callback. Each type of callback maintains a list of
563 // callbacks, so many callback functions may be registered, if desired.
564
573 void addStartCallback(SoDraggerCB *f, void *userData = NULL);
574
579 void removeStartCallback(SoDraggerCB *f, void *userData = NULL);
580
587 void addMotionCallback(SoDraggerCB *f, void *userData = NULL);
588
593 void removeMotionCallback(SoDraggerCB *f, void *userData = NULL);
594
601 void addFinishCallback(SoDraggerCB *f, void *userData = NULL);
602
607 void removeFinishCallback(SoDraggerCB *f, void *userData = NULL);
608
616 void addValueChangedCallback(SoDraggerCB *f, void *userData = NULL);
617
622 void removeValueChangedCallback(SoDraggerCB *f, void *userData = NULL);
623
628 void setMinGesture(int pixels) { minGesture = (float)pixels; }
629
635 void setMinGesture(float pixels) { minGesture = pixels; }
636
641 int getMinGesture() const { return (int)minGesture; }
642
648 float getMinGestureFloat() const { return minGesture; }
649
654 static void setMinScale(float newMinScale);
655
659 static float getMinScale();
660
673
698
705
710
717
722
734 void setMotionMatrix( const SbMatrix &newMatrix );
735
749
750 private:
751
752 // In addition to the public callback functions, these callback
753 // functions can also be used by subclasses to find out when things
754 // have happened.
755
756 // otherEvent callbacks are called in response to events other than
757 // the button1 Press/Release and location/tracker.
758 void addOtherEventCallback(SoDraggerCB *f, void *userData = NULL);
759 void removeOtherEventCallback(SoDraggerCB *f, void *userData = NULL);
760 void clearOtherEventCallbacks();
761
762 // Compound draggers should call this for each child dragger
763 // so that user callbacks (valueChanged, start, motion, finish, other event)
764 // registered with the parent dragger will be invoked based on the child
765 // dragger. Also, this will add the 'transferMotion' callback as a
766 // valueChanged callback on the child. Child dragger enableCallbacks field
767 // will be automatically connected from parent dragger enableCallbacks field,
768 // so that when parent dragger enableCallbacks field is set, value is the same
769 // for child draggers
770 void registerChildDragger(SoDragger *child);
771 void unregisterChildDragger(SoDragger *child);
772
773 // These two routines tie the child to the parent, but WITHOUT the
774 // transferMotion callback. It is good
775 // for child draggers that need to move independently of their parents,
776 // but which should still call the parents (valueChanged, start, motion,
777 // end, and otherEvent) callbacks when they are dragged.
778 void registerChildDraggerMovingIndependently(SoDragger *child);
779 void unregisterChildDraggerMovingIndependently(SoDragger *child);
780
781 // Get the matrix which converts from one dragger space to another.
782 SbMatrix getLocalToWorldMatrix( SoAction* action = NULL );
783 SbMatrix getWorldToLocalMatrix( SoAction* action = NULL );
784
785 // Returns the starting point in local coordinates.
786 SbVec3f getLocalStartingPoint();
787 // Returns the starting point in world coordinates.
788 SbVec3f getWorldStartingPoint();
789
790 // Get the matrix which converts from the space of one part into
791 // local space. Good to use if transforms occur between 'motionMatrix'
792 // and the space you want to work in.
793 // Note: This routine will try not to create parts that don't exist.
794 // Instead it finds the existing part that precedes it in traversal.
795 // But this only works if the partName is in this nodekit's catalog.
796 // If the part is nested within another kit below this one or
797 // sitting inside a list part, the part will be created when it
798 // doesn't exist.
799 void getPartToLocalMatrix( const SbName &partName,
800 SbMatrix &partToLocalMatrix,
801 SbMatrix &localToPartMatrix);
802
803 // Transforms a given matrix from one space into another space
804 void transformMatrixLocalToWorld( const SbMatrix &fromMatrix,
805 SbMatrix &toMatrix);
806 void transformMatrixWorldToLocal( const SbMatrix &fromMatrix,
807 SbMatrix &toMatrix);
808 void transformMatrixToLocalSpace( const SbMatrix &fromMatrix,
809 SbMatrix &toMatrix, const SbName &fromSpacePartName);
810
811 // Invokes the valueChangedCallbacks.
812 // These are invoked whenever setMotionMatrix() changes the motion matrix.
813 // If a subclass wishes to invoke the valueChanged callbacks for some
814 // other reason, they may call valueChanged(). Example: SoSpotLightDragger
815 // changes its angle field without altering the motionMatrix. So it
816 // calls valueChanged() to invoke callbacks.
817
818 void valueChanged();
819
820 // Used to calculate motion relative to the dragger's position at the
821 // beginning of the dragging.
822 const SbMatrix &getStartMotionMatrix() { return startMotionMatrix; }
823
824 // By default, saves the motionMatrix as the startMotionMatrix.
825 // Subclasses may want to save additional info. For example, the
826 // centerballDragger also saves the matrix that moves the center relative
827 // to the motionMatrix.
828 virtual void saveStartParameters();
829
830 // Information that's good to have during a valueChanged callback
831 const SoPath *getPickPath() const;
832 const SoEvent *getEvent() const;
833
834 // Creates a new path leading to this dragger, if the last path given by
835 // setTempPathToThis() is still valid. Will return NULL if not possible.
836 // You must ref() and unref() this new path if you
837 // don't want it (and all the nodes along it) to stay around forever.
838 SoPath *createPathToThis();
839
840 // Surrogate Pick Information. This is relevant if the we are dragging
841 // based on the pick of a surrogate part. This happens when you call
842 // SoInteractionKit::setPartAsPath() and thus specify a 'stand-in' path
843 // to pick when initiating a drag.
844 // Owner:
845 // Path to the InteractionKit that owns the surrogate part.
846 const SoPath *getSurrogatePartPickedOwner() const
847 { return pathToSurrogatePickOwner;}
848 // Name:
849 // Name of the surrogate part within the owners list.
850 const SbName &getSurrogatePartPickedName() const
851 { return surrogateNameInPickOwner; }
852 // SurrogatePath:
853 // The owner's surrogate path for this name. This path may
854 // differ from the actual pickPath, but it is guaranteed to
855 // be contained within the pickPath.
856 const SoPath *getSurrogatePartPickedPath() const
857 { return surrogatePathInPickOwner;}
858
859 // Set the point where the drag begins.
860 // The pickedPoint version would usually be the result of a pick.
861 void setStartingPoint( const SoPickedPoint *newPoint );
862 // The SbVec3f version would usually be a point saved from the end of
863 // another gesture. For example, when a modifier key goes down, we might
864 // save the current position and use it to begin another connected gesture.
865 void setStartingPoint( const SbVec3f &newPoint );
866
867 // Information about the window an event occurred in.
868 // Upon construction, the values are defaults.
869 // When drag begins, new values are taken from the handleEventAction
870 // and used for the duration of the drag.
871 // When drag ends, new values are taken from the final handleEventAction.
872 //
873 // DEPRECATED SINCE OIV 9.3
874 // Dragger must not store information related to viewer settings.
875 // In a multi-viewers configuration, draggers internal computation can be
876 // corrupted by using one of these values set from another viewer
877 // This has been solved by directly getting viewvolume and viewport from
878 // the state, or from the current action.
879
880#if 1 SoDEPRECATED
890 const SbViewVolume &getViewVolume() { return viewVolume; }
891SoDEPRECATED
893 void setViewVolume(const SbViewVolume &vol) { viewVolume = vol; }
894SoDEPRECATED
896 const SbViewportRegion &getViewportRegion() { return vpRegion; }
897SoDEPRECATED
899 void setViewportRegion(const SbViewportRegion &reg) { vpRegion = reg; }
900
901#endif
903 // Get the most recent handleEventAction.
904 SoHandleEventAction *getHandleEventAction() const { return handleEventAction; }
905 void setHandleEventAction( SoHandleEventAction *newAction );
906
907 // A path leading to 'this.' It is used to calculate the
908 // motionMatrix. It is set when a dragger first grabs event, through the
909 // handleEvent action, or by setCameraInfo() if NULL at the time.
910 void setTempPathToThis(const SoPath *somethingClose);
911
912 // Called when the dragger gains or loses status as "grabber" of events.
913 virtual void grabEventsSetup();
914 virtual void grabEventsCleanup();
915
916 // Changes only that part of the matrix for which this dragger has fields.
917 // For instance, when called by an SoTranslate1Dragger, any rotations and
918 // scales in the matrix will remain unchanged. But the translation will
919 // be replaced with value in the 'translation' field.
920 // First, factor mtx to get values for the following:
921 // trans, rot, scale, scaleOrient.
922 // If there's a center field, send it to the factor method.
923 // Replace any of these four values if fields are found named
924 // 'translation' 'scaleFactor' 'rotation' and/or 'scaleOrientation'
925 // Note that this could be all or none of the 4 listed.
926 // Values for which no fields are found remain unchanged.
927 // Build a new matrix using the new values. Some may be the originals
928 // and some may have been replaced.
929 void workFieldsIntoTransform( SbMatrix &mtx );
930
931 // Same as above, but values are given explicitly as pointers.
932 // If the pointers are NULL, the values in the matrix are not changed.
933 static void workValuesIntoTransform( SbMatrix &mtx,
934 const SbVec3f *translationPtr,
935 const SbRotation *rotationPtr,
936 const SbVec3f *scaleFactorPtr,
937 const SbRotation *scaleOrientationPtr,
938 const SbVec3f *centerPtr);
939
940 // Faster versions of getTransform() and factor() that take advantage of
941 // the case where there is no scaleOrientation. Reverts to slow method
942 // if it needs to.
943 // This method will not work if the matrix given contains any scales
944 // less than zero, and it does not check for that case.
945 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation,
946 SbRotation &rotation, SbVec3f &scaleFactor,
947 SbRotation &scaleOrientation,
948 const SbVec3f &center);
949 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation,
950 SbRotation &rotation, SbVec3f &scaleFactor,
951 SbRotation &scaleOrientation);
952
953 // Appends the given motion to the end of 'mtx'.
954 // 'conversion' transforms from the space the motion is defined in
955 // to the space 'mtx'.
956 static SbMatrix appendTranslation( const SbMatrix &mtx,
957 const SbVec3f &translation,
958 const SbMatrix *conversion = NULL );
959 static SbMatrix appendScale( const SbMatrix &mtx,
960 const SbVec3f &scale, const SbVec3f &scaleCenter,
961 const SbMatrix *conversion = NULL );
962 static SbMatrix appendRotation( const SbMatrix &mtx,
963 const SbRotation &rot, const SbVec3f &rotCenter,
964 const SbMatrix *conversion = NULL );
965
966 // Is the current tracker direct mode MOVE, ROTATE or FREE ?
967 SbBool isTrackerDirectMode() const;
968
969 private:
970 void GLRender(SoGLRenderAction *action);
971
972 static void initClass();
973 static void exitClass();
974 SB_THREAD_TLS_HEADER();
975
976 // Initialize ALL Inventor dragger classes
977 static void initClasses();
978 static void exitClasses();
979
980 // These control behavior of the rotational parts. If FRONT, no matter
981 // where you hit the dragger relative to its center, it will behave as if
982 // you are dragging from the front. If BACK, the rear. If USE_PICK,
983 // then it depends on the relationship between the picked point and the
984 // center of the dragger.
985 enum ProjectorFrontSetting {
986 FRONT, BACK, USE_PICK
987 };
988 void setFrontOnProjector( ProjectorFrontSetting newVal )
989 { projectorFrontSetting = newVal; }
990 ProjectorFrontSetting getFrontOnProjector() const
991 { return projectorFrontSetting;}
992
993 inline void setInteracting(bool flag) { m_draggerInteracting = flag; }
994
995 private:
996
997 // Constructor
998 SoDragger();
999
1000 // Sensor attached to enableCallbacks field
1001 SoFieldSensor* m_enableSensor;
1002
1003 //Field sensor callback
1004 static void enableCB( void *, SoSensor * );
1005
1006 // Get the last known position of the locator (mouse).
1007 // 2D locater positions have (0,0) at lower-left, and are
1008 // relative to the viewport.
1009 // Normalized positions go from 0.0 to 1.0.
1010 // Regular positions go from 0 to (vpSize - 1)
1011 SbVec2f getNormalizedLocaterPosition();
1012 const SbVec2f& getLocaterPosition();
1013
1014 // Get the 3D tracker device's ray in world coords (new in v3.0)
1015 SbLine getTrackerRay();
1016
1017 // Get the position of the locater when dragging started.
1018 const SbVec2f& getStartLocaterPosition() const { return startLocater; }
1019
1020 // The start locater position is automatically set when button 1
1021 // goes down over the dragger. Subclasses may wish to reset it, such
1022 // as when a constraint key goes down during dragging.
1023 void setStartLocaterPosition(const SbVec2f& p) { startLocater = p; }
1024
1025 // Has the locater moved far enough from where it started to
1026 // choose a constraint gesture.
1027 SbBool isAdequateConstraintMotion();
1028
1029 // Given a pickPath and a surrogatePath, decides whether it should
1030 // grab based on the surrogate. First, the pickPath must
1031 // contain the surrogatePath, indicating that the surrogate was picked.
1032 // Second, we consider the part of the pickPath below the point where
1033 // the surrogatePath ends.
1034 // If this bottom section contains other draggers, then we will pass it up.
1035 // This is because the other draggers will want to grab when they find out
1036 // they've been picked.
1037 virtual SbBool shouldGrabBasedOnSurrogate( const SoPath *pickPath,
1038 const SoPath *surrogatePath );
1039
1040 //
1041 // The dragger looks in this action to get information about the camera
1042 // and the viewport. Usually the action used is just the handleEventAction.
1043 void setCameraInfo( SoAction *action );
1044
1045 // This is called during traversal by a HandleEventAction. It
1046 // calls ha->setHandled() if the event is handled.
1047 virtual void handleEvent(SoHandleEventAction *ha);
1048
1049 // This should be called by every child dragger of a compound dragger
1050 // as a result of compoundDragger->registerChildDragger( childDragger );
1051 // Called on the compoundDragger when childDragger's value changes.
1052 // Gets the motionMatrix from a the child dragger. Appends that change
1053 // to the parent dragger's savedStartMatrix, and sets the result as the
1054 // parent's motionMatrix.
1055 // Then, it zeros out the motionMatrix of the child dragger.
1056 void transferMotion(SoDragger *child);
1057
1058 // Set/get whether the dragger should be ignored during bounding
1059 // box calculations.
1060 void setIgnoreInBbox( SbBool newVal ) { ignoreInBbox = newVal; }
1061 SbBool isIgnoreInBbox() { return ignoreInBbox; }
1062
1063 // Implements getBoundingBox action. Differs from separator as follows:
1064 // If the 'ignoreInBbox' flag is set to TRUE, then it will return without
1065 // traversing children.
1066 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
1067
1068 // Stubs used by compound draggers to get user callbacks from
1069 // the child dragger
1070 static void childTransferMotionAndValueChangedCB(void *, SoDragger *);
1071 static void childValueChangedCB(void *, SoDragger *);
1072 static void childStartCB(void *, SoDragger *);
1073 static void childMotionCB(void *, SoDragger *);
1074 static void childFinishCB(void *, SoDragger *);
1075 static void childOtherEventCB(void *, SoDragger *);
1076
1077 // Called by the above child callbacks. Establishes which child dragger
1078 // is currently active. Set at beginning of child callback, returned to
1079 // original value at end. Returns current value at time method is called.
1080 void setActiveChildDragger( SoDragger *newChildDragger );
1081 SoDragger *getActiveChildDragger() const { return activeChildDragger; }
1082
1083 // Called by the SoBaseKit::write() method.
1084 //
1085 // Draggers don't want to write out fields if they have default vals.
1086 //
1087 // sets isActive to default if default and not connected.
1088 //
1089 // Looks for fields named:
1090 // 'rotation' with value SbRotation::identity()
1091 // 'translation' with value (0,0,0)
1092 // 'center' with value (0,0,0)
1093 // 'scaleFactor' with value (1,1,1)
1094 // and sets them to default if they are not connected from a field.
1095 // (most draggers are missing at least some of these, but thats okay)
1096 //
1097 // Then calls the method for SoInteractionKit.
1098 //
1099 // NOTE: Parts which are set to default may still wind up writing to file
1100 // if, for example, they lie on a path.
1101 virtual void setDefaultOnNonWritingFields();
1102
1103 // In tracker direct mode, apply motion of tracked input device
1104 // directly to dragger's motion matrix. (new for v5.0)
1105 virtual SbBool applyTrackerMotion();
1106
1107 virtual ~SoDragger();
1108
1109 // Class static thread local storage
1110 struct MTstruct {
1111 SoGetMatrixAction *m_matrixAction;
1112 SoSearchAction *m_searchAction;
1113 };
1114
1115 // Support for tracker direct mode (for immersive environments)
1116 //
1117 // Allows direct mode to be set for all draggers
1118 static TrackerDirectMode m_initialDirectMode;
1119 // Current direct mode for this dragger instance
1120 TrackerDirectMode m_directMode;
1121 // Default direct mode for this class of dragger
1122 TrackerDirectMode m_defaultDirectMode;
1123 // Saved start position of tracked input device
1124 SbVec3f m_trackerStartPos;
1125 // Saved start orientation of tracked input device
1126 SbRotation m_trackerStartRot;
1127
1128 SbViewVolume viewVolume; // view volume for xsection tests
1129 SbViewportRegion vpRegion; // view volume for xsection tests
1130
1131 private:
1132
1133 // lists of callback functions
1134 SoCallbackList *startCallbacks;
1135 SoCallbackList *motionCallbacks;
1136 SoCallbackList *finishCallbacks;
1137 SoCallbackList *valueChangedCallbacks;
1138
1139 SoCallbackList *otherEventCallbacks;
1140
1141 SbBool valueChangedCallbacksEnabled;
1142 SoDragger *activeChildDragger;
1143
1144 SoHandleEventAction *handleEventAction; // current event action
1145
1146 // A record of the world space point which initiated the dragging.
1147 // This might be set from a pickedPoint of a handleEventAction,
1148 // or explicitly from a given point when a meta-key callback
1149 // changes gestures mid-stream and wants to select its own transitional
1150 // starting point.
1151 SbVec3f startingWorldPoint;
1152
1153 // Used by parent draggers to save initial matrix when motion begins.
1154 SbMatrix startMotionMatrix;
1155
1156 // Where the locater was when dragging was initiated
1157 SbVec2f startLocater;
1158
1159
1160 // sets pick path and tempPathToThis
1161 void setPickPath(SoPath *newPickPath);
1162 SoPath *pickPath; // pick path to the dragger
1163
1164 // sets surrogate part picks.
1165 void setNoPickedSurrogate();
1166 void setPickedSurrogate( SoPath *pathToOwner, SbName &nameUsedByOwner,
1167 SoPath *pathUsedByOwner );
1168
1169 SbName surrogateNameInPickOwner;
1170 SoPath *pathToSurrogatePickOwner;
1171 SoPath *surrogatePathInPickOwner;
1172
1173 // A tempPath leading to 'this.' It is used to calculate the
1174 // motionMatrix. It is set when a dragger first grabs event, through the
1175 // handleEvent action, or by setCameraInfo() if NULL at the time.
1176 // A tempPath does not increase any ref counts, so keeping this path
1177 // will not prevent this node from being deleted. However, we must be
1178 // very careful before using it, since some nodes my get deleted out from
1179 // under us. The variable tempPathNumKidsHack helps us fix up paths
1180 // that have changed since the path was set.
1181 SoTempPath *tempPathToThis;
1182 SbPList *tempPathNumKidsHack;
1183 // Determines if this path can actually be used. Since a temp path
1184 // does not ref the nodes, some nodes my get deleted out from
1185 // under us. This routine makes sure that everythings all right.
1186 SbBool isTempPathToThisOk();
1187 // Creates a temp path copy of the full path.
1188 SoTempPath *createTempPathFromFullPath( const SoFullPath *fp ) const;
1189
1190 // Minimum number of pixels to move before choosing a constraint
1191 // based on the gesture.
1192 float minGesture;
1193
1194 // The smallest scale that any dragger will write. If the user attempts
1195 // to go below this amount, the dragger will set it to this minimum.
1196 // Default is .0001
1197 static float minScale;
1198
1199 // We keep these matrices and their inverses around
1200 // to use when converting between spaces. The four
1201 // pairs are cached; the pair becomes invalud when its
1202 // valid flag is set to FALSE.
1203
1204 // Called to make sure these matrixes are up to date.
1205 void validateMatrices( SoAction* );
1206
1207 // These matrices are ones that are commonly queried by
1208 // subclasses. So, we cache them.
1209 // Two things determine the localToWorld matrix. The pathToThis and
1210 // the motionMatrix. If either value is invalid, we need to recalculate.
1211 // But depending on which one it is, we either need to run a matrix
1212 // action on the pick path or just on the motionMatrix.
1213 SbBool cachedPathToThisValid;
1214 SbBool cachedMotionMatrixValid;
1215 SbMatrix cachedMotionMatrix;
1216 // PostMotion is the matrix space just AFTER the motion matrix.
1217 SbMatrix postMotionToWorldMatrix;
1218 SbMatrix worldToPostMotionMatrix;
1219 // PreMotion is the matrix space just BEFORE the motion matrix.
1220 SbMatrix preMotionToWorldMatrix;
1221 SbMatrix worldToPreMotionMatrix;
1222
1223 // Used so that draggers don't try to include themselves
1224 // as part of their own sizing boxes. By default this is FALSE.
1225 SbBool ignoreInBbox;
1226
1227 // True if we are interacting in order to update the SoInteractionElement
1228 bool m_draggerInteracting;
1229
1230 ProjectorFrontSetting projectorFrontSetting;
1231};
1232
1233#endif /* _SO_DRAGGER_ */
1234
Directed line in 3D.
Definition SbLine.h:57
4x4 matrix class.
Definition SbMatrix.h:309
Character string stored in a hash table.
Definition SbName.h:162
List of generic (void *) pointers.
Definition SbPList.h:77
Class for representing a rotation.
Definition SbRotation.h:126
2D vector class.
Definition SbVec.h:76
3D vector class.
Definition SbVec.h:932
3D viewing volume class.
Class for representing a viewport.
Abstract base class for all actions.
Definition SoAction.h:132
Manages a list of callbacks and associated data.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
void setMinGesture(int pixels)
Sets the number of pixels of movement required to initiate a constraint gesture.
Definition SoDragger.h:628
void removeMotionCallback(SoDraggerCB *f, void *userData=NULL)
Removes motion callback.
void removeFinishCallback(SoDraggerCB *f, void *userData=NULL)
Removes finish callback.
SoSFBool enableCallbacks
If set to FALSE, motion, start and finish callbacks are disabled.
Definition SoDragger.h:558
SoSFBool isActive
TRUE when mouse is down and dragging, else FALSE.
Definition SoDragger.h:548
void SoDraggerCB(void *userData, SoDragger *dragger)
Used in defining the callback function lists.
Definition SoDragger.h:85
TrackerDirectMode getTrackerDirectMode() const
Get the current tracker direct mode for this dragger.
void setMinGesture(float pixels)
Float version of setMinGesture.
Definition SoDragger.h:635
void addFinishCallback(SoDraggerCB *f, void *userData=NULL)
Adds finish callback.
TrackerDirectMode
Tracker direct mode.
Definition SoDragger.h:675
@ NONE
Dragger will not use tracker values directly (default).
Definition SoDragger.h:679
@ MOVE
Dragger will use tracker position values directly.
Definition SoDragger.h:683
@ DEFAULT
Dragger will use its natural default direct behavior (which will be NONE, MOVE, ROTATE,...
Definition SoDragger.h:696
@ FREE
Dragger will use tracker position and orientation directly.
Definition SoDragger.h:691
@ ROTATE
Dragger will use tracker orientation values directly.
Definition SoDragger.h:687
void addStartCallback(SoDraggerCB *f, void *userData=NULL)
Adds start callback.
static TrackerDirectMode getInitialTrackerDirectMode()
Get the initial tracker direct mode.
void removeStartCallback(SoDraggerCB *f, void *userData=NULL)
Removes start callback.
float getMinGestureFloat() const
Float version of getMinGesture.
Definition SoDragger.h:648
void removeValueChangedCallback(SoDraggerCB *f, void *userData=NULL)
Removes value-changed callback.
static void setMinScale(float newMinScale)
Sets the smallest scale that any dragger will write.
void setMotionMatrix(const SbMatrix &newMatrix)
Set the motion matrix.
int getMinGesture() const
Gets the number of pixels of movement required to initiate a constraint gesture.
Definition SoDragger.h:641
void addMotionCallback(SoDraggerCB *f, void *userData=NULL)
Adds motion callback.
void addValueChangedCallback(SoDraggerCB *f, void *userData=NULL)
Adds value-changed callback.
SbBool enableValueChangedCallbacks(SbBool newVal)
You can temporarily disable a dragger's valueChangedCallbacks.
static float getMinScale()
Gets the smallest scale that any dragger will write.
const SbMatrix & getMotionMatrix()
Get the motion matrix.
static void setInitialTrackerDirectMode(TrackerDirectMode mode=DEFAULT)
Set the initial tracker direct mode for draggers not yet created.
void setTrackerDirectMode(TrackerDirectMode mode=DEFAULT)
Sets the tracker direct mode for this dragger (see description above).
Base class for all events.
Definition SoEvent.h:116
Sensor class that can be attached to Open Inventor fields.
Path that allows access to hidden children.
Definition SoPath.h:612
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Computes transformation matrix for a subgraph.
Allows nodes in a graph to receive input events.
Base class for all interaction nodekit classes.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Represents point on surface of picked object.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Searches for nodes in a scene graph.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
int SbBool
Boolean type.
Definition SbBase.h:87