How do I get the Texture File name From a 3Dformat

BlitzMax Forums/BlitzMax Beginners Area/How do I get the Texture File name From a 3Dformat

Hardcoal(Posted 2013) [#1]
Lets say B3d or 3ds

does the file include the names of the textures. (im guess it does)
so how can i extract it from the B3d,Fbx,3ds file?

thanks


Kryzon(Posted 2013) [#2]
You need to refer to the format's specification.

If you google "[format name] specification" you'll find the material.


xlsior(Posted 2013) [#3]
You can find file format descriptions for a ton of filetypes here:
http://www.wotsit.org


Gabriel(Posted 2013) [#4]
3ds format will only store the 8.3 trimmed version of texture names. Any files which use a texture name more than 8 characters long or a suffix longer than 3 characters long will be broken. I'd use B3D if I were you. The specs for that are here:

http://www.blitzbasic.com/sdkspecs/sdkspecs/b3dfile_specs.txt


Hardcoal(Posted 2013) [#5]
My favorites are fbx and b3d.
I thought there may be a module for that..
If not ill have to know how to read it from a data file


Gabriel(Posted 2013) [#6]
It really depends what you're using as a renderer. BlitzMax is just a language and has no official 3D module beyond the meager and deprecated Max3D. FBX is a widely supported format and covers pretty much everything you might need for games, so I'm sure it's well supported in 3D engines. What are you doing? Since you haven't mentioned a 3D module, I'm guessing you're rolling your own in OpenGL?


Hardcoal(Posted 2013) [#7]
here is what i was looking for.. pretty simple when you know it.



Function GetAllMeshTextures:TList(MESH)
	Local SURFACE, BRUSH, TEXTURE, TexCntr
	Global TexturesList:TList
	
	TexturesList = CreateList()
	
	For SURFACE = 0 To xCountSurfaces(MESH) - 1
		SURFACE = xGetSurface(MESH, 0)
		BRUSH = xGetSurfaceBrush(SURFACE)
		Repeat
			TEXTURE = xGetBrushTexture(BRUSH, TexCntr)
			If TEXTURE > 0 Then
				If CheckIfExsists(xTextureName(TEXTURE)) = False Then
					ListAddLast(TexturesList, StripDir(xTextureName(TEXTURE)))
				End If
			End If
			TexCntr = TexCntr + 1
		Until TEXTURE = 0
	Next
	
	Function CheckIfExsists(name:String)
		Local TName:String
		For TName = EachIn TexturesList
			if TName=name Then Return True
		Next
	End Function

   return TexturesList
End Function