Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_MESHLOADER_H__
00009 #define __SP_MESHLOADER_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "Base/spInputOutput.hpp"
00014 #include "Base/spBaseFileFormatHandler.hpp"
00015 #include "SceneGraph/spSceneMesh.hpp"
00016 #include "SceneGraph/Animation/spNodeAnimation.hpp"
00017 #include "SceneGraph/Animation/spMorphTargetAnimation.hpp"
00018 #include "SceneGraph/Animation/spSkeletalAnimation.hpp"
00019 #include "RenderSystem/spTextureBase.hpp"
00020
00021
00022 namespace sp
00023 {
00024 namespace scene
00025 {
00026
00027
00029 enum EMeshLoaderFlags
00030 {
00031 MESHFLAG_SINGLE_MODEL = 0x0001,
00032 };
00033
00034
00035
00036
00037
00038
00039 class SP_EXPORT MeshLoader : public io::BaseFileFormatHandler
00040 {
00041
00042 public:
00043
00044 virtual ~MeshLoader()
00045 {
00046 }
00047
00048 virtual Mesh* loadMesh(const io::stringc &Filename, const io::stringc &TexturePath) = 0;
00049
00050 inline Mesh* loadMesh(const io::stringc &Filename, const io::stringc &TexturePath, const s32 Flags)
00051 {
00052 LoadingFlags_ = Flags;
00053 return loadMesh(Filename, TexturePath);
00054 }
00055
00056 protected:
00057
00058
00059
00060 MeshLoader() :
00061 io::BaseFileFormatHandler ( ),
00062 Mesh_ (0 ),
00063 Surface_ (0 ),
00064 Anim_ (0 ),
00065 LoadingFlags_ (0 )
00066 {
00067 }
00068
00069 inline bool openLoadFile(const io::stringc &Filename, const io::stringc &TexturePath)
00070 {
00071 Filename_ = Filename;
00072 TexturePath_ = TexturePath;
00073 Mesh_ = MemoryManager::createMemory<Mesh>("scene::Mesh");
00074
00075 return ( File_ = FileSys_.readResourceFile(Filename) ) != 0;
00076 }
00077
00078 inline bool hasFlag(s32 Flag) const
00079 {
00080 return (LoadingFlags_ & Flag) != 0;
00081 }
00082
00083
00084
00085 Mesh* Mesh_;
00086 video::MeshBuffer* Surface_;
00087 Animation* Anim_;
00088 s32 LoadingFlags_;
00089
00090 io::stringc TexturePath_;
00091
00092 };
00093
00094
00095
00096
00097
00098
00099 class SceneGraph;
00100
00101 class SP_EXPORT SceneLoader : public io::BaseFileFormatHandler
00102 {
00103
00104 public:
00105
00106 virtual ~SceneLoader()
00107 {
00108 }
00109
00110 virtual Mesh* loadScene(
00111 const io::stringc &Filename, const io::stringc &TexturePath, const s32 Flags
00112 ) = 0;
00113
00114 protected:
00115
00116
00117
00118 SceneLoader() :
00119 io::BaseFileFormatHandler ( ),
00120 Mesh_ (0 ),
00121 MeshBase_ (0 ),
00122 MeshTrans_ (0 ),
00123 Surface_ (0 ),
00124 Flags_ (0 )
00125 {
00126 }
00127
00128
00129
00130 Mesh* Mesh_;
00131 Mesh* MeshBase_;
00132 Mesh* MeshTrans_;
00133
00134 video::MeshBuffer* Surface_;
00135
00136 io::stringc TexturePath_;
00137
00138 s32 Flags_;
00139
00140 };
00141
00142
00143 }
00144
00145 }
00146
00147
00148 #endif
00149
00150
00151
00152