Open Asset Import Library for BlitzMax

BlitzMax Modules Forums/MiniB3D/Open Asset Import Library for BlitzMax

A 3D model import module for Blitzmax.

It wraps the "Open Asset Import Library" Assimp, so that it can be staticly linked to your Blitzmax programs.

This initial release is without animation and hierarchy.

http://code.google.com/p/blitzmax-assimp/

Feedback appreciated

Nice module!

You don't need any of that "module" stuff at the top of source.bmx :-)

Thanks Brucey. :-)

I did try to split it up the way you do, but forgot to remove that.
Cleaned up now.

nice work,a huge project but really userful,
some format are very nice like the .dae, .ter...
hope we can see the animation version soon,keep up the great work!

Brilliant! I can't wait for animated support. That'll be absolutely fantastic. Good work!

Ok, I am one of those "pulling their hair out".
I have this path: blitzmax\mod\scheutz.mod\assimp.mod

I use tortoise svn.
Now I rightclick on the assimp.mod folder; choose svn checkout
and enter the URL "http://blitzmax-assimp.googlecode.com/svn/trunk/ blitzmax-assimp-read-only".
I get "URL http://blitzmax-assimp.googlecode.com/svn/trunk/%20blitzmax-assimp-read-only does not exist".

Don't know why i am again and again running in this trouble with svn..

You have a space between the "/" and "blitzmax-assimp-read-only".

That probably shouldn't be there?


Actually... you've read the instructions wrong ;-)

This is the URL you enter :

http://blitzmax-assimp.googlecode.com/svn/trunk/

If you were using the command-line, you would also want to add a folder in which to checkout to.
With tortoise you would browse for that folder instead.

Pheew, just in time Brucey. Some hairs left.
Actually... you've read the instructions wrong ;-)

Ouch! Already wondered about the space turned in %20.

I've committed a new version (revision 34) that loads the nodes.

I'm having major trouble decomposing the aiMatrix for the nodes into minib3d 3D space, so if anybody can help it will be mush appreciated.

[EDIT] I've started a cry for help here: /Community/posts.php?topic=82644

Hi Peter,

I just tracked down an error, that your function "aiLoadMiniB3D"
fails (just exits the application) when loading some files, if
I import Brucey's BaH.magick module.
It' s available at maxmods.googlecode.com, but not yet official
published. I do not really need it, but perhaps it's of interest
for you or Brucey.

If you enter "import bah.magick" in your "show-all-samples.bmx"
if fails compiling:

C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(log.c.debug.win32.x86.o):log.c:(.text+0xc0f): undefined reference to `RegisterEventSourceA@8'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(log.c.debug.win32.x86.o):log.c:(.text+0xc44): undefined reference to `DeregisterEventSource@4'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0x407): undefined reference to `RegOpenKeyExA@20'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0x49b): undefined reference to `RegEnumKeyA@16'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0x551): undefined reference to `RegOpenKeyExA@20'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0x57e): undefined reference to `RegQueryValueExA@24'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0x588): undefined reference to `RegCloseKey@4'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0xb70): undefined reference to `RegOpenKeyExA@20'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0xbb9): undefined reference to `RegQueryValueExA@24'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_base.c.debug.win32.x86.o):nt_base.c:(.text+0xbec): undefined reference to `RegQueryValueExA@24'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_feature.c.debug.win32.x86.o):nt_feature.c:(.text+0x3a9): undefined reference to `RegOpenKeyExA@20'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_feature.c.debug.win32.x86.o):nt_feature.c:(.text+0x3c4): undefined reference to `RegOpenKeyExA@20'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_feature.c.debug.win32.x86.o):nt_feature.c:(.text+0x4e1): undefined reference to `RegEnumValueA@32'
C:/Programme/BlitzMax/mod/bah.mod/magick.mod/magick.debug.win32.x86.a(nt_feature.c.debug.win32.x86.o):nt_feature.c:(.text+0xa70): undefined reference to `RegCloseKey@4'
Build Error: Failed to link C:/Programme/BlitzMax/mod/scheutz.mod/assimp.mod/examples/show-all-samples.exe




Hi Volker thanks for testing.

I got latest versions from SVN blitzmax-assimp r41, and bah.mods r586

And did a "Build All modules"

I can compile "Showallsamples" fine and import bah.magic

In debugmode, I do get
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Runtime Error!

Program: ...heutz.mod\assimp.mod\examples\show-all-samples.debug.exe



This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


---------------------------
OK   
---------------------------


at Local tex:TTexture=LoadTexture(texFilename)

with

../scheutz.mod/assimp.mod/assimp/test/models/3DS/cube_with_diffuse_texture.3DS
../scheutz.mod/assimp.mod/assimp/test/models/3DS/TEST.PNG


and the C++ runtime sends a signal!:22 to the Bmax ide.



so my guess is bah.magic is overriding Loadtexture() in some way, and that it does something wrong or strange...

over to you Brucey... ;-)

Something to do with how functions have been "externed'. One uses WINAPI the other doesn't.

It seems that when magick is linked, what it thinks those functions were defined as (with the win32 naming convention), are not actually like that. I'll maybe have a play with it tomorrow.
Good ole Windows.

Addition:
Here it fails at
assimp.mod\assimp\test\models\3DS\test1.3ds
assimp.mod\assimp\test\models\ASE\Rifle2.ase
without any warning.
BMax 1.28; newest BaH.magick; newest assimp.mod.
Did just "Rebuild modules".

