An8 Importer[Updated 08.Mai 2006: Beta 1.3]

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

An8 Importer[Updated 08.Mai 2006: Beta 1.3]

Post by sudi »

Today i sat down and thought that i really need a fast and easy way to edit my gamelevels.......eventhough there are no lightmaps......anyways i came up with a Anim8or fileimporter...
Ok right now it's only able to load basic meshes and i got some problems with the normals Anim8or exports....but other than that i works great...

Ohhh and how do i get irrlicht to render a meshbuffer with more than 3 vertizes? this is mainly the reason for my importer that it only supports triangel meshes right now.

I will upload some screenshots and the source as soon as i get some more time

DOWNLOAD: http://www.gdlib.net/index.php?name=Dow ... ails&id=90

Image

PS: It's not integrated into irrlicht as all the other loaders i saw....so i still have to do that but it's easy to use:
Exampel:
CAn8Parser MyData;
MyData.parse("Anim8or.an8"); //Anim8or.an8 is an Anim8or File
IAnimatedMeshSceneNode* myNode = smgr->addAnimatedMeshSceneNode(MyData.getFile().makeIrrlichtObject(device,0));
or to load a whole scene
MyData.getFile().makeIrrlichtScene(device, 0);

makeIrrlichtObject takes two parameters...the first is the Irrlicht device u r using...and the second is the object index of the An8 Object in the file(0=first....and so on)
makeIrrlichtScene takes two parameters...the first is the Irrlicht device u r using...and the second is the scene index of the An8 Scene in the file(0=first....and so on)
Last edited by sudi on Mon May 08, 2006 4:59 pm, edited 9 times in total.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

yey! we like more importers :)
re: more than 3 verts, I think you mean you want to triangulate concave polygons. You might want to steal the algorithm from wings3d's source since the license is compatible with irrlicht's :)
edit: oh no you won't, I forgot its written in some obscure 3d language!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

For simple polygons take a triangle fan alorithm. Use the first vertex as root and use these indices: 0,1,2, 0,2,3, 0,3,4,...
Many mesh loaders do it like this. It would be much easier to use triangle fans directly, but that's currently not possible with Irrlicht's mesh buffers.
What are the benefits of anim8 over the formats which aim8tor can export?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, I just read an example file. The anim8tor files use some basic primitives which have to be triangulated. Maybe implement some mesh buffer creators to easily add the primitive elements. For quadruple faces the triangulation is also rather simple. although the previously mentioned algorithm works just like that, too.
What about texture mapping? I think planar mapping is used by default?
And there are lots of advanced features left...
jam
Posts: 409
Joined: Fri Nov 04, 2005 3:52 am

Post by jam »

hybrid wrote: What are the benefits of anim8 over the formats which aim8tor can export?
Don't know if the importer will support this, but one can maybe finally load animated models into irrlicht as Anim8tor only saves this info in an8 files.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

@hybrid
right now u can uv map the mesh in anim8or and than apply the texture in irrlicht but at this moment i'm working on the marterial loader...so it will be there soon.
@jam
i actually just thought about supporting objects and scenes(want to use it as a level editor)
But maybe i will add animated meshes too....but that is just hypotetical.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
jam
Posts: 409
Joined: Fri Nov 04, 2005 3:52 am

Post by jam »

[quote="Sudi"
@jam
i actually just thought about supporting objects and scenes(want to use it as a level editor)
But maybe i will add animated meshes too....but that is just hypotetical.[/quote]

That would be great if you did, if not maybe someone can use the File export plug-ins support that is coming to v0.95 of anim8tor to bring animations to irrlicht, either way I think this would be a very useful importer.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

[offtopic]
is this plugin already out?
if the whole thing was pointless
since i already have a mapformat in which i'm formating the an8 files to load them.........
[/offtopic]
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Released!!
see first post
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
jam
Posts: 409
Joined: Fri Nov 04, 2005 3:52 am

Post by jam »

Sudi wrote:[offtopic]
is this plugin already out?
if the whole thing was pointless
since i already have a mapformat in which i'm formating the an8 files to load them.........
[/offtopic]
No, the plugin in not already out. Now I have to go off and try your loader as soon as it is available 8)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, still not uploaded. Could you please send me the files via e-mail (see webpage for adress) such that I can integrate it into the file formats patch page?
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

I uploaded it in the anim8or forums....but it's still not finished and the loading is really slow

http://www.anim8or.org/pn/index.php?nam ... 4496#44496

PS: the loader doesn't support groups....so u have to ungroup ur meshes before resaving
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

:shock: Did you notice that Irrlicht Mesh loaders follow a special (actually not special, but consistent :wink: ) implementation style? Your files (although only headers included in the file - will you open source your loader sometimes :?: ) seem to be really split into too small pieces.
Lack of speed is porbably due to IReadFile->read() because many calls of this method require lots of locking/unlocking of the file. I have the same with my dxf/ase loaders. But I dislike the approach of buffering the file into a large string. The file system should do that.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Sry i forgot to ship the source while cutting down file size i probably deleted the source folder.....my bad(uploaded the one with source)

And i'm not using IReadFile....thats why i sad i have to port it......
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, got the code.
Well, using fgetc or fread does exactly the same as IReadFile->read() so basically each byte oriented reading in files is slow. You got to read large portions of the file and parse them later on to speed up these things. And of course string handling is also slow. But the latter is harder to reduce, but you shouldn't probably pay attention to such things.
It's much more important to implement the IMeshLoader interface and make the file format accessible by Irrlicht the usual way. Also make your additional structures only structs, not classes, and hide them inside the an8loader class. That way you save some memory and avoid name space pollution by unnecessary structures.
Post Reply