| Class TExecuteBuffer (unit TExecute) |
TObject
Direct3D Immediate mode test by Massimo Bardetti - bigben@dircon.co.uk. This unit implement TExecute a delphi wrapper for DX3 Execute buffers. Important : Always add vertices first.
| Constructors |
constructor Create ( pID3D : IDirect3dDevice; pIViewPort : IDirect3dViewport; size : integer ; pEbRoot : TExecuteBuffer) ;| Functions |
function AddAmbLight(clr : D3DColor) : Boolean;
function AddByte(b : BYTE) : Boolean;
function AddChild(isize : integer) : TExecuteBuffer;
function AddIns(op : D3DOPCODE; size : BYTE; count : WORD) : boolean;
function AddLightState(state : D3DLIGHTSTATETYPE; Value : DWORD) : boolean;
function AddLine(v1 : Integer; v2 : Integer) : boolean;
function AddLines(var pLines : D3DLINE; nLine : Integer) : boolean;
function AddLitVertices(pVert : PPointerList; nVert : integer) : boolean;
function AddMaterial(hMat : D3DMATERIALHANDLE) : boolean;
function AddMatMul(hDest, hSrc1, hSrc2 : D3DMATRIXHANDLE) : boolean;
function AddPoint(v : integer) : boolean;
function AddPoints(var pPointInfo : D3DPOINT) : boolean;
function AddProcess(nVert : Integer; iStart : Integer; dwFlags : DWORD) : boolean;
function AddRenderState(state : D3DRENDERSTATETYPE; Value : DWORD) : boolean;
function AddState(t : D3DTRANSFORMSTATETYPE; h : D3DMATRIXHANDLE) : boolean;
function AddStruct(pStruct : pointer; iSize : integer) : boolean;
function AddTriangle(v1,v2,v3 : Integer) : Boolean;
function AddTriangleData(ptri : D3DTRIANGLE) : Boolean;
function AddTriangleOperation(inum : Integer) : Boolean;
function AddVertices(pVert : PPointerList; nVert : integer) : boolean;
destructor Destroy ;
function Execute : Boolean;
function GetChild(i : Integer) : TExecuteBuffer;
function GetExecuteData(var ped : D3DEXECUTEDATA) : boolean;
function LockBuffer : pointer;
function NumChilds : Integer;
procedure RemoveChild(EBCHild : TexecuteBuffer);
function UnLockBuffer : HResult;| Properties |
| Events |
| Variables |
Tag : Integer;
EBParent : TExecuteBuffer;
EBTemp : Pointer;
iExecuteOnce : integer;
lstEBChilds : TList;
m_Desc : D3DEXECUTEBUFFERDESC;
m_dwInsOffset : Integer;
m_dwOffset : Integer;
m_pID3D : IDirect3dDevice;
m_pIEB : IDirect3DExecuteBuffer;
m_pIViewPort : IDirect3dViewport;| Constructors |
constructor Create ( pID3D : IDirect3dDevice; pIViewPort : IDirect3dViewport; size : integer ; pEbRoot : TExecuteBuffer) ;//////////////////////////////////////////////////////////////// Create the object with the following parameters : pID3D : A direct3D device object pIViewport : A Direct3d Viewport object size : size in bytes of the execute buffer
| Functions |
function AddAmbLight(clr : D3DColor) : Boolean;AddAmbientLight : Add Ambient Light!! clr is a 32 bit value ($RRGGBB
function AddByte(b : BYTE) : Boolean;AddByte : Add one byte to the buffer
function AddChild(isize : integer) : TExecuteBuffer;Add a child buffer
function AddIns(op : D3DOPCODE; size : BYTE; count : WORD) : boolean;AddIns : Add D3D Op code
function AddLightState(state : D3DLIGHTSTATETYPE; Value : DWORD) : boolean;
function AddLine(v1 : Integer; v2 : Integer) : boolean;AddLine : Add a single line
function AddLines(var pLines : D3DLINE; nLine : Integer) : boolean;AddLines : Add a set of lines connecting two vertices
function AddLitVertices(pVert : PPointerList; nVert : integer) : boolean;AddLitVertices : Add a set of vertices that has been lit and transformed by your code. This is useful if you want to create your own lighting and transformation code.
function AddMaterial(hMat : D3DMATERIALHANDLE) : boolean;AddMaterial : Add material handle
function AddMatMul(hDest, hSrc1, hSrc2 : D3DMATRIXHANDLE) : boolean;AddMatMul : Add a Matrix Multiplication to rotate/translate transformation matrices
function AddPoint(v : integer) : boolean;AddPoint : Add point representing vertex
function AddPoints(var pPointInfo : D3DPOINT) : boolean;AddPoints : Add a set of points
function AddProcess(nVert : Integer; iStart : Integer; dwFlags : DWORD) : boolean;AddProcess : Add a process instruction nVert : number of vertices to process iStart : first vertex to process dwFlags : Flags (D3DPROCESSVERTICES_ type
function AddRenderState(state : D3DRENDERSTATETYPE; Value : DWORD) : boolean;AddRenderState : Add a rander state instruction
function AddState(t : D3DTRANSFORMSTATETYPE; h : D3DMATRIXHANDLE) : boolean;AddState : Add D3D State transformations (matrices) t : Type of transofrmation (world,projection, view ..); h : handle to the matrix describing it
function AddStruct(pStruct : pointer; iSize : integer) : boolean;AddStruct : Add a portion of memory yo the buffer
function AddTriangle(v1,v2,v3 : Integer) : Boolean;AddTriangle : Add Triangle connection v1,v2,v3 vertices
function AddTriangleData(ptri : D3DTRIANGLE) : Boolean;
function AddTriangleOperation(inum : Integer) : Boolean;AddTriangleOperation : Add the Triangle operation and the number of tringles following it This function must always be followed by AddTriangleData to add iNum traingles to the execute buffer.
function AddVertices(pVert : PPointerList; nVert : integer) : boolean;AddVertices : Add a set of vertices If your buffer will conatin vertices this is always the first instruction to do before adding anything else pVert : is a pointer to an array of pointers of D3DVERTEX type (eg. TList.List) nvert : Number of vertices
ZeroMemory(@ed, sizeof(ed));
destructor Destroy ;
function Execute : Boolean;Execute : Unlocks and execute the buffer
function GetChild(i : Integer) : TExecuteBuffer;
function GetExecuteData(var ped : D3DEXECUTEDATA) : boolean;GetExecuteData : Fills a D3DEXECUTEDATA passed by reference
function LockBuffer : pointer;//////////////////////////////////////////////////////////////// LockBuffer : lock the buffer in memory and return the pointer to the memory where it reside
function NumChilds : Integer;
procedure RemoveChild(EBCHild : TexecuteBuffer);
function UnLockBuffer : HResult;| Properties |
| Events |
| Variables |
Tag : Integer;
EBParent : TExecuteBuffer;
EBTemp : Pointer;
iExecuteOnce : integer;
lstEBChilds : TList;
m_Desc : D3DEXECUTEBUFFERDESC;
m_dwInsOffset : Integer;
m_dwOffset : Integer;
m_pID3D : IDirect3dDevice;
m_pIEB : IDirect3DExecuteBuffer;
m_pIViewPort : IDirect3dViewport;