I tried that, it seemed to loop for infinity. I did notice it was catching the textue names, which is what I want. Unfortunately, it doesn't seem to end it's loop.
Heres the code I tested with.
; LoadMesh Example
; ----------------
Graphics3D 640,480
SetBuffer BackBuffer()
camera=CreateCamera()
light=CreateLight()
RotateEntity light,90,0,0
; Load mesh
drum=LoadMesh("Objects\NarnFighterRT_Final.B3D")
GetB3dTextures("Objects\NarnFighterRT_Final.B3D")
PositionEntity drum,0,0,MeshDepth(drum)*2
While Not KeyDown( 1 )
RenderWorld
Flip
Wend
End
Type B3dTexture
Field FileName$
End Type
Function GetB3dTextures(B3dFilename$)
Stop
B3dFile= ReadFile(B3dFilename$)
While Not Eof(B3dFile)
Byte=ReadByte(B3dFile)
If Byte > 32
NewName$=NewName$+Chr(Byte)
Else
If NewName$ <> ""
Tex.B3dTexture=New B3dTexture
Tex\FileName$=Trim(NewName$)
DebugLog Newname
EndIf
EndIf
Wend
For Tex.B3dTexture=Each B3dTexture
If Len(Tex\FileName$)=1
Delete Tex
Else
If Instr(Tex\FileName$,".")=False
Delete Tex
EndIf
EndIf
Next
CloseFile B3DFile
End Function
Heres the code I tested with.
; LoadMesh Example
; ----------------
Graphics3D 640,480
SetBuffer BackBuffer()
camera=CreateCamera()
light=CreateLight()
RotateEntity light,90,0,0
; Load mesh
drum=LoadMesh("Objects\NarnFighterRT_Final.B3D")
GetB3dTextures("Objects\NarnFighterRT_Final.B3D")
PositionEntity drum,0,0,MeshDepth(drum)*2
While Not KeyDown( 1 )
RenderWorld
Flip
Wend
End
Type B3dTexture
Field FileName$
End Type
Function GetB3dTextures(B3dFilename$)
Stop
B3dFile= ReadFile(B3dFilename$)
While Not Eof(B3dFile)
Byte=ReadByte(B3dFile)
If Byte > 32
NewName$=NewName$+Chr(Byte)
Else
If NewName$ <> ""
Tex.B3dTexture=New B3dTexture
Tex\FileName$=Trim(NewName$)
DebugLog Newname
EndIf
EndIf
Wend
For Tex.B3dTexture=Each B3dTexture
If Len(Tex\FileName$)=1
Delete Tex
Else
If Instr(Tex\FileName$,".")=False
Delete Tex
EndIf
EndIf
Next
CloseFile B3DFile
End Function