1 //****************************************************************************// 2 // saver.h // 3 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger // 4 //****************************************************************************// 5 // This library is free software; you can redistribute it and/or modify it // 6 // under the terms of the GNU Lesser General Public License as published by // 7 // the Free Software Foundation; either version 2.1 of the License, or (at // 8 // your option) any later version. // 9 //****************************************************************************// 10 11 #ifndef CAL_SAVER_H 12 #define CAL_SAVER_H 13 14 //****************************************************************************// 15 // Includes // 16 //****************************************************************************// 17 18 #include "cal3d/global.h" 19 #include "cal3d/vector.h" 20 21 //****************************************************************************// 22 // Forward declarations // 23 //****************************************************************************// 24 25 class CalCoreModel; 26 class CalCoreSkeleton; 27 class CalCoreBone; 28 class CalCoreAnimation; 29 class CalCoreMesh; 30 class CalCoreSubmesh; 31 class CalCoreMaterial; 32 class CalCoreKeyframe; 33 class CalCoreTrack; 34 35 //****************************************************************************// 36 // Class declaration // 37 //****************************************************************************// 38 39 /*****************************************************************************/ 40 /** The saver class. 41 *****************************************************************************/ 42 43 class CalSaverAnimationOptions { 44 public: 45 bool bCompressKeyframes; 46 47 protected: 48 CalVector keyframe_min; 49 CalVector keyframe_scale; 50 float duration; 51 52 friend class CalSaver; 53 }; 54 55 class CAL3D_API CalSaver 56 { 57 public: 58 static bool saveCoreAnimation(const std::string& strFilename, CalCoreAnimation *pCoreAnimation, CalSaverAnimationOptions *pOptions = NULL); 59 static bool saveCoreMaterial(const std::string& strFilename, CalCoreMaterial *pCoreMaterial); 60 static bool saveCoreMesh(const std::string& strFilename, CalCoreMesh *pCoreMesh); 61 static bool saveCoreSkeleton(const std::string& strFilename, CalCoreSkeleton *pCoreSkeleton); 62 63 protected: 64 static bool saveCoreBones(std::ofstream& file, const std::string& strFilename, CalCoreBone *pCoreBone); 65 static bool saveCoreKeyframe(std::ofstream& file, const std::string& strFilename, CalCoreKeyframe *pCoreKeyframe); 66 static bool saveCompressedCoreKeyframe(std::ofstream& file, const std::string& strFilename, CalCoreKeyframe *pCoreKeyframe, CalSaverAnimationOptions *pOptions); 67 static bool saveCoreSubmesh(std::ofstream& file, const std::string& strFilename, CalCoreSubmesh *pCoreSubmesh); 68 static bool saveCoreTrack(std::ofstream& file, const std::string& strFilename, CalCoreTrack *pCoreTrack, CalSaverAnimationOptions *pOptions = NULL); 69 70 static bool saveXmlCoreSkeleton(const std::string& strFilename, CalCoreSkeleton *pCoreSkeleton); 71 static bool saveXmlCoreAnimation(const std::string& strFilename, CalCoreAnimation *pCoreAnimation); 72 static bool saveXmlCoreMesh(const std::string& strFilename, CalCoreMesh *pCoreMesh); 73 static bool saveXmlCoreMaterial(const std::string& strFilename, CalCoreMaterial *pCoreMaterial); 74 }; 75 76 #endif 77 78 //****************************************************************************// 79