surface - surface handle |
Returns a brush with the same properties as is applied to the specified mesh surface. If this command does not appear to be returning a valid brush, try using dxGetEntityBrush instead. Remember, dxGetSurfaceBrush actually creates a new brush so don't forget to free it afterwards using dxFreeBrush to prevent memory leaks. Once you have got the brush handle from a surface, you can use dxGetBrushTexture and dxTextureName to get the details of what texture(s) are applied to the brush. See also: dxGetEntityBrush, dxFreeBrush, dxGetSurface, dxGetBrushTexture, dxTextureName. |
; dxGetSurfaceBrush 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 |