return false;
}
+ LoaderData *ldata = new LoaderData;
+ ldata->aiscn = aiscn;
+ ldata->fname = std::string(fname);
+ loader_data = (void*)ldata;
+ }
+
+ /* then, assuming we have successfully loaded everything, proceed to construct
+ * all the engine objects, which require access to the OpenGL context
+ */
+ if(flags & SCNLOAD_STAGE_GL) {
+ if(!loader_data) {
+ error_log("second stage scene loader failed to find valid I/O data\n");
+ return false;
+ }
+
+ LoaderData *ldata = (LoaderData*)loader_data;
+ const aiScene *aiscn = ldata->aiscn;
+ fname = ldata->fname.c_str();
+
+ clear(); // clear any previous data (TODO: add flag for not clearing)
+
// assimp adds its own root node, which might have transformations
Vec3 root_pos, root_scaling(1.0, 1.0, 1.0);
Quat root_rot;
nodes->set_scaling(root_scaling);
}
- LoaderData *ldata = new LoaderData;
- ldata->aiscn = aiscn;
- ldata->fname = std::string(fname);
- loader_data = (void*)ldata;
- }
-
- /* then, assuming we have successfully loaded everything, proceed to construct
- * all the engine objects, which require access to the OpenGL context
- */
- if(flags & SCNLOAD_STAGE_GL) {
- if(!loader_data) {
- error_log("second stage scene loader failed to find valid I/O data\n");
- return false;
- }
-
- LoaderData *ldata = (LoaderData*)loader_data;
- const aiScene *aiscn = ldata->aiscn;
- fname = ldata->fname.c_str();
-
// load all meshes
for(unsigned int i=0; i<aiscn->mNumMeshes; i++) {
aiMesh *aimesh = aiscn->mMeshes[i];
bool SceneSet::load_scene(Scene *scn, const char *fname)
{
- scn->clear();
return scn->load(fname, SCNLOAD_FLIPTEX | SCNLOAD_STAGE_IO);
}