fbxsdk/scene/geometry/fbxcache.h Source File
 
 
 
fbxsdk/scene/geometry/fbxcache.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_SCENE_GEOMETRY_CACHE_H_
00014 #define _FBXSDK_SCENE_GEOMETRY_CACHE_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/fbxobject.h>
00019 #include <fbxsdk/core/base/fbxstatus.h>
00020 
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022 
00023 class FbxCache_internal;
00024 
00037 class FBXSDK_DLL FbxCache : public FbxObject
00038 {
00039     FBXSDK_OBJECT_DECLARE(FbxCache, FbxObject);
00040 
00041 public:
00046 
00049         enum EFileFormat
00050         {
00051             eUnknownFileFormat, 
00052             eMaxPointCacheV2,   
00053             eMayaCache                  
00054         };
00055 
00060         void SetCacheFileFormat(EFileFormat pFileFormat, FbxStatus* pStatus = NULL);
00061 
00065         EFileFormat GetCacheFileFormat() const;
00066 
00072         void SetCacheFileName(const char* pRelativeFileName_UTF8, const char* pAbsoluteFileName_UTF8, FbxStatus* pStatus = NULL);
00073 
00078         void GetCacheFileName(FbxString& pRelativeFileName_UTF8, FbxString& pAbsoluteFileName_UTF8) const;
00079 
00084         bool OpenFileForRead(FbxStatus* pStatus=NULL);
00085 
00090         bool IsOpen(FbxStatus* pStatus = NULL) const;
00091 
00096         bool CloseFile(FbxStatus* pStatus = NULL);
00097 
00102         double GetSamplingFrameRate(FbxStatus* pStatus=NULL);
00103 
00108         FbxTime GetCacheTimePerFrame(FbxStatus* pStatus = NULL);
00109 
00111 
00116 
00119         enum EMCFileCount
00120         {
00121                         eMCOneFile,                     
00122             eMCOneFilePerFrame  
00123         };
00124 
00127         enum EMCDataType
00128         {
00129             eUnknownData,               
00130             eDouble,                    
00131             eDoubleArray,               
00132             eDoubleVectorArray, 
00133             eInt32Array,                
00134             eFloatArray,                
00135             eFloatVectorArray   
00136         };
00137 
00139         enum EMCBinaryFormat
00140         {
00141             eMCC,       
00142             eMCX        
00143         };
00144 
00154         bool OpenFileForWrite(EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName, EMCBinaryFormat pBinaryFormat, EMCDataType pMCDataType = eDoubleVectorArray, const char* pInterpretation = "Points", FbxStatus* pStatus = NULL);
00155 
00166         bool AddChannel(const char* pChannelName, EMCDataType pMCDataType, const char* pInterpretation, unsigned int& pChannelIndex, FbxStatus* pStatus = NULL);     
00167 
00172         int  GetChannelCount(FbxStatus* pStatus = NULL);
00173 
00181         bool GetChannelName(int pChannelIndex, FbxString& pChannelName, FbxStatus* pStatus = NULL);
00182 
00190         bool GetChannelDataType(int pChannelIndex, EMCDataType& pChannelType, FbxStatus* pStatus = NULL);
00191 
00197         int  GetChannelIndex(const char* pChannelName, FbxStatus* pStatus = NULL);
00198 
00208         bool Read(int pChannelIndex, FbxTime& pTime, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus = NULL);
00209 
00219         bool Read(int pChannelIndex, FbxTime& pTime, float* pBuffer, unsigned int pPointCount, FbxStatus* pStatus = NULL);
00220 
00230         bool Read(int pChannelIndex, FbxTime& pTime, int* pBuffer, unsigned int pPointCount, FbxStatus* pStatus = NULL);
00231 
00238         bool BeginWriteAt( FbxTime& pTime, FbxStatus* pStatus = NULL );
00239 
00254         bool Write(int pChannelIndex, FbxTime& pTime, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus = NULL);
00255 
00270         bool Write(int pChannelIndex, FbxTime& pTime, float* pBuffer, unsigned int pPointCount, FbxStatus* pStatus = NULL);
00271 
00286         bool Write(int pChannelIndex, FbxTime& pTime, int* pBuffer, unsigned int pPointCount, FbxStatus* pStatus = NULL);
00287 
00294         bool EndWriteAt(FbxStatus* pStatus = NULL);
00295 
00303         bool GetAnimationRange(int pChannelIndex, FbxTime &pTimeStart, FbxTime &pTimeEnd, FbxStatus* pStatus = NULL);
00304 
00310         bool GetCacheType(EMCFileCount& pFileCount, FbxStatus* pStatus = NULL);
00311 
00318         bool GetChannelInterpretation(int pChannelIndex, FbxString& pInterpretation, FbxStatus* pStatus = NULL);
00319 
00322         enum EMCSamplingType
00323         {
00324             eSamplingRegular,   
00325             eSamplingIrregular  
00326         };
00327 
00334         bool GetChannelSamplingType(int pChannelIndex, EMCSamplingType& pSamplingType, FbxStatus* pStatus = NULL);
00335 
00343         bool GetChannelSamplingRate(int pChannelIndex, FbxTime& pSamplingRate, FbxStatus* pStatus = NULL);
00344 
00351         bool GetChannelSampleCount(int pChannelIndex, unsigned int& pSampleCount, FbxStatus* pStatus = NULL);
00352 
00360         bool GetChannelPointCount(int pChannelIndex, FbxTime pTime, unsigned int& pPointCount, FbxStatus* pStatus = NULL);
00361 
00367         int  GetCacheDataFileCount(FbxStatus* pStatus = NULL) const;
00368 
00378         bool GetCacheDataFileName(int pIndex, FbxString& pRelativeFileName, FbxString& pAbsoluteFileName, FbxStatus* pStatus = NULL);
00379 
00388         bool EnableMultiChannelFetching(bool pMultiChannelFetching, FbxStatus* pStatus = NULL);
00389         
00398         bool GetNextTimeWithData(FbxTime pCurTime, FbxTime& pNextTime, int pChannelIndex = -1, FbxStatus* pStatus = NULL);
00399         
00405         int GetDataCount(int pChannelIndex, FbxStatus* pStatus = NULL);
00406         
00414         bool GetDataTime(int pChannelIndex, unsigned int pDataIndex, FbxTime& pTime, FbxStatus* pStatus = NULL);
00415 
00417 
00422 
00432         bool OpenFileForWrite(double pFrameStartOffset, double pSamplingFrameRate, unsigned int pSampleCount, unsigned int pPointCount, FbxStatus* pStatus=NULL);
00433 
00438         unsigned int GetSampleCount(FbxStatus* pStatus = NULL);
00439 
00444         unsigned int GetPointCount(FbxStatus* pStatus = NULL);
00445 
00450         double GetFrameStartOffset(FbxStatus* pStatus = NULL);
00451 
00460         bool Read(unsigned int pFrameIndex, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus = NULL);
00461 
00470         bool Write(unsigned int pFrameIndex, double* pBuffer, FbxStatus* pStatus = NULL);
00471 
00473 
00478 
00487         bool ConvertFromPC2ToMC(EMCFileCount pFileCount, double pSamplingFrameRate, EMCBinaryFormat pBinaryFormat, FbxStatus* pStatus = NULL);
00488 
00496         bool ConvertFromMCToPC2(double pSamplingFrameRate, unsigned int pChannelIndex, FbxStatus* pStatus = NULL);
00497 
00499 
00500 
00501 /*****************************************************************************************************************************
00502 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00503 *****************************************************************************************************************************/
00504 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00505     static const char* sCacheFilePropertyName;
00506     static const char* sCacheFileAbsolutePathPropertyName;
00507     static const char* sCacheFileTypePropertyName;
00508     
00509     enum EOpenFlag
00510     {
00511         eReadOnly,
00512         eWriteOnly
00513     };
00514 
00515 protected:
00516     bool OpenFile(EOpenFlag pFlag, EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName, const char* pInterpretation, unsigned int pSampleCount, unsigned int pPointCount, double pFrameStartOffset, FbxStatus* pStatus, EMCDataType pMCDataType = eDoubleVectorArray, EMCBinaryFormat pBinaryFormat = eMCX); 
00517 
00518     virtual void Construct( const FbxCache* pFrom );
00519     virtual void ConstructProperties(bool pForceSet);
00520     virtual void Destruct(bool pRecursive);
00521 
00522     // Cache
00523     FbxCache_internal* mData;
00524 
00525 private:
00526     FbxPropertyT<FbxString> CacheFile;
00527     FbxPropertyT<FbxString> CacheFileAbsolutePath;
00528     FbxPropertyT<FbxEnum> CacheFileType;
00529 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00530 };
00531 
00532 inline EFbxType FbxTypeOf(const FbxCache::EFileFormat&){ return eFbxEnum; }
00533 
00534 #include <fbxsdk/fbxsdk_nsend.h>
00535 
00536 #endif /* _FBXSDK_SCENE_GEOMETRY_CACHE_H_ */