Texture Incbin solved

BlitzMax Forums/MiniB3D Module/Texture Incbin solved

Difference(Posted 2008) [#1]
If you change the Filefind() function in "TTexture.bmx", by adding some code to catch "incbin::" , minib3d lets you load incbin'ed textures, with the LoadTexture() function.

I have only tested with with a single texture (not cube maps etc.), but for now this it seems to work fine.

Also I have not tested reloading and if already loaded texures are properly reused.

My new Filefind() function looks like this:

	Function FileFind(file$ Var)
	
		If Lower(Left(file$,8)) = "incbin::"
			If IncbinPtr(Right(file$,Len(file)-8))
				Return True
			Else
				DebugLog "ERROR: Cannot find Incbin texture: "+file$
				Return False	
			EndIf
		EndIf
	
		If FileType(file$)=0
			Repeat
				file$=Right$(file$,(Len(file$)-Instr(file$,"\",1)))
			Until Instr(file$,"\",1)=0
			Repeat
				file$=Right$(file$,(Len(file$)-Instr(file$,"/",1)))
			Until Instr(file$,"/",1)=0
			If FileType(file$)=0
				DebugLog "ERROR: Cannot find texture: "+file$
				Return False
			EndIf
		EndIf
		
		Return True
		
	End Function



*(Posted 2008) [#2]
Would be interesting to see if this can be done with models etc, admittedly I havent used minib3d for a couple of months and dont know if thats in there yet.

Being able to incbin all media types would be a BIG plus for minib3d if it could be done.


klepto2(Posted 2008) [#3]
It could be done, I'm currently using an internal method to let the texture loaders search for incbin files as well. For this you have to incbin the textures at the incbin root. But better than nothing.