Hmm... I'll have to see if I have enough room for *another* copy of boost if I'm going to get all this building... ack ! :-p

@Volker: Is this with debug on?

I think you are having other errors than me. (the compile errors)

I trace the error I get to "magic.bmx":

Type TPixmapLoaderM Extends TPixmapLoader

Local image:TMImage = TMImage.CreateFromBlob(blob)

in magic.bmx, so it seems bah.magic *does* in some way interfere/take over pixmap loading ?

The order of my imports (if that matters) are:
Import scheutz.assimp
Import sidesign.minib3d
Import bah.magick


[EDIT]: Yes, it would indeed be nice to be able to share such libs as boost in some common way, without having to reconfigure external SVNs to use them

Yes, debug is on. Release mode makes no difference.
Same order of imports here.
Good night (or day, wherever you are) guys. I really have to view another episode from 4400 before sleeping :-)

in magic.bmx, so it seems bah.magic *does* in some way interfere/take over pixmap loading ?

Yes, that's the whole point of an image library ;-)

Does assimp include its own copy of libpng? Or are you importing brl.pngloader?

If the latter, ideally you leave it up to the user to import their preferred loaders.
If the former, it's... a little more complicated ...

in magic.bmx, so it seems bah.magic *does* in some way interfere/take over pixmap loading ?

Yes, that's the whole point of an image library ;-)


I disagree. Surely an image library does not *have to* interfere with bmax native functions?
It seems to me, that overriding pixmap loaders is a design choice you have made.

My sample program does not use the framework command, so I guess I import everything, but not brl.pngloader in particular.

I don't think assimp does anything with images at all, and I can't find any reference to libpng. I'll try a better debug, to tell you exactly where magic is crashing

Surely an image library does not *have to* interfere with bmax native functions?

I don't think it interferes at all. :-)
If you decide to use BaH.* modules without a Framework, then you are likely to encounter issues in certain areas (examples include BaH.Random, BaH.FreeImage, BaH.Magick).
The image modules are designed as drop-in replacements. BlitzMax's Framework system is designed to allow this.

It seems to me, that overriding pixmap loaders is a design choice you have made.

I would say it is a positive design choice. It doesn't override. Whatever pixmap loaders are available will be iterated over until the image can be loaded. However, having multiple of the same core libraries compiled into the same binary is probably not very healthy.

so I guess I import everything

Everything in BRL and Pub.

Of course the easy answer is not to use BaH.Magick (or BaH.FreeImage), and stick to BlitzMax's native functions :-)

Compile Error: File 'C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/assimp/code/irrXML/irrXML.cpp' not found
[C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/source.bmx;6;40]

:-(

I guess the checkout didn't work properly...

Seems the "irrXML" folder is not there at all.

That's one reason I don't use external repositories - they can change and break your code.

Compile Error: File 'C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/assimp/code/irrXML/irrXML.cpp' not found
[C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/source.bmx;6;40]


:-(

I guess the checkout didn't work properly...

I've updated a little time ago, so it should compile ok if you check out again.

To prevent this from happening again, I've locked boost and assimp to specific revisions. I'll be sure to check everything compiles next time before I update revisions again! :-)

This in minib3d does not help :
Import BRL.BMPLoader
Import BRL.PNGLoader
Import BRL.JPGLoader

Best to comment those out and let the user decide how they want to load images. (or let the module designer dictate it for you - the choice is yours :-)

Also, you will need the "config" folder in magick's example folder to be available locally for the app - it tells the library what features to support.

Thanks Brucey.
Including the config folder seems to solve the problems for me.

@Volker: There is a problem with some files that crash aiImportfile(), when the aiProcess_PreTransformVertices flag is used.

assimp authors are working on it to try and iron that out:
http://groups.google.com/group/bmx3d/browse_thread/thread/fdcb073d834b5e8f

https://sourceforge.net/forum/forum.php?thread_id=2869243&forum_id=817653

Hi Peter,

just found this in the sourceforge forum:
OBJ loads ok now. :-)

Hm, problem seems to be solved?
I will not support .dae until I hear from you.

Btw, under what license is your mod?
I want to publish a freeware version of my 3D content viewer in a few days
(who want's to do some betatesting, drop me a note).
Is this ok?

Hi Volker

Bye,
Alex

PS: Guys, please remember, Assimp is currently no *stable* release,
it's a beta in development. But I think we can profit from each
other :-)


And for blitzmax - assimp?, It's even more in a Beta state!

There are several minor problems, mainly when using the flag mentioned above, but they will I hope be ironed out along the way.
Collada import is not more unstable than other formats.

You can find the license on the googlecode page.
It's "The New BSD Style License" , so you can basically do what you want, except use my name or alias to promote or endorse what you release.

A notice that you are using Beta versions of assimp and blitzmax-assimp will be much appreciated, as will a link to blitzmax-assimp google code page.

It will be very useful, if you, when you find files (not already included with assimp) that crash aiFileImport() , (and only that), that you post a link on the assimp sf page, so that the authors has a chance to iron those out.

It will be very useful, if you, when you find files (not already included with assimp) that crash aiFileImport() , (and only that), that you post a link on the assimp sf page, so that the authors has a chance to iron those out.

Yep, I will create a special error check for this and browse some files.