Add files via upload
							parent
							
								
									6e37f69a96
								
							
						
					
					
						commit
						e3419d032e
					
				
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								| @ -0,0 +1,72 @@ | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| //
 | ||||
| //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
 | ||||
| //
 | ||||
| //  File:       d3dx10.h
 | ||||
| //  Content:    D3DX10 utility library
 | ||||
| //
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #ifdef  __D3DX10_INTERNAL__ | ||||
| #error Incorrect D3DX10 header used | ||||
| #endif | ||||
| 
 | ||||
| #ifndef __D3DX10_H__ | ||||
| #define __D3DX10_H__ | ||||
| 
 | ||||
| 
 | ||||
| // Defines
 | ||||
| #include <limits.h> | ||||
| #include <float.h> | ||||
| 
 | ||||
| #define D3DX10_DEFAULT            ((UINT) -1) | ||||
| #define D3DX10_FROM_FILE          ((UINT) -3) | ||||
| #define DXGI_FORMAT_FROM_FILE     ((DXGI_FORMAT) -3) | ||||
| 
 | ||||
| #ifndef D3DX10INLINE | ||||
| #ifdef _MSC_VER | ||||
|   #if (_MSC_VER >= 1200) | ||||
|   #define D3DX10INLINE __forceinline | ||||
|   #else | ||||
|   #define D3DX10INLINE __inline | ||||
|   #endif | ||||
| #else | ||||
|   #ifdef __cplusplus | ||||
|   #define D3DX10INLINE inline | ||||
|   #else | ||||
|   #define D3DX10INLINE | ||||
|   #endif | ||||
| #endif | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| // Includes
 | ||||
| #include "d3d10.h" | ||||
| #include "d3dx10.h" | ||||
| #include "d3dx10math.h" | ||||
| #include "d3dx10core.h" | ||||
| #include "d3dx10tex.h" | ||||
| #include "d3dx10mesh.h" | ||||
| #include "d3dx10async.h" | ||||
| 
 | ||||
| 
 | ||||
| // Errors
 | ||||
| #define _FACDD  0x876 | ||||
| #define MAKE_DDHRESULT( code )  MAKE_HRESULT( 1, _FACDD, code ) | ||||
| 
 | ||||
| enum _D3DX10_ERR { | ||||
|     D3DX10_ERR_CANNOT_MODIFY_INDEX_BUFFER       = MAKE_DDHRESULT(2900), | ||||
|     D3DX10_ERR_INVALID_MESH                     = MAKE_DDHRESULT(2901), | ||||
|     D3DX10_ERR_CANNOT_ATTR_SORT                 = MAKE_DDHRESULT(2902), | ||||
|     D3DX10_ERR_SKINNING_NOT_SUPPORTED           = MAKE_DDHRESULT(2903), | ||||
|     D3DX10_ERR_TOO_MANY_INFLUENCES              = MAKE_DDHRESULT(2904), | ||||
|     D3DX10_ERR_INVALID_DATA                     = MAKE_DDHRESULT(2905), | ||||
|     D3DX10_ERR_LOADED_MESH_HAS_NO_DATA          = MAKE_DDHRESULT(2906), | ||||
|     D3DX10_ERR_DUPLICATE_NAMED_FRAGMENT         = MAKE_DDHRESULT(2907), | ||||
|     D3DX10_ERR_CANNOT_REMOVE_LAST_ITEM		    = MAKE_DDHRESULT(2908), | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| #endif //__D3DX10_H__
 | ||||
| 
 | ||||
| @ -0,0 +1,290 @@ | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| //
 | ||||
| //  Copyright (c) Microsoft Corporation.  All rights reserved.
 | ||||
| //
 | ||||
| //  File:       D3DX10Async.h
 | ||||
| //  Content:    D3DX10 Asynchronous Effect / Shader loaders / compilers
 | ||||
| //
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #ifndef __D3DX10ASYNC_H__ | ||||
| #define __D3DX10ASYNC_H__ | ||||
| 
 | ||||
| #include "d3dx10.h" | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10Compile:
 | ||||
| // ------------------
 | ||||
| // Compiles an effect or shader.
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //  pSrcFile
 | ||||
| //      Source file name.
 | ||||
| //  hSrcModule
 | ||||
| //      Module handle. if NULL, current module will be used.
 | ||||
| //  pSrcResource
 | ||||
| //      Resource name in module.
 | ||||
| //  pSrcData
 | ||||
| //      Pointer to source code.
 | ||||
| //  SrcDataLen
 | ||||
| //      Size of source code, in bytes.
 | ||||
| //  pDefines
 | ||||
| //      Optional NULL-terminated array of preprocessor macro definitions.
 | ||||
| //  pInclude
 | ||||
| //      Optional interface pointer to use for handling #include directives.
 | ||||
| //      If this parameter is NULL, #includes will be honored when compiling
 | ||||
| //      from file, and will error when compiling from resource or memory.
 | ||||
| //  pFunctionName
 | ||||
| //      Name of the entrypoint function where execution should begin.
 | ||||
| //  pProfile
 | ||||
| //      Instruction set to be used when generating code.  Currently supported
 | ||||
| //      profiles are "vs_1_1",  "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0",
 | ||||
| //                   "vs_3_sw", "vs_4_0", "vs_4_1",
 | ||||
| //                   "ps_2_0",  "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0", 
 | ||||
| //                   "ps_3_sw", "ps_4_0", "ps_4_1",
 | ||||
| //                   "gs_4_0",  "gs_4_1",
 | ||||
| //                   "tx_1_0",
 | ||||
| //                   "fx_4_0",  "fx_4_1"
 | ||||
| //      Note that this entrypoint does not compile fx_2_0 targets, for that
 | ||||
| //      you need to use the D3DX9 function.
 | ||||
| //  Flags1
 | ||||
| //      See D3D10_SHADER_xxx flags.
 | ||||
| //  Flags2
 | ||||
| //      See D3D10_EFFECT_xxx flags.
 | ||||
| //  ppShader
 | ||||
| //      Returns a buffer containing the created shader.  This buffer contains
 | ||||
| //      the compiled shader code, as well as any embedded debug and symbol
 | ||||
| //      table info.  (See D3D10GetShaderConstantTable)
 | ||||
| //  ppErrorMsgs
 | ||||
| //      Returns a buffer containing a listing of errors and warnings that were
 | ||||
| //      encountered during the compile.  If you are running in a debugger,
 | ||||
| //      these are the same messages you will see in your debug output.
 | ||||
| //  pHResult
 | ||||
| //      Pointer to a memory location to receive the return value upon completion.
 | ||||
| //      Maybe NULL if not needed.
 | ||||
| //      If pPump != NULL, pHResult must be a valid memory location until the
 | ||||
| //      the asynchronous execution completes.
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CompileFromFileA(LPCSTR pSrcFile,CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, | ||||
|         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CompileFromFileW(LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, | ||||
|         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CompileFromFile D3DX10CompileFromFileW | ||||
| #else | ||||
| #define D3DX10CompileFromFile D3DX10CompileFromFileA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,  | ||||
|     LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,  | ||||
|     LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CompileFromResource D3DX10CompileFromResourceW | ||||
| #else | ||||
| #define D3DX10CompileFromResource D3DX10CompileFromResourceA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,  | ||||
|     LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10CreateEffectFromXXXX:
 | ||||
| // --------------------------
 | ||||
| // Creates an effect from a binary effect or file
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //
 | ||||
| // [in]
 | ||||
| //
 | ||||
| //
 | ||||
| //  pFileName
 | ||||
| //      Name of the ASCII (uncompiled) or binary (compiled) Effect file to load
 | ||||
| //
 | ||||
| //  hModule
 | ||||
| //      Handle to the module containing the resource to compile from
 | ||||
| //  pResourceName
 | ||||
| //      Name of the resource within hModule to compile from
 | ||||
| //
 | ||||
| //  pData
 | ||||
| //      Blob of effect data, either ASCII (uncompiled) or binary (compiled)
 | ||||
| //  DataLength
 | ||||
| //      Length of the data blob
 | ||||
| //
 | ||||
| //  pDefines
 | ||||
| //      Optional NULL-terminated array of preprocessor macro definitions.
 | ||||
| //  pInclude
 | ||||
| //      Optional interface pointer to use for handling #include directives.
 | ||||
| //      If this parameter is NULL, #includes will be honored when compiling
 | ||||
| //      from file, and will error when compiling from resource or memory.
 | ||||
| //  pProfile
 | ||||
| //      Profile to use when compiling the effect.
 | ||||
| //  HLSLFlags
 | ||||
| //      Compilation flags pertaining to shaders and data types, honored by
 | ||||
| //      the HLSL compiler
 | ||||
| //  FXFlags
 | ||||
| //      Compilation flags pertaining to Effect compilation, honored
 | ||||
| //      by the Effect compiler
 | ||||
| //  pDevice
 | ||||
| //      Pointer to the D3D10 device on which to create Effect resources
 | ||||
| //  pEffectPool
 | ||||
| //      Pointer to an Effect pool to share variables with or NULL
 | ||||
| //
 | ||||
| // [out]
 | ||||
| //
 | ||||
| //  ppEffect
 | ||||
| //      Address of the newly created Effect interface
 | ||||
| //  ppEffectPool
 | ||||
| //      Address of the newly created Effect pool interface
 | ||||
| //  ppErrors
 | ||||
| //      If non-NULL, address of a buffer with error messages that occurred 
 | ||||
| //      during parsing or compilation
 | ||||
| //  pHResult
 | ||||
| //      Pointer to a memory location to receive the return value upon completion.
 | ||||
| //      Maybe NULL if not needed.
 | ||||
| //      If pPump != NULL, pHResult must be a valid memory location until the
 | ||||
| //      the asynchronous execution completes.
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,  | ||||
|     ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,  | ||||
|     ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,  | ||||
|     ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,  | ||||
|     ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice,  | ||||
|     ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateEffectFromFile          D3DX10CreateEffectFromFileW | ||||
| #define D3DX10CreateEffectFromResource      D3DX10CreateEffectFromResourceW | ||||
| #else | ||||
| #define D3DX10CreateEffectFromFile          D3DX10CreateEffectFromFileA | ||||
| #define D3DX10CreateEffectFromResource      D3DX10CreateEffectFromResourceA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectPoolFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump,  | ||||
|     ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectPoolFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump,  | ||||
|     ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, | ||||
|     ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateEffectPoolFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, | ||||
|     ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
|                                           | ||||
| HRESULT WINAPI D3DX10CreateEffectPoolFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines,  | ||||
|     ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, | ||||
|     ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateEffectPoolFromFile      D3DX10CreateEffectPoolFromFileW | ||||
| #define D3DX10CreateEffectPoolFromResource  D3DX10CreateEffectPoolFromResourceW | ||||
| #else | ||||
| #define D3DX10CreateEffectPoolFromFile      D3DX10CreateEffectPoolFromFileA | ||||
| #define D3DX10CreateEffectPoolFromResource  D3DX10CreateEffectPoolFromResourceA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10PreprocessShaderFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,  | ||||
|     LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10PreprocessShaderFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,  | ||||
|     LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines,  | ||||
|     LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,  | ||||
|     LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines,  | ||||
|     LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10PreprocessShaderFromFile      D3DX10PreprocessShaderFromFileW | ||||
| #define D3DX10PreprocessShaderFromResource  D3DX10PreprocessShaderFromResourceW | ||||
| #else | ||||
| #define D3DX10PreprocessShaderFromFile      D3DX10PreprocessShaderFromFileA | ||||
| #define D3DX10PreprocessShaderFromResource  D3DX10PreprocessShaderFromResourceA | ||||
| #endif | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // Async processors
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateAsyncCompilerProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,  | ||||
|         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, | ||||
|         ID3D10Blob **ppCompiledShader, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateAsyncEffectCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,  | ||||
|         LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice, | ||||
|         ID3D10EffectPool *pPool, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateAsyncEffectPoolCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,  | ||||
|         LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice, | ||||
|         ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,  | ||||
|         ID3D10Blob** ppShaderText, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10 Asynchronous texture I/O (advanced mode)
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX10DataLoader **ppDataLoader); | ||||
| HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX10DataLoader **ppDataLoader); | ||||
| HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX10DataLoader **ppDataLoader); | ||||
| HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX10DataLoader **ppDataLoader); | ||||
| HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX10DataLoader **ppDataLoader); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderW | ||||
| #define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderW | ||||
| #else | ||||
| #define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderA | ||||
| #define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateAsyncTextureProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor); | ||||
| HRESULT WINAPI D3DX10CreateAsyncTextureInfoProcessor(D3DX10_IMAGE_INFO *pImageInfo, ID3DX10DataProcessor **ppDataProcessor); | ||||
| HRESULT WINAPI D3DX10CreateAsyncShaderResourceViewProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| #endif //__D3DX10ASYNC_H__
 | ||||
