00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CAL_SAVER_H
00012 #define CAL_SAVER_H
00013
00014
00015
00016
00017
00018 #include "cal3d/global.h"
00019 #include "cal3d/vector.h"
00020
00021
00022
00023
00024
00025 class CalCoreModel;
00026 class CalCoreSkeleton;
00027 class CalCoreBone;
00028 class CalCoreAnimation;
00029 class CalCoreAnimatedMorph;
00030 class CalCoreMesh;
00031 class CalCoreSubmesh;
00032 class CalCoreMaterial;
00033 class CalCoreKeyframe;
00034 class CalCoreMorphTrack;
00035 class CalCoreMorphKeyframe;
00036 class CalCoreTrack;
00037
00038
00039
00040
00041
00042
00046 class CalSaverAnimationOptions {
00047 public:
00048 bool bCompressKeyframes;
00049
00050 protected:
00051 CalVector keyframe_min;
00052 CalVector keyframe_scale;
00053 float duration;
00054
00055 friend class CalSaver;
00056 };
00057
00058 class CAL3D_API CalSaver
00059 {
00060 public:
00061 static bool saveCoreAnimation(const std::string& strFilename, CalCoreAnimation *pCoreAnimation, CalSaverAnimationOptions *pOptions = NULL);
00062 static bool saveCoreAnimatedMorph(const std::string& strFilename, CalCoreAnimatedMorph *pCoreAnimatedMorph);
00063 static bool saveCoreMaterial(const std::string& strFilename, CalCoreMaterial *pCoreMaterial);
00064 static bool saveCoreMesh(const std::string& strFilename, CalCoreMesh *pCoreMesh);
00065 static bool saveCoreSkeleton(const std::string& strFilename, CalCoreSkeleton *pCoreSkeleton);
00066
00067 protected:
00068 static bool saveCoreBones(std::ofstream& file, const std::string& strFilename, CalCoreBone *pCoreBone);
00069 static bool saveCoreKeyframe(std::ofstream& file, const std::string& strFilename, CalCoreKeyframe *pCoreKeyframe, int version,
00070 bool needTranslation, bool highRangeRequired, bool useAnimationCompression );
00071 static bool saveCompressedCoreKeyframe(std::ofstream& file, const std::string& strFilename, CalCoreKeyframe *pCoreKeyframe, CalSaverAnimationOptions *pOptions);
00072 static bool saveCoreSubmesh(std::ofstream& file, const std::string& strFilename, CalCoreSubmesh *pCoreSubmesh);
00073 static bool saveCoreTrack(std::ofstream& file, const std::string& strFilename, CalCoreTrack *pCoreTrack, int version, CalSaverAnimationOptions *pOptions = NULL);
00074 static bool saveCoreMorphKeyframe(std::ofstream& file, const std::string& strFilename, CalCoreMorphKeyframe *pCoreMorphKeyframe);
00075 static bool saveCoreMorphTrack(std::ofstream& file, const std::string& strFilename, CalCoreMorphTrack *pCoreMorphTrack);
00076
00077
00078 static bool saveXmlCoreSkeleton(const std::string& strFilename, CalCoreSkeleton *pCoreSkeleton);
00079 static bool saveXmlCoreAnimation(const std::string& strFilename, CalCoreAnimation *pCoreAnimation);
00080 static bool saveXmlCoreAnimatedMorph(const std::string& strFilename, CalCoreAnimatedMorph *pCoreAnimatedMorph);
00081 static bool saveXmlCoreMesh(const std::string& strFilename, CalCoreMesh *pCoreMesh);
00082 static bool saveXmlCoreMaterial(const std::string& strFilename, CalCoreMaterial *pCoreMaterial);
00083 };
00084
00085 #endif
00086
00087