Class T3dTexture (unit ttexture)

Inherits from

TObject

T3DTexture: T3DTexture creates, loads and destroys textures [up to 5 textures now but is easy to increase it, just increase the arrays size]. // The process to create a texture is the following : 1> When initializing set texture names using SetTextureNames(n, fileName) 2> When you need to load a texture call LoadTextureSurface(n, bInVideo) bInVideo returns True if the surface is in video memory 3> Call GetTextureHandle(n) to return a handle to the texture 4> Call ReleaseTexture(n) to discard it Most of this code is base on the example tunnel.c and texture.c from the SDK I think that the next thing to do is to forget about those arrays and just let each instance of the class to represent one texture surface To create a T3dTexture object you need a TDDScreen and a TD3D objects. TD3D enumerates texture formats that your renderer support and selects one of them into TD3D.ThisTextureFormat At the moment the texture format remains the same through the execution of the program

Constructors


constructor Create(scr : TDDScreen; d3d : TD3D);



Functions

function loadSurface(DD : IDirectDraw; fname : string; pformat : DDSurfaceDesc; memoryflag : DWORD) : IDirectDrawSurface;


function SetTextureHandle : boolean;


destructor Destroy;


function GetTextureHandle : D3DTEXTUREHANDLE;


function LoadTextureSurface(fname : string; binVideo : boolean) : boolean;


procedure ReleaseTexture ;


Properties

Events

Variables

devD3D : TD3D;


pTexture : IDIRECT3DTEXTURE;


ptextureSurface : IDirectDrawSurface;


scrScreen : TDDScreen;


TextureHandle : D3DTEXTUREHANDLE;



Constructors


constructor Create(scr : TDDScreen; d3d : TD3D);


Functions


function loadSurface(DD : IDirectDraw; fname : string; pformat : DDSurfaceDesc; memoryflag : DWORD) : IDirectDrawSurface;


function SetTextureHandle : boolean;


destructor Destroy;


function GetTextureHandle : D3DTEXTUREHANDLE;


function LoadTextureSurface(fname : string; binVideo : boolean) : boolean;


procedure ReleaseTexture ;


Properties


Events


Variables


devD3D : TD3D;


pTexture : IDIRECT3DTEXTURE;


ptextureSurface : IDirectDrawSurface;


scrScreen : TDDScreen;


TextureHandle : D3DTEXTUREHANDLE;