Support of INCBIN and ZIP?

BlitzMax Forums/MiniB3D Module/Support of INCBIN and ZIP?

Midimaster(Posted 2010) [#1]
I recognized, that the current version of MINIB3D cannot handle with files included with INCBIN or ZIP. This does not match to the professional impression, that makes MINIB3D to me...

Is it a error of my code or does it really not support streams? Would it be a big problem to solve it?

demo-code (needs a test.png in code directory):

SuperStrict
Import sidesign.minib3d
Incbin "test.png"

Graphics3D 800,600,24,2

Global camera:TCamera = CreateCamera()
Global light:Tlight = CreateLight()

Global OldDraw:TImage = LoadImage("incbin::test.png")
Global SpriteA:TSprite = LoadSprite("test.png")
Global SpriteB:TSprite = LoadSprite("incbin::test.png")

MoveEntity SpriteA,0,0,2
MoveEntity SpriteB,-2,0,3

Repeat
	MoveEntity SpriteA,0,0,0.01
	MoveEntity SpriteB,0.01,0,0
        RenderWorld
	BeginMax2D
		DrawImage OldDraw,0,0
	EndMax2D
	Flip 1
Until KeyHit(key_Escape)


You can see: Drawimage is working, but MINIB3D-sprite recognizes the PNG-size, but not the image itself.


SLotman(Posted 2010) [#2]
Already found the problem, miniB3D first tries to find the texture on disk (using bmax command FileType), and since it's incbinned, it returns null, so it won't load it at all.

To fix it, go to TTexture.bmx and change the function 'Findfile' to this:



Now it will work with incbinned files, and probably with zipstream module too.


jkrankie(Posted 2010) [#3]
So would this work with meshes too? that would be cool...

Cheers
Charlie


SLotman(Posted 2010) [#4]
No, this only works for textures. To get it into meshes, you have to make changes on TMesh, TModel and who knows where :P


Difference(Posted 2010) [#5]
Any advantages over /Community/posts.php?topic=80655#907525 ?

I'll put the best version in my "minib3d smallfixes" version.


SLotman(Posted 2010) [#6]
Yes, I think so - my version works with zipstream module, and anything implemented over streams, instead of plain checking for incbin:: =)


Midimaster(Posted 2010) [#7]
Wouldn't this be worth to be added in the next official update of MiniB3D?

So, that not everybody has to think about his little patches, each time a new minib3d updates comes? I noticed a discussion about this streams problems is running since two years now.

I would suggest to add a full stream support for all "loading functions" of minib3d.

SimonH. Could you help us please? This would make some people happy.


(sorry for my bad english...)


Difference(Posted 2010) [#8]
Thanks SLotman, added to the smallfixes version at /Community/posts.php?topic=88252#1009504