If I load the model the first time, I can get the loading working like a charm with the code below. But from the second time (when the model is already cached), it hangs the do_frame.
I want it to be cached AND async loaded.
I guess there's some weird lock when using bamcache that there's not when using the egg. Ok, the cache loads much faster, but it hangs the screen for the secs (it hangs the movie in my case).
It's a bug? Am I doing something wrong?
- Code: Select all
NodePath box = window->load_model(render, "box");
PT(Loader) loader = new Loader("My Async Loader");
PT(ModelLoadRequest) request = new ModelLoadRequest("MyPandaModel", "ModelWithHeavyTexture.egg", options, loader);
/* Until here is all instantly */
bool loaded = false;
nout << "Before do_frame" << endl;
/* Placeholder loader screen */
box.set_x(box, 2 * ClockObject::get_global_clock()->get_dt());
/* Here it hangs when reading from cache */
nout << "After do frame" << endl;
my_model = NodePath(request->get_model());
loaded = true;