Comments (11)
Coming to adding and removing, you can do that already in the current development version. See the clear
method in the ResourceLoader
class. I think this is what you are trying to achieve.
Coming to the second point, I don't think that is easy to implement, as I still haven't experimented on how multithreading will effect the GLFW and LWJGL. But if it was achieved, it would be a good addition to the engine. Thanks for your suggestions.
from silenceengine.
Ok here Ill show you your own code -_-
public void clear(boolean dispose)
{
if (dispose) dispose();
fonts.clear();
fontsToLoad.clear();
textures.clear();
texturesToLoad.clear();
sounds.clear();
soundsToLoad.clear();
models.clear();
modelsToLoad.clear();
}
This clears all your lists and maps so it is no longer possible to old loaded models from the Loader after this call is made. I was thinking more along the lines of adding a way to actively add items to those maps something like an addModel(Model model)
method that allows the engine to cleanup at the end and a removeModel(int modeID)
that allows for cleanup of the model before the engine finishes without needed to clear the whole list and possibly even keeps that ID so that the user knows it has to be loaded again.
from silenceengine.
You didn't understand my words, it is possible to reuse the models after clearing these maps. But you have to do so manually and get a reference to the loaded objects. Then you clear the maps, redefine your new resources and load them. Or it may also be that I may not have clearly understood you. My idea is that this is a ResourceLoader
and not a ResourceManager
. There is a difference between them in my opinion.
from silenceengine.
OK then my second suggestion still remains but you should probably make a basic resource manager and move the your maps of objects to that so that the only thing the loader handles is loading though its up to you what you do with your engine
In how to load and do things asynchronously as long as the initial thread handles the window and lwjgl stuff it should work fine though synchronization becomes an issue so if you do add it it would probably be a more advanced feature or hidden from the user
from silenceengine.
Thanks for your suggestion, it will be done in 0.0.4a release. I'll be leaving it open until it is done in 0.0.4a.
from silenceengine.
I have re-implemented the ResourceLoader so that now it does asynchronous loading of resources. And by resource map, do you mean a reference counted resource cache or something?
from silenceengine.
wow I've been slow recently -_-, well being sick does that would be a resource manager. I was talking about a way to add and remove different items from what was the internal list. I have yet to look at the new code that you wrote but if the core is still the same the idea was that it would make it so that you could use the resource loader to load items as needed without loosing the reference to the object or having to reload it when you reset the loader as it kept a reference and cleaned up after itself as I remember.
from silenceengine.
Okay now that there are a lot of changes in the new resource loader, I would like to know what you are thinking about this. This loader does load asynchronously, has the ability to load at anytime in between, and create as many loaders as you want. See the wiki for the information on what's been changed recently.
Are there any new things that I should have in it? Of course, I do plan to make the rendering of the progress controllable from outside so it might be possible not to block the game loop when loading takes place in middle of the game.
from silenceengine.
You could probably decouple it from rendering or just add a secondary method or something that tells it not to render a loading screen just because you don't always want a loading screen showing up in a seperate window like if your main loop shows its own loading screen that can be shifted (those are cool and give the user something to do while the gane is loading) while the loading takes place in another thread
other than that though it looks good to me (trying to get my port of TWL to work properly with LWJGL 3 though and its a pain though 90% of it does work now)
from silenceengine.
This is now done. I've added another method startLoading(boolean async)
that when set async to true, this doesn't take the loop into it's hands. Then through the isDone()
and renderLoadingScreen()
methods, you can display the resource manager to the screen.
I'm considering to rename the renderLoadingScreen()
to update()
so that when one sets the rendering callback to null, then it ignores rendering the progress. That is because the progress is currently calculated in renderLoadingScreen()
method inorder to smoothly increase the progress bar.
Any opinions on this? See the latest ResourceLoaderTest for more info on this.
from silenceengine.
This is done using commit e67e01e so I'm closing this issue. If you have anything to say, you can still comment here.
from silenceengine.
Related Issues (20)
- Wav file playing incorrect in desktop backend HOT 1
- Use DrawElement with a IntBuffer (transformed in ByteBuffer) for Indexes of element HOT 3
- Streams support HOT 3
- AMD shouts on Pre GL3 shaders in Core profile HOT 1
- Implement model loading API HOT 1
- Issue with parsing APK HOT 13
- Re-Evaluate iOS support HOT 2
- A reasonable way to handle files loading HOT 6
- Modularity for non essential features HOT 3
- Source and Javadocs not available HOT 1
- There are any screen of the game editor? HOT 2
- Add error callbacks to all asynchronous methods
- Fix performance issue on DynamicTree2D and DynamicTree3D HOT 1
- Add a dialog system for modal dialogs `prompt`, `alert` and `confirm` in the JS style. HOT 1
- Implement a `FileWriter` for writing to files on Android and LWJGL backends
- Android backend crashes on relaunch
- Implement Preferences API for persistent storage of Key-Value pair objects.
- Creating polygon convex hull from image HOT 1
- Clean SceneGraph and Entity Component API
- Forum is not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silenceengine.