from xml to pyogre

lucy

20-02-2007 16:20:44

hey...

Im a noob in python and ogre so I tried out the tutorials and I wrote my own little application and everything works fine :D thanks for this funny stuff until yet!

now here is my problem: I create a XML-file (done by converter) from the cube.mesh file (source: media.zip) and now I like to rebind this file to OGRE (pyogre)

the reason for this: I try to find out, if it is possible, to visualize graph-data like the points and the edges of the cube from xml-data.
Im sure it is possible :wink: but i dont see any solution to begin :cry:

is there somebody who can help me please? the only thread i found was this: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1583 but it doesn't really help :roll:


thanks for any comment and sorry for my english

lucy

persoontje

22-02-2007 09:23:25

hey...

Im a noob in python and ogre so I tried out the tutorials and I wrote my own little application and everything works fine :D thanks for this funny stuff until yet!

now here is my problem: I create a XML-file (done by converter) from the cube.mesh file (source: media.zip) and now I like to rebind this file to OGRE (pyogre)

the reason for this: I try to find out, if it is possible, to visualize graph-data like the points and the edges of the cube from xml-data.
Im sure it is possible :wink: but i dont see any solution to begin :cry:

is there somebody who can help me please? the only thread i found was this: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1583 but it doesn't really help :roll:


thanks for any comment and sorry for my english

lucy


What did you try to convert exactly? The xml file of a mesh file contains actually the same data, but in xml format. The .mesh format is just an optimized binary version of it. With OgreXMLConverter you can convert it to binary and from binary to xml. You can find this program somewhere sdk, but if you like I can send you my build version of it.

The link you gave is about dotscene. This is format to store your scene it, it contains the name of meshes, positions, lights and so on. See for more information the Ogre wiki http://www.ogre3d.org/wiki/index.php/DotScene

I've no experience with using this with python, because I've programmed all my ogre stuff in c++ :twisted:

lucy

22-02-2007 15:43:32

hey...

Thanks for comment.

I try to visualize an object (e.g. cube) in pyogre from xml-data...
I used a converter to get the cube.xml from the cube.mesh,
so far so good :wink:

Now I want to know, how do I get the data from the created cube.xml into my pyogre application?
It seems that i have to use a parser but I dont know how to set up something like that :roll:

...but python is so much easier than c++ :D

Game_Ender

22-02-2007 16:32:07

What data do want exactly? You can now use cube.mesh in you Ogre application. If you want to access the vertex data directory you need to do some looking through the Ogre API/Docs for hardware vertex buffers.

lucy

23-02-2007 11:02:50

Thanks for comment.

I try to explain this with pictures and code...this is my cube.xml file:


<mesh>
<submeshes>
<submesh material="1 - Default" usesharedvertices="false" use32bitindexes="false" operationtype="triangle_list">
<faces count="12">
<face v1="1" v2="2" v3="3" />
<face v1="3" v2="4" v3="1" />
<face v1="5" v2="6" v3="7" />
<face v1="7" v2="8" v3="5" />
<face v1="9" v2="10" v3="11" />
<face v1="11" v2="12" v3="9" />
<face v1="13" v2="14" v3="15" />
<face v1="15" v2="16" v3="13" />
<face v1="17" v2="18" v3="19" />
<face v1="19" v2="20" v3="17" />
<face v1="21" v2="22" v3="23" />
<face v1="23" v2="24" v3="21" />
</faces>
<geometry vertexcount="25">
<vertexbuffer positions="true">
<vertex>
<position x="0.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="-50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="-50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="-50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="-50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="-50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="-50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="-50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="-50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="-50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="-50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="50.000000" y="50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="-50.000000" z="-50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="-50.000000" z="50.000000" />
</vertex>
<vertex>
<position x="-50.000000" y="50.000000" z="50.000000" />
</vertex>
</vertexbuffer>
<vertexbuffer normals="true">
<vertex>
<normal x="0.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="-1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="-1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="-1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="-1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="0.000000" z="1.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="-1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="-1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="-1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="-1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="1.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="1.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="1.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="1.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="0.000000" y="1.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="-1.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="-1.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="-1.000000" y="0.000000" z="0.000000" />
</vertex>
<vertex>
<normal x="-1.000000" y="0.000000" z="0.000000" />
</vertex>
</vertexbuffer>
</geometry>
</submesh>
</submeshes>
</mesh>


When I use the cube.mesh file OGRE shows:
http://mitglied.lycos.de/lucywebs/pictures/cube.JPG

What I like to see is the whole wireframe but from the cube.xml file like that:
http://mitglied.lycos.de/lucywebs/pictures/wireframe.JPG

hope this help's anyway :oops:

sorry for my incompetence to explain :wink:

lucy

Game_Ender

23-02-2007 13:29:48

Now I understand, this has very little to do with the xml format. Do you have Ogre in wireframe when you took the Ogre screenshot? It looks like you just need to make your block transparent so you can see through it to the line on the other side.

lucy

23-02-2007 13:54:47

yes, OGRE was in wireframe mode...

what did I have to do, to set the sides transparent? something about material? like "RustySteel"?
and the other thing is, that I wouldn't use the cube.mesh file! what's necessary to use these data directly from cube.xml? a parser or something like that? I have no idea how to let OGRE know, that the data is coming from *xml files only (e.g. GraphML) :roll:

thanks a lot. lucy

Game_Ender

23-02-2007 19:54:20

We should take a step back here. What are you trying to do? Procedurally generate meshes for Ogre by transforming GraphML data?

lucy

23-02-2007 21:16:02

yes...something like that. I try to find a way, to visualize graphs in pyOGRE and a solution to manipulate them after integration (especially from GraphML or TreeML format).
I thought that I can improve my skills by handling a wireframe and manipulate it like the facial-demo. this may sound strange to you, but this thought was the first crossing my mind :wink:

thanks

lucy

Game_Ender

23-02-2007 21:40:19

It would make more sense to procedurally generate things in python code while parsing the output. Something like the debug view for OgreNewt. That uses manually object and you can draw spheres for the nodes and lines for the edges. Investigate the manual object examples on the wiki.

lucy

26-02-2007 12:41:47

thanks for all your staying power :wink:

I've got it!...creating a modell with 3dsmax9 -> convert it to xml file with 3d object converter -> transforming it into mesh with ogrecommandlinetools and launching it @ ogre
it's sad, that it seems to be necessary to convert xml back to mesh :(

the problem now is that I loose the information about material (colour) by using 3d object converter...but I check for other tools

lucy