Save mesh

BlitzMax Forums/MiniB3D Module/Save mesh

Hezkore(Posted 2011) [#1]
Does anyone have any code for saving meshes loaded in MiniB3d? :o
I'd like to load a bunch of meshes, merge them into one mesh and finally save that one mesh as a single B3D file. (or some other format)
It's important that the textures are there though...

Last edited 2011


Warner(Posted 2011) [#2]
You could try this archive entry:
http://www.blitzbasic.com/codearcs/codearcs.php?code=866
It can be autoconverted by using File->Import bb file.
Then it needs a few tweaks to get it running:

The program loads a file, then saves it. If you run it, it will give a 'file not found' error because it can't find "testsurf.b3d".


Hezkore(Posted 2011) [#3]
Yeah but Warner... you seem pretty high on this 3D stuff...
What I want to do is merge a bunch of meshes (over 300) and they all have one texture of their own.
I'd like to merge those 300 into one file, so I was thinking about merging the meshes using the merge mesh function and then resaving the mesh as something.
But the problem is that when I do it (tried like all of the code archive export codes in Blitz3D) they just save one of the textures and it's very important that it saves all of the textures.
Do you know what I mean?
I guess I should make an example of this...
I'll upload it soon!

Last edited 2011


Warner(Posted 2011) [#4]
I'd like to merge those 300 into one file,
O_o really? That sounds like quite erm .. much.
You might use your own mesh format, maybe. If it is a single mesh, without hierarchy, use something like this:



Hezkore(Posted 2011) [#5]
Yeah heh it's quite much, but there are a LOOOOOT of objects and the problem is that I don't really control it, cause the editor I'm using (and am forced to use) is not made by me.
And that's the reason I'd like to merge them into one single file.

When I did AddMesh() in Blitz3D... well let's just say it had some odd results when it came to using GetSurfaceBrush()

But yeah, thanks a lot, I'll give this a try! :)


AdamRedwoods(Posted 2011) [#6]
AddMesh() compares brushes and if they're the same then it combines the surfaces.

Sometimes what I do is add a switch to disable odd behaviors that miniB3D does:
AddMesh(mesh, true) '' to skip compare brushes routine, and add in your own if/then to check, etc...

That way the original code works, but adds your own special routines.


Hezkore(Posted 2011) [#7]
Thanks for the tip AdamRedwoods!
And thanks Warner for all the help.
Everything's been solved! :)