00001 /* 00002 * Mesh saver header 00003 * 00004 * This file is part of the "SoftPixel Engine" (Copyright (c) 2008 by Lukas Hermanns) 00005 * See "SoftPixelEngine.hpp" for license information. 00006 */ 00007 00008 #ifndef __SP_MESHSAVER_H__ 00009 #define __SP_MESHSAVER_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 #include "Base/spInputOutput.hpp" 00014 #include "Base/spBaseFileFormatHandler.hpp" 00015 #include "SceneGraph/Animation/spAnimation.hpp" 00016 #include "Base/spDimension.hpp" 00017 #include "SceneGraph/spSceneMesh.hpp" 00018 #include "RenderSystem/spTextureBase.hpp" 00019 00020 00021 namespace sp 00022 { 00023 namespace scene 00024 { 00025 00026 00027 /* 00028 * ======= MeshSaver class ======= 00029 */ 00030 00031 class SP_EXPORT MeshSaver : public io::BaseFileFormatHandler 00032 { 00033 00034 public: 00035 00036 virtual ~MeshSaver() 00037 { 00038 } 00039 00040 virtual bool saveMesh(Mesh* Model, const io::stringc &Filename) = 0; 00041 00042 protected: 00043 00044 /* Protected functions */ 00045 00046 MeshSaver() : 00047 io::BaseFileFormatHandler ( ), 00048 Mesh_ (0 ), 00049 Surface_ (0 ), 00050 Anim_ (0 ) 00051 { 00052 } 00053 00054 inline bool openSaveFile(Mesh* Model, const io::stringc &Filename) 00055 { 00056 Filename_ = Filename; 00057 Mesh_ = Model; 00058 00059 return ( File_ = FileSys_.openFile(Filename, io::FILE_WRITE) ) != 0; 00060 } 00061 00062 /* Members */ 00063 00064 Mesh* Mesh_; 00065 video::MeshBuffer* Surface_; 00066 Animation* Anim_; 00067 00068 }; 00069 00070 00071 } // /namespace scene 00072 00073 } // /namespace sp 00074 00075 00076 #endif 00077 00078 00079 00080 00081 00082 // ================================================================================