| 
 | ||||
| 
 | ||||
| @ -0,0 +1,444 @@ | ||||
| ///////////////////////////////////////////////////////////////////////////
 | ||||
| //
 | ||||
| //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
 | ||||
| //
 | ||||
| //  File:       d3dx10core.h
 | ||||
| //  Content:    D3DX10 core types and functions
 | ||||
| //
 | ||||
| ///////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #include "d3dx10.h" | ||||
| 
 | ||||
| #ifndef __D3DX10CORE_H__ | ||||
| #define __D3DX10CORE_H__ | ||||
| 
 | ||||
| // Current name of the DLL shipped in the same SDK as this header.
 | ||||
| 
 | ||||
| 
 | ||||
| #define D3DX10_DLL_W L"d3dx10_43.dll" | ||||
| #define D3DX10_DLL_A "d3dx10_43.dll" | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
|     #define D3DX10_DLL D3DX10_DLL_W  | ||||
| #else | ||||
|     #define D3DX10_DLL D3DX10_DLL_A | ||||
| #endif | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////////////////////
 | ||||
| // D3DX10_SDK_VERSION:
 | ||||
| // -----------------
 | ||||
| // This identifier is passed to D3DX10CheckVersion in order to ensure that an
 | ||||
| // application was built against the correct header files and lib files. 
 | ||||
| // This number is incremented whenever a header (or other) change would 
 | ||||
| // require applications to be rebuilt. If the version doesn't match, 
 | ||||
| // D3DX10CreateVersion will return FALSE. (The number itself has no meaning.)
 | ||||
| ///////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| 
 | ||||
| #define D3DX10_SDK_VERSION 43 | ||||
| 
 | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////////////////////
 | ||||
| // D3DX10CreateDevice
 | ||||
| // D3DX10CreateDeviceAndSwapChain
 | ||||
| // D3DX10GetFeatureLevel1
 | ||||
| ///////////////////////////////////////////////////////////////////////////
 | ||||
| HRESULT WINAPI D3DX10CreateDevice(IDXGIAdapter *pAdapter, | ||||
|                                   D3D10_DRIVER_TYPE DriverType, | ||||
|                                   HMODULE Software, | ||||
|                                   UINT Flags, | ||||
|                                   ID3D10Device **ppDevice); | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateDeviceAndSwapChain(IDXGIAdapter *pAdapter, | ||||
|                                               D3D10_DRIVER_TYPE DriverType, | ||||
|                                               HMODULE Software, | ||||
|                                               UINT Flags, | ||||
|                                               DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, | ||||
|                                               IDXGISwapChain **ppSwapChain,     | ||||
|                                               ID3D10Device **ppDevice); | ||||
| 
 | ||||
| typedef interface ID3D10Device1 ID3D10Device1; | ||||
| HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *pDevice, ID3D10Device1 **ppDevice1); | ||||
| 
 | ||||
| 
 | ||||
| #ifdef D3D_DIAG_DLL | ||||
| BOOL WINAPI D3DX10DebugMute(BOOL Mute);   | ||||
| #endif | ||||
| HRESULT WINAPI D3DX10CheckVersion(UINT D3DSdkVersion, UINT D3DX10SdkVersion); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| // D3DX10_SPRITE flags:
 | ||||
| // -----------------
 | ||||
| // D3DX10_SPRITE_SAVE_STATE
 | ||||
| //   Specifies device state should be saved and restored in Begin/End.
 | ||||
| // D3DX10SPRITE_SORT_TEXTURE
 | ||||
| //   Sprites are sorted by texture prior to drawing.  This is recommended when
 | ||||
| //   drawing non-overlapping sprites of uniform depth.  For example, drawing
 | ||||
| //   screen-aligned text with ID3DX10Font.
 | ||||
| // D3DX10SPRITE_SORT_DEPTH_FRONT_TO_BACK
 | ||||
| //   Sprites are sorted by depth front-to-back prior to drawing.  This is 
 | ||||
| //   recommended when drawing opaque sprites of varying depths.
 | ||||
| // D3DX10SPRITE_SORT_DEPTH_BACK_TO_FRONT
 | ||||
| //   Sprites are sorted by depth back-to-front prior to drawing.  This is 
 | ||||
| //   recommended when drawing transparent sprites of varying depths.
 | ||||
| // D3DX10SPRITE_ADDREF_TEXTURES
 | ||||
| //   AddRef/Release all textures passed in to DrawSpritesBuffered
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| typedef enum _D3DX10_SPRITE_FLAG | ||||
| { | ||||
|     D3DX10_SPRITE_SORT_TEXTURE              = 0x01, | ||||
|     D3DX10_SPRITE_SORT_DEPTH_BACK_TO_FRONT  = 0x02, | ||||
|     D3DX10_SPRITE_SORT_DEPTH_FRONT_TO_BACK  = 0x04, | ||||
|     D3DX10_SPRITE_SAVE_STATE                = 0x08, | ||||
|     D3DX10_SPRITE_ADDREF_TEXTURES           = 0x10, | ||||
| } D3DX10_SPRITE_FLAG; | ||||
| 
 | ||||
| typedef struct _D3DX10_SPRITE | ||||
| { | ||||
|     D3DXMATRIX  matWorld; | ||||
| 
 | ||||
|     D3DXVECTOR2 TexCoord; | ||||
|     D3DXVECTOR2 TexSize; | ||||
| 
 | ||||
|     D3DXCOLOR   ColorModulate; | ||||
| 
 | ||||
|     ID3D10ShaderResourceView *pTexture; | ||||
|     UINT        TextureIndex; | ||||
| } D3DX10_SPRITE; | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| // ID3DX10Sprite:
 | ||||
| // ------------
 | ||||
| // This object intends to provide an easy way to drawing sprites using D3D.
 | ||||
| //
 | ||||
| // Begin - 
 | ||||
| //    Prepares device for drawing sprites.
 | ||||
| //
 | ||||
| // Draw -
 | ||||
| //    Draws a sprite
 | ||||
| //
 | ||||
| // Flush -
 | ||||
| //    Forces all batched sprites to submitted to the device.
 | ||||
| //
 | ||||
| // End - 
 | ||||
| //    Restores device state to how it was when Begin was called.
 | ||||
| //
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| typedef interface ID3DX10Sprite ID3DX10Sprite; | ||||
| typedef interface ID3DX10Sprite *LPD3DX10SPRITE; | ||||
| 
 | ||||
| 
 | ||||
| // {BA0B762D-8D28-43ec-B9DC-2F84443B0614}
 | ||||
| DEFINE_GUID(IID_ID3DX10Sprite,  | ||||
| 0xba0b762d, 0x8d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); | ||||
| 
 | ||||
| 
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10Sprite | ||||
| 
 | ||||
