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");
}