iMiniB3D Instancing

BlitzMax Forums/MiniB3D Module/iMiniB3D Instancing

Ian Thompson(Posted 2013) [#1]
Is there any way to get proper instancing via iMiniB3D? CopyEntity() does a CopyMesh(), unlike BB where only an entities transformation matrix is needed.


angros47(Posted 2013) [#2]
In OpenB3D, I added the command RepeatMesh for that.


Ian Thompson(Posted 2013) [#3]
Thanks for reply Angros but I'm looking for a mobile solution. If OpenB3D was GLES, it would be perfect for my needs.


Kryzon(Posted 2013) [#4]
Hello. I don't understand what is stopping you from looking into the source code behind that RepeatMesh function he suggested, figuring out the logic and making your own implementation for iMiniB3D. If you can't help yourself, nobody else will.

While you do the above, you will most likely realize that OpenB3D uses a major part of the iMiniB3D source code and therefore has a remarkably similar structure, and you could probably just copy-paste the function and it would work - you can't do that, however. You need to write your own version because OpenB3D is LGPL licensed and you wouldn't want your commercial game with that kind of license.

You can find the OpenB3D source code [here] and the RepeatMesh function is located in the "Mesh.CPP" file.


Yasha(Posted 2013) [#5]
because OpenB3D is LGPL licensed and you wouldn't want your commercial game with that kind of license.


More specifically, any GPL-derived licence is not usable on iOS no matter how you swing it (unless angros47 gives you specific permission; obviously the licence holder can do whatever they want). It's to do with the app model and closed developer system; they're not legally compatible with some of the more obscure parts of the GPL even if you open-source the app and set its price to free.

On the desktop LGPL is usually acceptable for commercial projects as it allows you to separate your code from the library code.


(On-topic: I'd try and implement this if I was at my Xcode, but I'm not. We'll see who beats me to it.)


Ian Thompson(Posted 2013) [#6]
@Kryzon: Your assumption that I have not looked at the source is wrong. I am very familiar with the OpenB3D source base( http://www.glbasic.com/forum/index.php?topic=6982.msg56815#msg56815 my own GLB branch with extra features) already. Thanks for your comments though.


Kryzon(Posted 2013) [#7]
I see.
Have you managed to achieve the instancing, or are you still looking for a way?


Ian Thompson(Posted 2013) [#8]
Still looking into it, hardware instancing via a shader would be the most efficient I think. Angros47 code is a nice insight on how to go about adding to and modifying the entity/mesh class though.


Kryzon(Posted 2013) [#9]
Here are some links that may help:

http://developer.download.nvidia.com/SDK/9.5/Samples/samples.html#glsl_pseudo_instancing (it's the Pseudo Instancing article)

http://sol.gfxile.net/instancing.html (for non-ES, but may give some ideas).

http://nukecode.blogspot.com/2011/07/geometry-instancig-for-iphone-wip.html


Ian Thompson(Posted 2013) [#10]
Some nice links there Kryzon, thank you.