Horde3D

Next-Generation Graphics Engine
It is currently 15.05.2024, 02:52

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Reloading resources
PostPosted: 14.02.2009, 10:59 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
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");
}


Top
 Profile  
Reply with quote  
 Post subject: Re: Reloading resources
PostPosted: 15.02.2009, 12:31 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group