Horde3D http://horde3d.org/forums/ |
|
Reloading resources http://horde3d.org/forums/viewtopic.php?f=8&t=644 |
Page 1 of 1 |
Author: | jimbo [ 14.02.2009, 10:59 ] |
Post subject: | Reloading resources |
Hi, reloading resources at runtime with the new getNextResource() function is really handy, I've made a litte helper function to reload most resources, it works great but there are a few issues: - The function getNextResource() is exported as iterateResources() in the community svn branch. - Reloading ResourceTypes::Code resources crashes the application. - When material uniforms, you have to reset them. Using HDR you need to set the HDR params again: Code: Horde3D::setMaterialUniform(post_mat_res, "hdrParams", 6, 1.1, 0.08, 0); Code: bool reloadResources() {
ResHandle reshandle=0; int restype; while(reshandle=Horde3D::getNextResource(ResourceTypes::Undefined, reshandle)) { restype=Horde3D::getResourceType(reshandle); if(restype == ResourceTypes::Code) continue; // reloading code resources crashes app // logger("unloading: %s\n", Horde3D::getResourceName(reshandle)); Horde3D::unloadResource(reshandle); } return Horde3DUtils::loadResourcesFromDisk("content"); } |
Author: | marciano [ 15.02.2009, 12:31 ] |
Post subject: | Re: Reloading resources |
Thanks for the feedback. The first two problems are easy to fix. Concerning the reset of the material uniforms: it could make sense to save and take over the current uniform values. But it is also a valid view that you expect the uniforms to be reset to the values defined in the material. Saving the uniforms would also have some more technical issues (e.g. the reloaded material could declare different uniforms) so I think the current behavior is ok. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |