This does not work for some reason
Blitz3D Forums/Blitz3D Programming/This does not work for some reason
| ||
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
camera=CreateCamera()
light=CreateLight()
RotateEntity light,90,0,0
; Load mesh
crate=LoadMesh("Plataforma_1.b3d")
PositionEntity crate,0,0,100
; Get mesh surface
surf=GetSurface(crate,1)
; Get surface brush
crate_brush=GetSurfaceBrush(surf)
; Get brush texture
crate_tex=GetBrushTexture(crate_brush,0)
While Not KeyDown( 1 )
RenderWorld
; Display full texture name
Text 0,0,"Texture name, as returned by TextureName$():"
Text 0,20,TextureName$(crate_tex)
; Display trimmed texture name
Text 0,40,"Texture name with path stripped:"
Text 0,60,StripPath$(TextureName$(crate_tex))
Flip
Wend
End
Function StripPath$(file$)
If Len(file$)>0
For i=Len(file$) To 1 Step -1
mi$=Mid$(file$,i,1)
If mi$="\" Or mi$="/" Then Return name$ Else name$=mi$+name$
Next
EndIf
Return name$
End Function
Do not return the name of the texture I try to recover, just returns nothing. any suggestions. |
| ||
| Yue, as RemiD kindly reminded me in my thread to grab texture names in an array, use the following from this link: http://www.blitzbasic.com/Community/post.php?topic=101442&post=1205263 Code: Haven't tested this because I wrote it out in a codebox, but it SHOULD work if you follow the directions from within the code correctly! ^_^ Hope this helps! Good luck with your project! Sincerely, ~GF |
| ||
| Thanks You :) The problem here in my models, so far I find that for every texture have my model is a surface set, however, was looking on the surface that had no texture assigned.
Local Superficie%[2]
Local Brush%[2]
Local TexturaVector%[2]
Local TexturaNormal%[2]
Local TexturaSpecular%[2]
Local S%
For S% = 1 To CountSurfaces(Plataforma1.Mesh\Malla)
Superficie[S%] = GetSurface(Plataforma1\Malla,S%)
Brush[S%] = GetSurfaceBrush(Superficie[S%])
TexturaVector[S%] = GetBrushTexture(Brush[S%],0)
SetCubeMode TexturaVector[S%],2
SetCubeAlign TexturaVector[S%],Bombillo.Luz\TipoLuz%
TexturaNormal[S%] = GetBrushTexture(Brush[S%],1)
SetCubeMode TexturaNormal[S%],2
TexturaSpecular[S%] = GetBrushTexture(Brush[S%],4)
SetCubeMode TexturaSpecular[S%],2
SetCubeAlign TexturaSpecular[S%],Bombillo.Luz\TipoLuz%
Next
AmbientLight 32,32,32
|
| ||
| Yea, this code only works if the texture data is in the model and the files are in the same folder as the model. |