abhijitnandy2011 / Age-of-Steam

A WebGL based train simulation
MIT License
0 stars 0 forks source link

Create a Resource Manager #8

Open abhijitnandy2011 opened 8 years ago

abhijitnandy2011 commented 8 years ago

It should be able to load resources - meshes mostly, also textures asynchronously. It should be able to send an event when done to any subscribers that a resource that was requested is ready. When registering a resource fetch request, the user registers a lambda which can be called back.

The Resource Manager returns a Resource object which can be used to check if the resource has loaded yet. After a resource is loaded the callback will also have this Resource object passed as an argument. The Resource can be used to get to the actual mesh, texture, file etc.

abhijitnandy2011 commented 8 years ago

Caching of resources can happen in IndexDB. Resources will be reloaded here if marked as changed in the site, we store the last modified time stamp in the cache.