Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3507 Members - Latest Member: PienueDut

26. May 2012, 12:21:33 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Model Meta Data File
Pages: [1] 2
Print
Author Topic: Model Meta Data File  (Read 3144 times)
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« on: 10. February 2007, 06:53:21 pm »

For my own project I was going to make a Model Meta Data file. Probably in XML. It could list the type of the file (OBJ, Cal3D, ect.), the path of it, a fixed translation, rotation, and scaling to perform on the model before its loaded, along with (possibly) many other things.

After reading    
Re: Prescaling and Positioning
by Amos
I decided that this could really go into Xith-tk.

I'm asking for suggestions as to what people would like to see or what they want from something like this. Along with ways to implement it and so forth.

Here is the list of things I'd like to see:
  • Path to find the model. Can be absolute, relative to the meta file, or possibly relative to other base paths specified by the loader.
  • Model Type, ie what class to use to load it (ie org.xith3d.loaders.models.impl.obj.OBJLoader for example)
  • Some sort of static scaling, positioning, and rotating.
  • Extensibility. The ability to add additional meta data to the model. An example from my game is weapon mounting points for our ships. Each ship will have fixed places the different weapon models can be put on it.
  • Points for special effects. I'm not sure what Xith has to offer in the way of special effects so I'm not sure how this one would work yet.
Logged

"I like my method, what was my method again?" - Jon
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 10. February 2007, 07:34:38 pm »

Cool thing Smiley.

Model Type, ie what class to use to load it (ie org.xith3d.loaders.models.impl.obj.OBJLoader for example)

This should be an optional info. If the extension of the model file doesn't tell the ExtensionLoader correctly, which loader to use, than this info must be provided as an extension hint.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #2 on: 12. February 2007, 04:34:58 pm »

Suggestions :
- This filetype should have a graphical editor. I'll enjoy very much to do it once I have the specifications for it.
- For extensibility, just make a list of (serialized) "org.xith3d.datatypes.PlaceableImpl" associated with other Meta Data Model files. It should be OK.
- Don't forget an "Auto normal calculation" and "Smoothing mode" boolean parameters.
- About special effects, should this really be specified in the Meta Data Model file ?? If you want to anticipate the arrival of special effects applied to models as a whole, just create a "SpecialFX" abstract class/Interface? and include it in the File format.
- What about multiple sets of textures for one Model ? (Note : this change needs modifications in the Model class)
- What about animated textures ? (I plan to play with them during the following weeks, I think it needs OpenGL extensions to be optimal)
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 12. February 2007, 04:51:40 pm »

- Don't forget an "Auto normal calculation" and "Smoothing mode" boolean parameters.

Of course these ones are optional attributes, too.

- What about multiple sets of textures for one Model ? (Note : this change needs modifications in the Model class)

The Loader class (and extensions) alread have a "skin" parameter (which doesn't work for all loaders, though). This has to be guaranteed to work for all Loader implementations.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #4 on: 12. February 2007, 05:08:25 pm »

- Don't forget an "Auto normal calculation" and "Smoothing mode" boolean parameters.

Of course these ones are optional attributes, too.

- What about multiple sets of textures for one Model ? (Note : this change needs modifications in the Model class)

The Loader class (and extensions) alread have a "skin" parameter (which doesn't work for all loaders, though). This has to be guaranteed to work for all Loader implementations.

Marvin
Yeah.
Logged
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #5 on: 12. February 2007, 09:06:08 pm »

Suggestions :
- This filetype should have a graphical editor. I'll enjoy very much to do it once I have the specifications for it.
I look forward to getting a speck and loader working.


- For extensibility, just make a list of (serialized) "org.xith3d.datatypes.PlaceableImpl" associated with other Meta Data Model files. It should be OK.
Where is this "org.xith3d.datatypes.PlaceableImpl" class? I can't seem to find it. Also serializing things takes away the benefit of human readable data in the meta data file.


- What about multiple sets of textures for one Model ? (Note : this change needs modifications in the Model class)
The Loader class (and extensions) alread have a "skin" parameter (which doesn't work for all loaders, though). This has to be guaranteed to work for all Loader implementations.
What about a single model that has multiple textures on it. Reskining it would take more than a single parameter.


- What about animated textures ? (I plan to play with them during the following weeks, I think it needs OpenGL extensions to be optimal)
Animated Textures sound useful. Let me know when you have code implemented, but I'm not sure what the model meta file has to do with it.
Logged

"I like my method, what was my method again?" - Jon
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 12. February 2007, 09:30:19 pm »

Where is this "org.xith3d.datatypes.PlaceableImpl" class? I can't seem to find it. Also serializing things takes away the benefit of human readable data in the meta data file.

Hmmm... Doesn't Strg+Space automagically addthe appropriate import? I moved this class to org.xith3d.datatypes.impl. But don't forget to update to the latest SVN trunk, since this class is brandnew.

Marvin
Logged
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #7 on: 13. February 2007, 12:27:05 am »

For extensibility I want to create something like a XMLModelWraper, that enclosed the loaded model and contains extra data the user defines.

I'd have to alter the Model hierarchy a bit

Model (would be an interface)
 - XMLModelWraper
 - - MyModelWraper
 - Base Model (what is currently Model)
 - - OBJModel
 - - ASMModel
...

So MyModelWraper would be what an extension of what I intend to make for Xith. It would contain what ever user defined fields the person extending the class would want. It would have a method to override that would take the org.w3c.dom.Document and allow the user to extract from it the values to place in MyModelWraper's fields.
Logged

"I like my method, what was my method again?" - Jon
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #8 on: 13. February 2007, 01:53:14 am »

Model cannot be an interface. It must extend Node (in this case it extends TransformGroup, which is an indirect Node extension).

You could simply add a getter called getMetaData() to the Model class or to the XMLModelWrapper class.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #9 on: 13. February 2007, 03:26:34 pm »

Where is this "org.xith3d.datatypes.PlaceableImpl" class? I can't seem to find it. Also serializing things takes away the benefit of human readable data in the meta data file.
Certainly not. I was talking about serializing to XML (with XStream, for example), which is perfectly human-readable.

- What about animated textures ? (I plan to play with them during the following weeks, I think it needs OpenGL extensions to be optimal)
Animated Textures sound useful. Let me know when you have code implemented, but I'm not sure what the model meta file has to do with it.
Maybe specifying multiple texture files (e.g. texture_XXX.png, with XXX=[001..MAX]) ? In this case it would be good to have a way to specify the way it's named, rather than every file name..
Logged
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #10 on: 13. February 2007, 11:10:14 pm »

I was talking about serializing to XML (with XStream, for example), which is perfectly human-readable.
I'm not very familiar with XML in Java. I've use DOM4J a few times. However I was thinking I could fall back and use the JAXP interface. Does any one have any suggestions as to what is good (and reasonable efficient at reading XML)


Maybe specifying multiple texture files (e.g. texture_XXX.png, with XXX=[001..MAX]) ? In this case it would be good to have a way to specify the way it's named, rather than every file name..
I think I should wait to implement skinning until after I get the initial version working and maybe after skinning is supported by all the Model Loaders.


You could simply add a getter called getMetaData() to the Model class or to the XMLModelWrapper class.
The XMLModelWrapper class won't work unless there is an interface, because its supose to be able to wrap any kind of model, OBJ, ASM... So I think I'll make a getMetaData() on the Model class instead.
Logged

"I like my method, what was my method again?" - Jon
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #11 on: 13. February 2007, 11:59:08 pm »

JIBX is by far the most efficient and flexible XML binding that is still easy to use.

As long as you follow the JavaBeans standard, you can call the following code from the java.beans package without getting any libraries or changing ANY of your code:
Code:
       XMLEncoder e = new XMLEncoder(
                          new BufferedOutputStream(
                              new FileOutputStream("Test.xml")));
       e.writeObject(new JButton("Hello, world"));
       e.close();
...
       XMLDecoder d = new XMLDecoder(
                          new BufferedInputStream(
                              new FileInputStream("Test.xml")));
       Object result = d.readObject();
       d.close();
It's quick and dirty and not that great of a performer but you can load 10 or 20 thousand objects within a few seconds.

For a good comparison, check out http://www-128.ibm.com/developerworks/xml/library/x-databdopt2/
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #12 on: 14. February 2007, 01:50:22 pm »

horati, do you know how JIBX compares to XStream (http://xstream.codehaus.org/) in terms of performance ? IIRC, XStream is already used in Xith3D (and in my games), so I'd like to know which is best..
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #13 on: 14. February 2007, 02:18:11 pm »

Sorry to say it, but it performs dismally in comparison... approximately 3x-10x as long to perform tasks.  For more information, check out https://bindmark.dev.java.net/old-index.html.

I also noticed that it scored considerably lower in terms of subjective ease-of-use according to the author of that link.  I haven't used xstream but I have used JIBX and it rocks!!  It is the only binding framework that I have found that bends to match your Java model instead of forcing your Java model to bend to the XML model.
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #14 on: 14. February 2007, 02:46:34 pm »

Sorry to say it, but it performs dismally in comparison... approximately 3x-10x as long to perform tasks.  For more information, check out https://bindmark.dev.java.net/old-index.html.

I also noticed that it scored considerably lower in terms of subjective ease-of-use according to the author of that link.  I haven't used xstream but I have used JIBX and it rocks!!  It is the only binding framework that I have found that bends to match your Java model instead of forcing your Java model to bend to the XML model.
No need to be sorry, I admit I didn't study all the XML libs existing. OK, I'll switch to JIBX when I have time..
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic