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 

Loading an exported .x file with DirectX9

 
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
Koobazaur
Member


Joined: 08 Mar 2007
Posts: 22

PostPosted: Thu Mar 08, 2007 12:59 am    Post subject: Loading an exported .x file with DirectX9 Reply with quote

Hey,

I have created an .X file using Deled but I am having trouble loading it in my program. I am using the following function:

D3DXLoadMeshFromX("deled/scene.x",
D3DXMESH_MANAGED,
D3D9Device,
0, //no adjecency info
&MaterialBuffer,
0,
(DWORD*)(&MaterialCount),
&mesh );

but it returns and error. Works fine with my other mesh.

Help appreciated.

EDIT: just noticed this only happens when I insert the 88 prefab; otherwise it loads fine.
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


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

PostPosted: Sat Mar 10, 2007 2:47 pm    Post subject: Reply with quote

Interesting how inserting the 88 prefab triggers the problem. Some quick questions:
1. Does inserting the 88 prefab always trigger the problem?
2. Does the error convey any specific message?
3. Does loading the file in the DirectX Viewer result in any such errors as well? If it does, that would be great, because it would save us from having to write a test application... Very Happy
Back to top
View user's profile Send private message Visit poster's website
Koobazaur
Member


Joined: 08 Mar 2007
Posts: 22

PostPosted: Sun Mar 11, 2007 1:36 am    Post subject: Reply with quote

1. Yup, whether by itself or with other level geometry. Another one that causes it is 88 trailer. I have not tested ALL prefabs, but others that I looked at seemed to work fine.

2. Nope. I tested for D3DERR_INVALIDCALL and E_OUTOFMEMORY and neither of them are the case. I also updated to a 32bit indexing buffer, but same problem persists.

3. Unfortunately, I can't say, as the DX viewer crashes on my system when I try to load it.
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


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

PostPosted: Sun Mar 11, 2007 8:05 pm    Post subject: Reply with quote

Ok, thanks, we'll take it from here! Once we figure out what's wrong we'll post our findings here, and hopefully release a new version of the exporter.
Back to top
View user's profile Send private message Visit poster's website
Koobazaur
Member


Joined: 08 Mar 2007
Posts: 22

PostPosted: Sun Mar 11, 2007 9:41 pm    Post subject: Reply with quote

Would you like the code I use for loading the model (it's pretty much standard DX9 stuff, though) ?
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


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

PostPosted: Mon Mar 12, 2007 7:15 pm    Post subject: Reply with quote

Thanks, but we should be ok. Even though we are pretty much OpenGL geeks ourselves, so if we somehow get really really stuck on calling that function we might come calling for your help. Very Happy

[edit]Well, the good news is that the problem is easy to reproduce. The bad news is that the exported file seems pretty much ok to the naked eye, and the .X importer loads it in without any problems. Perhaps the model is a big larger than most, but that shouldn't be too much of a problem... Downloading the full DirectX SDK as we speak, in the hope of pulling some more information from the DirectX debug dll... [/edit].
Back to top
View user's profile Send private message Visit poster's website
Koobazaur
Member


Joined: 08 Mar 2007
Posts: 22

PostPosted: Tue Mar 13, 2007 6:26 am    Post subject: Reply with quote

The model being too big was the first thing that came to my mind but, as I said, I do not get the out of memory error. And if I am correct, the bike model is more complicated than the 88 and it loads fine.
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


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

PostPosted: Wed Mar 14, 2007 2:34 pm    Post subject: Reply with quote

Yeah, you've got a good there! Back to the 'there must be something wrong with the file structure' then. I'll keep you posted!
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: Wed Mar 14, 2007 7:55 pm    Post subject: Reply with quote

Ok, I figured it out. The 88 prefab (like any prefab that only has a number for a name) gets names like '1', '2', etc when you place it as a primitive into the scene. So far so good, but the exporter copies this name straight into the .X file as the mesh name, and mesh names are not allowed to start with a number. If you open the resulting .X file in notepad, and change the mesh name to 'test', or 'biggun', or 'whohoo', the .X file loads properly.

Quote:
...

Material Floor02 {
1.000000;1.000000;1.000000;1.000000;;
0.000000;
0.000000;0.000000;0.000000;;
0.000000;0.000000;0.000000;;
TextureFileName {
"Floor02.jpg";
}
}

Mesh [b]PutAnyNameHereThatDoesNotStartWithANumber/b] {
10096;
63.1025400;62.0000000;11.9426300;,
62.6025400;66.0000000;12.8086600;,
-30.0621800;71.0000000;-40.6913400;,

...


I'll now hand this over to Jeroen, he will decide how we want to handle this in the exporter. Very Happy
Back to top
View user's profile Send private message Visit poster's website
Koobazaur
Member


Joined: 08 Mar 2007
Posts: 22

PostPosted: Thu Mar 15, 2007 6:28 am    Post subject: Reply with quote

Bugs--;

Very Happy
Back to top
View user's profile Send private message
jwatte
DeleD PRO user


Joined: 26 Apr 2006
Posts: 513

PostPosted: Tue Apr 24, 2007 3:43 am    Post subject: Reply with quote

Interesting. Does this happen with my .X exporter, too?
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 Apr 24, 2007 6:51 pm    Post subject: Reply with quote

I haven't tested it, but I see nothing in your code (kudos for open sourcing it!) to prevent it. Convert_name does not pay special attention to the first character.
Back to top
View user's profile Send private message Visit poster's website
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
Page 1 of 1

 
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