brush - brush handle index (optional) - index of texture applied to brush, from 0-7. Defaults to 0. |
Returns the texture that is applied to the specified brush. The optional index parameter allows you to specify which particular texture you'd like returning, if there are more than one textures applied to a brush. You should release the texture returned by dxGetBrushTexture after use to prevent leaks! Use FreeTexture to do this. To find out the name of the texture, use dxTextureName See also: dxTextureName, FreeTexture, dxGetEntityBrush, dxGetSurfaceBrush. |
; dxGetBrushTexture 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 |