www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: mystara on March 17, 2007, 06:20:36 pm

Title: 3DS -> XML
Post by: mystara on March 17, 2007, 06:20:36 pm
Hello,

Are there any means for converting from a 3DS model to the proprietary XML format used in jpct?

Cheers!
Title: Re: 3DS -> XML
Post by: EgonOlsen on March 17, 2007, 07:16:09 pm
You may serialize a World to XML. So just add the object to a (dummy) world and create a XML from that. You may then get the object back from the (dummy?) world after loading the XML. It's a bit of an overhead but not much.
Title: Re: 3DS -> XML
Post by: mystara on March 18, 2007, 05:05:13 pm
D'oh,
That's exactly what I was looking for. Somehow I managed to miss it.

So, in keeping with my new tradition, I have another stupid question.

I've exported a scene (with models and textures) to XML by the method you mention above. It contains a texture_list element with a number of texture elements.
When the scene is loaded back (using Loader) it mentions that the textures have been "added to texture manager" but the scene is rendered without textures. I've tried changing the names of the textures in the XML file, but nothing different happens.

Any ideas? Is there something else I have to do to make the textures work?
Title: Re: 3DS -> XML
Post by: EgonOlsen on March 18, 2007, 07:22:32 pm
Like when loading a 3DS, you've to add the textures to the TextureManager with the proper names by yourself. The Loader doesn't do this for you.
Title: Re: 3DS -> XML
Post by: mystara on March 18, 2007, 08:24:04 pm
Thanks for the reply,
I did consider this, but the XML has caused the textures to be 'added' to TextureManager (via the XML file), which prevents me from loading them.

My current approach simply performs 'replaceTexture' on each texture. But I'm wondering if there's a better approach to this?

Title: Re: 3DS -> XML
Post by: EgonOlsen on March 19, 2007, 12:12:42 am
The behaviour is the same as it is with the 3ds loader. You may add them before loading the model with the correct names and Loader will use them or, if you don't, Loader will add dummy textures with the correct names that you may replace afterwards. Which way you prefer is up to you.
Title: Re: 3DS -> XML
Post by: mystara on March 19, 2007, 08:40:33 am
Thanks :)