www.pudn.com > DelphiX_for7.zip   To Read all the content


[file head]:
unit DXRender;

interface

{$INCLUDE DelphiXcfg.inc}

uses
Windows, DirectX;

const
DXR_MAXTEXTURE = 4;

type
TDXR_Value = Double;

TDXR_Color = DWORD;
TDXR_SurfaceColor = DWORD;

{ TDXR_ShadeMode }

TDXR_ShadeMode = (
DXR_SHADEMODE_FLAT,
DXR_SHADEMODE_GOURAUD
);

{ TDXR_Blend }

TDXR_Blend = (
// for blending
DXR_BLEND_ZERO, // r=0
DXR_BLEND_ONE1, // r=c1
DXR_BLEND_ONE2, // r=c2
DXR_BLEND_ONE1_ADD_ONE2, // r=c1+c2
DXR_BLEND_ONE1_SUB_ONE2, // r=c1-c2
DXR_BLEND_ONE2_SUB_ONE1, // r=c2-c1
DXR_BLEND_ONE1_MUL_ONE2, // r=c1*c2

DXR_BLEND_SRCALPHA1, // r=c1*a1
DXR_BLEND_SRCALPHA1_ADD_ONE2, // r=c1*a1+c2
DXR_BLEND_ONE2_SUB_SRCALPHA1, // r=c2-c1*a1
DXR_BLEND_SRCALPHA1_ADD_INVSRCALPHA2, // r=c1*a1+c2*(1-a2)
DXR_BL
... ...

[file tail]:
... ...
X + pSkip*xIncX;
gStartY := gStartY + pSkip*xIncY;

{ X clipping }
if xIncX>=0 then
begin
pCount := (SrcRect.Right*TextureAxisFloat-gStartX) div Max(xIncX, 1);
end else
begin
pCount := (gStartX-SrcRect.Left*TextureAxisFloat) div (-xIncX);
end;

if xIncY>=0 then
begin
pCount := Min((SrcRect.Bottom*TextureAxisFloat-gStartY) div Max(xIncY, 1), pCount);
end else
begin
pCount := Min((gStartY-SrcRect.Top*TextureAxisFloat) div (-xIncY), pCount);
end;

pCount := Min(Integer(Dest.Width)-(StartX+pSkip), pCount);

{ Run }
DXRMachine.Axis.Axis.X := StartX + pSkip;
DXRMachine.Axis.Axis.Y := dy;
DXRMachine.TextureList[0].nAxis.X := gStartX;
DXRMachine.TextureList[0].nAxis.Y := gStartY;
DXRMachine.Run(pCount);

sx := sx - yIncX;
sy := sy + yIncY;
end;
end;

initialization
ReadCPUID;
Init;
InitCosinTable;
finalization
FDXRMachine.Free;
end.