| texture - указатель текстуры |
|
Возвращает полное имя файла текстуры.
Чтобы узнать только название текстуры, Вы должны будете анализировать строку, возвращенную TextureName. Вот одна из функций для этой цели: ; начало 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 ; конец Смотрите также : GetBrushTexture. |
|
; Пример TextureName
; ------------------- Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,90,0,0 ; Загружаем модель crate=LoadMesh("media/wood-crate/wcrate1.3ds") PositionEntity crate,0,0,100 ; Берем поверхность модели surf=GetSurface(crate,1) ; Берем кисть этой поверхности crate_brush=GetSurfaceBrush(surf) ; Берем текстуру кисти crate_tex=GetBrushTexture(crate_brush,0) While Not KeyDown( 1 ) RenderWorld ; Выводим полное имя файла текстуры (включая путь) Text 0,0,"Texture name, as returned by TextureName$():" Text 0,20,TextureName$(crate_tex) ; Выводим обрезанное имя файла текстуры (путь удален) 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 |