Delgine 3D Tools & Content DeleD Community Edition
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

.DMF fileformat question
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Community Edition
View previous topic :: View next topic  
Author Message
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Sun Jul 03, 2005 12:39 pm    Post subject: Reply with quote

Oh, right, I was looking in the wrong place, my bad Embarassed

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
View user's profile Send private message Visit poster's website
CMe
Member


Joined: 30 Jun 2005
Posts: 72
Location: Ontario Canada

PostPosted: Sun Jul 03, 2005 9:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
_kohai
Member


Joined: 23 Jun 2005
Posts: 12

PostPosted: Mon Jul 04, 2005 10:49 pm    Post subject: Reply with quote

Well, at first look , that's a nice piece of codewe have here Smile

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 Smile
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Tue Jul 05, 2005 8:48 am    Post subject: Reply with quote

Great, I've put it online in the Products -> Various section! Very Happy
Back to top
View user's profile Send private message Visit poster's website
_kohai
Member


Joined: 23 Jun 2005
Posts: 12

PostPosted: Tue Jul 05, 2005 11:20 am    Post subject: Reply with quote

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 ! Smile
[/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
View user's profile Send private message
_kohai
Member


Joined: 23 Jun 2005
Posts: 12

PostPosted: Wed Jul 06, 2005 4:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
CMe
Member


Joined: 30 Jun 2005
Posts: 72
Location: Ontario Canada

PostPosted: Wed Jul 06, 2005 5:24 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
_kohai
Member


Joined: 23 Jun 2005
Posts: 12

PostPosted: Wed Jul 06, 2005 9:42 pm    Post subject: Reply with quote

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 Smile
_________________
Pay a visit to my blog, and some code in action :
http://www.kohaistyle.com
Back to top
View user's profile Send private message
CMe
Member


Joined: 30 Jun 2005
Posts: 72
Location: Ontario Canada

PostPosted: Wed Jul 06, 2005 10:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
CMe
Member


Joined: 30 Jun 2005
Posts: 72
Location: Ontario Canada

PostPosted: Wed Jul 06, 2005 11:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Thu Jul 07, 2005 6:44 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Thu Jul 07, 2005 7:04 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message Visit poster's website
CMe
Member


Joined: 30 Jun 2005
Posts: 72
Location: Ontario Canada

PostPosted: Mon Jul 11, 2005 1:08 am    Post subject: new update Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
_kohai
Member


Joined: 23 Jun 2005
Posts: 12

PostPosted: Sun Aug 14, 2005 9:38 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Community Edition All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum