kfbxcache.h
Go to the documentation of this file.00001
00004 #ifndef _FBXSDK_CACHE_H_
00005 #define _FBXSDK_CACHE_H_
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
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 #include <kfbxplugins/kfbxobject.h>
00049 #include <kfbxplugins/kfbxgroupname.h>
00050
00051 #include <fbxfilesdk_nsbegin.h>
00052
00053 class KFbxCache_internal;
00054 class KFbxVertexCacheDeformer;
00055
00064 class KFBX_DLL KFbxCache : public KFbxObject
00065 {
00066 KFBXOBJECT_DECLARE(KFbxCache);
00067
00068 public:
00073
00079 typedef enum
00080 {
00081 eUNKNOWN,
00082 ePC2,
00083 eMC
00084 } EFileFormat;
00085
00089 void SetCacheFileFormat(EFileFormat pFileFormat);
00090
00094 EFileFormat GetCacheFileFormat();
00095
00100 void SetCacheFileName(const char* pRelativeFileName, const char* pAbsoluteFileName);
00101
00106 void GetCacheFileName(KString& pRelativeFileName, KString& pAbsoluteFileName);
00107
00112 bool OpenFileForRead();
00113
00117 bool IsOpen();
00118
00122 bool CloseFile();
00123
00125
00130
00135 typedef enum
00136 {
00137 eMC_ONE_FILE,
00138 eMC_ONE_FILE_PER_FRAME
00139 } EMCFileCount;
00140
00146 bool OpenFileForWrite(EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName);
00147
00151 int GetChannelCount();
00152
00159 bool GetChannelName(int pChannelIndex, KString& pChannelName);
00160
00166 int GetChannelIndex(const char* pChannelName);
00167
00177 bool Read(int pChannelIndex, KTime& pTime, double* pBuffer, unsigned int pPointCount);
00178
00188 bool Write(int pChannelIndex, KTime& pTime, double* pBuffer, unsigned int pPointCount);
00189
00191
00196
00205 bool OpenFileForWrite(double pFrameStartOffset, double pSamplingFrameRate, unsigned int pSampleCount, unsigned int pPointCount);
00206
00210 unsigned int GetSampleCount();
00211
00215 unsigned int GetPointCount();
00216
00220 double GetFrameStartOffset();
00221
00225 double GetSamplingFrameRate();
00226
00235 bool Read(unsigned int pFrameIndex, double* pBuffer, unsigned int pPointCount);
00236
00245 bool Write(unsigned int pFrameIndex, double* pBuffer);
00246
00248
00253
00261 bool ConvertFromPC2ToMC(EMCFileCount pFileCount, double pSamplingFrameRate);
00262
00270 bool ConvertFromMCToPC2(double pSamplingFrameRate, unsigned int pChannelIndex);
00271
00273
00278
00282 KError& GetError();
00283
00300 typedef enum
00301 {
00302 eUNSUPPORTED_ARCHITECTURE,
00303 eINVALID_ABSOLUTE_PATH,
00304 eINVALID_SAMPLING_RATE,
00305 eINVALID_CACHE_FORMAT,
00306 eUNSUPPORTED_FILE_VERSION,
00307 eCONVERSION_FROM_PC2_FAILED,
00308 eCONVERSION_FROM_MC_FAILED,
00309 eCACHE_FILE_NOT_FOUND,
00310 eCACHE_FILE_NOT_OPENED,
00311 eCACHE_FILE_NOT_CREATED,
00312 eINVALID_OPEN_FLAG,
00313 eERROR_WRITING_SAMPLE,
00314 eERROR_READING_SAMPLE,
00315 eERROR_COUNT
00316 } EError;
00317
00321 EError GetLastErrorID();
00322
00326 char* GetLastErrorString();
00327
00329
00331 KFbxCache& operator=( const KFbxCache& pOther );
00332
00336 virtual KFbxObject::ENameSpace GetNameSpace() const;
00337
00339
00340
00341
00342
00343
00344
00346 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00347 static const char* CacheFilePropertyName;
00348 static const char* CacheFileAbsolutePathPropertyName;
00349 static const char* CacheFileTypePropertyName;
00350
00351
00352 virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType) const;
00353
00354 void FillPropertyList(void* pPropertyList);
00355
00356 typedef enum
00357 {
00358 _O_RDONLY,
00359 _O_WRONLY
00360 } EOpenFlag;
00361
00362 protected:
00363 bool OpenFile(EOpenFlag pFlag, EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName, unsigned int pSampleCount, unsigned int pPointCount, double pFrameStartOffset);
00364
00365 static char const* GetNamePrefix() { return CACHE_PREFIX; }
00366
00367 KFbxCache(KFbxSdkManager& pManager, char const* pName);
00368 virtual ~KFbxCache();
00369
00370 virtual void Destruct(bool pRecursive, bool pDependents);
00371
00372
00373 virtual KObject* GetFbxObject_internal();
00374 virtual KObject const* GetFbxObject_internal() const;
00375
00376
00377 KFbxCache_internal* mData;
00378
00379 friend class KFbxReaderFbx;
00380 friend class KFbxReaderFbx6;
00381 friend class KFbxWriterFbx;
00382 friend class KFbxWriterFbx6;
00383
00384 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00385 };
00386
00387 typedef KFbxCache* HKFbxCache;
00388
00389 #include <fbxfilesdk_nsend.h>
00390
00391 #endif //_FBXSDK_CACHE_H_