Clone Function

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Clone Function

Post by Insomniacp »

Hello,
I noticed you have a clone function for ISceneNode, how well implemented is this? I was thinking I could create a second scene manager and preload all of my models in a different thread then simply clone them into the working scene manager. Is that something that is possible or does it still need work? I did notice in the terrain scene node it said it needed to be reworked since it recreates the terrain. Is that something common to the other nodes or is it just a few complex ones that were temporarily ignored? Actually on second thought I would rather make a move function since the old data need not be preserved in the loading scene manager.
Brainsaw
Posts: 1177
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: Clone Function

Post by Brainsaw »

From my experience it workes fine with most nodes, but some nodes (e.g. the particle system) don't have the clone method implemented.

Btw: I use templates for bullets and missiles and simply clone them when a shot is fired.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Clone Function

Post by hybrid »

you cannot load models in a separate thread. So this idea seems rather compilcated to use.
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Re: Clone Function

Post by Insomniacp »

I know it is complicated but you can get multiple scene managers. is it not safe because the driver overlaps between them? I was under the impression that the scenemanager was the main problem with threaded loading and since I can clone to a new manager that may solve that problem. Is that true or does having a second scene manager have no effect on loading models? If so what prevents it from being able to (IE the driver, or device maybe)?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Clone Function

Post by hybrid »

Yes, it's the driver. It's basically the texture upload to the gfx card which does not work in a separate thread.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Clone Function

Post by 3DModelerMan »

What if you created a null device in the other thread and copied the data using locks?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
CuteAlien
Admin
Posts: 9682
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Clone Function

Post by CuteAlien »

Textures are device-specific.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Clone Function

Post by hybrid »

Yeah, but locking and copying from one texture of one driver to another texture of the second driver could still work. Might need quite some time, though, and the meshes need to be copied as well (having two drivers is only possible with two devices, which don't share anything).
However, I'd prefer a lazy loading flag which loads the textures just into system RAM, and uploads to GPU only upon render or explicit user decision. Nice idea, but not yet implemented.
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Re: Clone Function

Post by Insomniacp »

what if the texture was preloaded in the driver before being used by the scene managers? Would that allow for being able to load everything else in a separate thread?
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Clone Function

Post by 3DModelerMan »

The driver would still access the texture cache... I don't know if it's thread safe or not. You might be able to synchronize access.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Clone Function

Post by hybrid »

Yes, some synchronization of the threads would be required anyway, but preloading would solve the hw driver problems.
Post Reply