Re: [Plib-devel] SSG and DirectX files [patch included]
Brought to you by:
sjbaker
From: Jan R. <slo...@gm...> - 2005-11-21 19:07:07
|
Am Sun, 20 Nov 2005 20:36:26 +0100 schrieb Jan Reucker <slo...@gm...>: > just one quick question: I've tried to load several ".x" (MS DirectX) > model files into a scenegraph, but never had any luck. I think it's O.k., I found something. First, some files were corrupted, the texture coordinate array does not correspond to the MS file format spec. This is easy to fix in the .x file itself, but I'll have to see which modeller generated these files. Second and third, I think I found two bugs in the X loader and in the intermediate loader mesh stuff. First bug: When loading an .x file, all materials will be stored in a globalMaterialList, but the materials are never added to the LoaderWriterMesh. I've added a fix to ssgLoadX.cxx that adds the created SimpleStates to the mesh. Second bug is located in the mesh handler itself. There's a global variable currentDiffuse that holds the most recent diffuse colour found by the ASCII parser. Now when composing the final SSG branch, all leafs not containing a colour array will be set to this variable's value. This is, in fact, the colour that was defined last in whatever file we were parsing. But this is wrong, the right diffuse colour is located in the SimpleState that is used to draw the leaf. Therefore we have to create the colour array with that value. To understand the effect of this bug, here's what I experienced while bug-hunting: I used a .x airplane model which contained 5 materials. All materials but the last one were opaque, only the last (used to draw the propeller disc) was 80% translucent. This caused the whole model to look 80% translucent because the model did not contain any per-vertex or per-face colour values, only the colours defined by the materials (and the GL_COLOR_MATERIAL mode). I don't know if this patch hurts anything, because the ASCII parser is also used in some other file loaders and I'm not able to test them all. And I can't believe that these bugs haven't been noticed for so long. But on the other hand it would be very nice if the working .x loader could still make it into 1.8.5... :-) Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |