00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ASSIMPLOADER_H
00016 #define ASSIMPLOADER_H
00017
00018 #include "config_assimp.h"
00019 #include "filename.h"
00020 #include "modelRoot.h"
00021 #include "texture.h"
00022
00023 #include "aiScene.h"
00024
00025
00026
00027
00028
00029
00030
00031 class AssimpLoader : public TypedReferenceCount {
00032 public:
00033 AssimpLoader();
00034 virtual ~AssimpLoader();
00035
00036 void get_extensions(string &ext) const;
00037
00038 bool read(const Filename &filename);
00039 void build_graph();
00040
00041 public:
00042 bool _error;
00043 PT(ModelRoot) _root;
00044 Filename _filename;
00045 Mutex _lock;
00046
00047 private:
00048 Assimp::Importer _importer;
00049 const aiScene *_scene;
00050
00051
00052 PT(Texture) *_textures;
00053 CPT(RenderState) *_mat_states;
00054 PT(Geom) *_geoms;
00055 unsigned int *_geom_matindices;
00056
00057 void load_texture(size_t index);
00058 void load_texture_stage(const aiMaterial &mat, const aiTextureType &ttype, CPT(TextureAttrib) &tattr);
00059 void load_material(size_t index);
00060 void load_mesh(size_t index);
00061 void load_node(const aiNode &node, PandaNode *parent);
00062 void load_light(const aiLight &light);
00063 };
00064
00065 #include "assimpLoader.I"
00066
00067 #endif