DFF mesh format loader
DFF mesh format loader
hi folks.
as already promised in another thread i release my DFF format loader for Irrlicht.
- currently developed with/for Irrlicht 1.4.2
- loading of GTA3 DFFs works pretty well in most cases (minor glitches could occur i guess, after all the format is not well documented)
- no animations are supported at the moment
- for some more details take a look at the header file
// EDIT:
- - GTAVC and GTASA meshes work OK now
- - tested ManHunt models work OK too.
i am planning to find and fix the GTAVC problem and then hopefully fix support for GTASA files. but since i am unsure about when and if this will happen, i release it so others can use the code and hopefully even improve it.
i appreciate any comments, ideas and (most of all) bugfixes to this code.
download source:
http://b66883.com/projects/dffloader/CD ... 081201.zip
(zlib/libpng license)
screenshot:
regards,
---loki
//EDIT:
also, here are my script parsing routines combined into one SceneNode. using this, you can add the entires game world to your scene using a few simple calls:
http://b66883.com/projects/dffloader/CG ... 081201.zip
(also zlib/libpng license)
as already promised in another thread i release my DFF format loader for Irrlicht.
- currently developed with/for Irrlicht 1.4.2
- loading of GTA3 DFFs works pretty well in most cases (minor glitches could occur i guess, after all the format is not well documented)
- no animations are supported at the moment
- for some more details take a look at the header file
// EDIT:
- - GTAVC and GTASA meshes work OK now
- - tested ManHunt models work OK too.
i am planning to find and fix the GTAVC problem and then hopefully fix support for GTASA files. but since i am unsure about when and if this will happen, i release it so others can use the code and hopefully even improve it.
i appreciate any comments, ideas and (most of all) bugfixes to this code.
download source:
http://b66883.com/projects/dffloader/CD ... 081201.zip
(zlib/libpng license)
screenshot:
regards,
---loki
//EDIT:
also, here are my script parsing routines combined into one SceneNode. using this, you can add the entires game world to your scene using a few simple calls:
http://b66883.com/projects/dffloader/CG ... 081201.zip
(also zlib/libpng license)
Last edited by loki1985 on Tue Dec 02, 2008 3:14 pm, edited 10 times in total.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The code looks quite usable, just a few things: You should get rid of the std:: things (I didn't see anythings left, maybe just the using namespace?) and the many this-> references, because it's definitely not necessary. The Irrlicht coding style with capital letters for member attributes are enough to know if it's an attribute or a local variable.
And finally an optimization hint: Irrlicht arrays don't resize expoentially, but reallocate for each additional element. So better reallocate manually in front of a loop that contains push_backs. This will improve the loading times by orders of magnitudes (the .x loader became 20x faster just by adding some rellocates).
And finally an optimization hint: Irrlicht arrays don't resize expoentially, but reallocate for each additional element. So better reallocate manually in front of a loop that contains push_backs. This will improve the loading times by orders of magnitudes (the .x loader became 20x faster just by adding some rellocates).
Oh boy. I already have a game engine and a driving module for it (see my website). It sure would be interesting to load up one of those levels and have a drive around it. I'll give this a try when I get the chance...
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781
Irrlicht arrays don't resize expoentially, but reallocate for each additional element.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
@hybrid:
i reworked the code like you mentioned. writing members first letter uppercase was a somewhat new concept to me, and so i was a bit skeptic, but in the end it looks pretty OK. so also all this-> references are removed.
i had no problem with array speed since i used std::vector. now that i changed to irrlicht arrays i see what you mean, it was really slow. so i implemented the manual reallocate, now works really good again. and no std things needed anymore.
new version is uploaded and link in first post is updated.
@sio2:
sure, this would be cool. was my original intention also for writing this loader.
but, for being able to load complete cities from GTA you have to know: this DFF loader does not load the entire GTA cities at once. GTA cities consist of thousands of models in seperate DFF files.
Some .DAT files in GTA games define which IPL and IDE files must be parsed. The IDE (Item DEfinition) files do the definition for a specific model (e.g. which internal ID it has, which texture subdirectory this model files should load its textures from). The IPL (Item PLacement) files do the placing of the concrete item instances, defining e.g. placement, rotation.
these 3 file types (DAT, IDE, IPL) are simple text files (can be binary for GTASA tho) which are parsed very easily.
maybe, if i find some time, i could re-organize my file parsing classes into another Irrlicht format loader which in return feeds the DFFLoader which files to load and then places these on map. but don't get your hopes up, i am pretty busy with other stuff lately. and parsing those files is pretty straightforward and easy....
i reworked the code like you mentioned. writing members first letter uppercase was a somewhat new concept to me, and so i was a bit skeptic, but in the end it looks pretty OK. so also all this-> references are removed.
i had no problem with array speed since i used std::vector. now that i changed to irrlicht arrays i see what you mean, it was really slow. so i implemented the manual reallocate, now works really good again. and no std things needed anymore.
new version is uploaded and link in first post is updated.
@sio2:
sure, this would be cool. was my original intention also for writing this loader.
but, for being able to load complete cities from GTA you have to know: this DFF loader does not load the entire GTA cities at once. GTA cities consist of thousands of models in seperate DFF files.
Some .DAT files in GTA games define which IPL and IDE files must be parsed. The IDE (Item DEfinition) files do the definition for a specific model (e.g. which internal ID it has, which texture subdirectory this model files should load its textures from). The IPL (Item PLacement) files do the placing of the concrete item instances, defining e.g. placement, rotation.
these 3 file types (DAT, IDE, IPL) are simple text files (can be binary for GTASA tho) which are parsed very easily.
maybe, if i find some time, i could re-organize my file parsing classes into another Irrlicht format loader which in return feeds the DFFLoader which files to load and then places these on map. but don't get your hopes up, i am pretty busy with other stuff lately. and parsing those files is pretty straightforward and easy....
this is interesting
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
don't wanna appear unappreciative, but thats no news to me. as you can see in the sourcecode, i am recognizing the version of DFF files and do conditional code depending on version.Mag-got wrote:The bug is, every GTA has it's own DFF version. (Your distortion)
the problem is that i found no document/forum post/whatever that describes the difference of vertex/index format between GTA3 and GTAVC (and that is where the problem seems to be).
so, one more bug was found and fixed. this improves compatibility with all DFF files, most Vice City meshes look much better now, tho some still have problems.
also fixes some glitches in GTA3:
get updated source here (link in 1st post was also updated):
http://b66883.com/projects/dffloader/CD ... 080930.zip
also fixes some glitches in GTA3:
get updated source here (link in 1st post was also updated):
http://b66883.com/projects/dffloader/CD ... 080930.zip