📄 direct3d.pas
字号:
PD3DViewport = ^TD3DViewport;
TD3DViewport = packed record
dwSize: DWORD;
dwX: DWORD;
dwY: DWORD; (* Top left *)
dwWidth: DWORD;
dwHeight: DWORD; (* Dimensions *)
dvScaleX: TD3DValue; (* Scale homogeneous to screen *)
dvScaleY: TD3DValue; (* Scale homogeneous to screen *)
dvMaxX: TD3DValue; (* Min/max homogeneous x coord *)
dvMaxY: TD3DValue; (* Min/max homogeneous y coord *)
dvMinZ: TD3DValue;
dvMaxZ: TD3DValue; (* Min/max homogeneous z coord *)
end;
PD3DViewport2 = ^TD3DViewport2;
TD3DViewport2 = packed record
dwSize: DWORD;
dwX: DWORD;
dwY: DWORD; (* Viewport Top left *)
dwWidth: DWORD;
dwHeight: DWORD; (* Viewport Dimensions *)
dvClipX: TD3DValue; (* Top left of clip volume *)
dvClipY: TD3DValue;
dvClipWidth: TD3DValue; (* Clip Volume Dimensions *)
dvClipHeight: TD3DValue;
dvMinZ: TD3DValue; (* Min/max of clip Volume *)
dvMaxZ: TD3DValue;
end;
PD3DViewport7 = ^TD3DViewport7;
TD3DViewport7 = packed record
dwX: DWORD;
dwY: DWORD; (* Viewport Top left *)
dwWidth: DWORD;
dwHeight: DWORD; (* Viewport Dimensions *)
dvMinZ: TD3DValue; (* Min/max of clip Volume *)
dvMaxZ: TD3DValue;
end;
(*
* Values for clip fields.
*)
const
// Max number of user clipping planes, supported in D3D.
D3DMAXUSERCLIPPLANES = 32;
// These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
//
D3DCLIPPLANE0 = (1 shl 0);
D3DCLIPPLANE1 = (1 shl 1);
D3DCLIPPLANE2 = (1 shl 2);
D3DCLIPPLANE3 = (1 shl 3);
D3DCLIPPLANE4 = (1 shl 4);
D3DCLIPPLANE5 = (1 shl 5);
const
D3DCLIP_LEFT = $00000001;
D3DCLIP_RIGHT = $00000002;
D3DCLIP_TOP = $00000004;
D3DCLIP_BOTTOM = $00000008;
D3DCLIP_FRONT = $00000010;
D3DCLIP_BACK = $00000020;
D3DCLIP_GEN0 = $00000040;
D3DCLIP_GEN1 = $00000080;
D3DCLIP_GEN2 = $00000100;
D3DCLIP_GEN3 = $00000200;
D3DCLIP_GEN4 = $00000400;
D3DCLIP_GEN5 = $00000800;
(*
* Values for d3d status.
*)
D3DSTATUS_CLIPUNIONLEFT = D3DCLIP_LEFT;
D3DSTATUS_CLIPUNIONRIGHT = D3DCLIP_RIGHT;
D3DSTATUS_CLIPUNIONTOP = D3DCLIP_TOP;
D3DSTATUS_CLIPUNIONBOTTOM = D3DCLIP_BOTTOM;
D3DSTATUS_CLIPUNIONFRONT = D3DCLIP_FRONT;
D3DSTATUS_CLIPUNIONBACK = D3DCLIP_BACK;
D3DSTATUS_CLIPUNIONGEN0 = D3DCLIP_GEN0;
D3DSTATUS_CLIPUNIONGEN1 = D3DCLIP_GEN1;
D3DSTATUS_CLIPUNIONGEN2 = D3DCLIP_GEN2;
D3DSTATUS_CLIPUNIONGEN3 = D3DCLIP_GEN3;
D3DSTATUS_CLIPUNIONGEN4 = D3DCLIP_GEN4;
D3DSTATUS_CLIPUNIONGEN5 = D3DCLIP_GEN5;
D3DSTATUS_CLIPINTERSECTIONLEFT = $00001000;
D3DSTATUS_CLIPINTERSECTIONRIGHT = $00002000;
D3DSTATUS_CLIPINTERSECTIONTOP = $00004000;
D3DSTATUS_CLIPINTERSECTIONBOTTOM = $00008000;
D3DSTATUS_CLIPINTERSECTIONFRONT = $00010000;
D3DSTATUS_CLIPINTERSECTIONBACK = $00020000;
D3DSTATUS_CLIPINTERSECTIONGEN0 = $00040000;
D3DSTATUS_CLIPINTERSECTIONGEN1 = $00080000;
D3DSTATUS_CLIPINTERSECTIONGEN2 = $00100000;
D3DSTATUS_CLIPINTERSECTIONGEN3 = $00200000;
D3DSTATUS_CLIPINTERSECTIONGEN4 = $00400000;
D3DSTATUS_CLIPINTERSECTIONGEN5 = $00800000;
D3DSTATUS_ZNOTVISIBLE = $01000000;
(* Do not use 0x80000000 for any status flags in future as it is reserved *)
D3DSTATUS_CLIPUNIONALL = (
D3DSTATUS_CLIPUNIONLEFT or
D3DSTATUS_CLIPUNIONRIGHT or
D3DSTATUS_CLIPUNIONTOP or
D3DSTATUS_CLIPUNIONBOTTOM or
D3DSTATUS_CLIPUNIONFRONT or
D3DSTATUS_CLIPUNIONBACK or
D3DSTATUS_CLIPUNIONGEN0 or
D3DSTATUS_CLIPUNIONGEN1 or
D3DSTATUS_CLIPUNIONGEN2 or
D3DSTATUS_CLIPUNIONGEN3 or
D3DSTATUS_CLIPUNIONGEN4 or
D3DSTATUS_CLIPUNIONGEN5);
D3DSTATUS_CLIPINTERSECTIONALL = (
D3DSTATUS_CLIPINTERSECTIONLEFT or
D3DSTATUS_CLIPINTERSECTIONRIGHT or
D3DSTATUS_CLIPINTERSECTIONTOP or
D3DSTATUS_CLIPINTERSECTIONBOTTOM or
D3DSTATUS_CLIPINTERSECTIONFRONT or
D3DSTATUS_CLIPINTERSECTIONBACK or
D3DSTATUS_CLIPINTERSECTIONGEN0 or
D3DSTATUS_CLIPINTERSECTIONGEN1 or
D3DSTATUS_CLIPINTERSECTIONGEN2 or
D3DSTATUS_CLIPINTERSECTIONGEN3 or
D3DSTATUS_CLIPINTERSECTIONGEN4 or
D3DSTATUS_CLIPINTERSECTIONGEN5);
D3DSTATUS_DEFAULT = (
D3DSTATUS_CLIPINTERSECTIONALL or
D3DSTATUS_ZNOTVISIBLE);
(*
* Options for direct transform calls
*)
D3DTRANSFORM_CLIPPED = $00000001;
D3DTRANSFORM_UNCLIPPED = $00000002;
type
PD3DTransformData = ^TD3DTransformData;
TD3DTransformData = packed record
dwSize: DWORD;
lpIn: Pointer; (* Input vertices *)
dwInSize: DWORD; (* Stride of input vertices *)
lpOut: Pointer; (* Output vertices *)
dwOutSize: DWORD; (* Stride of output vertices *)
lpHOut: ^TD3DHVertex; (* Output homogeneous vertices *)
dwClip: DWORD; (* Clipping hint *)
dwClipIntersection: DWORD;
dwClipUnion: DWORD; (* Union of all clip flags *)
drExtent: TD3DRect; (* Extent of transformed vertices *)
end;
(*
* Structure defining position and direction properties for lighting.
*)
PD3DLightingElement = ^TD3DLightingElement;
TD3DLightingElement = packed record
dvPosition: TD3DVector; (* Lightable point in model space *)
dvNormal: TD3DVector; (* Normalised unit vector *)
end;
(*
* Structure defining material properties for lighting.
*)
PD3DMaterial = ^TD3DMaterial;
TD3DMaterial = packed record
dwSize: DWORD;
case Integer of
0: (
diffuse: TD3DColorValue; (* Diffuse color RGBA *)
ambient: TD3DColorValue; (* Ambient color RGB *)
specular: TD3DColorValue; (* Specular 'shininess' *)
emissive: TD3DColorValue; (* Emissive color RGB *)
power: TD3DValue; (* Sharpness if specular highlight *)
hTexture: TD3DTextureHandle; (* Handle to texture map *)
dwRampSize: DWORD;
);
1: (
dcvDiffuse: TD3DColorValue;
dcvAmbient: TD3DColorValue;
dcvSpecular: TD3DColorValue;
dcvEmissive: TD3DColorValue;
dvPower: TD3DValue;
);
end;
PD3DMaterial7 = ^TD3DMaterial7;
TD3DMaterial7 = packed record
case Integer of
0: (
diffuse: TD3DColorValue; (* Diffuse color RGBA *)
ambient: TD3DColorValue; (* Ambient color RGB *)
specular: TD3DColorValue; (* Specular 'shininess' *)
emissive: TD3DColorValue; (* Emissive color RGB *)
power: TD3DValue; (* Sharpness if specular highlight *)
);
1: (
dcvDiffuse: TD3DColorValue;
dcvAmbient: TD3DColorValue;
dcvSpecular: TD3DColorValue;
dcvEmissive: TD3DColorValue;
dvPower: TD3DValue;
);
end;
PD3DLightType = ^TD3DLightType;
TD3DLightType = (
D3DLIGHT_INVALID_0,
D3DLIGHT_POINT,
D3DLIGHT_SPOT,
D3DLIGHT_DIRECTIONAL,
// Note: The following light type (D3DLIGHT_PARALLELPOINT)
// is no longer supported from D3D for DX7 onwards.
D3DLIGHT_PARALLELPOINT,
D3DLIGHT_GLSPOT);
(*
* Structure defining a light source and its properties.
*)
PD3DLight = ^TD3DLight;
TD3DLight = packed record
dwSize: DWORD;
dltType: TD3DLightType; (* Type of light source *)
dcvColor: TD3DColorValue; (* Color of light *)
dvPosition: TD3DVector; (* Position in world space *)
dvDirection: TD3DVector; (* Direction in world space *)
dvRange: TD3DValue; (* Cutoff range *)
dvFalloff: TD3DValue; (* Falloff *)
dvAttenuation0: TD3DValue; (* Constant attenuation *)
dvAttenuation1: TD3DValue; (* Linear attenuation *)
dvAttenuation2: TD3DValue; (* Quadratic attenuation *)
dvTheta: TD3DValue; (* Inner angle of spotlight cone *)
dvPhi: TD3DValue; (* Outer angle of spotlight cone *)
end;
PD3DLight7 = ^TD3DLight7;
TD3DLight7 = packed record
dltType: TD3DLightType; (* Type of light source *)
dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
dcvSpecular: TD3DColorValue;(* Specular color of light *)
dcvAmbient: TD3DColorValue; (* Ambient color of light *)
dvPosition: TD3DVector; (* Position in world space *)
dvDirection: TD3DVector; (* Direction in world space *)
dvRange: TD3DValue; (* Cutoff range *)
dvFalloff: TD3DValue; (* Falloff *)
dvAttenuation0: TD3DValue; (* Constant attenuation *)
dvAttenuation1: TD3DValue; (* Linear attenuation *)
dvAttenuation2: TD3DValue; (* Quadratic attenuation *)
dvTheta: TD3DValue; (* Inner angle of spotlight cone *)
dvPhi: TD3DValue; (* Outer angle of spotlight cone *)
end;
(*
* Structure defining a light source and its properties.
*)
(* flags bits *)
const
D3DLIGHT_ACTIVE = $00000001;
D3DLIGHT_NO_SPECULAR = $00000002;
D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
(* maximum valid light range *)
D3DLIGHT_RANGE_MAX = 1.8439088915e+18; //sqrt(FLT_MAX);
type
PD3DLight2 = ^TD3DLight2;
TD3DLight2 = packed record
dwSize: DWORD;
dltType: TD3DLightType; (* Type of light source *)
dcvColor: TD3DColorValue; (* Color of light *)
dvPosition: TD3DVector; (* Position in world space *)
dvDirection: TD3DVector; (* Direction in world space *)
dvRange: TD3DValue; (* Cutoff range *)
dvFalloff: TD3DValue; (* Falloff *)
dvAttenuation0: TD3DValue; (* Constant attenuation *)
dvAttenuation1: TD3DValue; (* Linear attenuation *)
dvAttenuation2: TD3DValue; (* Quadratic attenuation *)
dvTheta: TD3DValue; (* Inner angle of spotlight cone *)
dvPhi: TD3DValue; (* Outer angle of spotlight cone *)
dwFlags: DWORD;
end;
PD3DLightData = ^TD3DLightData;
TD3DLightData = packed record
dwSize: DWORD;
lpIn: ^TD3DLightingElement; (* Input positions and normals *)
dwInSize: DWORD; (* Stride of input elements *)
lpOut: ^TD3DTLVertex; (* Output colors *)
dwOutSize: DWORD; (* Stride of output colors *)
end;
(*
* Before DX5, these values were in an enum called
* TD3DColorModel. This was not correct, since they are
* bit flags. A driver can surface either or both flags
* in the dcmColorModel member of D3DDEVICEDESC.
*)
type
TD3DColorModel = DWORD;
const
D3DCOLOR_MONO = 1;
D3DCOLOR_RGB = 2;
(*
* Options for clearing
*)
const
D3DCLEAR_TARGET = $00000001; (* Clear target surface *)
D3DCLEAR_ZBUFFER = $00000002; (* Clear target z buffer *)
D3DCLEAR_STENCIL = $00000004; (* Clear stencil planes *)
(*
* Execute buffers are allocated via Direct3D. These buffers may then
* be filled by the application with instructions to execute along with
* vertex data.
*)
(*
* Supported op codes for execute instructions.
*)
type
PD3DOpcode = ^TD3DOpcode;
TD3DOpcode = (
D3DOP_INVALID_0,
D3DOP_POINT,
D3DOP_LINE,
D3DOP_TRIANGLE,
D3DOP_MATRIXLOAD,
D3DOP_MATRIXMULTIPLY,
D3DOP_STATETRANSFORM,
D3DOP_STATELIGHT,
D3DOP_STATERENDER,
D3DOP_PROCESSVERTICES,
D3DOP_TEXTURELOAD,
D3DOP_EXIT,
D3DOP_BRANCHFORWARD,
D3DOP_SPAN,
D3DOP_SETSTATUS);
PD3DInstruction = ^TD3DInstruction;
TD3DInstruction = packed record
bOpcode: BYTE; (* Instruction opcode *)
bSize: BYTE; (* Size of each instruction data unit *)
wCount: WORD; (* Count of instruction data units to follow *)
end;
(*
* Structure for texture loads
*)
PD3DTextureLoad = ^TD3DTextureLoad;
TD3DTextureLoad = packed record
hDestTexture: TD3DTextureHandle;
hSrcTexture: TD3DTextureHandle;
end;
(*
* Structure for picking
*)
PD3DPickRecord = ^TD3DPickRecord;
TD3DPickRecord = packed record
bOpcode: BYTE;
bPad: BYTE;
dwOffset: DWORD;
dvZ: TD3DValue;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -