Reusing a loaded model?

View: New views
3 Messages — Rating Filter:   Alert me  

Reusing a loaded model?

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,
I am working on a game which loads several models with the loader interface. The models are stored in files. I use these models very often in my game (i.e. houses), but every use they are scaled,transformed .. At this time I load every model new from file, this takes a long time. What is the best way to save memory and share the default loaded model in my BranchGraph?

Thank you for your help

Nice regards
Chris
[Message sent by forum member 'chhrabia' (c.hrabia@...)]

http://forums.java.net/jive/thread.jspa?messageID=370929

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Reusing a loaded model?

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

I have done it this way:

Load a Model, Put it into a sharedgroup and return Links instead of Branchgroups. After I put the sharedgroup into a hashmap
Everytime I load model, I check the hashmap, if a model was loaded from the same path and then I return the one from hashmap or load a new one.

Chris
[Message sent by forum member 'chhrabia' (c.hrabia@...)]

http://forums.java.net/jive/thread.jspa?messageID=370953

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Reusing a loaded model?

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Chris,

That's a workable strategy.  I've heard (probably on this forum) that SharedGroups aren't good for performance.  You can also do something like modelFromCache.cloneTree(false, false) where modelFromCache is the BranchGroup you got from the loaded scene.  Since it appears geometry and appearances don't get copied when you cloneTree, this turns out to be not terribly memory intensive.  I'd be curious if anyone has evaluated the rendering vs memory tradeoffs of these two approaches.

Bill
[Message sent by forum member 'weiland' (weiland@...)]

http://forums.java.net/jive/thread.jspa?messageID=371165

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...