| 1 |
///////////////////////////////////////////////////////////////////////////
|
| 2 |
//
|
| 3 |
// Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
|
| 4 |
//
|
| 5 |
// File: d3dx8core.h
|
| 6 |
// Content: D3DX core types and functions
|
| 7 |
//
|
| 8 |
///////////////////////////////////////////////////////////////////////////
|
| 9 |
|
| 10 |
#include "d3dx8.h"
|
| 11 |
|
| 12 |
#ifndef __D3DX8CORE_H__
|
| 13 |
#define __D3DX8CORE_H__
|
| 14 |
|
| 15 |
|
| 16 |
///////////////////////////////////////////////////////////////////////////
|
| 17 |
// ID3DXBuffer:
|
| 18 |
// ------------
|
| 19 |
// The buffer object is used to return arbitrary lenght data.
|
| 20 |
///////////////////////////////////////////////////////////////////////////
|
| 21 |
|
| 22 |
typedef interface ID3DXBuffer ID3DXBuffer;
|
| 23 |
typedef interface ID3DXBuffer *LPD3DXBUFFER;
|
| 24 |
|
| 25 |
// {932E6A7E-C68E-45dd-A7BF-53D19C86DB1F}
|
| 26 |
DEFINE_GUID(IID_ID3DXBuffer,
|
| 27 |
0x932e6a7e, 0xc68e, 0x45dd, 0xa7, 0xbf, 0x53, 0xd1, 0x9c, 0x86, 0xdb, 0x1f);
|
| 28 |
|
| 29 |
DECLARE_INTERFACE_(ID3DXBuffer, IUnknown)
|
| 30 |
{
|
| 31 |
// IUnknown
|
| 32 |
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
| 33 |
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
| 34 |
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
| 35 |
|
| 36 |
// ID3DXBuffer
|
| 37 |
STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
|
| 38 |
STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
|
| 39 |
};
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
///////////////////////////////////////////////////////////////////////////
|
| 46 |
// ID3DXFont:
|
| 47 |
// ----------
|
| 48 |
// Font objects contain the textures and resources needed to render
|
| 49 |
// a specific font on a specific device.
|
| 50 |
//
|
| 51 |
// Begin -
|
| 52 |
// Prepartes device for drawing text. This is optional.. if DrawText
|
| 53 |
// is called outside of Begin/End, it will call Begin and End for you.
|
| 54 |
//
|
| 55 |
// DrawText -
|
| 56 |
// Draws formatted text on a D3D device. Some parameters are
|
| 57 |
// surprisingly similar to those of GDI's DrawText function. See GDI
|
| 58 |
// documentation for a detailed description of these parameters.
|
| 59 |
//
|
| 60 |
// End -
|
| 61 |
// Restores device state to how it was when Begin was called.
|
| 62 |
///////////////////////////////////////////////////////////////////////////
|
| 63 |
|
| 64 |
typedef interface ID3DXFont ID3DXFont;
|
| 65 |
typedef interface ID3DXFont *LPD3DXFONT;
|
| 66 |
|
| 67 |
|
| 68 |
// {2D501DF7-D253-4414-865F-A6D54A753138}
|
| 69 |
DEFINE_GUID( IID_ID3DXFont,
|
| 70 |
0x2d501df7, 0xd253, 0x4414, 0x86, 0x5f, 0xa6, 0xd5, 0x4a, 0x75, 0x31, 0x38);
|
| 71 |
|
| 72 |
|
| 73 |
DECLARE_INTERFACE_(ID3DXFont, IUnknown)
|
| 74 |
{
|
| 75 |
// IUnknown
|
| 76 |
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
| 77 |
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
| 78 |
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
| 79 |
|
| 80 |
// ID3DXFont
|
| 81 |
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
| 82 |
STDMETHOD(GetLogFont)(THIS_ LOGFONT* pLogFont) PURE;
|
| 83 |
|
| 84 |
STDMETHOD(Begin)(THIS) PURE;
|
| 85 |
|
| 86 |
STDMETHOD_(INT, DrawTextA)(THIS_ LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
|
| 87 |
STDMETHOD_(INT, DrawTextW)(THIS_ LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
|
| 88 |
|
| 89 |
STDMETHOD(End)(THIS) PURE;
|
| 90 |
};
|
| 91 |
|
| 92 |
#ifndef DrawText
|
| 93 |
#ifdef UNICODE
|
| 94 |
#define DrawText DrawTextW
|
| 95 |
#else
|
| 96 |
#define DrawText DrawTextA
|
| 97 |
#endif
|
| 98 |
#endif
|
| 99 |
|
| 100 |
|
| 101 |
#ifdef __cplusplus
|
| 102 |
extern "C" {
|
| 103 |
#endif //__cplusplus
|
| 104 |
|
| 105 |
HRESULT WINAPI
|
| 106 |
D3DXCreateFont(
|
| 107 |
LPDIRECT3DDEVICE8 pDevice,
|
| 108 |
HFONT hFont,
|
| 109 |
LPD3DXFONT* ppFont);
|
| 110 |
|
| 111 |
|
| 112 |
HRESULT WINAPI
|
| 113 |
D3DXCreateFontIndirect(
|
| 114 |
LPDIRECT3DDEVICE8 pDevice,
|
| 115 |
CONST LOGFONT* pLogFont,
|
| 116 |
LPD3DXFONT* ppFont);
|
| 117 |
|
| 118 |
#ifdef __cplusplus
|
| 119 |
}
|
| 120 |
#endif //__cplusplus
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
///////////////////////////////////////////////////////////////////////////
|
| 129 |
// ID3DXSprite:
|
| 130 |
// ------------
|
| 131 |
// This object intends to provide an easy way to drawing sprites using D3D.
|
| 132 |
//
|
| 133 |
// Begin -
|
| 134 |
// Prepares device for drawing sprites
|
| 135 |
//
|
| 136 |
// Draw, DrawAffine, DrawTransform
|
| 137 |
// Draws a sprite in screen-space. Before transformation, the sprite is
|
| 138 |
// the size of SrcRect, with its top-left corner at the origin (0,0).
|
| 139 |
// The color and alpha channels are modulated by Color.
|
| 140 |
//
|
| 141 |
// End -
|
| 142 |
// Restores device state to how it was when Begin was called.
|
| 143 |
///////////////////////////////////////////////////////////////////////////
|
| 144 |
|
| 145 |
typedef interface ID3DXSprite ID3DXSprite;
|
| 146 |
typedef interface ID3DXSprite *LPD3DXSPRITE;
|
| 147 |
|
| 148 |
|
| 149 |
// {E8691849-87B8-4929-9050-1B0542D5538C}
|
| 150 |
DEFINE_GUID( IID_ID3DXSprite,
|
| 151 |
0xe8691849, 0x87b8, 0x4929, 0x90, 0x50, 0x1b, 0x5, 0x42, 0xd5, 0x53, 0x8c);
|
| 152 |
|
| 153 |
|
| 154 |
DECLARE_INTERFACE_(ID3DXSprite, IUnknown)
|
| 155 |
{
|
| 156 |
// IUnknown
|
| 157 |
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
| 158 |
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
| 159 |
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
| 160 |
|
| 161 |
// ID3DXSprite
|
| 162 |
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
| 163 |
|
| 164 |
STDMETHOD(Begin)(THIS) PURE;
|
| 165 |
|
| 166 |
STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE8 pSrcTexture,
|
| 167 |
CONST RECT* pSrcRect, CONST D3DXVECTOR2* pScaling,
|
| 168 |
CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation,
|
| 169 |
CONST D3DXVECTOR2* pTranslation, D3DCOLOR Color) PURE;
|
| 170 |
|
| 171 |
STDMETHOD(DrawTransform)(THIS_ LPDIRECT3DTEXTURE8 pSrcTexture,
|
| 172 |
CONST RECT* pSrcRect, CONST D3DXMATRIX* pTransform,
|
| 173 |
D3DCOLOR Color) PURE;
|
| 174 |
|
| 175 |
STDMETHOD(End)(THIS) PURE;
|
| 176 |
};
|
| 177 |
|
| 178 |
|
| 179 |
#ifdef __cplusplus
|
| 180 |
extern "C" {
|
| 181 |
#endif //__cplusplus
|
| 182 |
|
| 183 |
|
| 184 |
HRESULT WINAPI
|
| 185 |
D3DXCreateSprite(
|
| 186 |
LPDIRECT3DDEVICE8 pDevice,
|
| 187 |
LPD3DXSPRITE* ppSprite);
|
| 188 |
|
| 189 |
#ifdef __cplusplus
|
| 190 |
}
|
| 191 |
#endif //__cplusplus
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
///////////////////////////////////////////////////////////////////////////
|
| 198 |
// ID3DXRenderToSurface:
|
| 199 |
// ---------------------
|
| 200 |
// This object abstracts rendering to surfaces. These surfaces do not
|
| 201 |
// necessarily need to be render targets. If they are not, a compatible
|
| 202 |
// render target is used, and the result copied into surface at end scene.
|
| 203 |
///////////////////////////////////////////////////////////////////////////
|
| 204 |
|
| 205 |
typedef struct _D3DXRTS_DESC
|
| 206 |
{
|
| 207 |
UINT Width;
|
| 208 |
UINT Height;
|
| 209 |
D3DFORMAT Format;
|
| 210 |
BOOL DepthStencil;
|
| 211 |
D3DFORMAT DepthStencilFormat;
|
| 212 |
|
| 213 |
} D3DXRTS_DESC;
|
| 214 |
|
| 215 |
|
| 216 |
typedef interface ID3DXRenderToSurface ID3DXRenderToSurface;
|
| 217 |
typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE;
|
| 218 |
|
| 219 |
|
| 220 |
// {69CC587C-E40C-458d-B5D3-B029E18EB60A}
|
| 221 |
DEFINE_GUID( IID_ID3DXRenderToSurface,
|
| 222 |
0x69cc587c, 0xe40c, 0x458d, 0xb5, 0xd3, 0xb0, 0x29, 0xe1, 0x8e, 0xb6, 0xa);
|
| 223 |
|
| 224 |
|
| 225 |
DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown)
|
| 226 |
{
|
| 227 |
// IUnknown
|
| 228 |
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
| 229 |
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
| 230 |
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
| 231 |
|
| 232 |
// ID3DXRenderToSurface
|
| 233 |
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
| 234 |
STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE;
|
| 235 |
|
| 236 |
STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE8 pSurface, CONST D3DVIEWPORT8* pViewport) PURE;
|
| 237 |
STDMETHOD(EndScene)(THIS) PURE;
|
| 238 |
};
|
| 239 |
|
| 240 |
|
| 241 |
#ifdef __cplusplus
|
| 242 |
extern "C" {
|
| 243 |
#endif //__cplusplus
|
| 244 |
|
| 245 |
HRESULT WINAPI
|
| 246 |
D3DXCreateRenderToSurface(
|
| 247 |
LPDIRECT3DDEVICE8 pDevice,
|
| 248 |
UINT Width,
|
| 249 |
UINT Height,
|
| 250 |
D3DFORMAT Format,
|
| 251 |
BOOL DepthStencil,
|
| 252 |
D3DFORMAT DepthStencilFormat,
|
| 253 |
LPD3DXRENDERTOSURFACE* ppRenderToSurface);
|
| 254 |
|
| 255 |
#ifdef __cplusplus
|
| 256 |
}
|
| 257 |
#endif //__cplusplus
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
///////////////////////////////////////////////////////////////////////////
|
| 262 |
// ID3DXRenderToEnvMap:
|
| 263 |
// --------------------
|
| 264 |
///////////////////////////////////////////////////////////////////////////
|
| 265 |
|
| 266 |
typedef struct _D3DXRTE_DESC
|
| 267 |
{
|
| 268 |
UINT Size;
|
| 269 |
D3DFORMAT Format;
|
| 270 |
BOOL DepthStencil;
|
| 271 |
D3DFORMAT DepthStencilFormat;
|
| 272 |
} D3DXRTE_DESC;
|
| 273 |
|
| 274 |
|
| 275 |
typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap;
|
| 276 |
typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap;
|
| 277 |
|
| 278 |
// {9F6779E5-60A9-4d8b-AEE4-32770F405DBA}
|
| 279 |
DEFINE_GUID( IID_ID3DXRenderToEnvMap,
|
| 280 |
0x9f6779e5, 0x60a9, 0x4d8b, 0xae, 0xe4, 0x32, 0x77, 0xf, 0x40, 0x5d, 0xba);
|
| 281 |
|
| 282 |
|
| 283 |
DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown)
|
| 284 |
{
|
| 285 |
// IUnknown
|
| 286 |
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
| 287 |
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
| 288 |
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
| 289 |
|
| 290 |
// ID3DXRenderToEnvMap
|
| 291 |
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
|
| 292 |
STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE;
|
| 293 |
|
| 294 |
STDMETHOD(BeginCube)(THIS_
|
| 295 |
LPDIRECT3DCUBETEXTURE8 pCubeTex) PURE;
|
| 296 |
|
| 297 |
STDMETHOD(BeginSphere)(THIS_
|
| 298 |
LPDIRECT3DTEXTURE8 pTex) PURE;
|
| 299 |
|
| 300 |
STDMETHOD(BeginHemisphere)(THIS_
|
| 301 |
LPDIRECT3DTEXTURE8 pTexZPos,
|
| 302 |
LPDIRECT3DTEXTURE8 pTexZNeg) PURE;
|
| 303 |
|
| 304 |
STDMETHOD(BeginParabolic)(THIS_
|
| 305 |
LPDIRECT3DTEXTURE8 pTexZPos,
|
| 306 |
LPDIRECT3DTEXTURE8 pTexZNeg) PURE;
|
| 307 |
|
| 308 |
STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face) PURE;
|
| 309 |
STDMETHOD(End)(THIS) PURE;
|
| 310 |
};
|
| 311 |
|
| 312 |
|
| 313 |
#ifdef __cplusplus
|
| 314 |
extern "C" {
|
| 315 |
#endif //__cplusplus
|
| 316 |
|
| 317 |
HRESULT WINAPI
|
| 318 |
D3DXCreateRenderToEnvMap(
|
| 319 |
LPDIRECT3DDEVICE8 pDevice,
|
| 320 |
UINT Size,
|
| 321 |
D3DFORMAT Format,
|
| 322 |
BOOL DepthStencil,
|
| 323 |
D3DFORMAT DepthStencilFormat,
|
| 324 |
LPD3DXRenderToEnvMap* ppRenderToEnvMap);
|
| 325 |
|
| 326 |
#ifdef __cplusplus
|
| 327 |
}
|
| 328 |
#endif //__cplusplus
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
///////////////////////////////////////////////////////////////////////////
|
| 333 |
// Shader assemblers:
|
| 334 |
///////////////////////////////////////////////////////////////////////////
|
| 335 |
|
| 336 |
//-------------------------------------------------------------------------
|
| 337 |
// D3DXASM flags:
|
| 338 |
// --------------
|
| 339 |
//
|
| 340 |
// D3DXASM_DEBUG
|
| 341 |
// Generate debug info.
|
| 342 |
//
|
| 343 |
// D3DXASM_SKIPVALIDATION
|
| 344 |
// Do not validate the generated code against known capabilities and
|
| 345 |
// constraints. This option is only recommended when assembling shaders
|
| 346 |
// you KNOW will work. (ie. have assembled before without this option.)
|
| 347 |
//-------------------------------------------------------------------------
|
| 348 |
|
| 349 |
#define D3DXASM_DEBUG (1 << 0)
|
| 350 |
#define D3DXASM_SKIPVALIDATION (1 << 1)
|
| 351 |
|
| 352 |
|
| 353 |
#ifdef __cplusplus
|
| 354 |
extern "C" {
|
| 355 |
#endif //__cplusplus
|
| 356 |
|
| 357 |
//-------------------------------------------------------------------------
|
| 358 |
// D3DXAssembleShader:
|
| 359 |
// ------------------------
|
| 360 |
// Assembles an ascii description of a vertex or pixel shader into
|
| 361 |
// binary form.
|
| 362 |
//
|
| 363 |
// Parameters:
|
| 364 |
// pSrcFile
|
| 365 |
// Source file name
|
| 366 |
// pSrcData
|
| 367 |
// Pointer to source code
|
| 368 |
// SrcDataLen
|
| 369 |
// Size of source code, in bytes
|
| 370 |
// Flags
|
| 371 |
// D3DXASM_xxx flags
|
| 372 |
// ppConstants
|
| 373 |
// Returns an ID3DXBuffer object containing constant declarations.
|
| 374 |
// ppCompiledShader
|
| 375 |
// Returns an ID3DXBuffer object containing the object code.
|
| 376 |
// ppCompilationErrors
|
| 377 |
// Returns an ID3DXBuffer object containing ascii error messages
|
| 378 |
//-------------------------------------------------------------------------
|
| 379 |
|
| 380 |
HRESULT WINAPI
|
| 381 |
D3DXAssembleShaderFromFileA(
|
| 382 |
LPCSTR pSrcFile,
|
| 383 |
DWORD Flags,
|
| 384 |
LPD3DXBUFFER* ppConstants,
|
| 385 |
LPD3DXBUFFER* ppCompiledShader,
|
| 386 |
LPD3DXBUFFER* ppCompilationErrors);
|
| 387 |
|
| 388 |
HRESULT WINAPI
|
| 389 |
D3DXAssembleShaderFromFileW(
|
| 390 |
LPCWSTR pSrcFile,
|
| 391 |
DWORD Flags,
|
| 392 |
LPD3DXBUFFER* ppConstants,
|
| 393 |
LPD3DXBUFFER* ppCompiledShader,
|
| 394 |
LPD3DXBUFFER* ppCompilationErrors);
|
| 395 |
|
| 396 |
#ifdef UNICODE
|
| 397 |
#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW
|
| 398 |
#else
|
| 399 |
#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA
|
| 400 |
#endif
|
| 401 |
|
| 402 |
HRESULT WINAPI
|
| 403 |
D3DXAssembleShader(
|
| 404 |
LPCVOID pSrcData,
|
| 405 |
UINT SrcDataLen,
|
| 406 |
DWORD Flags,
|
| 407 |
LPD3DXBUFFER* ppConstants,
|
| 408 |
LPD3DXBUFFER* ppCompiledShader,
|
| 409 |
LPD3DXBUFFER* ppCompilationErrors);
|
| 410 |
|
| 411 |
|
| 412 |
#ifdef __cplusplus
|
| 413 |
}
|
| 414 |
#endif //__cplusplus
|
| 415 |
|
| 416 |
|
| 417 |
///////////////////////////////////////////////////////////////////////////
|
| 418 |
// Misc APIs:
|
| 419 |
///////////////////////////////////////////////////////////////////////////
|
| 420 |
|
| 421 |
#ifdef __cplusplus
|
| 422 |
extern "C" {
|
| 423 |
#endif //__cplusplus
|
| 424 |
|
| 425 |
|
| 426 |
//-------------------------------------------------------------------------
|
| 427 |
// D3DXGetFVFVertexSize:
|
| 428 |
// ---------------------
|
| 429 |
// Returns the size (in bytes) of a vertex for a given FVF.
|
| 430 |
//-------------------------------------------------------------------------
|
| 431 |
|
| 432 |
UINT WINAPI
|
| 433 |
D3DXGetFVFVertexSize(DWORD FVF);
|
| 434 |
|
| 435 |
|
| 436 |
//-------------------------------------------------------------------------
|
| 437 |
// D3DXGetErrorString:
|
| 438 |
// ------------------
|
| 439 |
// Returns the error string for given an hresult. Interprets all D3DX and
|
| 440 |
// D3D hresults.
|
| 441 |
//
|
| 442 |
// Parameters:
|
| 443 |
// hr
|
| 444 |
// The error code to be deciphered.
|
| 445 |
// pBuffer
|
| 446 |
// Pointer to the buffer to be filled in.
|
| 447 |
// BufferLen
|
| 448 |
// Count of characters in buffer. Any error message longer than this
|
| 449 |
// length will be truncated to fit.
|
| 450 |
//-------------------------------------------------------------------------
|
| 451 |
HRESULT WINAPI
|
| 452 |
D3DXGetErrorStringA(
|
| 453 |
HRESULT hr,
|
| 454 |
LPSTR pBuffer,
|
| 455 |
UINT BufferLen);
|
| 456 |
|
| 457 |
HRESULT WINAPI
|
| 458 |
D3DXGetErrorStringW(
|
| 459 |
HRESULT hr,
|
| 460 |
LPWSTR pBuffer,
|
| 461 |
UINT BufferLen);
|
| 462 |
|
| 463 |
#ifdef UNICODE
|
| 464 |
#define D3DXGetErrorString D3DXGetErrorStringW
|
| 465 |
#else
|
| 466 |
#define D3DXGetErrorString D3DXGetErrorStringA
|
| 467 |
#endif
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
#ifdef __cplusplus
|
| 472 |
}
|
| 473 |
#endif //__cplusplus
|
| 474 |
|
| 475 |
|
| 476 |
#endif //__D3DX8CORE_H__
|