| DECLARE_INTERFACE_(ID3DX10Sprite, IUnknown) | ||||
| { | ||||
|     // IUnknown
 | ||||
|     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; | ||||
|     STDMETHOD_(ULONG, AddRef)(THIS) PURE; | ||||
|     STDMETHOD_(ULONG, Release)(THIS) PURE; | ||||
| 
 | ||||
|     // ID3DX10Sprite
 | ||||
|     STDMETHOD(Begin)(THIS_ UINT flags) PURE; | ||||
|      | ||||
|     STDMETHOD(DrawSpritesBuffered)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites) PURE; | ||||
|     STDMETHOD(Flush)(THIS) PURE; | ||||
| 
 | ||||
|     STDMETHOD(DrawSpritesImmediate)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites, UINT cbSprite, UINT flags) PURE; | ||||
|     STDMETHOD(End)(THIS) PURE; | ||||
| 
 | ||||
|     STDMETHOD(GetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; | ||||
|     STDMETHOD(SetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; | ||||
|     STDMETHOD(GetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; | ||||
|     STDMETHOD(SetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; | ||||
| 
 | ||||
|     STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| HRESULT WINAPI  | ||||
|     D3DX10CreateSprite(  | ||||
|         ID3D10Device*         pDevice,  | ||||
|         UINT                  cDeviceBufferSize, | ||||
|         LPD3DX10SPRITE*       ppSprite); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| // ID3DX10ThreadPump:
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10DataLoader | ||||
| 
 | ||||
| DECLARE_INTERFACE(ID3DX10DataLoader) | ||||
| { | ||||
| 	STDMETHOD(Load)(THIS) PURE; | ||||
| 	STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE; | ||||
| 	STDMETHOD(Destroy)(THIS) PURE; | ||||
| }; | ||||
| 
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10DataProcessor | ||||
| 
 | ||||
| DECLARE_INTERFACE(ID3DX10DataProcessor) | ||||
| { | ||||
| 	STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE; | ||||
| 	STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE; | ||||
| 	STDMETHOD(Destroy)(THIS) PURE; | ||||
| }; | ||||
| 
 | ||||
| // {C93FECFA-6967-478a-ABBC-402D90621FCB}
 | ||||
| DEFINE_GUID(IID_ID3DX10ThreadPump,  | ||||
| 0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb); | ||||
| 
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10ThreadPump | ||||
| 
 | ||||
| DECLARE_INTERFACE_(ID3DX10ThreadPump, IUnknown) | ||||
| { | ||||
|     // IUnknown
 | ||||
|     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; | ||||
|     STDMETHOD_(ULONG, AddRef)(THIS) PURE; | ||||
|     STDMETHOD_(ULONG, Release)(THIS) PURE; | ||||
| 
 | ||||
|     // ID3DX10ThreadPump
 | ||||
|     STDMETHOD(AddWorkItem)(THIS_ ID3DX10DataLoader *pDataLoader, ID3DX10DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE; | ||||
|     STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE; | ||||
|        | ||||
|     STDMETHOD(WaitForAllItems)(THIS) PURE; | ||||
|     STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount); | ||||
| 
 | ||||
|     STDMETHOD(PurgeAllItems)(THIS) PURE; | ||||
|     STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE; | ||||
|      | ||||
| }; | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX10ThreadPump **ppThreadPump); | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| // ID3DX10Font:
 | ||||
| // ----------
 | ||||
| // Font objects contain the textures and resources needed to render a specific 
 | ||||
| // font on a specific device.
 | ||||
| //
 | ||||
| // GetGlyphData -
 | ||||
| //    Returns glyph cache data, for a given glyph.
 | ||||
| //
 | ||||
| // PreloadCharacters/PreloadGlyphs/PreloadText -
 | ||||
| //    Preloads glyphs into the glyph cache textures.
 | ||||
| //
 | ||||
| // 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.
 | ||||
| //    If pSprite is NULL, an internal sprite object will be used.
 | ||||
| //
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| typedef struct _D3DX10_FONT_DESCA | ||||
| { | ||||
|     INT Height; | ||||
|     UINT Width; | ||||
|     UINT Weight; | ||||
|     UINT MipLevels; | ||||
|     BOOL Italic; | ||||
|     BYTE CharSet; | ||||
|     BYTE OutputPrecision; | ||||
|     BYTE Quality; | ||||
|     BYTE PitchAndFamily; | ||||
|     CHAR FaceName[LF_FACESIZE]; | ||||
| 
 | ||||
| } D3DX10_FONT_DESCA, *LPD3DX10_FONT_DESCA; | ||||
| 
 | ||||
| typedef struct _D3DX10_FONT_DESCW | ||||
| { | ||||
|     INT Height; | ||||
|     UINT Width; | ||||
|     UINT Weight; | ||||
|     UINT MipLevels; | ||||
|     BOOL Italic; | ||||
|     BYTE CharSet; | ||||
|     BYTE OutputPrecision; | ||||
|     BYTE Quality; | ||||
|     BYTE PitchAndFamily; | ||||
|     WCHAR FaceName[LF_FACESIZE]; | ||||
| 
 | ||||
| } D3DX10_FONT_DESCW, *LPD3DX10_FONT_DESCW; | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| typedef D3DX10_FONT_DESCW D3DX10_FONT_DESC; | ||||
| typedef LPD3DX10_FONT_DESCW LPD3DX10_FONT_DESC; | ||||
| #else | ||||
| typedef D3DX10_FONT_DESCA D3DX10_FONT_DESC; | ||||
| typedef LPD3DX10_FONT_DESCA LPD3DX10_FONT_DESC; | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| typedef interface ID3DX10Font ID3DX10Font; | ||||
| typedef interface ID3DX10Font *LPD3DX10FONT; | ||||
| 
 | ||||
| 
 | ||||
| // {D79DBB70-5F21-4d36-BBC2-FF525C213CDC}
 | ||||
| DEFINE_GUID(IID_ID3DX10Font,  | ||||
| 0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); | ||||
| 
 | ||||
| 
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10Font | ||||
| 
 | ||||
| DECLARE_INTERFACE_(ID3DX10Font, IUnknown) | ||||
| { | ||||
|     // IUnknown
 | ||||
|     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; | ||||
|     STDMETHOD_(ULONG, AddRef)(THIS) PURE; | ||||
|     STDMETHOD_(ULONG, Release)(THIS) PURE; | ||||
| 
 | ||||
|     // ID3DX10Font
 | ||||
|     STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; | ||||
|     STDMETHOD(GetDescA)(THIS_ D3DX10_FONT_DESCA *pDesc) PURE; | ||||
|     STDMETHOD(GetDescW)(THIS_ D3DX10_FONT_DESCW *pDesc) PURE; | ||||
|     STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; | ||||
|     STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; | ||||
| 
 | ||||
|     STDMETHOD_(HDC, GetDC)(THIS) PURE; | ||||
|     STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, ID3D10ShaderResourceView** ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; | ||||
| 
 | ||||
|     STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; | ||||
|     STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; | ||||
|     STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; | ||||
|     STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; | ||||
| 
 | ||||
|     STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DX10SPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; | ||||
|     STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DX10SPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| #ifdef UNICODE | ||||
|     HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCW *pDesc) { return GetDescW(pDesc); } | ||||
|     HRESULT WINAPI_INLINE PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } | ||||
| #else | ||||
|     HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCA *pDesc) { return GetDescA(pDesc); } | ||||
|     HRESULT WINAPI_INLINE PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } | ||||
| #endif | ||||
| #endif //__cplusplus
 | ||||
| }; | ||||
| 
 | ||||
| #ifndef GetTextMetrics | ||||
| #ifdef UNICODE | ||||
| #define GetTextMetrics GetTextMetricsW | ||||
| #else | ||||
| #define GetTextMetrics GetTextMetricsA | ||||
| #endif | ||||
| #endif | ||||
| 
 | ||||
| #ifndef DrawText | ||||
| #ifdef UNICODE | ||||
| #define DrawText DrawTextW | ||||
| #else | ||||
| #define DrawText DrawTextA | ||||
| #endif | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| 
 | ||||
| HRESULT WINAPI  | ||||
|     D3DX10CreateFontA( | ||||
|         ID3D10Device*           pDevice,   | ||||
|         INT                     Height, | ||||
|         UINT                    Width, | ||||
|         UINT                    Weight, | ||||
|         UINT                    MipLevels, | ||||
|         BOOL                    Italic, | ||||
|         UINT                    CharSet, | ||||
|         UINT                    OutputPrecision, | ||||
|         UINT                    Quality, | ||||
|         UINT                    PitchAndFamily, | ||||
|         LPCSTR                  pFaceName, | ||||
|         LPD3DX10FONT*           ppFont); | ||||
| 
 | ||||
| HRESULT WINAPI  | ||||
|     D3DX10CreateFontW( | ||||
|         ID3D10Device*           pDevice,   | ||||
|         INT                     Height, | ||||
|         UINT                    Width, | ||||
|         UINT                    Weight, | ||||
|         UINT                    MipLevels, | ||||
|         BOOL                    Italic, | ||||
|         UINT                    CharSet, | ||||
|         UINT                    OutputPrecision, | ||||
|         UINT                    Quality, | ||||
|         UINT                    PitchAndFamily, | ||||
|         LPCWSTR                 pFaceName, | ||||
|         LPD3DX10FONT*           ppFont); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateFont D3DX10CreateFontW | ||||
| #else | ||||
| #define D3DX10CreateFont D3DX10CreateFontA | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| HRESULT WINAPI  | ||||
|     D3DX10CreateFontIndirectA(  | ||||
|         ID3D10Device*             pDevice,   | ||||
|         CONST D3DX10_FONT_DESCA*   pDesc,  | ||||
|         LPD3DX10FONT*             ppFont); | ||||
| 
 | ||||
