⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d3dx8.pas

📁 雷神之锤2(Quake2)Delphi源码
💻 PAS
📖 第 1 页 / 共 5 页
字号:

    // Left multiply the current matrix with the computed rotation
    // matrix. All angles are counterclockwise. (rotation is about the
    // local origin of the object)

    // The rotation is composed of a yaw around the Y axis, a pitch around
    // the X axis, and a roll around the Z axis.
    function RotateYawPitchRollLocal(const yaw, pitch, roll : Single) : HResult; stdcall;

    // Right multiply the current matrix with the computed scale
    // matrix. (transformation is about the current world origin)
    function Scale(const x, y, z: Single) : HResult; stdcall;

    // Left multiply the current matrix with the computed scale
    // matrix. (transformation is about the local origin of the object)
    function ScaleLocal(const x, y, z : Single) : HResult; stdcall;

    // Right multiply the current matrix with the computed translation
    // matrix. (transformation is about the current world origin)
    function Translate(const x, y, z : Single) : HResult; stdcall;

    // Left multiply the current matrix with the computed translation
    // matrix. (transformation is about the local origin of the object)
    function TranslateLocal(const x, y, z : Single) : HResult; stdcall;

    // Obtain the current matrix at the top of the stack
    function GetTop : PD3DXMatrix; stdcall;
  end;

const
  IID_ID3DXMatrixStack = ID3DXMatrixStack;

function D3DXCreateMatrixStack(const Flags : LongWord; out Stack : ID3DXMatrixStack) : HResult; stdcall;


///////////////////////////////////////////////////////////////////////////
//
//  Copyright (C) 1999 Microsoft Corporation.  All Rights Reserved.
//
//  File:       d3dx8core.h
//  Content:    D3DX core types and functions
//
///////////////////////////////////////////////////////////////////////////

type
///////////////////////////////////////////////////////////////////////////
// ID3DXBuffer:
// ------------
// The buffer object is used to return arbitrary lenght data.
///////////////////////////////////////////////////////////////////////////

  (*$HPPEMIT 'typedef LPD3DXBUFFER PID3DXBuffer;' *)
  PID3DXBuffer = ^ID3DXBuffer;
  ID3DXBuffer = interface(IUnknown)
    ['{932E6A7E-C68E-45dd-A7BF-53D19C86DB1F}']
    // ID3DXBuffer
    function GetBufferPointer : Pointer; stdcall;
    function GetBufferSize : LongWord; stdcall;
  end;



///////////////////////////////////////////////////////////////////////////
// ID3DXFont:
// ----------
// Font objects contain the textures and resources needed to render
// a specific font on a specific device.
//
// Begin -
//    Prepartes device for drawing text.  This is optional.. if DrawText
//    is called outside of Begin/End, it will call Begin and End for you.
//
// DrawText -
//    Draws formatted text on a D3D device.  Some parameters are
//    surprisingly similar to those of GDI's DrawText function.  See GDI
//    documentation for a detailed description of these parameters.
//
// End -
//    Restores device state to how it was when Begin was called.
///////////////////////////////////////////////////////////////////////////

  ID3DXFont = interface(IUnknown)
    ['{2D501DF7-D253-4414-865F-A6D54A753138}']
    // ID3DXFont
    function GetDevice(out ppDevice : IDirect3DDevice8) : HResult; stdcall;
    function GetLogFont(var pLogFont : LOGFONT) : HResult; stdcall;

    function _Begin : HResult; stdcall;
                                                  
    function DrawTextA(pString : PAnsiChar; Count : Integer; var pRect : TRect; const Format : LongWord; const Color : TD3DColor) : Integer stdcall;
    function DrawTextW(pString : PWideChar; Count : Integer; var pRect : TRect; const Format : LongWord; const Color : TD3DColor) : Integer stdcall;

    function _End : HResult; stdcall;
  end;


function D3DXCreateFont(const pDevice : IDirect3DDevice8; hFont : HFONT; out ppFont : ID3DXFont) : HResult; stdcall;

function D3DXCreateFontIndirect(const pDevice : IDirect3DDevice8; const pLogFont : LOGFONT; out ppFont : ID3DXFont) : HResult; stdcall;


///////////////////////////////////////////////////////////////////////////
// ID3DXSprite:
// ------------
// This object intends to provide an easy way to drawing sprites using D3D.
//
// Begin -
//    Prepares device for drawing sprites
//
// Draw, DrawAffine, DrawTransform
//    Draws a sprite in screen-space.  Before transformation, the sprite is
//    the size of SrcRect, with its top-left corner at the origin (0,0).
//    The color and alpha channels are modulated by Color.
//
// End -
//     Restores device state to how it was when Begin was called.
///////////////////////////////////////////////////////////////////////////
type

  ID3DXSprite = interface(IUnknown)
    ['{E8691849-87B8-4929-9050-1B0542D5538C}']
    // ID3DXSprite
    function GetDevice(out ppDevice: IDirect3DDevice8) : HResult; stdcall;

    function _Begin : HResult; stdcall;

    function Draw(const pSrcTexture : IDirect3DTexture8; pSrcRect : PRect; pScaling, pRotationCenter : PD3DXVector2; const Rotation : Single; pTranslation : PD3DXVector2; const Color : TD3DColor): HResult; stdcall;

    function DrawTransform(const pSrcTexture : IDirect3DTexture8; pSrcRect : PRect; var pTransform: TD3DXMatrix; const Color: TD3DColor): HResult; stdcall;

    function _End : HResult; stdcall;
  end;


function D3DXCreateSprite(const pDevice : IDirect3DDevice8; out ppSprite : ID3DXSprite) : HResult; stdcall;



///////////////////////////////////////////////////////////////////////////
// ID3DXRenderToSurface:
// ---------------------
// This object abstracts rendering to surfaces.  These surfaces do not
// necessarily need to be render targets.  If they are not, a compatible
// render target is used, and the result copied into surface at end scene.
///////////////////////////////////////////////////////////////////////////
type

  PD3DXRTS_Desc = ^TD3DXRTS_Desc;
  TD3DXRTS_Desc = packed record
    Width              : Cardinal;
    Height             : Cardinal;
    Format             : TD3DFormat;
    DepthStencil       : BOOL;
    DepthStencilFormat : TD3DFormat;
  end;
  PD3DXRTSDesc = ^TD3DXRTSDesc;
  TD3DXRTSDesc = TD3DXRTS_Desc;


  ID3DXRenderToSurface = interface(IUnknown)
    ['{69CC587C-E40C-458d-B5D3-B029E18EB60A}']
    // ID3DXRenderToSurface
    function GetDevice(out ppDevice : IDirect3DDevice8) : HResult; stdcall;
    function GetDesc(out pDesc : TD3DXRTSDesc) : HResult; stdcall;

    function BeginScene(const pSurface: IDirect3DSurface8; var pViewport: TD3DViewport8) : HResult; stdcall;
    function EndScene : HResult; stdcall;
  end;


function D3DXCreateRenderToSurface(const pDevice : IDirect3DDevice8; const Width, Height : Cardinal; const Format : TD3DFormat; const DepthStencil : BOOL; const DepthStencilFormat : TD3DFormat; out ppRenderToSurface : ID3DXRenderToSurface) : HResult; stdcall;


///////////////////////////////////////////////////////////////////////////
// ID3DXRenderToEnvMap:
// --------------------
///////////////////////////////////////////////////////////////////////////
type

  PD3DXRTEDesc = ^TD3DXRTEDesc;
  TD3DXRTEDesc = record
    Size               : Cardinal;
    Format             : TD3DFormat;
    DepthStencil       : Bool;
    DepthStencilFormat : TD3DFormat;
  end {_D3DXRTE_DESC};

  ID3DXRenderToEnvMap = interface(IUnknown)
    ['{9F6779E5-60A9-4d8b-AEE4-32770F405DBA}']
    // ID3DXRenderToEnvMap
    function GetDevice(out ppDevice : IDirect3DDevice8) : HResult; stdcall;
    function GetDesc(out pDesc : TD3DXRTEDesc) : HResult; stdcall;

    function BeginCube(var pCubeTex : IDirect3DCubeTexture8) : HResult; stdcall;

    function BeginSphere(var pTex : IDirect3DTexture8) : HResult; stdcall;

    function BeginHemisphere(var pTexZPos, pTexZNeg : IDirect3DTexture8) : HResult; stdcall;

    function BeginParabolic(var pTexZPos, pTexZNeg : IDirect3DTexture8) : HResult; stdcall;

    function Face(Face : TD3DCubemapFaces) : HResult; stdcall;
    function _End : HResult; stdcall;
  end;


function D3DXCreateRenderToEnvMap(const ppDevice: IDirect3DDevice8; const Size : Cardinal; const Format : TD3DFormat; const DepthStencil : BOOL; const DepthStencilFormat : TD3DFormat; out ppRenderToEnvMap : ID3DXRenderToEnvMap) : HResult; stdcall;



///////////////////////////////////////////////////////////////////////////
// Shader assemblers:
///////////////////////////////////////////////////////////////////////////

//-------------------------------------------------------------------------
// D3DXASM flags:
// --------------
//
// D3DXASM_DEBUG
//   Generate debug info.
//
// D3DXASM_SKIPVALIDATION
//   Do not validate the generated code against known capabilities and
//   constraints.  This option is only recommended when assembling shaders
//   you KNOW will work.  (ie. have assembled before without this option.)
//-------------------------------------------------------------------------
const
  D3DXASM_DEBUG           = (1 shl 0);
  D3DXASM_SKIPVALIDATION  = (1 shl 1);


//-------------------------------------------------------------------------
// D3DXAssembleShader:
// ------------------------
// Assembles an ascii description of a vertex or pixel shader into
// binary form.
//
// Parameters:
//  pSrcFile
//      Source file name
//  pSrcData
//      Pointer to source code
//  SrcDataLen
//      Size of source code, in bytes
//  Flags
//      D3DXASM_xxx flags
//  ppConstants
//      Returns an ID3DXBuffer object containing constant declarations.
//  ppCompiledShader
//      Returns an ID3DXBuffer object containing the object code.
//  ppCompilationErrors
//      Returns an ID3DXBuffer object containing ascii error messages
//-------------------------------------------------------------------------

function D3DXAssembleShaderFromFileA(pSrcFile : PAnsiChar; Flags : LongWord; ppConstants, ppCompiledShader, ppCompilationErrors : PID3DXBuffer) : HResult; stdcall; overload;
function D3DXAssembleShaderFromFileA(pSrcFile : PAnsiChar; Flags : LongWord; out ppConstants, ppCompiledShader, ppCompilationErrors : ID3DXBuffer) : HResult; stdcall; overload;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -