fbxmanipulators.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_UTILS_MANIPULATORS_H_
00014 #define _FBXSDK_UTILS_MANIPULATORS_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/fbxobject.h>
00019 #include <fbxsdk/core/math/fbxvector2.h>
00020 #include <fbxsdk/core/math/fbxvector4.h>
00021 #include <fbxsdk/scene/geometry/fbxcamera.h>
00022 
00023 #include <fbxsdk/fbxsdk_nsbegin.h>
00024 
00025 class FbxCameraManipulationState;
00026 
00030 class FBXSDK_DLL FbxCameraManipulator : public FbxObject
00031 {
00032     FBXSDK_OBJECT_DECLARE(FbxCameraManipulator, FbxObject);
00033 
00034 public:
00036     enum EAction
00037     {
00038         eNone,      
00039         eOrbit,     
00040         eDolly,     
00041         ePan,       
00042         eFreePan    
00043     };
00044 
00049     void Begin(EAction pAction, float pX, float pY);
00050 
00055     void Notify(float pX, float pY, float pZ=0);
00056 
00058     void End();
00059 
00063     void FrameAll(const FbxTime& pTime=FBXSDK_TIME_INFINITE, int pOnAnimLayer=0);
00064 
00068     void FrameSelected(const FbxTime& pTime=FBXSDK_TIME_INFINITE, int pOnAnimLayer=0);
00069 
00072     EAction GetCurrentAction() const;
00073 
00075     FbxPropertyT<FbxReference> Camera;
00076 
00079     FbxPropertyT<FbxFloat> ViewportWidth;
00080 
00083     FbxPropertyT<FbxFloat> ViewportHeight;
00084 
00086     FbxPropertyT<FbxBool> Restore;
00087 
00088 /*****************************************************************************************************************************
00089 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00090 *****************************************************************************************************************************/
00091 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00092 protected:
00093     virtual void Construct(const FbxCameraManipulator* pFrom);
00094     virtual void Destruct(bool pRecursive);
00095     virtual void ConstructProperties(bool pForceSet);
00096     virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty);
00097 
00098 private:
00099     void        Reset();
00100     FbxCamera*  GetCamera() const;
00101     FbxNode*    GetCameraNode() const;
00102     FbxNode*    GetCameraLookAtNode() const;
00103     FbxVector4  GetCameraPosition() const;
00104     void        SetCameraPosition(const FbxVector4& pPosition);
00105     FbxVector4  GetCameraRotation() const;
00106     void        SetCameraRotation(const FbxVector4& pRotation);
00107     FbxVector4  GetCameraLookAtPosition() const;
00108     void        SetCameraLookAtPosition(const FbxVector4& pPosition);
00109     void        StoreCameraState();
00110 
00111     double      ComputeRotationAxis(FbxVector4& pFront, FbxVector4& pUp, FbxVector4& pRight) const;
00112     void        ComputeRotationMatrix(FbxAMatrix& pRM);
00113     void        UpdateCameraRotation();
00114 
00115     void        MoveCameraToFitBBoxInFrustum(int pOnAnimLayer, const FbxTime& pTime, const FbxVector4& pBBoxMin, const FbxVector4& pBBoxMax);
00116     bool        Frame(int pOnAnimLayer, const FbxTime& pTime, bool pSelected);
00117     void        Evaluate(double& v, const FbxTime& pTime, FbxProperty& p, FbxAnimLayer* pAnimLayer);
00118     FbxVector4  RejectionOfOn(const FbxVector4& a, const FbxVector4& b);
00119 
00120     EAction     mCurrentAction;
00121     float       mBeginX, mBeginY;
00122     FbxVector4  mBeginPosition, mBeginLookAtPosition;
00123     FbxVector4  mAxisX, mAxisY, mAxisZ;
00124     FbxVector4  mInitialPosition, mInitialRotation, mInitialLookAt;
00125 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00126 };
00127 
00128 #include <fbxsdk/fbxsdk_nsend.h>
00129 
00130 #endif /* _FBXSDK_UTILS_MANIPULATORS_H_ */