fbxsdk/utils/fbxmanipulators.h Source File

fbxmanipulators.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_UTILS_MANIPULATORS_H_
14 #define _FBXSDK_UTILS_MANIPULATORS_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
18 #include <fbxsdk/core/fbxobject.h>
22 
23 #include <fbxsdk/fbxsdk_nsbegin.h>
24 
25 class FbxCameraManipulationState;
26 
31 {
33 
34 public:
36  enum EAction
37  {
41  ePan,
42  eFreePan
43  };
44 
49  void Begin(EAction pAction, float pX, float pY);
50 
56  void Notify(float pX, float pY, float pScale=0);
57 
59  void End();
60 
64  void Update(const FbxTime& pTimeDelta=FBXSDK_TIME_ZERO);
65 
71  void Action(EAction pAction, float pX, float pY, float pScale=0);
72 
75  EAction GetCurrentAction() const;
76 
79  void FrameAll(const FbxTime& pTime=FBXSDK_TIME_INFINITE);
80 
83  void FrameSelected(const FbxTime& pTime=FBXSDK_TIME_INFINITE);
84 
91  void FrameScreenPosition(float pX, float pY, bool pCulling=false, const FbxTime& pTime=FBXSDK_TIME_INFINITE);
92 
95 
99 
103 
106 
109 
112 
115 
118 
119 /*****************************************************************************************************************************
120 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
121 *****************************************************************************************************************************/
122 #ifndef DOXYGEN_SHOULD_SKIP_THIS
123 protected:
124  virtual void Construct(const FbxObject* pFrom);
125  virtual void Destruct(bool pRecursive);
126  virtual void ConstructProperties(bool pForceSet);
127  virtual bool ConnectNotify(const FbxConnectEvent& pEvent);
128  virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty);
129 
130 private:
131  void Reset();
132  FbxCamera* GetCamera() const;
133  FbxNode* GetCameraNode() const;
134  FbxNode* GetCameraLookAtNode() const;
135  FbxNode* GetCameraTargetUpNode() const;
136  FbxVector4 GetCameraPosition() const;
137  void SetCameraPosition(const FbxVector4& pPosition);
138  FbxVector4 GetCameraRotation() const;
139  void SetCameraRotation(const FbxVector4& pRotation);
140  FbxVector4 GetCameraLookAtPosition() const;
141  void SetCameraLookAtPosition(const FbxVector4& pPosition);
142  FbxVector4 GetCameraTargetUpPosition() const;
143  void SetCameraTargetUpPosition(const FbxVector4& pPosition);
144  FbxAMatrix GetCameraRotationMatrix() const;
145  void SetCameraRotationMatrix(const FbxAMatrix& pRM);
146 
147  double ComputeRotationAxis(FbxVector4& pFront, FbxVector4& pUp, FbxVector4& pRight, const FbxVector4& pEye, const FbxVector4& pLookAt, const FbxVector4& pUpVector) const;
148  void ComputeRotationMatrix(FbxAMatrix& pRM, const FbxVector4& pEye, const FbxVector4& pLookAt, const FbxVector4& pUpVector);
149  void UpdateCameraRotation();
150 
151  bool FrameObjects(bool pSelected, const FbxTime& pTime);
152  FbxVector4 ComputePositionToFitBBoxInFrustum(const FbxVector4& pBBoxMin, const FbxVector4& pBBoxMax, const FbxVector4& pBBoxCenter, const FbxVector4& pCameraPosition, const FbxAMatrix& pCameraRM, const FbxTime& pTime);
153 
154  EAction mCurrentAction;
155  FbxFloat mBeginMouse[3], mLastMouse[3];
156  FbxVector4 mBeginPosition, mBeginAxis[3];
157  FbxBool mBeginFlipped;
158 
159  FbxDouble mDestOrthoZoom;
160  FbxVector4 mDestPosition, mDestLookAt, mDestTargetUp;
161  FbxAMatrix mDestRotation;
162 
163  FbxVector4 mInitialPosition, mInitialRotation, mInitialLookAt;
164 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
165 };
166 
167 #include <fbxsdk/fbxsdk_nsend.h>
168 
169 #endif /* _FBXSDK_UTILS_MANIPULATORS_H_ */
#define FBXSDK_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new class derived from FbxObject.
Definition: fbxobject.h:61
FbxPropertyT< FbxFloat > ViewportHeight
Height of the camera viewport, in pixels.
FBX SDK environment definition.
Panning camera up, down and sideways.
FbxPropertyT< FbxBool > InvertX
Invert the camera horizontal manipulation direction if set to true.
FbxPropertyT< FbxFloat > ViewportWidth
Width of the camera viewport, in pixels.
FbxPropertyT< FbxBool > Restore
Restore the camera transform upon destruction of the manipulator.
#define FBXSDK_TIME_ZERO
Definition: fbxtime.h:25
FbxPropertyT< FbxReference > Camera
The camera controlled by the manipulator.
#define FBXSDK_TIME_INFINITE
Definition: fbxtime.h:23
FbxPropertyT< FbxBool > Smooth
Camera manipulations will be smooth if enabled.
double FbxDouble
Definition: fbxtypes.h:42
Moving camera closer or away from its LookAt/Intest position.
Class to encapsulate time units.
Definition: fbxtime.h:44
The base class of most FBX objects.
Definition: fbxobject.h:157
Represents an element in the scene graph.
Definition: fbxnode.h:72
bool FbxBool
Definition: fbxtypes.h:32
EAction
All possible manipulation actions that can be performed on a camera using this manipulator.
float FbxFloat
Definition: fbxtypes.h:41
virtual void Construct(const FbxObject *pFrom)
Optional constructor override, automatically called by default constructor.
This class can be used to provide basic camera manipulation in any program using this library...
Class to hold user properties.
Definition: fbxproperty.h:37
FbxPropertyT< FbxBool > InvertY
Invert the camera vertical manipulation direction if set to true.
A four double mathematic vector class.
Definition: fbxvector4.h:25
FBX SDK affine matrix class.
Orbiting camera around LootAt/Interest position.
This node attribute contains methods for accessing the properties of a camera.
Definition: fbxcamera.h:34
FbxPropertyT< FbxDouble > SmoothSpeed
Camera manipulations smoothing speed.
#define FBXSDK_DLL
Definition: fbxarch.h:173
virtual void Destruct(bool pRecursive)
Optional destructor override, automatically called by default destructor.
This template class is used to contain user properties of specific data types.
Definition: fbxproperty.h:1124
virtual void ConstructProperties(bool pForceSet)
Optional property constructor override, automatically called by default constructor.