[Gtkradiant] Re: xml?

Timothee Besset gtkradiant@zerowing.idsoftware.com
Sun, 23 Sep 2001 16:56:30 +0200


ok

now may be a good time to start the layout of xml map format. basic issue
is node/attributes distinction. the official approach of XML files says
that the data should not be anywhere in the node names or attributes.
nodes are there to distinguish independant parts of the data, and
attributes to specify things like type.

for instance our main node names would be
<entity>
<primitive> ?
<epair>
<plane>
<texdef>

I am not sure wether we want to keep the 'worldspawn'. It makes a lot of
sense to have the toplevel of a map being only a list of entities. But it
raises tricky issues when you manipulate that data and merge it with other
data chunks etc. You have to go through the list of issues and merge
worldpawns. if something like a <primitive> or <epair> is found at the top
level it would be understood as being the worldspawn.

For types, for instance primitive 
<primitive type="brush"> 
<primitive type="patch">
or
<brush>
<patch> 
.. I still don't know here .. 

we should be able to make the parsing ignore any unknown node name anyway.
same issue with <plane> or <surface type="plane"> storing the type in
those cases may be problematic if the format of the data inside of the
node depends on the type. If primitive doesn't have it's own data and only
a list of nodes, then we should go for the type way.

<brush>
  <plane>
  x y z x y z x y z
    <texdef type="q3"> # could be q2 etc.
      0 # flags?
      <shader>
        textures/radiant/notex
      </shader>
    </texdef>
  </plane>

etc.

TTimo

originally posted by spog -------------------------------------

<?xml version="1.0"?>

<q3map>
  <ent classname="worldspawn">
    <prim type="brush">
      <surf pts="( x y z ) ( x y z ) ( x y z )" tex="textures/radiant/notex" flags="0"/>
      <surf pts="( x y z ) ( x y z ) ( x y z )" tex="textures/radiant/notex" flags="0"/> 
      <surf pts="( x y z ) ( x y z ) ( x y z )" tex="textures/radiant/notex" flags="0"/>
      <surf pts="( x y z ) ( x y z ) ( x y z )" tex="textures/radiant/notex" flags="0"/>
      <surf pts="( x y z ) ( x y z ) ( x y z )" tex="textures/radiant/notex" flags="0"/>
      <surf pts="( x y z ) ( x y z ) ( x y z )" tex="textures/radiant/notex" flags="0"/>
    </prim>
    <prim type="patch">
      <surf width="3" height="3"
	matrix="( ( x y z s t ) ( x y z s t ) ( x y z s t ) ) ( ( x y z s t ) ( x y z s t ) ( x y z s t ) ) ( ( x y z s t ) ( x y z s t ) ( x y z s t ) )"
        tex="textures/radiant/notex" flags="0"/>
    </prim>
    <prim type="mesh"
      <surf texture="textures/radiant/notex">
	<geoprim type="polygon" numpoints="3">
	  <point crd="x y z" nrm="x y z" uv="u v"/>
          <point crd="x y z" nrm="x y z" uv="u v"/>
          <point crd="x y z" nrm="x y z" uv="u v"/>
        </geoprim>
      </surf>
    </prim>
  </ent>
</q3map>