jfk's B3D exporter

Blitz3D Forums/Blitz3D Programming/jfk's B3D exporter

ringwraith(Posted 2007) [#1]
Hey everyone,

I'm using jfk's exporter to save meshes for my mesh terrain editor and I'd like to thank jfk for it because its ver useful.

The only problem is that when it saves my terrain meshes it messes with the surface order, which doesn't alter the appearance but does mess up the way the terrain gets edited when loaded.

I've searched thecode high and low for the source of the bug but I can't seem to find it. Just wondering if anyone could take a look at and see if they could find the bug or give me any suggestions.

The code for the exporter can be found here:
http://www.melog.ch/dl/saveb3d_2007a.zip


Vertigo(Posted 2007) [#2]
Dont quote me on this, but I do believe that with some meshes(all?) blitz loads the surfaces in a near random order anyways.

You may have to make your own model format or something if you want to have 100% control over the surface ordering.

-Scott


ringwraith(Posted 2007) [#3]
Thanks for the reply.

Well, if that is true then you just saved me a lot of time trying to debug code that doesn't have a bug :) I guess if that's the case then I can work my way around it.


jfk EO-11110(Posted 2007) [#4]
Yes, this is true. As soon as you alter the exe, the order of the surfaces will change (a DirectX "feature"). This is why we had to develop surface recognition workarounds. In early times I wrote a brute force texture comparing hack, which became obsolete with the introduction of the commands GetSurfaceBRush, GetBrushTexture and GetTextureName$, that will allow to trace back the used texture of a surface. This way it usually is possible to to identify the surfaces correctly. (Will fail when multiple surfaces use the same texture, eg. when you need to break up the mesh in pieces because of too many vertices).

An other solution is to use LoadAnimMesh. This way you can get the entity name of every child (that's every surface). So eg. when there are 3 cubes in 3d studio max, and you name them cube1, cube2 and cube3, then you can do this: c1=FindChild(m,"cube1") in Blitz3D.


ringwraith(Posted 2007) [#5]
Yeah, that's what I ended up doing. I just got the name of the texture used by each brush and compared it to the name of the texture I wanted.

Thanks for the reply and a very useful function jfk.