[ODE] XML ODE Data Interchange Format (revision 5)

Jon Watte hplus-ode at mindcontrol.org
Sat Mar 13 15:42:30 MST 2004


I would recommend that you allow the addition of more components. Thus, I'd suggest that you add a format="x,y,z" attribute to the "vertices" element, which is a comma-separated list of components, where the components x, y and z are currently well-defined, and others should be ignored. This means that a loader has to have slightly more smarts, in that it has to count how many numbers there are per vertex (>= 3) and remember which index corresponds to each of x, y and z for a vertex. However, it buys lots of flexibility.

This is very useful for people who attach other things to their vertices, such as normals, friction, surface Id, etc.

Cheers,

			/ h+


-----Original Message-----
From: William Denniss [mailto:lists at omegadelta.net]
Sent: Saturday, March 13, 2004 3:41 PM
To: Jon Watte
Cc: Chris Gregan; ode at q12.org
Subject: RE: [ODE] XML ODE Data Interchange Format (revision 5)


Lets go with the first option, the <v> tags are hardly necessary - and
it is the smallest size of the three.

I agree that not everything must be represented in XML.  In some cases
it makes life easier, but for a simple array of numbers, it's hardly
necessary.


How's this for the spec:

Vertices are represented as a one dimensional array of floats whose
length is three times the vertex count (i.e. there are three floats for
each vertex).  The data is delimited by commas and new lines, spaces are
ignored.

Thus:

<vertices>
0,1,2,1,2,3
</vertices>

<vertices>
0,1,2
1,2,3
</vertices>

and

<vertices>
0  , 1.0, 2
1.0, 2.1, 3
</vertices>

are all valid.

I guess whatever method we adopt for the vertices, we should adopt for
the matrix representation, ie.

<matrix>
0,1,2,3
4,5,6,3
4,2,1,2
3,4,5,6
</matrix>


Do you think the format attribute is really needed when we know exactly
ahead of time what the data should be?  I don't want to make the job of
writing a parser any harder than it need be.

Thanks for your feedback.

Will.

On Sun, 2004-03-14 at 03:07, Jon Watte wrote:
> Another approach is to use the CDATA for vertices:
> 
> <vertices format="x,y,z">
> 0,1,2
> 1,2,3
> </vertices>
> 
> Also, putting the x, y and z as attributes of the "v" tag seems a poor
> choice if file size is what you want. If you don't like using
> linefeeds or other separators in your CDATA for some reason, try this:
> 
> <vertices format="x,y,z">
> <v>1,2,3</v>
> <v>2,3,4</v>
> </vertex>
> 
> Which may be a happy medium. Anyway, on previous work, I've found that
> putting the template/format of vertex/array data in the description is
> a Really Good Thing, because you WILL want to add more attributes that
> are only valid in certain arrays.
> 
> Just because XML is structured doesn't mean that all data should be
> accessible using the XML structure (attributes and elements). CDATA is
> there for a reason, you know :-)
>
> 
> Cheers,
> 
> 			/ h+
> 
> 
> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Chris
> Gregan
> Sent: Saturday, March 13, 2004 7:05 AM
> Cc: ode at q12.org
> Subject: Re: [ODE] XML ODE Data Interchange Format (revision 5)
> 
> 
> I am using my own XML format to represent physical geometry in an FPS. 
> For large tri-mesh style meshes I found it to be a good idea to use a 
> "v" tag instead of the full "vertex" to keep the file size down. 
> Similarly for indices. I think it is still clear what is intended. I 
> haven't followed this discussion too closely so apologies if this has 
> been mentioned already.
> 
> <vertices>
>     <v x="0" y="1" z="1" />
>     <v x="1" y="2" z="2" />
>     <v x="2" y="0" z="1" />
> </vertices>
> 
> Cheers,
> 
> Chris Gregan
-- 
William Denniss - will@ http://tanksoftware.com/





More information about the ODE mailing list