fbxcamera.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 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_SCENE_GEOMETRY_CAMERA_H_
00014 #define _FBXSDK_SCENE_GEOMETRY_CAMERA_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/scene/geometry/fbxnodeattribute.h>
00019 #include <fbxsdk/core/math/fbxvector4.h>
00020 #include <fbxsdk/core/base/fbxstring.h>
00021 
00022 #include <fbxsdk/fbxsdk_nsbegin.h>
00023 
00024 class FbxTexture;
00025 class FbxManager;
00026 class FbxMatrix;
00027 class FbxAMatrix;
00028 class FbxTime;
00029 
00038 class FBXSDK_DLL FbxCamera : public FbxNodeAttribute
00039 {
00040     FBXSDK_OBJECT_DECLARE(FbxCamera,FbxNodeAttribute);
00041 
00042 public:
00044     virtual FbxNodeAttribute::EType GetAttributeType() const;
00045 
00047     void Reset();
00048 
00059     enum EProjectionType
00060     {
00061         ePerspective,   
00062         eOrthogonal     
00063     };
00064 
00073         enum EFormat
00074         {
00075             eCustomFormat,  
00076             eD1NTSC,        
00077             eNTSC,          
00078             ePAL,           
00079             eD1PAL,         
00080             eHD,            
00081             e640x480,       
00082             e320x200,       
00083             e320x240,       
00084             e128x128,       
00085             eFullscreen     
00086         };
00087 
00094         void SetFormat(EFormat pFormat);
00095 
00099         EFormat GetFormat() const;
00100 
00104         enum EAspectRatioMode
00105         {
00106             eWindowSize,        
00107             eFixedRatio,        
00108             eFixedResolution,   
00109             eFixedWidth,        
00110             eFixedHeight        
00111         };
00112 
00120         void SetAspect(EAspectRatioMode pRatioMode, double pWidth, double pHeight);
00121 
00125         EAspectRatioMode GetAspectRatioMode() const;
00126 
00132         void SetPixelRatio(double pRatio);
00133 
00137         double GetPixelRatio() const;
00138 
00146         void SetNearPlane(double pDistance);
00147 
00153         double GetNearPlane() const;
00154 
00162         void SetFarPlane(double pDistance);
00163 
00169         double GetFarPlane() const;
00170 
00172 
00183 
00188     enum EApertureFormat
00189     {
00190         eCustomAperture,    
00191         e16mmTheatrical,    
00192         eSuper16mm,         
00193         e35mmAcademy,       
00194         e35mmTVProjection,  
00195         e35mmFullAperture,  
00196         e35mm185Projection, 
00197         e35mmAnamorphic,    
00198         e70mmProjection,    
00199         eVistaVision,       
00200         eDynaVision,        
00201         eIMAX               
00202     };
00203 
00208     void SetApertureFormat(EApertureFormat pFormat);
00209 
00213     EApertureFormat GetApertureFormat() const;
00214 
00220     enum EApertureMode
00221     {
00222         eHorizAndVert,  
00223         eHorizontal,    
00224         eVertical,      
00225         eFocalLength    
00226     };
00227 
00231     void SetApertureMode(EApertureMode pMode);
00232 
00236     EApertureMode GetApertureMode() const;
00237 
00243     void SetApertureWidth(double pWidth);
00244 
00248     double GetApertureWidth() const;
00249 
00255     void SetApertureHeight(double pHeight);
00256 
00260     double GetApertureHeight() const;
00261 
00267     void SetSqueezeRatio(double pRatio);
00268 
00272     double GetSqueezeRatio() const;
00273 
00282     enum EGateFit
00283     {
00284         eFitNone,       
00285         eFitVertical,   
00286         eFitHorizontal, 
00287         eFitFill,       
00288         eFitOverscan,   
00289         eFitStretch     
00290     };
00291 
00297     double ComputeFieldOfView(double pFocalLength) const;
00298 
00304     double ComputeFocalLength(double pAngleOfView) const;
00305 
00308     enum EFilmRollOrder
00309     {
00310         eRotateFirst,   
00311         eTranslateFirst 
00312     };
00313 
00315 
00331 
00338     void SetBackgroundFileName(const char* pFileName);
00339 
00345     char const* GetBackgroundFileName() const;
00346 
00353     void SetBackgroundMediaName(const char* pFileName);
00354 
00360     char const* GetBackgroundMediaName() const;
00361 
00368     void SetForegroundFileName(const char* pFileName);
00369 
00375     char const* GetForegroundFileName() const;
00376 
00383     void SetForegroundMediaName(const char* pFileName);
00384 
00390     char const* GetForegroundMediaName() const;
00391 
00392     
00395     enum EPlateDrawingMode
00396     {
00397         ePlateBackground,   
00398         ePlateForeground,   
00399         ePlateBackAndFront  
00400     };
00401 
00406     void SetBackgroundAlphaTreshold(double pThreshold);
00407 
00412     double GetBackgroundAlphaTreshold() const;
00413 
00418     void SetBackPlateFitImage(bool pFitImage);
00419 
00424     bool GetBackPlateFitImage() const;
00425 
00431     void SetBackPlateCrop(bool pCrop);
00432 
00438     bool GetBackPlateCrop() const;
00439 
00444     void SetBackPlateCenter(bool pCenter);
00445 
00450     bool GetBackPlateCenter() const;
00451 
00457     void SetBackPlateKeepRatio(bool pKeepRatio);
00458 
00464     bool GetBackPlateKeepRatio() const;
00465 
00471     void SetShowFrontPlate(bool pEnable);
00472 
00478     bool GetShowFrontPlate() const;
00479  
00484     void SetFrontPlateFitImage(bool pFrontPlateFitImage);
00485 
00490     bool GetFrontPlateFitImage() const;
00491 
00497     void SetFrontPlateCrop(bool pFrontPlateCrop);
00498 
00504     bool GetFrontPlateCrop() const;
00505 
00510     void SetFrontPlateCenter(bool pFrontPlateCenter);
00511 
00516     bool GetFrontPlateCenter() const;
00517 
00523     void SetFrontPlateKeepRatio(bool pFrontPlateKeepRatio);
00524 
00530     bool GetFrontPlateKeepRatio() const;
00531 
00535     void SetForegroundOpacity(double pOpacity);
00536 
00540     double GetForegroundOpacity() const;
00541 
00545     void SetForegroundTexture(FbxTexture* pTexture);
00546 
00550     FbxTexture* GetForegroundTexture() const;
00551 
00555     enum EFrontBackPlaneDistanceMode
00556     {
00557         eRelativeToInterest,    
00558         eRelativeToCamera       
00559     };
00560 
00564     void SetBackPlaneDistanceMode(EFrontBackPlaneDistanceMode pMode);
00565 
00569     EFrontBackPlaneDistanceMode GetBackPlaneDistanceMode() const;
00570 
00577     void SetFrontPlaneDistance(double pDistance);
00578 
00582     double GetFrontPlaneDistance() const;
00583 
00587     void SetFrontPlaneDistanceMode(EFrontBackPlaneDistanceMode pMode);
00588 
00592     EFrontBackPlaneDistanceMode GetFrontPlaneDistanceMode() const;
00593 
00596     enum EFrontBackPlaneDisplayMode
00597     {
00598         ePlanesDisabled,    
00599         ePlanesAlways,      
00600         ePlanesWhenMedia    
00601     };
00602     
00607     void SetViewFrustumFrontPlaneMode(EFrontBackPlaneDisplayMode pMode);
00608 
00612     EFrontBackPlaneDisplayMode GetViewFrustumFrontPlaneMode() const;
00613 
00618     void SetViewFrustumBackPlaneMode(EFrontBackPlaneDisplayMode pMode);
00619 
00623     EFrontBackPlaneDisplayMode GetViewFrustumBackPlaneMode() const;
00624     
00626 
00633 
00637     void SetViewCameraInterest(bool pEnable);
00638 
00642     bool GetViewCameraInterest() const;
00643 
00647     void SetViewNearFarPlanes(bool pEnable);
00648 
00652     bool GetViewNearFarPlanes() const;
00653 
00656     enum ESafeAreaStyle
00657     {
00658         eSafeAreaRound, 
00659         eSafeAreaSquare 
00660     };
00661 
00663 
00670 
00673     enum ERenderOptionsUsageTime
00674     {
00675         eInteractive,   
00676         eOnDemand       
00677     };
00678 
00681     enum EAntialiasingMethod
00682     {
00683         eAAOversampling,    
00684         eAAHardware         
00685     };
00686 
00689     enum ESamplingType
00690     {
00691         eSamplingUniform,   
00694         eSamplingStochastic 
00696     };
00697 
00701     enum EFocusDistanceSource
00702     {
00703         eFocusSrcCameraInterest,    
00705         eFocusSpecificDistance      
00706     };
00707 
00709 
00714 
00724     bool IsBoundingBoxInView( const FbxMatrix& pWorldToScreen, 
00725                              const FbxMatrix& pWorldToCamera, 
00726                              const FbxVector4 pPoints[8] ) const;
00727 
00736     bool IsPointInView( const FbxMatrix& pWorldToScreen, const FbxMatrix& pWorldToCamera, const FbxVector4& pPoint ) const;
00737 
00744     FbxMatrix ComputeWorldToScreen(int pPixelWidth, int pPixelHeight, const FbxAMatrix& pWorldToCamera) const;
00745 
00756     FbxMatrix ComputePerspective(int pPixelWidth, int pPixelHeight, bool pIncludePostPerspective) const;
00757 
00766     FbxVector4 EvaluatePosition(int& pIndex, const FbxTime& pTime=FBXSDK_TIME_ZERO) const;
00767 
00776     FbxVector4 EvaluateLookAtPosition(int& pIndex, const FbxTime& pTime=FBXSDK_TIME_ZERO) const;
00777 
00783     FbxVector4 ComputeUpVector(const FbxVector4& pCameraPosition, const FbxVector4& pLookAtPosition) const;
00784 
00786 
00788     //
00789     // Properties
00790     //
00792 
00793     // -----------------------------------------------------------------------
00794     // Geometrical
00795     // -----------------------------------------------------------------------
00796 
00804     FbxPropertyT<FbxDouble3>                       Position;
00805 
00813     FbxPropertyT<FbxDouble3>                       UpVector;
00814 
00826     FbxPropertyT<FbxDouble3>                       InterestPosition;
00827 
00835     FbxPropertyT<FbxDouble>                       Roll;
00836 
00846     FbxPropertyT<FbxDouble>                       OpticalCenterX;
00847 
00857     FbxPropertyT<FbxDouble>                       OpticalCenterY;
00858 
00866     FbxPropertyT<FbxDouble3>                       BackgroundColor;
00867 
00877     FbxPropertyT<FbxDouble>                       TurnTable;
00878 
00887     FbxPropertyT<FbxBool>                         DisplayTurnTableIcon;
00888 
00889     // -----------------------------------------------------------------------
00890     // Motion Blur
00891     // -----------------------------------------------------------------------
00892 
00901     FbxPropertyT<FbxBool>                         UseMotionBlur;
00902 
00911     FbxPropertyT<FbxBool>                         UseRealTimeMotionBlur;
00912 
00920     FbxPropertyT<FbxDouble>                       MotionBlurIntensity;
00921 
00922     // -----------------------------------------------------------------------
00923     // Optical
00924     // -----------------------------------------------------------------------
00925 
00934     FbxPropertyT<EAspectRatioMode>           AspectRatioMode;
00935 
00943     FbxPropertyT<FbxDouble>                       AspectWidth;
00944 
00952     FbxPropertyT<FbxDouble>                       AspectHeight;
00953 
00962     FbxPropertyT<FbxDouble>                       PixelAspectRatio;
00963 
00971     FbxPropertyT<EApertureMode>              ApertureMode;
00972 
00982     FbxPropertyT<EGateFit>                   GateFit;
00983 
00995     FbxPropertyT<FbxDouble>                       FieldOfView;
00996 
01008     FbxPropertyT<FbxDouble>                       FieldOfViewX;
01009 
01021     FbxPropertyT<FbxDouble>                       FieldOfViewY;
01022 
01030     FbxPropertyT<FbxDouble>                       FocalLength;
01031 
01042     FbxPropertyT<EFormat>                    CameraFormat;
01043 
01044     // -----------------------------------------------------------------------
01045     // Frame
01046     // -----------------------------------------------------------------------
01047 
01054     FbxPropertyT<FbxBool>                         UseFrameColor;
01055 
01063     FbxPropertyT<FbxDouble3>                       FrameColor;
01064 
01065     // -----------------------------------------------------------------------
01066     // On Screen Display
01067     // -----------------------------------------------------------------------
01068 
01076     FbxPropertyT<FbxBool>                         ShowName;
01077 
01085     FbxPropertyT<FbxBool>                         ShowInfoOnMoving;
01086 
01094     FbxPropertyT<FbxBool>                         ShowGrid;
01095 
01103     FbxPropertyT<FbxBool>                         ShowOpticalCenter;
01104 
01115     FbxPropertyT<FbxBool>                         ShowAzimut;
01116 
01124     FbxPropertyT<FbxBool>                         ShowTimeCode;
01125 
01133     FbxPropertyT<FbxBool>                         ShowAudio;
01134 
01142     FbxPropertyT<FbxDouble3>                       AudioColor;
01143 
01144     // -----------------------------------------------------------------------
01145     // Clipping Planes
01146     // -----------------------------------------------------------------------
01147 
01156     FbxPropertyT<FbxDouble>                       NearPlane;
01157 
01166     FbxPropertyT<FbxDouble>                       FarPlane;
01167 
01176     FbxPropertyT<FbxBool>                         AutoComputeClipPlanes;
01177 
01178 
01179     // -----------------------------------------------------------------------
01180     // Camera Film Setting
01181     // -----------------------------------------------------------------------
01182 
01192     FbxPropertyT<FbxDouble>                       FilmWidth;
01193 
01203     FbxPropertyT<FbxDouble>                       FilmHeight;
01204 
01213     FbxPropertyT<FbxDouble>                       FilmAspectRatio;
01214 
01224     FbxPropertyT<FbxDouble>                       FilmSqueezeRatio;
01225 
01234     FbxPropertyT<EApertureFormat>            FilmFormat;
01235 
01244     FbxPropertyT<FbxDouble>                       FilmOffsetX;
01245 
01255     FbxPropertyT<FbxDouble>                       FilmOffsetY;
01256 
01266     FbxPropertyT<FbxDouble>                       PreScale;
01267 
01273     FbxPropertyT<FbxDouble>                       FilmTranslateX;
01274 
01282     FbxPropertyT<FbxDouble>                       FilmTranslateY;
01283 
01292     FbxPropertyT<FbxDouble>                       FilmRollPivotX;
01293 
01302     FbxPropertyT<FbxDouble>                       FilmRollPivotY;
01303 
01314     FbxPropertyT<FbxDouble>                       FilmRollValue;
01315 
01325     FbxPropertyT<EFilmRollOrder>             FilmRollOrder ;
01326 
01327     // -----------------------------------------------------------------------
01328     // Camera View Widget Option
01329     // -----------------------------------------------------------------------
01330 
01339     FbxPropertyT<FbxBool>                         ViewCameraToLookAt;
01340 
01348     FbxPropertyT<FbxBool>                         ViewFrustumNearFarPlane;
01349 
01357     FbxPropertyT<EFrontBackPlaneDisplayMode>    ViewFrustumBackPlaneMode;
01358 
01366     FbxPropertyT<FbxDouble>                       BackPlaneDistance;
01367 
01375     FbxPropertyT<EFrontBackPlaneDistanceMode>   BackPlaneDistanceMode;
01376 
01384     FbxPropertyT<EFrontBackPlaneDisplayMode>    ViewFrustumFrontPlaneMode;
01385 
01393     FbxPropertyT<FbxDouble>                       FrontPlaneDistance;
01394 
01402     FbxPropertyT<EFrontBackPlaneDistanceMode>   FrontPlaneDistanceMode;
01403 
01404     // -----------------------------------------------------------------------
01405     // Camera Lock Mode
01406     // -----------------------------------------------------------------------
01407 
01415     FbxPropertyT<FbxBool>                         LockMode;
01416 
01424     FbxPropertyT<FbxBool>                         LockInterestNavigation;
01425 
01426     // -----------------------------------------------------------------------
01427     // Background Image Display Options
01428     // -----------------------------------------------------------------------
01429 
01438     FbxPropertyT<FbxBool>                         BackPlateFitImage;
01439 
01448     FbxPropertyT<FbxBool>                         BackPlateCrop;
01449 
01458     FbxPropertyT<FbxBool>                         BackPlateCenter;
01459 
01468     FbxPropertyT<FbxBool>                         BackPlateKeepRatio;
01469 
01477     FbxPropertyT<FbxDouble>                       BackgroundAlphaTreshold;
01478 
01486     FbxPropertyT<FbxDouble>                       BackPlaneOffsetX;
01487 
01495     FbxPropertyT<FbxDouble>                       BackPlaneOffsetY;
01496 
01504     FbxPropertyT<FbxDouble>                       BackPlaneRotation;
01505 
01515     FbxPropertyT<FbxDouble>                       BackPlaneScaleX;
01516 
01526     FbxPropertyT<FbxDouble>                       BackPlaneScaleY;
01527 
01536     FbxPropertyT<FbxBool>                         ShowBackplate;
01537 
01545     FbxPropertyT<FbxReference> BackgroundTexture;
01546 
01547 
01548     // -----------------------------------------------------------------------
01549     // Foreground Image Display Options
01550     // -----------------------------------------------------------------------
01551 
01559     FbxPropertyT<FbxBool> FrontPlateFitImage;
01560 
01568     FbxPropertyT<FbxBool> FrontPlateCrop;
01569 
01577     FbxPropertyT<FbxBool> FrontPlateCenter;
01578 
01586     FbxPropertyT<FbxBool> FrontPlateKeepRatio;
01587 
01588 
01597     FbxPropertyT<FbxBool> ShowFrontplate;
01598 
01606     FbxPropertyT<FbxDouble>                       FrontPlaneOffsetX;
01607 
01615     FbxPropertyT<FbxDouble>                       FrontPlaneOffsetY;
01616 
01624     FbxPropertyT<FbxDouble>                       FrontPlaneRotation;
01625 
01633     FbxPropertyT<FbxDouble>                       FrontPlaneScaleX;
01634 
01642     FbxPropertyT<FbxDouble>                       FrontPlaneScaleY;
01643     
01651     FbxPropertyT<FbxReference>                      ForegroundTexture;
01652 
01660     FbxPropertyT<FbxDouble>                     ForegroundOpacity;
01661 
01662     // -----------------------------------------------------------------------
01663     // Safe Area
01664     // -----------------------------------------------------------------------
01665 
01673     FbxPropertyT<FbxBool>                         DisplaySafeArea;
01674 
01682     FbxPropertyT<FbxBool>                         DisplaySafeAreaOnRender;
01683 
01691     FbxPropertyT<ESafeAreaStyle>             SafeAreaDisplayStyle;
01692 
01700     FbxPropertyT<FbxDouble>                       SafeAreaAspectRatio;
01701 
01702     // -----------------------------------------------------------------------
01703     // 2D Magnifier
01704     // -----------------------------------------------------------------------
01705 
01715     FbxPropertyT<FbxBool>                         Use2DMagnifierZoom;
01716 
01724     FbxPropertyT<FbxDouble>                       _2DMagnifierZoom;
01725 
01733     FbxPropertyT<FbxDouble>                       _2DMagnifierX;
01734 
01742     FbxPropertyT<FbxDouble>                       _2DMagnifierY;
01743 
01744     // -----------------------------------------------------------------------
01745     // Projection Type: Ortho, Perspective
01746     // -----------------------------------------------------------------------
01747 
01755     FbxPropertyT<EProjectionType>            ProjectionType;
01756 
01764     FbxPropertyT<FbxDouble>                       OrthoZoom;
01765 
01766     // -----------------------------------------------------------------------
01767     // Depth Of Field & Anti Aliasing
01768     // -----------------------------------------------------------------------
01769 
01777     FbxPropertyT<FbxBool>                         UseRealTimeDOFAndAA;
01778 
01786     FbxPropertyT<FbxBool>                         UseDepthOfField;
01787 
01796     FbxPropertyT<EFocusDistanceSource>       FocusSource;
01797 
01805     FbxPropertyT<FbxDouble>                       FocusAngle;
01806 
01817     FbxPropertyT<FbxDouble>                       FocusDistance;
01818 
01826     FbxPropertyT<FbxBool>                         UseAntialiasing;
01827 
01835     FbxPropertyT<FbxDouble>                       AntialiasingIntensity;
01836 
01844     FbxPropertyT<EAntialiasingMethod>        AntialiasingMethod;
01845 
01846     // -----------------------------------------------------------------------
01847     // Accumulation Buffer
01848     // -----------------------------------------------------------------------
01849 
01857     FbxPropertyT<FbxBool>                         UseAccumulationBuffer;
01858 
01866     FbxPropertyT<FbxInt>                      FrameSamplingCount;
01867 
01875     FbxPropertyT<ESamplingType>              FrameSamplingType;
01876 
01878 //
01879 //  WARNING!
01880 //
01881 //  Anything beyond these lines may not be documented accurately and is
01882 //  subject to change without notice.
01883 //
01885 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01886     friend class FbxGlobalCameraSettings;
01887 
01888     virtual FbxObject& Copy(const FbxObject& pObject);
01889 
01890 protected:
01891     FbxCamera(FbxManager& pManager, char const* pName);
01892 
01893     virtual bool ConstructProperties(bool pForceSet);
01894 
01898     virtual FbxStringList GetTypeFlags() const;
01899 
01900 private:
01901     double ComputePixelRatio(FbxUInt pWidth, FbxUInt pHeight, double pScreenRatio = 1.3333333333);
01902 
01903     // Background Properties
01904     FbxString mBackgroundMediaName;
01905     FbxString mBackgroundFileName;
01906 
01907     // Foreground Properties
01908     FbxString mForegroundMediaName;
01909     FbxString mForegroundFileName;
01910 
01911     friend class FbxNode;
01912 
01913 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01914 
01915 };
01916 
01917 inline EFbxType FbxTypeOf(const FbxCamera::EAntialiasingMethod&){ return eFbxEnum; }
01918 inline EFbxType FbxTypeOf(const FbxCamera::EApertureFormat&){ return eFbxEnum; }
01919 inline EFbxType FbxTypeOf(const FbxCamera::EApertureMode&){ return eFbxEnum; }
01920 inline EFbxType FbxTypeOf(const FbxCamera::EAspectRatioMode&){ return eFbxEnum; }
01921 inline EFbxType FbxTypeOf(const FbxCamera::EFrontBackPlaneDisplayMode&){ return eFbxEnum; }
01922 inline EFbxType FbxTypeOf(const FbxCamera::EFrontBackPlaneDistanceMode&){ return eFbxEnum; }
01923 inline EFbxType FbxTypeOf(const FbxCamera::EPlateDrawingMode&){ return eFbxEnum; }
01924 inline EFbxType FbxTypeOf(const FbxCamera::EFocusDistanceSource&){ return eFbxEnum; }
01925 inline EFbxType FbxTypeOf(const FbxCamera::EFormat&){ return eFbxEnum; }
01926 inline EFbxType FbxTypeOf(const FbxCamera::EGateFit&){ return eFbxEnum; }
01927 inline EFbxType FbxTypeOf(const FbxCamera::EProjectionType&){ return eFbxEnum; }
01928 inline EFbxType FbxTypeOf(const FbxCamera::ERenderOptionsUsageTime&){ return eFbxEnum; }
01929 inline EFbxType FbxTypeOf(const FbxCamera::ESafeAreaStyle&){ return eFbxEnum; }
01930 inline EFbxType FbxTypeOf(const FbxCamera::ESamplingType&){ return eFbxEnum; }
01931 inline EFbxType FbxTypeOf(const FbxCamera::EFilmRollOrder&){ return eFbxEnum; }
01932 
01933 #include <fbxsdk/fbxsdk_nsend.h>
01934 
01935 #endif /* _FBXSDK_SCENE_GEOMETRY_CAMERA_H_ */