texture - a valid texture handle |
Returns a texture's absolute filename. To find out just the name of the texture, you will need to parse the string returned by dxTextureName. One such function to do this is: ; start of code 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 ; end of code See also: dxGetBrushTexture. |
; dxTextureName Example ; ------------------- dxGraphics3D 640,480 dxSetBuffer dxBackBuffer() camera=dxCreateCamera() light=dxCreateLight() dxRotateEntity light,90,0,0 ; Load mesh crate=dxLoadMesh("media/wood-crate/wcrate1.3ds") dxPositionEntity crate,0,0,100 ; Get mesh surface surf=dxGetSurface(crate,1) ; Get surface brush crate_brush=dxGetSurfaceBrush(surf) ; Get brush texture crate_tex=dxGetBrushTexture(crate_brush,0) While Not dxKeyDown( 1 ) dxRenderWorld ; Display full texture name dxText 0,0,"Texture name, as returned by dxTextureName$():" dxText 0,20,dxTextureName$(crate_tex) ; Display trimmed texture name dxText 0,40,"Texture name with path stripped:" dxText 0,60,StripPath$(dxTextureName$(crate_tex)) dxFlip 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 |