X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fsceneload.cc;h=58d186558c161e332281c0a0f44260a7223d0c3e;hb=e99c236d23e4a27a1ec606382d9fb517e7a8ae65;hp=ad6e61ec5b625c9a469bf545f25dbc4c7c48208b;hpb=b30241a8a51be904b22459a1d0cc3322e0a505d9;p=laserbrain_demo diff --git a/src/sceneload.cc b/src/sceneload.cc index ad6e61e..58d1865 100644 --- a/src/sceneload.cc +++ b/src/sceneload.cc @@ -13,6 +13,7 @@ #include #include #include +#include "app.h" #include "scene.h" #include "objmesh.h" #include "datamap.h" @@ -25,7 +26,7 @@ static Mesh *load_mesh(Scene *scn, const aiScene *aiscn, unsigned int flags, con /*static const char *mprop_semantic(int x); static int count_textures(const aiMaterial *aimat);*/ static int assimp_textype(aiTextureType type); -static const char *assimp_textypestr(aiTextureType type); +//static const char *assimp_textypestr(aiTextureType type); static Mat4 assimp_matrix(const aiMatrix4x4 &aim); @@ -199,10 +200,11 @@ static bool load_material(Scene *scn, Material *mat, const aiMaterial *aimat) *dptr++ = *sptr == '\\' ? '/' : *sptr; } while(*sptr++); + if(!fname || !*fname) continue; + int textype = assimp_textype(aitype); - info_log("loading %s texture: %s\n", assimp_textypestr(aitype), fname); - Texture *tex = scn->texset->get_texture(fname, TEX_2D, &scn->datamap); + Texture *tex = texman.get_texture(fname, TEX_2D, &scn->datamap); assert(tex); mat->textures.push_back(tex); @@ -335,7 +337,7 @@ static int assimp_textype(aiTextureType type) return MTL_TEX_UNKNOWN; } -static const char *assimp_textypestr(aiTextureType type) +/*static const char *assimp_textypestr(aiTextureType type) { switch(type) { case aiTextureType_DIFFUSE: @@ -353,7 +355,7 @@ static const char *assimp_textypestr(aiTextureType type) break; } return "unknown"; -} +}*/ static Mat4 assimp_matrix(const aiMatrix4x4 &aim) { @@ -377,6 +379,7 @@ Scene *SceneSet::create_scene() bool SceneSet::load_scene(Scene *scn, const char *fname) { + scn->clear(); return scn->load(fname, SCNLOAD_FLIPTEX | SCNLOAD_STAGE_IO); }