View previous topic :: View next topic |
Author |
Message |
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sun Jul 03, 2005 12:39 pm Post subject: |
|
|
Oh, right, I was looking in the wrong place, my bad
That reserved field was (and still is) meant to store a 'is used' flag, to mark materials that are actually used in the current scene. This would save people from having to parse the file in two passes. However, that information is not written in current DeleD versions, so the field is 'reserved'. |
|
Back to top |
|
|
CMe Member
Joined: 30 Jun 2005 Posts: 72 Location: Ontario Canada
|
Posted: Sun Jul 03, 2005 9:01 pm Post subject: |
|
|
Hi, ok here is a link to to download the parser.
link: DMF Parser
if anyone finds any bugs or improvements that could be made, please send me an email at the address in the source file. |
|
Back to top |
|
|
_kohai Member
Joined: 23 Jun 2005 Posts: 12
|
Posted: Mon Jul 04, 2005 10:49 pm Post subject: |
|
|
Well, at first look , that's a nice piece of codewe have here
Thx for sharing it with us, you saved me some hours of work testing, and such ...
Heading to my compiler to test that right away |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Tue Jul 05, 2005 8:48 am Post subject: |
|
|
Great, I've put it online in the Products -> Various section! |
|
Back to top |
|
|
_kohai Member
Joined: 23 Jun 2005 Posts: 12
|
Posted: Tue Jul 05, 2005 11:20 am Post subject: |
|
|
Ok, a little report :
I got working like a charm after somme little mindboggling glitches ( ah, multidim array for layers ! )
So the geometry is loading right, UV seems ok too ...
Though i didn't manage to get the texture callback function to work ( seems the Gl texture index is not returned, and i don't know why yet ... ), this is a great one ...
[edit]
Stupid me, i found the annoying thing, now it REALLY works like a charm, even the texture Callback !
[/edit]
Many thx again ( yes, i know, i thank everyone much often, but hey, that's a reward for some great work ! ^^ ) |
|
Back to top |
|
|
_kohai Member
Joined: 23 Jun 2005 Posts: 12
|
Posted: Wed Jul 06, 2005 4:35 pm Post subject: |
|
|
OK, little update :
got the loader working right for geometry and 1st layer texture ...
But got some pbs with the lightmaps ^^
Hope to get that sorted soon !
cME > the lightmaps layer is always stored as the 4th layer right ? _________________ Pay a visit to my blog, and some code in action :
http://www.kohaistyle.com |
|
Back to top |
|
|
CMe Member
Joined: 30 Jun 2005 Posts: 72 Location: Ontario Canada
|
Posted: Wed Jul 06, 2005 5:24 pm Post subject: |
|
|
Is it a 1.1 version map? they flipped the V component in texcoords for some reason. Actually I'd really like to know why. but anyway, if my guess is right, this should fix it. Stick this in after loading the map and see if it fixes it. the -1 just negates the v coord.
if(dmf.version >= DMF_VERSION_1_1)
ScaleDMF(&dmf, 1.f, 1.f, 1.f, 1.f, -1.f);
There's a reason why I didn't automate this. I wanted to keep data modification to a minimum after reading in the file. Just in case someone wanted to use WriteDMF.
Yeah the lightmap is always in the 4th layer as was stated by the dev's. |
|
Back to top |
|
|
_kohai Member
Joined: 23 Jun 2005 Posts: 12
|
Posted: Wed Jul 06, 2005 9:42 pm Post subject: |
|
|
Cme > sorry for the late, but didn't have the time to edit my post.
Yes, everything is ok by now, it was a stupid mistake on my side. I used the scaleDMF() function, and guess what, i scaled the UV's also ^^
So the scrambled output is not very surprising !! It's all ok now :
thx again _________________ Pay a visit to my blog, and some code in action :
http://www.kohaistyle.com |
|
Back to top |
|
|
CMe Member
Joined: 30 Jun 2005 Posts: 72 Location: Ontario Canada
|
Posted: Wed Jul 06, 2005 10:25 pm Post subject: |
|
|
Glad to hear it's working. The rendering looks right. Maybe I should write some documentation on reading the structures. I had a look at your blog and noticed that you got a bit of a headache understanding the structure layout. I like a bit of criticism. anything to help make this easier to use.
Maybe I should remedy that multidim texcoord layout too. maybe put the texcoord vertices into a new struct for clarity.
Code: |
typedef struct
{
dmf_vector2_t *vertices;
} dmf_texcoord_t;
typedef struct
{
unsigned int numVertices;
unsigned int materialIndex;
unsigned int *indices;
dmf_texcoord_t texcoords[4];
} dmf_polygon_t;
|
so to access it would be
dmf_file_t dmf;
dmf_polygon_t *poly = &dmf.objectList[0].polygons[0];
poly->texcoords[0].vertices[0].x;
instead of
poly->texcoords[0][0].x;
Let me know what you think. |
|
Back to top |
|
|
CMe Member
Joined: 30 Jun 2005 Posts: 72 Location: Ontario Canada
|
Posted: Wed Jul 06, 2005 11:41 pm Post subject: |
|
|
Ok I've changed the multidim array, and added a bit more of a usage example. Here's the modified version:
dmf.zip |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Thu Jul 07, 2005 6:44 am Post subject: |
|
|
The reason why we flipped the v-coordinate from version 1.1 onwards, is because it was upside down in versions previous to that. Seriously. If you use the OpenGL coordinate system and do CW rendering, the v-coordinate can now be used 'as is'. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Thu Jul 07, 2005 7:04 am Post subject: |
|
|
The download at this site has now been updated as well.
Little sidenote: you indented the latest entry to the version history info (top of .h file) with tabs, while the other entries are indented with spaces. Depending on the tab size used, the indentation will not look right. Not important at all, just thought you might like to know |
|
Back to top |
|
|
CMe Member
Joined: 30 Jun 2005 Posts: 72 Location: Ontario Canada
|
Posted: Mon Jul 11, 2005 1:08 am Post subject: new update |
|
|
ok I've added a few new functions to the library now. updates include the ability to
reverse the winding order for polygons, translation and rotation of object space, and
the ability to combine / merge multiple .dmf files into one. get it here: dmf.zip |
|
Back to top |
|
|
_kohai Member
Joined: 23 Jun 2005 Posts: 12
|
Posted: Sun Aug 14, 2005 9:38 am Post subject: |
|
|
Abitlity to merge several .DMF ???
Damn, are you reading my mind ? With that feature, and a little quadtree optim. i should have my level editor done in a twist !!
Thx, will try and make a report ^^ _________________ Pay a visit to my blog, and some code in action :
http://www.kohaistyle.com |
|
Back to top |
|
|
|