| HRESULT WINAPI  | ||||
|     D3DX10CreateFontIndirectW(  | ||||
|         ID3D10Device*             pDevice,   | ||||
|         CONST D3DX10_FONT_DESCW*   pDesc,  | ||||
|         LPD3DX10FONT*             ppFont); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateFontIndirect D3DX10CreateFontIndirectW | ||||
| #else | ||||
| #define D3DX10CreateFontIndirect D3DX10CreateFontIndirectA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI D3DX10UnsetAllDeviceObjects(ID3D10Device *pDevice); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #define _FACD3D  0x876 | ||||
| #define MAKE_D3DHRESULT( code )  MAKE_HRESULT( 1, _FACD3D, code ) | ||||
| #define MAKE_D3DSTATUS( code )  MAKE_HRESULT( 0, _FACD3D, code ) | ||||
| 
 | ||||
| #define D3DERR_INVALIDCALL                      MAKE_D3DHRESULT(2156) | ||||
| #define D3DERR_WASSTILLDRAWING                  MAKE_D3DHRESULT(540) | ||||
| 
 | ||||
| #endif //__D3DX10CORE_H__
 | ||||
| 
 | ||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								| @ -0,0 +1,286 @@ | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| //
 | ||||
| //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
 | ||||
| //
 | ||||
| //  File:       d3dx10mesh.h
 | ||||
| //  Content:    D3DX10 mesh types and functions
 | ||||
| //
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #include "d3dx10.h" | ||||
| 
 | ||||
| #ifndef __D3DX10MESH_H__ | ||||
| #define __D3DX10MESH_H__ | ||||
| 
 | ||||
| // {7ED943DD-52E8-40b5-A8D8-76685C406330}
 | ||||
| DEFINE_GUID(IID_ID3DX10BaseMesh,  | ||||
| 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30); | ||||
| 
 | ||||
| // {04B0D117-1041-46b1-AA8A-3952848BA22E}
 | ||||
| DEFINE_GUID(IID_ID3DX10MeshBuffer,  | ||||
| 0x4b0d117, 0x1041, 0x46b1, 0xaa, 0x8a, 0x39, 0x52, 0x84, 0x8b, 0xa2, 0x2e); | ||||
| 
 | ||||
| // {4020E5C2-1403-4929-883F-E2E849FAC195}
 | ||||
| DEFINE_GUID(IID_ID3DX10Mesh,  | ||||
| 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95); | ||||
| 
 | ||||
| // {8875769A-D579-4088-AAEB-534D1AD84E96}
 | ||||
| DEFINE_GUID(IID_ID3DX10PMesh,  | ||||
| 0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96); | ||||
| 
 | ||||
| // {667EA4C7-F1CD-4386-B523-7C0290B83CC5}
 | ||||
| DEFINE_GUID(IID_ID3DX10SPMesh,  | ||||
| 0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5); | ||||
| 
 | ||||
| // {3CE6CC22-DBF2-44f4-894D-F9C34A337139}
 | ||||
| DEFINE_GUID(IID_ID3DX10PatchMesh,  | ||||
| 0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39); | ||||
| 
 | ||||
| 
 | ||||
| // Mesh options - lower 3 bytes only, upper byte used by _D3DX10MESHOPT option flags
 | ||||
| enum _D3DX10_MESH { | ||||
|     D3DX10_MESH_32_BIT                  = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices.
 | ||||
|     D3DX10_MESH_GS_ADJACENCY			= 0x004, // If set, mesh contains GS adjacency info. Not valid on input.
 | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| typedef struct _D3DX10_ATTRIBUTE_RANGE | ||||
| { | ||||
|     UINT  AttribId; | ||||
|     UINT  FaceStart; | ||||
|     UINT  FaceCount; | ||||
|     UINT  VertexStart; | ||||
|     UINT  VertexCount; | ||||
| } D3DX10_ATTRIBUTE_RANGE; | ||||
| 
 | ||||
| typedef D3DX10_ATTRIBUTE_RANGE* LPD3DX10_ATTRIBUTE_RANGE; | ||||
| 
 | ||||
| typedef enum _D3DX10_MESH_DISCARD_FLAGS | ||||
| { | ||||
|     D3DX10_MESH_DISCARD_ATTRIBUTE_BUFFER = 0x01, | ||||
|     D3DX10_MESH_DISCARD_ATTRIBUTE_TABLE = 0x02, | ||||
|     D3DX10_MESH_DISCARD_POINTREPS = 0x04, | ||||
|     D3DX10_MESH_DISCARD_ADJACENCY = 0x08, | ||||
|     D3DX10_MESH_DISCARD_DEVICE_BUFFERS = 0x10, | ||||
| 
 | ||||
| } D3DX10_MESH_DISCARD_FLAGS; | ||||
| 
 | ||||
| typedef struct _D3DX10_WELD_EPSILONS | ||||
| { | ||||
|     FLOAT Position;                 // NOTE: This does NOT replace the epsilon in GenerateAdjacency
 | ||||
|                                             // in general, it should be the same value or greater than the one passed to GeneratedAdjacency
 | ||||
|     FLOAT BlendWeights; | ||||
|     FLOAT Normal; | ||||
|     FLOAT PSize; | ||||
|     FLOAT Specular; | ||||
|     FLOAT Diffuse; | ||||
|     FLOAT Texcoord[8]; | ||||
|     FLOAT Tangent; | ||||
|     FLOAT Binormal; | ||||
|     FLOAT TessFactor; | ||||
| } D3DX10_WELD_EPSILONS; | ||||
| 
 | ||||
| typedef D3DX10_WELD_EPSILONS* LPD3DX10_WELD_EPSILONS; | ||||
| 
 | ||||
| typedef struct _D3DX10_INTERSECT_INFO | ||||
| { | ||||
|     UINT  FaceIndex;                // index of face intersected
 | ||||
|     FLOAT U;                        // Barycentric Hit Coordinates    
 | ||||
|     FLOAT V;                        // Barycentric Hit Coordinates
 | ||||
|     FLOAT Dist;                     // Ray-Intersection Parameter Distance
 | ||||
| } D3DX10_INTERSECT_INFO, *LPD3DX10_INTERSECT_INFO; | ||||
| 
 | ||||
| // ID3DX10MeshBuffer is used by D3DX10Mesh vertex and index buffers
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10MeshBuffer | ||||
| 
 | ||||
| DECLARE_INTERFACE_(ID3DX10MeshBuffer, IUnknown) | ||||
| { | ||||
|     // IUnknown
 | ||||
|     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; | ||||
|     STDMETHOD_(ULONG, AddRef)(THIS) PURE; | ||||
|     STDMETHOD_(ULONG, Release)(THIS) PURE; | ||||
|      | ||||
|     // ID3DX10MeshBuffer
 | ||||
|     STDMETHOD(Map)(THIS_ void **ppData, SIZE_T *pSize) PURE; | ||||
|     STDMETHOD(Unmap)(THIS) PURE; | ||||
|     STDMETHOD_(SIZE_T, GetSize)(THIS) PURE; | ||||
| }; | ||||
| 
 | ||||
| // D3DX10 Mesh interfaces
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10Mesh | ||||
| 
 | ||||
| DECLARE_INTERFACE_(ID3DX10Mesh, IUnknown) | ||||
| { | ||||
|     // IUnknown
 | ||||
|     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; | ||||
|     STDMETHOD_(ULONG, AddRef)(THIS) PURE; | ||||
|     STDMETHOD_(ULONG, Release)(THIS) PURE; | ||||
| 
 | ||||
|     // ID3DX10Mesh
 | ||||
|     STDMETHOD_(UINT, GetFaceCount)(THIS) PURE; | ||||
|     STDMETHOD_(UINT, GetVertexCount)(THIS) PURE; | ||||
|     STDMETHOD_(UINT, GetVertexBufferCount)(THIS) PURE; | ||||
|     STDMETHOD_(UINT, GetFlags)(THIS) PURE; | ||||
|     STDMETHOD(GetVertexDescription)(THIS_ CONST D3D10_INPUT_ELEMENT_DESC **ppDesc, UINT *pDeclCount) PURE; | ||||
| 
 | ||||
|     STDMETHOD(SetVertexData)(THIS_ UINT iBuffer, CONST void *pData) PURE; | ||||
|     STDMETHOD(GetVertexBuffer)(THIS_ UINT iBuffer, ID3DX10MeshBuffer **ppVertexBuffer) PURE; | ||||
| 
 | ||||
|     STDMETHOD(SetIndexData)(THIS_ CONST void *pData, UINT cIndices) PURE; | ||||
|     STDMETHOD(GetIndexBuffer)(THIS_ ID3DX10MeshBuffer **ppIndexBuffer) PURE; | ||||
| 
 | ||||
|     STDMETHOD(SetAttributeData)(THIS_ CONST UINT *pData) PURE; | ||||
|     STDMETHOD(GetAttributeBuffer)(THIS_ ID3DX10MeshBuffer **ppAttributeBuffer) PURE; | ||||
| 
 | ||||
|     STDMETHOD(SetAttributeTable)(THIS_ CONST D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT  cAttribTableSize) PURE; | ||||
|     STDMETHOD(GetAttributeTable)(THIS_ D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT  *pAttribTableSize) PURE; | ||||
| 
 | ||||
|     STDMETHOD(GenerateAdjacencyAndPointReps)(THIS_ FLOAT Epsilon) PURE; | ||||
|     STDMETHOD(GenerateGSAdjacency)(THIS) PURE; | ||||
| 
 | ||||
|     STDMETHOD(SetAdjacencyData)(THIS_ CONST UINT *pAdjacency) PURE; | ||||
|     STDMETHOD(GetAdjacencyBuffer)(THIS_ ID3DX10MeshBuffer **ppAdjacency) PURE; | ||||
| 
 | ||||
|     STDMETHOD(SetPointRepData)(THIS_ CONST UINT *pPointReps) PURE; | ||||
|     STDMETHOD(GetPointRepBuffer)(THIS_ ID3DX10MeshBuffer **ppPointReps) PURE; | ||||
|      | ||||
|     STDMETHOD(Discard)(THIS_ D3DX10_MESH_DISCARD_FLAGS dwDiscard) PURE; | ||||
|     STDMETHOD(CloneMesh)(THIS_ UINT Flags, LPCSTR pPosSemantic, CONST D3D10_INPUT_ELEMENT_DESC *pDesc, UINT  DeclCount, ID3DX10Mesh** ppCloneMesh) PURE; | ||||
| 
 | ||||
|     STDMETHOD(Optimize)(THIS_ UINT Flags, UINT * pFaceRemap, LPD3D10BLOB *ppVertexRemap) PURE; | ||||
|     STDMETHOD(GenerateAttributeBufferFromTable)(THIS) PURE; | ||||
|      | ||||
| 	STDMETHOD(Intersect)(THIS_ D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir,  | ||||
|                                         UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits); | ||||
|     STDMETHOD(IntersectSubset)(THIS_ UINT AttribId, D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir,  | ||||
|                                         UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits); | ||||
|      | ||||
|     // ID3DX10Mesh - Device functions
 | ||||
|     STDMETHOD(CommitToDevice)(THIS) PURE; | ||||
|     STDMETHOD(DrawSubset)(THIS_ UINT AttribId) PURE; | ||||
|     STDMETHOD(DrawSubsetInstanced)(THIS_ UINT AttribId, UINT InstanceCount, UINT StartInstanceLocation) PURE; | ||||
| 
 | ||||
|     STDMETHOD(GetDeviceVertexBuffer)(THIS_ UINT iBuffer, ID3D10Buffer **ppVertexBuffer) PURE; | ||||
|     STDMETHOD(GetDeviceIndexBuffer)(THIS_ ID3D10Buffer **ppIndexBuffer) PURE; | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| // Flat API
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| HRESULT WINAPI  | ||||
|     D3DX10CreateMesh( | ||||
|         ID3D10Device *pDevice, | ||||
|         CONST D3D10_INPUT_ELEMENT_DESC *pDeclaration,  | ||||
|         UINT  DeclCount, | ||||
|         LPCSTR pPositionSemantic, | ||||
|         UINT  VertexCount, | ||||
|         UINT  FaceCount, | ||||
|         UINT  Options,  | ||||
|         ID3DX10Mesh **ppMesh); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| 
 | ||||
| // ID3DX10Mesh::Optimize options - upper byte only, lower 3 bytes used from _D3DX10MESH option flags
 | ||||
| enum _D3DX10_MESHOPT { | ||||
|     D3DX10_MESHOPT_COMPACT       = 0x01000000, | ||||
|     D3DX10_MESHOPT_ATTR_SORT     = 0x02000000, | ||||
|     D3DX10_MESHOPT_VERTEX_CACHE   = 0x04000000, | ||||
|     D3DX10_MESHOPT_STRIP_REORDER  = 0x08000000, | ||||
|     D3DX10_MESHOPT_IGNORE_VERTS   = 0x10000000,  // optimize faces only, don't touch vertices
 | ||||
|     D3DX10_MESHOPT_DO_NOT_SPLIT    = 0x20000000,  // do not split vertices shared between attribute groups when attribute sorting
 | ||||
|     D3DX10_MESHOPT_DEVICE_INDEPENDENT = 0x00400000,  // Only affects VCache.  uses a static known good cache size for all cards
 | ||||
|                              | ||||
|     // D3DX10_MESHOPT_SHAREVB has been removed, please use D3DX10MESH_VB_SHARE instead
 | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////
 | ||||
| // ID3DXSkinInfo
 | ||||
| //////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| // {420BD604-1C76-4a34-A466-E45D0658A32C}
 | ||||
| DEFINE_GUID(IID_ID3DX10SkinInfo,  | ||||
| 0x420bd604, 0x1c76, 0x4a34, 0xa4, 0x66, 0xe4, 0x5d, 0x6, 0x58, 0xa3, 0x2c); | ||||
| 
 | ||||
| // scaling modes for ID3DX10SkinInfo::Compact() & ID3DX10SkinInfo::UpdateMesh()
 | ||||
| #define D3DX10_SKININFO_NO_SCALING 0 | ||||
| #define D3DX10_SKININFO_SCALE_TO_1 1 | ||||
| #define D3DX10_SKININFO_SCALE_TO_TOTAL 2 | ||||
| 
 | ||||
| typedef struct _D3DX10_SKINNING_CHANNEL | ||||
| { | ||||
|     UINT            SrcOffset; | ||||
|     UINT            DestOffset; | ||||
|     BOOL            IsNormal; | ||||
| } D3DX10_SKINNING_CHANNEL; | ||||
| 
 | ||||
| #undef INTERFACE | ||||
| #define INTERFACE ID3DX10SkinInfo | ||||
| 
 | ||||
| typedef struct ID3DX10SkinInfo *LPD3DX10SKININFO; | ||||
| 
 | ||||
| DECLARE_INTERFACE_(ID3DX10SkinInfo, IUnknown) | ||||
| { | ||||
|     // IUnknown
 | ||||
|     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; | ||||
|     STDMETHOD_(ULONG, AddRef)(THIS) PURE; | ||||
|     STDMETHOD_(ULONG, Release)(THIS) PURE; | ||||
| 
 | ||||
|     STDMETHOD_(UINT , GetNumVertices)(THIS) PURE; | ||||
|     STDMETHOD_(UINT , GetNumBones)(THIS) PURE; | ||||
|     STDMETHOD_(UINT , GetMaxBoneInfluences)(THIS) PURE; | ||||
| 
 | ||||
|     STDMETHOD(AddVertices)(THIS_ UINT  Count) PURE; | ||||
|     STDMETHOD(RemapVertices)(THIS_ UINT  NewVertexCount, UINT  *pVertexRemap) PURE; | ||||
| 
 | ||||
|     STDMETHOD(AddBones)(THIS_ UINT  Count) PURE; | ||||
|     STDMETHOD(RemoveBone)(THIS_ UINT  Index) PURE; | ||||
|     STDMETHOD(RemapBones)(THIS_ UINT  NewBoneCount, UINT  *pBoneRemap) PURE; | ||||
| 
 | ||||
|     STDMETHOD(AddBoneInfluences)(THIS_ UINT  BoneIndex, UINT  InfluenceCount, UINT  *pIndices, float *pWeights) PURE; | ||||
|     STDMETHOD(ClearBoneInfluences)(THIS_ UINT  BoneIndex) PURE; | ||||
|     STDMETHOD_(UINT , GetBoneInfluenceCount)(THIS_ UINT  BoneIndex) PURE; | ||||
|     STDMETHOD(GetBoneInfluences)(THIS_ UINT  BoneIndex, UINT  Offset, UINT  Count, UINT  *pDestIndices, float *pDestWeights) PURE; | ||||
|     STDMETHOD(FindBoneInfluenceIndex)(THIS_ UINT  BoneIndex, UINT  VertexIndex, UINT  *pInfluenceIndex) PURE; | ||||
|     STDMETHOD(SetBoneInfluence)(THIS_ UINT  BoneIndex, UINT  InfluenceIndex, float Weight) PURE; | ||||
|     STDMETHOD(GetBoneInfluence)(THIS_ UINT  BoneIndex, UINT  InfluenceIndex, float *pWeight) PURE; | ||||
| 
 | ||||
|     STDMETHOD(Compact)(THIS_ UINT  MaxPerVertexInfluences, UINT  ScaleMode, float MinWeight) PURE; | ||||
|     STDMETHOD(DoSoftwareSkinning)(UINT  StartVertex, UINT  VertexCount, void *pSrcVertices, UINT  SrcStride, void *pDestVertices, UINT  DestStride, D3DXMATRIX *pBoneMatrices, D3DXMATRIX *pInverseTransposeBoneMatrices, D3DX10_SKINNING_CHANNEL *pChannelDescs, UINT  NumChannels) PURE; | ||||
| }; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateSkinInfo(LPD3DX10SKININFO* ppSkinInfo); | ||||
|          | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| typedef struct _D3DX10_ATTRIBUTE_WEIGHTS | ||||
| { | ||||
|     FLOAT Position; | ||||
|     FLOAT Boundary; | ||||
|     FLOAT Normal; | ||||
|     FLOAT Diffuse; | ||||
|     FLOAT Specular; | ||||
|     FLOAT Texcoord[8]; | ||||
|     FLOAT Tangent; | ||||
|     FLOAT Binormal; | ||||
| } D3DX10_ATTRIBUTE_WEIGHTS, *LPD3DX10_ATTRIBUTE_WEIGHTS; | ||||
| 
 | ||||
| #endif //__D3DX10MESH_H__
 | ||||
| 
 | ||||
| 
 | ||||
| @ -0,0 +1,766 @@ | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| //
 | ||||
| //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
 | ||||
| //
 | ||||
| //  File:       d3dx10tex.h
 | ||||
| //  Content:    D3DX10 texturing APIs
 | ||||
| //
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #include "d3dx10.h" | ||||
| 
 | ||||
| #ifndef __D3DX10TEX_H__ | ||||
| #define __D3DX10TEX_H__ | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_FILTER flags:
 | ||||
| // ------------------
 | ||||
| //
 | ||||
| // A valid filter must contain one of these values:
 | ||||
| //
 | ||||
| //  D3DX10_FILTER_NONE
 | ||||
| //      No scaling or filtering will take place.  Pixels outside the bounds
 | ||||
| //      of the source image are assumed to be transparent black.
 | ||||
| //  D3DX10_FILTER_POINT
 | ||||
| //      Each destination pixel is computed by sampling the nearest pixel
 | ||||
| //      from the source image.
 | ||||
| //  D3DX10_FILTER_LINEAR
 | ||||
| //      Each destination pixel is computed by linearly interpolating between
 | ||||
| //      the nearest pixels in the source image.  This filter works best 
 | ||||
| //      when the scale on each axis is less than 2.
 | ||||
| //  D3DX10_FILTER_TRIANGLE
 | ||||
| //      Every pixel in the source image contributes equally to the
 | ||||
| //      destination image.  This is the slowest of all the filters.
 | ||||
| //  D3DX10_FILTER_BOX
 | ||||
| //      Each pixel is computed by averaging a 2x2(x2) box pixels from 
 | ||||
| //      the source image. Only works when the dimensions of the 
 | ||||
| //      destination are half those of the source. (as with mip maps)
 | ||||
| //
 | ||||
| // And can be OR'd with any of these optional flags:
 | ||||
| //
 | ||||
| //  D3DX10_FILTER_MIRROR_U
 | ||||
| //      Indicates that pixels off the edge of the texture on the U-axis
 | ||||
| //      should be mirrored, not wraped.
 | ||||
| //  D3DX10_FILTER_MIRROR_V
 | ||||
| //      Indicates that pixels off the edge of the texture on the V-axis
 | ||||
| //      should be mirrored, not wraped.
 | ||||
| //  D3DX10_FILTER_MIRROR_W
 | ||||
| //      Indicates that pixels off the edge of the texture on the W-axis
 | ||||
| //      should be mirrored, not wraped.
 | ||||
| //  D3DX10_FILTER_MIRROR
 | ||||
| //      Same as specifying D3DX10_FILTER_MIRROR_U | D3DX10_FILTER_MIRROR_V |
 | ||||
| //      D3DX10_FILTER_MIRROR_V
 | ||||
| //  D3DX10_FILTER_DITHER
 | ||||
| //      Dithers the resulting image using a 4x4 order dither pattern.
 | ||||
| //  D3DX10_FILTER_SRGB_IN
 | ||||
| //      Denotes that the input data is in sRGB (gamma 2.2) colorspace.
 | ||||
| //  D3DX10_FILTER_SRGB_OUT
 | ||||
| //      Denotes that the output data is in sRGB (gamma 2.2) colorspace.
 | ||||
| //  D3DX10_FILTER_SRGB
 | ||||
| //      Same as specifying D3DX10_FILTER_SRGB_IN | D3DX10_FILTER_SRGB_OUT
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| typedef enum D3DX10_FILTER_FLAG | ||||
| { | ||||
|     D3DX10_FILTER_NONE            =   (1 << 0), | ||||
|     D3DX10_FILTER_POINT           =   (2 << 0), | ||||
|     D3DX10_FILTER_LINEAR          =   (3 << 0), | ||||
|     D3DX10_FILTER_TRIANGLE        =   (4 << 0), | ||||
|     D3DX10_FILTER_BOX             =   (5 << 0), | ||||
| 
 | ||||
|     D3DX10_FILTER_MIRROR_U        =   (1 << 16), | ||||
|     D3DX10_FILTER_MIRROR_V        =   (2 << 16), | ||||
|     D3DX10_FILTER_MIRROR_W        =   (4 << 16), | ||||
|     D3DX10_FILTER_MIRROR          =   (7 << 16), | ||||
| 
 | ||||
|     D3DX10_FILTER_DITHER          =   (1 << 19), | ||||
|     D3DX10_FILTER_DITHER_DIFFUSION=   (2 << 19), | ||||
| 
 | ||||
|     D3DX10_FILTER_SRGB_IN         =   (1 << 21), | ||||
|     D3DX10_FILTER_SRGB_OUT        =   (2 << 21), | ||||
|     D3DX10_FILTER_SRGB            =   (3 << 21), | ||||
| } D3DX10_FILTER_FLAG; | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_NORMALMAP flags:
 | ||||
| // ---------------------
 | ||||
| // These flags are used to control how D3DX10ComputeNormalMap generates normal
 | ||||
| // maps.  Any number of these flags may be OR'd together in any combination.
 | ||||
| //
 | ||||
| //  D3DX10_NORMALMAP_MIRROR_U
 | ||||
| //      Indicates that pixels off the edge of the texture on the U-axis
 | ||||
| //      should be mirrored, not wraped.
 | ||||
| //  D3DX10_NORMALMAP_MIRROR_V
 | ||||
| //      Indicates that pixels off the edge of the texture on the V-axis
 | ||||
| //      should be mirrored, not wraped.
 | ||||
| //  D3DX10_NORMALMAP_MIRROR
 | ||||
| //      Same as specifying D3DX10_NORMALMAP_MIRROR_U | D3DX10_NORMALMAP_MIRROR_V
 | ||||
| //  D3DX10_NORMALMAP_INVERTSIGN
 | ||||
| //      Inverts the direction of each normal 
 | ||||
| //  D3DX10_NORMALMAP_COMPUTE_OCCLUSION
 | ||||
| //      Compute the per pixel Occlusion term and encodes it into the alpha.
 | ||||
| //      An Alpha of 1 means that the pixel is not obscured in anyway, and
 | ||||
| //      an alpha of 0 would mean that the pixel is completly obscured.
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| typedef enum D3DX10_NORMALMAP_FLAG | ||||
| { | ||||
|     D3DX10_NORMALMAP_MIRROR_U          =   (1 << 16), | ||||
|     D3DX10_NORMALMAP_MIRROR_V          =   (2 << 16), | ||||
|     D3DX10_NORMALMAP_MIRROR            =   (3 << 16), | ||||
|     D3DX10_NORMALMAP_INVERTSIGN        =   (8 << 16), | ||||
|     D3DX10_NORMALMAP_COMPUTE_OCCLUSION =   (16 << 16), | ||||
| } D3DX10_NORMALMAP_FLAG; | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_CHANNEL flags:
 | ||||
| // -------------------
 | ||||
| // These flags are used by functions which operate on or more channels
 | ||||
| // in a texture.
 | ||||
| //
 | ||||
| // D3DX10_CHANNEL_RED
 | ||||
| //     Indicates the red channel should be used
 | ||||
| // D3DX10_CHANNEL_BLUE
 | ||||
| //     Indicates the blue channel should be used
 | ||||
| // D3DX10_CHANNEL_GREEN
 | ||||
| //     Indicates the green channel should be used
 | ||||
| // D3DX10_CHANNEL_ALPHA
 | ||||
| //     Indicates the alpha channel should be used
 | ||||
| // D3DX10_CHANNEL_LUMINANCE
 | ||||
| //     Indicates the luminaces of the red green and blue channels should be 
 | ||||
| //     used.
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| typedef enum D3DX10_CHANNEL_FLAG | ||||
| { | ||||
|     D3DX10_CHANNEL_RED           =    (1 << 0), | ||||
|     D3DX10_CHANNEL_BLUE          =    (1 << 1), | ||||
|     D3DX10_CHANNEL_GREEN         =    (1 << 2), | ||||
|     D3DX10_CHANNEL_ALPHA         =    (1 << 3), | ||||
|     D3DX10_CHANNEL_LUMINANCE     =    (1 << 4), | ||||
| } D3DX10_CHANNEL_FLAG; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_IMAGE_FILE_FORMAT:
 | ||||
| // ---------------------
 | ||||
| // This enum is used to describe supported image file formats.
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| typedef enum D3DX10_IMAGE_FILE_FORMAT | ||||
| { | ||||
|     D3DX10_IFF_BMP         = 0, | ||||
|     D3DX10_IFF_JPG         = 1, | ||||
|     D3DX10_IFF_PNG         = 3, | ||||
|     D3DX10_IFF_DDS         = 4, | ||||
|     D3DX10_IFF_TIFF		  = 10, | ||||
|     D3DX10_IFF_GIF		  = 11, | ||||
|     D3DX10_IFF_WMP		  = 12, | ||||
|     D3DX10_IFF_FORCE_DWORD = 0x7fffffff | ||||
| 
 | ||||
| } D3DX10_IMAGE_FILE_FORMAT; | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_SAVE_TEXTURE_FLAG:
 | ||||
| // ---------------------
 | ||||
| // This enum is used to support texture saving options.
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| typedef enum D3DX10_SAVE_TEXTURE_FLAG | ||||
| { | ||||
|     D3DX10_STF_USEINPUTBLOB      = 0x0001, | ||||
| } D3DX10_SAVE_TEXTURE_FLAG; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_IMAGE_INFO:
 | ||||
| // ---------------
 | ||||
| // This structure is used to return a rough description of what the
 | ||||
| // the original contents of an image file looked like.
 | ||||
| // 
 | ||||
| //  Width
 | ||||
| //      Width of original image in pixels
 | ||||
| //  Height
 | ||||
| //      Height of original image in pixels
 | ||||
| //  Depth
 | ||||
| //      Depth of original image in pixels
 | ||||
| //  ArraySize
 | ||||
| //      Array size in textures
 | ||||
| //  MipLevels
 | ||||
| //      Number of mip levels in original image
 | ||||
| //  MiscFlags
 | ||||
| //      Miscellaneous flags
 | ||||
| //  Format
 | ||||
| //      D3D format which most closely describes the data in original image
 | ||||
| //  ResourceDimension
 | ||||
| //      D3D10_RESOURCE_DIMENSION representing the dimension of texture stored in the file.
 | ||||
| //      D3D10_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D
 | ||||
| //  ImageFileFormat
 | ||||
| //      D3DX10_IMAGE_FILE_FORMAT representing the format of the image file.
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| typedef struct D3DX10_IMAGE_INFO | ||||
| { | ||||
|     UINT                        Width; | ||||
|     UINT                        Height; | ||||
|     UINT                        Depth; | ||||
|     UINT                        ArraySize; | ||||
|     UINT                        MipLevels; | ||||
|     UINT                        MiscFlags; | ||||
|     DXGI_FORMAT                 Format; | ||||
|     D3D10_RESOURCE_DIMENSION    ResourceDimension; | ||||
|     D3DX10_IMAGE_FILE_FORMAT    ImageFileFormat; | ||||
| } D3DX10_IMAGE_INFO; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| // Image File APIs ///////////////////////////////////////////////////////////
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_IMAGE_LOAD_INFO:
 | ||||
| // ---------------
 | ||||
| // This structure can be optionally passed in to texture loader APIs to 
 | ||||
| // control how textures get loaded. Pass in D3DX10_DEFAULT for any of these
 | ||||
| // to have D3DX automatically pick defaults based on the source file.
 | ||||
| // 
 | ||||
| //  Width
 | ||||
| //      Rescale texture to Width texels wide
 | ||||
| //  Height
 | ||||
| //      Rescale texture to Height texels high
 | ||||
| //  Depth
 | ||||
| //      Rescale texture to Depth texels deep
 | ||||
| //  FirstMipLevel
 | ||||
| //      First mip level to load
 | ||||
| //  MipLevels
 | ||||
| //      Number of mip levels to load after the first level
 | ||||
| //  Usage
 | ||||
| //      D3D10_USAGE flag for the new texture
 | ||||
| //  BindFlags
 | ||||
| //      D3D10 Bind flags for the new texture
 | ||||
| //  CpuAccessFlags
 | ||||
| //      D3D10 CPU Access flags for the new texture
 | ||||
| //  MiscFlags
 | ||||
| //      Reserved. Must be 0
 | ||||
| //  Format
 | ||||
| //      Resample texture to the specified format
 | ||||
| //  Filter
 | ||||
| //      Filter the texture using the specified filter (only when resampling)
 | ||||
| //  MipFilter
 | ||||
| //      Filter the texture mip levels using the specified filter (only if 
 | ||||
| //      generating mips)
 | ||||
| //  pSrcInfo
 | ||||
| //      (optional) pointer to a D3DX10_IMAGE_INFO structure that will get 
 | ||||
| //      populated with source image information
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| 
 | ||||
| typedef struct D3DX10_IMAGE_LOAD_INFO | ||||
| { | ||||
|     UINT                       Width; | ||||
|     UINT                       Height; | ||||
|     UINT                       Depth; | ||||
|     UINT                       FirstMipLevel; | ||||
|     UINT                       MipLevels; | ||||
|     D3D10_USAGE                Usage; | ||||
|     UINT                       BindFlags; | ||||
|     UINT                       CpuAccessFlags; | ||||
|     UINT                       MiscFlags; | ||||
|     DXGI_FORMAT                Format; | ||||
|     UINT                       Filter; | ||||
|     UINT                       MipFilter; | ||||
|     D3DX10_IMAGE_INFO*         pSrcInfo; | ||||
|      | ||||
| #ifdef __cplusplus | ||||
|     D3DX10_IMAGE_LOAD_INFO() | ||||
|     { | ||||
|         Width = D3DX10_DEFAULT; | ||||
|         Height = D3DX10_DEFAULT; | ||||
|         Depth = D3DX10_DEFAULT; | ||||
|         FirstMipLevel = D3DX10_DEFAULT; | ||||
|         MipLevels = D3DX10_DEFAULT; | ||||
|         Usage = (D3D10_USAGE) D3DX10_DEFAULT; | ||||
|         BindFlags = D3DX10_DEFAULT; | ||||
|         CpuAccessFlags = D3DX10_DEFAULT; | ||||
|         MiscFlags = D3DX10_DEFAULT; | ||||
|         Format = DXGI_FORMAT_FROM_FILE; | ||||
|         Filter = D3DX10_DEFAULT; | ||||
|         MipFilter = D3DX10_DEFAULT; | ||||
|         pSrcInfo = NULL; | ||||
|     }   | ||||
| #endif | ||||
| 
 | ||||
| } D3DX10_IMAGE_LOAD_INFO; | ||||
| 
 | ||||
| //-------------------------------------------------------------------------------
 | ||||
| // GetImageInfoFromFile/Resource/Memory:
 | ||||
| // ------------------------------
 | ||||
| // Fills in a D3DX10_IMAGE_INFO struct with information about an image file.
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //  pSrcFile
 | ||||
| //      File name of the source image.
 | ||||
| //  pSrcModule
 | ||||
| //      Module where resource is located, or NULL for module associated
 | ||||
| //      with image the os used to create the current process.
 | ||||
| //  pSrcResource
 | ||||
| //      Resource name.
 | ||||
| //  pSrcData
 | ||||
| //      Pointer to file in memory.
 | ||||
| //  SrcDataSize
 | ||||
| //      Size in bytes of file in memory.
 | ||||
| //  pPump
 | ||||
| //      Optional pointer to a thread pump object to use.
 | ||||
| //  pSrcInfo
 | ||||
| //      Pointer to a D3DX10_IMAGE_INFO structure to be filled in with the 
 | ||||
| //      description of the data in the source image file.
 | ||||
| //  pHResult
 | ||||
| //      Pointer to a memory location to receive the return value upon completion.
 | ||||
| //      Maybe NULL if not needed.
 | ||||
| //      If pPump != NULL, pHResult must be a valid memory location until the
 | ||||
| //      the asynchronous execution completes.
 | ||||
| //-------------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10GetImageInfoFromFileA( | ||||
|         LPCSTR                    pSrcFile, | ||||
|         ID3DX10ThreadPump*        pPump, | ||||
|         D3DX10_IMAGE_INFO*        pSrcInfo, | ||||
|         HRESULT*                  pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10GetImageInfoFromFileW( | ||||
|         LPCWSTR                   pSrcFile, | ||||
|         ID3DX10ThreadPump*        pPump, | ||||
|         D3DX10_IMAGE_INFO*        pSrcInfo, | ||||
|         HRESULT*                  pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileW | ||||
| #else | ||||
| #define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileA | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10GetImageInfoFromResourceA( | ||||
|         HMODULE                   hSrcModule, | ||||
|         LPCSTR                    pSrcResource, | ||||
|         ID3DX10ThreadPump*        pPump, | ||||
|         D3DX10_IMAGE_INFO*        pSrcInfo, | ||||
|         HRESULT*                  pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10GetImageInfoFromResourceW( | ||||
|         HMODULE                   hSrcModule, | ||||
|         LPCWSTR                   pSrcResource, | ||||
|         ID3DX10ThreadPump*        pPump, | ||||
|         D3DX10_IMAGE_INFO*        pSrcInfo, | ||||
|         HRESULT*                  pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceW | ||||
| #else | ||||
| #define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceA | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10GetImageInfoFromMemory( | ||||
|         LPCVOID                   pSrcData, | ||||
|         SIZE_T                    SrcDataSize, | ||||
|         ID3DX10ThreadPump*        pPump, | ||||
|         D3DX10_IMAGE_INFO*        pSrcInfo, | ||||
|         HRESULT*                  pHResult); | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| // Create/Save Texture APIs //////////////////////////////////////////////////
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10CreateTextureFromFile/Resource/Memory:
 | ||||
| // D3DX10CreateShaderResourceViewFromFile/Resource/Memory:
 | ||||
| // -----------------------------------
 | ||||
| // Create a texture object from a file or resource.
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //
 | ||||
| //  pDevice
 | ||||
| //      The D3D device with which the texture is going to be used.
 | ||||
| //  pSrcFile
 | ||||
| //      File name.
 | ||||
| //  hSrcModule
 | ||||
| //      Module handle. if NULL, current module will be used.
 | ||||
| //  pSrcResource
 | ||||
| //      Resource name in module
 | ||||
| //  pvSrcData
 | ||||
| //      Pointer to file in memory.
 | ||||
| //  SrcDataSize
 | ||||
| //      Size in bytes of file in memory.
 | ||||
| //  pLoadInfo
 | ||||
| //      Optional pointer to a D3DX10_IMAGE_LOAD_INFO structure that
 | ||||
| //      contains additional loader parameters.
 | ||||
| //  pPump
 | ||||
| //      Optional pointer to a thread pump object to use.
 | ||||
| //  ppTexture
 | ||||
| //      [out] Created texture object.
 | ||||
| //  ppShaderResourceView
 | ||||
| //      [out] Shader resource view object created.
 | ||||
| //  pHResult
 | ||||
| //      Pointer to a memory location to receive the return value upon completion.
 | ||||
| //      Maybe NULL if not needed.
 | ||||
| //      If pPump != NULL, pHResult must be a valid memory location until the
 | ||||
| //      the asynchronous execution completes.
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| 
 | ||||
| // FromFile
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateShaderResourceViewFromFileA( | ||||
|         ID3D10Device*               pDevice, | ||||
|         LPCSTR                      pSrcFile, | ||||
|         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo, | ||||
|         ID3DX10ThreadPump*          pPump, | ||||
|         ID3D10ShaderResourceView**  ppShaderResourceView, | ||||
|         HRESULT*                    pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateShaderResourceViewFromFileW( | ||||
|         ID3D10Device*               pDevice, | ||||
|         LPCWSTR                     pSrcFile, | ||||
|         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo, | ||||
|         ID3DX10ThreadPump*          pPump, | ||||
|         ID3D10ShaderResourceView**  ppShaderResourceView, | ||||
|         HRESULT*                    pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileW | ||||
| #else | ||||
| #define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateTextureFromFileA( | ||||
|         ID3D10Device*               pDevice, | ||||
|         LPCSTR                      pSrcFile, | ||||
|         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo, | ||||
|         ID3DX10ThreadPump*          pPump, | ||||
|         ID3D10Resource**            ppTexture, | ||||
|         HRESULT*                    pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateTextureFromFileW( | ||||
|         ID3D10Device*               pDevice, | ||||
|         LPCWSTR                     pSrcFile, | ||||
|         D3DX10_IMAGE_LOAD_INFO      *pLoadInfo, | ||||
|         ID3DX10ThreadPump*          pPump, | ||||
|         ID3D10Resource**            ppTexture, | ||||
|         HRESULT*                    pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileW | ||||
| #else | ||||
| #define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileA | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| // FromResource (resources in dll/exes)
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateShaderResourceViewFromResourceA( | ||||
|         ID3D10Device*              pDevice, | ||||
|         HMODULE                    hSrcModule, | ||||
|         LPCSTR                     pSrcResource, | ||||
|         D3DX10_IMAGE_LOAD_INFO*    pLoadInfo, | ||||
|         ID3DX10ThreadPump*         pPump, | ||||
|         ID3D10ShaderResourceView** ppShaderResourceView, | ||||
|         HRESULT*                   pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateShaderResourceViewFromResourceW( | ||||
|         ID3D10Device*              pDevice, | ||||
|         HMODULE                    hSrcModule, | ||||
|         LPCWSTR                    pSrcResource, | ||||
|         D3DX10_IMAGE_LOAD_INFO*    pLoadInfo, | ||||
|         ID3DX10ThreadPump*         pPump, | ||||
|         ID3D10ShaderResourceView** ppShaderResourceView, | ||||
|         HRESULT*                   pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceW | ||||
| #else | ||||
| #define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceA | ||||
| #endif | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateTextureFromResourceA( | ||||
|         ID3D10Device*            pDevice, | ||||
|         HMODULE                  hSrcModule, | ||||
|         LPCSTR                   pSrcResource, | ||||
|         D3DX10_IMAGE_LOAD_INFO   *pLoadInfo,   | ||||
|         ID3DX10ThreadPump*       pPump,    | ||||
|         ID3D10Resource**         ppTexture, | ||||
|         HRESULT*                 pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateTextureFromResourceW( | ||||
|         ID3D10Device*           pDevice, | ||||
|         HMODULE                 hSrcModule, | ||||
|         LPCWSTR                 pSrcResource, | ||||
|         D3DX10_IMAGE_LOAD_INFO* pLoadInfo, | ||||
|         ID3DX10ThreadPump*      pPump, | ||||
|         ID3D10Resource**        ppTexture, | ||||
|         HRESULT*                pHResult); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceW | ||||
| #else | ||||
| #define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceA | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| // FromFileInMemory
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateShaderResourceViewFromMemory( | ||||
|         ID3D10Device*              pDevice, | ||||
|         LPCVOID                    pSrcData, | ||||
|         SIZE_T                     SrcDataSize, | ||||
|         D3DX10_IMAGE_LOAD_INFO*    pLoadInfo, | ||||
|         ID3DX10ThreadPump*         pPump,         | ||||
|         ID3D10ShaderResourceView** ppShaderResourceView, | ||||
|         HRESULT*                   pHResult); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10CreateTextureFromMemory( | ||||
|         ID3D10Device*             pDevice, | ||||
|         LPCVOID                   pSrcData, | ||||
|         SIZE_T                    SrcDataSize, | ||||
|         D3DX10_IMAGE_LOAD_INFO*   pLoadInfo,     | ||||
|         ID3DX10ThreadPump*        pPump,     | ||||
|         ID3D10Resource**          ppTexture, | ||||
|         HRESULT*                  pHResult); | ||||
| 
 | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| // Misc Texture APIs /////////////////////////////////////////////////////////
 | ||||
| //////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10_TEXTURE_LOAD_INFO:
 | ||||
| // ------------------------
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| typedef struct _D3DX10_TEXTURE_LOAD_INFO | ||||
| { | ||||
|     D3D10_BOX       *pSrcBox; | ||||
|     D3D10_BOX       *pDstBox; | ||||
|     UINT            SrcFirstMip; | ||||
|     UINT            DstFirstMip; | ||||
|     UINT            NumMips; | ||||
|     UINT            SrcFirstElement; | ||||
|     UINT            DstFirstElement; | ||||
|     UINT            NumElements; | ||||
|     UINT            Filter; | ||||
|     UINT            MipFilter; | ||||
|      | ||||
| #ifdef __cplusplus | ||||
|     _D3DX10_TEXTURE_LOAD_INFO() | ||||
|     { | ||||
|         pSrcBox = NULL; | ||||
|         pDstBox = NULL; | ||||
|         SrcFirstMip = 0; | ||||
|         DstFirstMip = 0; | ||||
|         NumMips = D3DX10_DEFAULT; | ||||
|         SrcFirstElement = 0; | ||||
|         DstFirstElement = 0; | ||||
|         NumElements = D3DX10_DEFAULT; | ||||
|         Filter = D3DX10_DEFAULT; | ||||
|         MipFilter = D3DX10_DEFAULT; | ||||
|     }   | ||||
| #endif | ||||
| 
 | ||||
| } D3DX10_TEXTURE_LOAD_INFO; | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10LoadTextureFromTexture:
 | ||||
| // ----------------------------
 | ||||
| // Load a texture from a texture.
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10LoadTextureFromTexture( | ||||
|         ID3D10Resource            *pSrcTexture, | ||||
|         D3DX10_TEXTURE_LOAD_INFO  *pLoadInfo, | ||||
|         ID3D10Resource            *pDstTexture); | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10FilterTexture:
 | ||||
| // ------------------
 | ||||
| // Filters mipmaps levels of a texture.
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //  pBaseTexture
 | ||||
| //      The texture object to be filtered
 | ||||
| //  SrcLevel
 | ||||
| //      The level whose image is used to generate the subsequent levels. 
 | ||||
| //  MipFilter
 | ||||
| //      D3DX10_FILTER flags controlling how each miplevel is filtered.
 | ||||
| //      Or D3DX10_DEFAULT for D3DX10_FILTER_BOX,
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10FilterTexture( | ||||
|         ID3D10Resource            *pTexture, | ||||
|         UINT                      SrcLevel, | ||||
|         UINT                      MipFilter); | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10SaveTextureToFile:
 | ||||
| // ----------------------
 | ||||
| // Save a texture to a file.
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //  pDestFile
 | ||||
| //      File name of the destination file
 | ||||
| //  DestFormat
 | ||||
| //      D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving.
 | ||||
| //  pSrcTexture
 | ||||
| //      Source texture, containing the image to be saved
 | ||||
| //
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10SaveTextureToFileA( | ||||
|         ID3D10Resource            *pSrcTexture, | ||||
|         D3DX10_IMAGE_FILE_FORMAT    DestFormat, | ||||
|         LPCSTR                    pDestFile); | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10SaveTextureToFileW( | ||||
|         ID3D10Resource            *pSrcTexture, | ||||
|         D3DX10_IMAGE_FILE_FORMAT    DestFormat, | ||||
|         LPCWSTR                   pDestFile); | ||||
| 
 | ||||
| #ifdef UNICODE | ||||
| #define D3DX10SaveTextureToFile D3DX10SaveTextureToFileW | ||||
| #else | ||||
| #define D3DX10SaveTextureToFile D3DX10SaveTextureToFileA | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10SaveTextureToMemory:
 | ||||
| // ----------------------
 | ||||
| // Save a texture to a blob.
 | ||||
| //
 | ||||
| // Parameters:
 | ||||
| //  pSrcTexture
 | ||||
| //      Source texture, containing the image to be saved
 | ||||
| //  DestFormat
 | ||||
| //      D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving.
 | ||||
| //  ppDestBuf
 | ||||
| //      address of a d3dxbuffer pointer to return the image data
 | ||||
| //  Flags
 | ||||
| //      optional flags
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10SaveTextureToMemory( | ||||
|         ID3D10Resource*            pSrcTexture, | ||||
|         D3DX10_IMAGE_FILE_FORMAT   DestFormat, | ||||
|         LPD3D10BLOB*               ppDestBuf, | ||||
|         UINT                       Flags); | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10ComputeNormalMap:
 | ||||
| // ---------------------
 | ||||
| // Converts a height map into a normal map.  The (x,y,z) components of each
 | ||||
| // normal are mapped to the (r,g,b) channels of the output texture.
 | ||||
| //
 | ||||
| // Parameters
 | ||||
| //  pSrcTexture
 | ||||
| //      Pointer to the source heightmap texture 
 | ||||
| //  Flags
 | ||||
| //      D3DX10_NORMALMAP flags
 | ||||
| //  Channel
 | ||||
| //      D3DX10_CHANNEL specifying source of height information
 | ||||
| //  Amplitude
 | ||||
| //      The constant value which the height information is multiplied by.
 | ||||
| //  pDestTexture
 | ||||
| //      Pointer to the destination texture
 | ||||
| //---------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10ComputeNormalMap( | ||||
|         ID3D10Texture2D		     *pSrcTexture, | ||||
|         UINT                      Flags, | ||||
|         UINT                      Channel, | ||||
|         FLOAT                     Amplitude, | ||||
|         ID3D10Texture2D		     *pDestTexture); | ||||
| 
 | ||||
| 
 | ||||
| //----------------------------------------------------------------------------
 | ||||
| // D3DX10SHProjectCubeMap:
 | ||||
| // ----------------------
 | ||||
| //  Projects a function represented in a cube map into spherical harmonics.
 | ||||
| //
 | ||||
| //  Parameters:
 | ||||
| //   Order
 | ||||
| //      Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
 | ||||
| //   pCubeMap
 | ||||
| //      CubeMap that is going to be projected into spherical harmonics
 | ||||
| //   pROut
 | ||||
| //      Output SH vector for Red.
 | ||||
| //   pGOut
 | ||||
| //      Output SH vector for Green
 | ||||
| //   pBOut
 | ||||
| //      Output SH vector for Blue        
 | ||||
| //
 | ||||
| //---------------------------------------------------------------------------
 | ||||
| 
 | ||||
| HRESULT WINAPI | ||||
|     D3DX10SHProjectCubeMap( | ||||
|         __in_range(2,6) UINT                                Order, | ||||
|         ID3D10Texture2D                                    *pCubeMap, | ||||
|         __out_ecount(Order*Order) FLOAT                    *pROut, | ||||
|         __out_ecount_opt(Order*Order) FLOAT                *pGOut, | ||||
|         __out_ecount_opt(Order*Order) FLOAT                *pBOut); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif //__cplusplus
 | ||||
| 
 | ||||
| #endif //__D3DX10TEX_H__
 | ||||
| 
 | ||||
					Loading…
					
					
				
		Reference in New Issue