kfbxcamera.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_CAMERA_H_
00005 #define _FBXSDK_CAMERA_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2001 - 2007 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material
00013  (collectively the "Data") in these files contain unpublished information
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00015  Canada and United States of America federal copyright law and by international
00016  treaties.
00017 
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00028 
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE.
00039 
00040 **************************************************************************************/
00041 
00042 #include <kaydaradef.h>
00043 #ifndef KFBX_DLL 
00044     #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <kaydara.h>
00048 
00049 #include <kfbxplugins/kfbxnodeattribute.h>
00050 #include <kfbxplugins/kfbxcolor.h>
00051 
00052 #include <kfbxmath/kfbxvector4.h>
00053 
00054 #include <klib/kstring.h>
00055 
00056 #ifdef KARCH_DEV_MACOSX_CFM
00057     #include <CFURL.h>
00058     #include <Files.h>
00059 #endif
00060 
00061 #include <fbxfilesdk_nsbegin.h>
00062 
00063 class KFbxTexture;
00064 class KFbxSdkManager;
00065 class KFbxCamera_internal;
00066 
00074 class KFBX_DLL KFbxCamera : public KFbxNodeAttribute
00075 {
00076     KFBXOBJECT_DECLARE(KFbxCamera);
00077     
00078 public:
00080     virtual EAttributeType GetAttributeType() const;
00081 
00083     void Reset();
00084 
00089 
00094     void SetPosition(const KFbxVector4& pPosition);
00095     
00100     KFbxVector4 GetPosition() const;
00101 
00105     void SetUpVector(const KFbxVector4& pVector);
00106 
00110     KFbxVector4 GetUpVector() const;
00111 
00118     void SetDefaultCameraInterestPosition(const KFbxVector4& pPosition);
00119 
00126     KFbxVector4 GetDefaultCameraInterestPosition() const;
00127 
00131     void SetRoll(double pRoll);
00132 
00136     double GetRoll() const;
00137 
00141     void SetTurnTable(double pTurnTable);
00142 
00146     double GetTurnTable() const;
00147 
00163     typedef enum 
00164     { 
00165         ePERSPECTIVE, 
00166         eORTHOGONAL 
00167     } ECameraProjectionType;
00168 
00172     void SetProjectionType(ECameraProjectionType pProjectionType);
00173 
00177     ECameraProjectionType GetProjectionType() const;
00178 
00180 
00185 
00199     typedef enum 
00200     {
00201         eCUSTOM_FORMAT,
00202         eD1_NTSC,
00203         eNTSC,
00204         ePAL,
00205         eD1_PAL,
00206         eHD,
00207         e640x480,
00208         e320x200,
00209         e320x240,
00210         e128x128,
00211         eFULL_SCREEN
00212     } ECameraFormat;
00213 
00220     void SetFormat(ECameraFormat pFormat);
00221 
00225     ECameraFormat GetFormat() const;
00226 
00234     typedef enum 
00235     {
00236         eWINDOW_SIZE,
00237         eFIXED_RATIO,
00238         eFIXED_RESOLUTION,
00239         eFIXED_WIDTH,
00240         eFIXED_HEIGHT
00241     } ECameraAspectRatioMode;
00242 
00254     void SetAspect(ECameraAspectRatioMode pRatioMode, double pWidth, double pHeight);
00255 
00259     ECameraAspectRatioMode GetAspectRatioMode() const;
00260 
00264     double GetAspectWidth() const;
00265 
00269     double GetAspectHeight() const;
00270 
00276     void SetPixelRatio(double pRatio);
00277 
00281     double GetPixelRatio() const;
00282 
00289     void SetNearPlane(double pDistance);
00290 
00295     double GetNearPlane() const;
00296 
00303     void SetFarPlane(double pDistance);
00304     
00309     double GetFarPlane() const;
00310 
00316     void SetMouseLock(bool pMouseLock);
00317 
00323     bool GetMouseLock() const;
00324 
00326 
00336 
00351     typedef enum 
00352     {
00353         eCUSTOM_APERTURE_FORMAT = 0,
00354         e16MM_THEATRICAL,
00355         eSUPER_16MM,
00356         e35MM_ACADEMY,
00357         e35MM_TV_PROJECTION,
00358         e35MM_FULL_APERTURE,
00359         e35MM_185_PROJECTION,
00360         e35MM_ANAMORPHIC,
00361         e70MM_PROJECTION,
00362         eVISTAVISION,
00363         eDYNAVISION,
00364         eIMAX       
00365     } ECameraApertureFormat;
00366 
00371     void SetApertureFormat(ECameraApertureFormat pFormat);
00372 
00376     ECameraApertureFormat GetApertureFormat() const;
00377 
00386     typedef enum 
00387     { 
00388         eHORIZONTAL_AND_VERTICAL,
00389         eHORIZONTAL,
00390         eVERTICAL,
00391         eFOCAL_LENGTH
00392     } ECameraApertureMode;
00393 
00397     void SetApertureMode(ECameraApertureMode pMode);
00398 
00402     ECameraApertureMode GetApertureMode() const;
00403 
00409     void SetApertureWidth(double pWidth);
00410     
00414     double GetApertureWidth() const;
00415 
00421     void SetApertureHeight(double pHeight);
00422 
00426     double GetApertureHeight() const;
00427 
00433     void SetSqueezeRatio(double pRatio);
00434 
00438     double GetSqueezeRatio() const;
00439 
00444     void SetOrthoZoom(const double& pOrthoZoom);
00445 
00449     double GetOrthoZoom() const;
00450 
00460     typedef enum 
00461     { 
00462         eNO_FIT,
00463         eVERTICAL_FIT,
00464         eHORIZONTAL_FIT,
00465         eFILL_FIT,
00466         eOVERSCAN_FIT,
00467         eSTRETCH_FIT
00468     } ECameraGateFit;
00469 
00473     void SetGateFit(const ECameraGateFit pGateFit);
00474 
00478     ECameraGateFit GetGateFit() const;
00479 
00484     double ComputeFieldOfView(double pFocalLength) const;
00485 
00490     double ComputeFocalLength(double pAngleOfView);
00492 
00497 
00502     void SetBackgroundFileName(char* pFileName);
00503 
00504 #ifdef KARCH_DEV_MACOSX_CFM
00505     bool SetBackgroundFile(const FSSpec &pMacFileSpec);
00506     bool SetBackgroundFile(const FSRef &pMacFileRef);
00507     bool SetBackgroundFile(const CFURLRef &pMacURL);
00508 #endif
00509 
00513     char const* GetBackgroundFileName() const;
00514 
00515 #ifdef KARCH_DEV_MACOSX_CFM
00516     bool GetBackgroundFile(FSSpec &pMacFileSpec) const;
00517     bool GetBackgroundFile(FSRef &pMacFileRef) const;
00518     bool GetBackgroundFile(CFURLRef &pMacURL) const;
00519 #endif
00520 
00525     void SetBackgroundMediaName(char* pFileName);
00526 
00530     char const* GetBackgroundMediaName() const;
00531 
00537     typedef enum 
00538     {
00539         eDISABLED,
00540         eALWAYS,  
00541         eWHEN_MEDIA
00542     } ECameraBackgroundDisplayMode;
00543 
00547     void SetBackgroundDisplayMode(ECameraBackgroundDisplayMode pMode);
00548 
00552     ECameraBackgroundDisplayMode GetBackgroundDisplayMode() const;
00553 
00559     typedef enum 
00560     {
00561         eBACKGROUND,
00562         eFOREGROUND,
00563         eBACKGROUND_AND_FOREGROUND
00564     } ECameraBackgroundDrawingMode;
00565 
00569     void SetBackgroundDrawingMode(ECameraBackgroundDrawingMode pMode);
00570 
00574     ECameraBackgroundDrawingMode GetBackgroundDrawingMode() const;
00575 
00581     void SetForegroundMatteThresholdEnable(bool pEnable);
00582     
00588     bool GetForegroundMatteThresholdEnable() const;
00589 
00594     void SetForegroundMatteThreshold(double pThreshold);
00595     
00600     double GetForegroundMatteThreshold() const;
00601 
00608     typedef enum 
00609     {
00610         eFIT = 1<<0,
00611         eCENTER = 1<<1,
00612         eKEEP_RATIO = 1<<2,
00613         eCROP = 1<<3
00614     } ECameraBackgroundPlacementOptions;
00615     
00619     void SetBackgroundPlacementOptions(kUInt pOptions);
00620 
00624     kUInt GetBackgroundPlacementOptions() const;
00625 
00630     typedef enum 
00631     {
00632         eRELATIVE_TO_INTEREST,
00633         eABSOLUTE_FROM_CAMERA
00634     } ECameraBackgroundDistanceMode;
00635 
00639     void SetBackgroundDistanceMode(ECameraBackgroundDistanceMode pMode);
00640 
00644     ECameraBackgroundDistanceMode GetBackgroundDistanceMode() const;
00645 
00650     void SetBackgroundDistance(double pDistance);
00651 
00655     double GetBackgroundDistance() const;
00656 
00658 
00665 
00669     void SetViewCameraInterest(bool pEnable);
00670 
00674     bool GetViewCameraInterest() const;
00675 
00679     void SetViewNearFarPlanes(bool pEnable);
00680 
00684     bool GetViewNearFarPlanes() const;
00685     
00689     void SetShowGrid(bool pEnable);
00690     
00694     bool GetShowGrid() const;
00695 
00699     void SetShowAxis(bool pEnable);
00700 
00704     bool GetShowAxis() const;
00705 
00709     void SetShowName(bool pEnable);
00710 
00714     bool GetShowName() const;
00715 
00719     void SetShowInfoOnMoving(bool pEnable);
00720 
00724     bool GetShowInfoOnMoving() const;
00725 
00729     void SetShowTimeCode(bool pEnable);
00730     
00734     bool GetShowTimeCode() const;
00735 
00739     void SetDisplaySafeArea(bool pEnable);
00740 
00744     bool GetDisplaySafeArea() const;
00745 
00749     void SetDisplaySafeAreaOnRender(bool pEnable);
00750 
00754     bool GetDisplaySafeAreaOnRender() const;
00755 
00760     typedef enum 
00761     { 
00762         eROUND = 0, 
00763         eSQUARE = 1 
00764     } ECameraSafeAreaStyle;
00765 
00769     void SetSafeAreaStyle(ECameraSafeAreaStyle pStyle);
00770 
00774     ECameraSafeAreaStyle GetSafeAreaStyle() const;
00775 
00779     void SetShowAudio(bool pEnable);
00780 
00784     bool GetShowAudio() const;
00785 
00789     void SetAudioColor(const KFbxColor& pColor);
00790 
00794     KFbxColor GetAudioColor() const;
00795 
00799     void SetUseFrameColor(bool pEnable);
00800 
00804     bool GetUseFrameColor() const;
00805 
00809     void SetFrameColor(const KFbxColor& pColor);
00810 
00814     KFbxColor GetFrameColor() const;
00815 
00817 
00824 
00829     typedef enum 
00830     {
00831         eINTERACTIVE,
00832         eAT_RENDER
00833     } ECameraRenderOptionsUsageTime;
00834 
00838     void SetRenderOptionsUsageTime(ECameraRenderOptionsUsageTime pUsageTime);
00839 
00843     ECameraRenderOptionsUsageTime GetRenderOptionsUsageTime() const;
00844 
00848     void SetUseAntialiasing(bool pEnable);
00849 
00853     bool GetUseAntialiasing() const;
00854 
00858     void SetAntialiasingIntensity(double pIntensity);
00859 
00863     double GetAntialiasingIntensity() const;
00864 
00869     typedef enum 
00870     {
00871         eOVERSAMPLING_ANTIALIASING, 
00872         eHARDWARE_ANTIALIASING
00873     } ECameraAntialiasingMethod;
00874 
00878     void SetAntialiasingMethod(ECameraAntialiasingMethod pMethod);
00879 
00883     ECameraAntialiasingMethod GetAntialiasingMethod() const;
00884 
00889     void SetNumberOfSamples(int pNumberOfSamples);
00890 
00895     int GetNumberOfSamples() const;
00896 
00901     typedef enum 
00902     {
00903         eUNIFORM,
00904         eSTOCHASTIC
00905     } ECameraSamplingType;
00906 
00911     void SetSamplingType(ECameraSamplingType pType);
00912 
00917     ECameraSamplingType GetSamplingType() const;
00918 
00922     void SetUseAccumulationBuffer(bool pUseAccumulationBuffer);
00923 
00927     bool GetUseAccumulationBuffer() const;
00928 
00932     void SetUseDepthOfField(bool pUseDepthOfField);
00933 
00937     bool GetUseDepthOfField() const;
00938 
00943     typedef enum 
00944     {
00945         eCAMERA_INTEREST, 
00946         eSPECIFIC_DISTANCE
00947     } ECameraFocusDistanceSource;
00948 
00952     void SetFocusDistanceSource(ECameraFocusDistanceSource pSource);
00953 
00957     ECameraFocusDistanceSource GetFocusDistanceSource() const;
00958 
00963     void SetSpecificDistance(double pDistance);
00964 
00969     double GetSpecificDistance() const;
00970 
00974     void SetFocusAngle(double pAngle);
00975     
00979     double GetFocusAngle() const;
00980 
00982 
00990 
01000     void SetDefaultFieldOfView(double pFieldOfView);
01001 
01009     double GetDefaultFieldOfView() const;
01010 
01018     void SetDefaultFieldOfViewX(double pFieldOfViewX);
01019 
01026     double GetDefaultFieldOfViewX() const;
01027 
01034     void SetDefaultFieldOfViewY(double pFieldOfViewY);
01035 
01042     double GetDefaultFieldOfViewY() const;
01043 
01050     void SetDefaultOpticalCenterX(double pOpticalCenterX);
01051 
01058     double GetDefaultOpticalCenterX() const;
01059 
01066     void SetDefaultOpticalCenterY(double pOpticalCenterY);
01067 
01074     double GetDefaultOpticalCenterY() const;
01075 
01082     void SetDefaultFocalLength(double pFocalLength);
01083 
01091     double GetDefaultFocalLength() const;
01092 
01097     void SetDefaultRoll(double pRoll);
01098 
01103     double GetDefaultRoll() const;
01104 
01109     void SetDefaultTurnTable(double pTurnTable);
01110 
01115     double GetDefaultTurnTable() const;
01116 
01121     void SetDefaultBackgroundColor(const KFbxColor& pColor);
01122 
01127     KFbxColor GetDefaultBackgroundColor() const;
01128 
01130 
01136 
01141     K_DEPRECATED void SetBackgroundColor(const KFbxColor& pColor);
01142 
01147     K_DEPRECATED KFbxColor GetBackgroundColor() const;
01148 
01154     K_DEPRECATED void SetAngleOfView(double pAngleOfView);
01155 
01160     K_DEPRECATED double GetAngleOfView() const;
01161 
01167     K_DEPRECATED void SetFocalLength(double pFocalLength);
01168 
01173     K_DEPRECATED double GetFocalLength() const;
01174 
01176 
01177 
01178     void SetBackgroundTexture(KFbxTexture* pTexture);
01179 
01181 //
01182 //  WARNING!
01183 //
01184 //  Anything beyond these lines may not be documented accurately and is 
01185 //  subject to change without notice.
01186 //
01188 
01189 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01190 
01191     friend class KFbxGlobalCameraSettings;
01192     
01193 public:
01194 
01195     virtual KObject* GetFbxObject_internal();
01196     virtual KObject const*  GetFbxObject_internal() const;
01197 
01198     // Clone
01199     virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType) const;
01200 
01201 protected:
01202     static char const* GetNamePrefix() { return 0; }
01203 
01205     KFbxCamera& operator=(KFbxCamera const& pCamera);
01206 
01207     KFbxCamera(KFbxSdkManager& pManager, char const* pName);
01208     virtual ~KFbxCamera ();
01209 
01210     virtual void Destruct(bool pRecursive, bool pDependents);
01211 
01215     virtual void AddChannels(KFbxTakeNode *pTakeNode);
01216 
01220     virtual void RemoveChannels(KFbxTakeNode *pTakeNode);
01221 
01225     KFbxCamera_internal* mPH;
01226 
01227     virtual KString     GetTypeName() const;
01228     virtual KStringList GetTypeFlags() const;
01229 
01230 private:
01231 
01232     double ComputePixelRatio(kUInt pWidth, kUInt pHeight, double pScreenRatio = 1.3333333333);
01233 
01234     // Camera Position and Orientation
01235     KFbxVector4 mUpVector;
01236     KFbxVector4 mDefaultCameraInterestPosition;
01237 
01238     // Background Properties
01239     KString mBackgroundMediaName;
01240     KString mBackgroundFileName;
01241 
01242     // Camera Ortho Zoom
01243     double mOrthoZoom;
01244 
01245     // Camera View Options
01246     bool mShowInfoOnMoving;
01247     bool mDisplaySafeAreaOnRender;
01248     bool mShowAudio;
01249     KFbxColor mAudioColor;
01250 
01251     // Render Options
01252     ECameraAntialiasingMethod mAntialiasingMethod;
01253     ECameraSamplingType mSamplingType;
01254 
01255     friend class KFbxNode;
01256 
01257 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01258 
01259 };
01260 
01261 typedef KFbxCamera* HKFbxCamera;
01262 
01263 #include <fbxfilesdk_nsend.h>
01264 
01265 #endif // #ifndef _FBXSDK_CAMERA_H_
01266 
01267