diff --git a/gfx/include/d3d8/d3dx8core.h b/gfx/include/d3d8/d3dx8core.h index 5629124aa0..7542f28924 100644 --- a/gfx/include/d3d8/d3dx8core.h +++ b/gfx/include/d3d8/d3dx8core.h @@ -1,11 +1,10 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8core.h -// Content: D3DX core types and functions -// -/////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8core.h + * Content: D3DX core types and functions + */ #include "d3dx8.h" @@ -14,22 +13,22 @@ -/////////////////////////////////////////////////////////////////////////// -// ID3DXBuffer: -// ------------ -// The buffer object is used by D3DX to return arbitrary size data. -// -// GetBufferPointer - -// Returns a pointer to the beginning of the buffer. -// -// GetBufferSize - -// Returns the size of the buffer, in bytes. -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXBuffer: + * ------------ + * The buffer object is used by D3DX to return arbitrary size data. + * + * GetBufferPointer - + * Returns a pointer to the beginning of the buffer. + * + * GetBufferSize - + * Returns the size of the buffer, in bytes. + */ typedef interface ID3DXBuffer ID3DXBuffer; typedef interface ID3DXBuffer *LPD3DXBUFFER; -// {932E6A7E-C68E-45dd-A7BF-53D19C86DB1F} +/* {932E6A7E-C68E-45dd-A7BF-53D19C86DB1F} */ DEFINE_GUID(IID_ID3DXBuffer, 0x932e6a7e, 0xc68e, 0x45dd, 0xa7, 0xbf, 0x53, 0xd1, 0x9c, 0x86, 0xdb, 0x1f); @@ -38,48 +37,45 @@ DEFINE_GUID(IID_ID3DXBuffer, DECLARE_INTERFACE_(ID3DXBuffer, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXBuffer + /* ID3DXBuffer */ STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; }; - - -/////////////////////////////////////////////////////////////////////////// -// ID3DXFont: -// ---------- -// Font objects contain the textures and resources needed to render -// a specific font on a specific device. -// -// Begin - -// Prepartes device for drawing text. This is optional.. if DrawText -// is called outside of Begin/End, it will call Begin and End for you. -// -// DrawText - -// Draws formatted text on a D3D device. Some parameters are -// surprisingly similar to those of GDI's DrawText function. See GDI -// documentation for a detailed description of these parameters. -// -// End - -// Restores device state to how it was when Begin was called. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -// -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFont: + * ---------- + * Font objects contain the textures and resources needed to render + * a specific font on a specific device. + * + * Begin - + * Prepartes device for drawing text. This is optional.. if DrawText + * is called outside of Begin/End, it will call Begin and End for you. + * + * DrawText - + * Draws formatted text on a D3D device. Some parameters are + * surprisingly similar to those of GDI's DrawText function. See GDI + * documentation for a detailed description of these parameters. + * + * End - + * Restores device state to how it was when Begin was called. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + * + */ typedef interface ID3DXFont ID3DXFont; typedef interface ID3DXFont *LPD3DXFONT; - -// {89FAD6A5-024D-49af-8FE7-F51123B85E25} +/* {89FAD6A5-024D-49af-8FE7-F51123B85E25} */ DEFINE_GUID( IID_ID3DXFont, 0x89fad6a5, 0x24d, 0x49af, 0x8f, 0xe7, 0xf5, 0x11, 0x23, 0xb8, 0x5e, 0x25); @@ -89,12 +85,12 @@ DEFINE_GUID( IID_ID3DXFont, DECLARE_INTERFACE_(ID3DXFont, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXFont + /* ID3DXFont */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(GetLogFont)(THIS_ LOGFONT* pLogFont) PURE; @@ -118,7 +114,7 @@ DECLARE_INTERFACE_(ID3DXFont, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateFont( @@ -137,33 +133,33 @@ HRESULT WINAPI } #endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// ID3DXSprite: -// ------------ -// This object intends to provide an easy way to drawing sprites using D3D. -// -// Begin - -// Prepares device for drawing sprites -// -// Draw, DrawAffine, DrawTransform - -// Draws a sprite in screen-space. Before transformation, the sprite is -// the size of SrcRect, with its top-left corner at the origin (0,0). -// The color and alpha channels are modulated by Color. -// -// End - -// Restores device state to how it was when Begin was called. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXSprite: + * ------------ + * This object intends to provide an easy way to drawing sprites using D3D. + * + * Begin - + * Prepares device for drawing sprites + * + * Draw, DrawAffine, DrawTransform - + * Draws a sprite in screen-space. Before transformation, the sprite is + * the size of SrcRect, with its top-left corner at the origin (0,0). + * The color and alpha channels are modulated by Color. + * + * End - + * Restores device state to how it was when Begin was called. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + */ typedef interface ID3DXSprite ID3DXSprite; typedef interface ID3DXSprite *LPD3DXSPRITE; -// {13D69D15-F9B0-4e0f-B39E-C91EB33F6CE7} +/* {13D69D15-F9B0-4e0f-B39E-C91EB33F6CE7} */ DEFINE_GUID( IID_ID3DXSprite, 0x13d69d15, 0xf9b0, 0x4e0f, 0xb3, 0x9e, 0xc9, 0x1e, 0xb3, 0x3f, 0x6c, 0xe7); @@ -173,12 +169,12 @@ DEFINE_GUID( IID_ID3DXSprite, DECLARE_INTERFACE_(ID3DXSprite, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXSprite + /* ID3DXSprite */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(Begin)(THIS) PURE; @@ -201,7 +197,7 @@ DECLARE_INTERFACE_(ID3DXSprite, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI @@ -211,28 +207,28 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// ID3DXRenderToSurface: -// --------------------- -// This object abstracts rendering to surfaces. These surfaces do not -// necessarily need to be render targets. If they are not, a compatible -// render target is used, and the result copied into surface at end scene. -// -// BeginScene, EndScene - -// Call BeginScene() and EndScene() at the beginning and ending of your -// scene. These calls will setup and restore render targets, viewports, -// etc.. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXRenderToSurface: + * --------------------- + * This object abstracts rendering to surfaces. These surfaces do not + * necessarily need to be render targets. If they are not, a compatible + * render target is used, and the result copied into surface at end scene. + * + * BeginScene, EndScene - + * Call BeginScene() and EndScene() at the beginning and ending of your + * scene. These calls will setup and restore render targets, viewports, + * etc.. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + */ typedef struct _D3DXRTS_DESC { @@ -248,23 +244,21 @@ typedef struct _D3DXRTS_DESC typedef interface ID3DXRenderToSurface ID3DXRenderToSurface; typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE; - -// {82DF5B90-E34E-496e-AC1C-62117A6A5913} +/* {82DF5B90-E34E-496e-AC1C-62117A6A5913} */ DEFINE_GUID( IID_ID3DXRenderToSurface, 0x82df5b90, 0xe34e, 0x496e, 0xac, 0x1c, 0x62, 0x11, 0x7a, 0x6a, 0x59, 0x13); - #undef INTERFACE #define INTERFACE ID3DXRenderToSurface DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXRenderToSurface + /* ID3DXRenderToSurface */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE; @@ -278,7 +272,7 @@ DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateRenderToSurface( @@ -292,37 +286,37 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// ID3DXRenderToEnvMap: -// -------------------- -// This object abstracts rendering to environment maps. These surfaces -// do not necessarily need to be render targets. If they are not, a -// compatible render target is used, and the result copied into the -// environment map at end scene. -// -// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - -// This function initiates the rendering of the environment map. As -// parameters, you pass the textures in which will get filled in with -// the resulting environment map. -// -// Face - -// Call this function to initiate the drawing of each face. For each -// environment map, you will call this six times.. once for each face -// in D3DCUBEMAP_FACES. -// -// End - -// This will restore all render targets, and if needed compose all the -// rendered faces into the environment map surfaces. -// -// OnLostDevice, OnResetDevice - -// Call OnLostDevice() on this object before calling Reset() on the -// device, so that this object can release any stateblocks and video -// memory resources. After Reset(), the call OnResetDevice(). -/////////////////////////////////////////////////////////////////////////// +/* + * ID3DXRenderToEnvMap: + * -------------------- + * This object abstracts rendering to environment maps. These surfaces + * do not necessarily need to be render targets. If they are not, a + * compatible render target is used, and the result copied into the + * environment map at end scene. + * + * BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - + * This function initiates the rendering of the environment map. As + * parameters, you pass the textures in which will get filled in with + * the resulting environment map. + * + * Face - + * Call this function to initiate the drawing of each face. For each + * environment map, you will call this six times.. once for each face + * in D3DCUBEMAP_FACES. + * + * End - + * This will restore all render targets, and if needed compose all the + * rendered faces into the environment map surfaces. + * + * OnLostDevice, OnResetDevice - + * Call OnLostDevice() on this object before calling Reset() on the + * device, so that this object can release any stateblocks and video + * memory resources. After Reset(), the call OnResetDevice(). + */ typedef struct _D3DXRTE_DESC { @@ -336,7 +330,7 @@ typedef struct _D3DXRTE_DESC typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap; typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap; -// {4E42C623-9451-44b7-8C86-ABCCDE5D52C8} +/* {4E42C623-9451-44b7-8C86-ABCCDE5D52C8} */ DEFINE_GUID( IID_ID3DXRenderToEnvMap, 0x4e42c623, 0x9451, 0x44b7, 0x8c, 0x86, 0xab, 0xcc, 0xde, 0x5d, 0x52, 0xc8); @@ -346,12 +340,12 @@ DEFINE_GUID( IID_ID3DXRenderToEnvMap, DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXRenderToEnvMap + /* ID3DXRenderToEnvMap */ STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE; STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE; @@ -379,7 +373,7 @@ DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateRenderToEnvMap( @@ -392,26 +386,26 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// Shader assemblers: -/////////////////////////////////////////////////////////////////////////// +/* + * Shader assemblers: + */ -//------------------------------------------------------------------------- -// D3DXASM flags: -// -------------- -// -// D3DXASM_DEBUG -// Generate debug info. -// -// D3DXASM_SKIPVALIDATION -// Do not validate the generated code against known capabilities and -// constraints. This option is only recommended when assembling shaders -// you KNOW will work. (ie. have assembled before without this option.) -//------------------------------------------------------------------------- +/* + * D3DXASM flags: + * -------------- + * + * D3DXASM_DEBUG + * Generate debug info. + * + * D3DXASM_SKIPVALIDATION + * Do not validate the generated code against known capabilities and + * constraints. This option is only recommended when assembling shaders + * you KNOW will work. (ie. have assembled before without this option.) + */ #define D3DXASM_DEBUG (1 << 0) #define D3DXASM_SKIPVALIDATION (1 << 1) @@ -419,34 +413,34 @@ HRESULT WINAPI #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ -//------------------------------------------------------------------------- -// D3DXAssembleShader: -// ------------------- -// Assembles an ascii description of a vertex or pixel shader into -// binary form. -// -// 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 -// Flags -// D3DXASM_xxx flags -// ppConstants -// Returns an ID3DXBuffer object containing constant declarations. -// ppCompiledShader -// Returns an ID3DXBuffer object containing the object code. -// ppCompilationErrors -// Returns an ID3DXBuffer object containing ascii error messages -//------------------------------------------------------------------------- +/* + * D3DXAssembleShader: + * ------------------- + * Assembles an ascii description of a vertex or pixel shader into + * binary form. + * + * 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 + * Flags + * D3DXASM_xxx flags + * ppConstants + * Returns an ID3DXBuffer object containing constant declarations. + * ppCompiledShader + * Returns an ID3DXBuffer object containing the object code. + * ppCompilationErrors + * Returns an ID3DXBuffer object containing ascii error messages + */ HRESULT WINAPI D3DXAssembleShaderFromFileA( @@ -506,33 +500,33 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -/////////////////////////////////////////////////////////////////////////// -// Misc APIs: -/////////////////////////////////////////////////////////////////////////// +/* + * Misc APIs: + */ #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ -//------------------------------------------------------------------------- -// D3DXGetErrorString: -// ------------------ -// Returns the error string for given an hresult. Interprets all D3DX and -// D3D hresults. -// -// Parameters: -// hr -// The error code to be deciphered. -// pBuffer -// Pointer to the buffer to be filled in. -// BufferLen -// Count of characters in buffer. Any error message longer than this -// length will be truncated to fit. -//------------------------------------------------------------------------- +/* + * D3DXGetErrorString: + * ------------------ + * Returns the error string for given an hresult. Interprets all D3DX and + * D3D hresults. + * + * Parameters: + * hr + * The error code to be deciphered. + * pBuffer + * Pointer to the buffer to be filled in. + * BufferLen + * Count of characters in buffer. Any error message longer than this + * length will be truncated to fit. + */ HRESULT WINAPI D3DXGetErrorStringA( HRESULT hr, diff --git a/gfx/include/d3d8/d3dx8math.h b/gfx/include/d3d8/d3dx8math.h index a1a68fd6b6..c126258db3 100644 --- a/gfx/include/d3d8/d3dx8math.h +++ b/gfx/include/d3d8/d3dx8math.h @@ -1,11 +1,11 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8math.h -// Content: D3DX math types and functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8math.h + * Content: D3DX math types and functions + * + */ #include "d3dx8.h" @@ -15,11 +15,11 @@ #include #pragma warning(disable:4201) /* anonymous unions warning */ -//=========================================================================== -// -// General purpose utilities -// -//=========================================================================== +/* + * + * General purpose utilities + * + */ #define D3DX_PI ((FLOAT) 3.141592654f) #define D3DX_1BYPI ((FLOAT) 0.318309886f) @@ -28,15 +28,15 @@ -//=========================================================================== -// -// Vectors -// -//=========================================================================== +/* + * + * Vectors + * + */ -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ typedef struct D3DXVECTOR2 { #ifdef __cplusplus @@ -45,21 +45,21 @@ public: D3DXVECTOR2( CONST FLOAT * ); D3DXVECTOR2( FLOAT x, FLOAT y ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& ); D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& ); D3DXVECTOR2& operator *= ( FLOAT ); D3DXVECTOR2& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXVECTOR2 operator + () const; D3DXVECTOR2 operator - () const; - // binary operators + /* binary operators */ D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const; D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const; D3DXVECTOR2 operator * ( FLOAT ) const; @@ -72,14 +72,14 @@ public: public: -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT x, y; } D3DXVECTOR2, *LPD3DXVECTOR2; -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ #ifdef __cplusplus typedef struct D3DXVECTOR3 : public D3DVECTOR { @@ -89,21 +89,21 @@ public: D3DXVECTOR3( CONST D3DVECTOR& ); D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); D3DXVECTOR3& operator *= ( FLOAT ); D3DXVECTOR3& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXVECTOR3 operator + () const; D3DXVECTOR3 operator - () const; - // binary operators + /* binary operators */ D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; D3DXVECTOR3 operator * ( FLOAT ) const; @@ -116,14 +116,14 @@ public: } D3DXVECTOR3, *LPD3DXVECTOR3; -#else //!__cplusplus +#else /* !__cplusplus */ typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; -#endif //!__cplusplus +#endif /* !__cplusplus */ -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ typedef struct D3DXVECTOR4 { #ifdef __cplusplus @@ -132,21 +132,21 @@ public: D3DXVECTOR4( CONST FLOAT* ); D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& ); D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& ); D3DXVECTOR4& operator *= ( FLOAT ); D3DXVECTOR4& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXVECTOR4 operator + () const; D3DXVECTOR4 operator - () const; - // binary operators + /* binary operators */ D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const; D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const; D3DXVECTOR4 operator * ( FLOAT ) const; @@ -158,16 +158,16 @@ public: BOOL operator != ( CONST D3DXVECTOR4& ) const; public: -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT x, y, z, w; } D3DXVECTOR4, *LPD3DXVECTOR4; -//=========================================================================== -// -// Matrices -// -//=========================================================================== +/* + * + * Matrices + * + */ #ifdef __cplusplus typedef struct D3DXMATRIX : public D3DMATRIX { @@ -181,26 +181,26 @@ public: FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); - // access grants + /* access grants */ FLOAT& operator () ( UINT Row, UINT Col ); FLOAT operator () ( UINT Row, UINT Col ) const; - // casting operators + /* casting operators */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXMATRIX& operator *= ( CONST D3DXMATRIX& ); D3DXMATRIX& operator += ( CONST D3DXMATRIX& ); D3DXMATRIX& operator -= ( CONST D3DXMATRIX& ); D3DXMATRIX& operator *= ( FLOAT ); D3DXMATRIX& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXMATRIX operator + () const; D3DXMATRIX operator - () const; - // binary operators + /* binary operators */ D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const; D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const; D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const; @@ -214,27 +214,27 @@ public: } D3DXMATRIX, *LPD3DXMATRIX; -#else //!__cplusplus +#else /* !__cplusplus */ typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX; -#endif //!__cplusplus +#endif /* !__cplusplus */ -//=========================================================================== -// -// Aligned Matrices -// -// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. -// It aligns matrices on the stack and on the heap or in global scope. -// It does this using __declspec(align(16)) which works on VC7 and on VC 6 -// with the processor pack. Unfortunately there is no way to detect the -// latter so this is turned on only on VC7. On other compilers this is the -// the same as D3DXMATRIX. -// Using this class on a compiler that does not actually do the alignment -// can be dangerous since it will not expose bugs that ignore alignment. -// E.g if an object of this class in inside a struct or class, and some code -// memcopys data in it assuming tight packing. This could break on a compiler -// that eventually start aligning the matrix. -// -//=========================================================================== +/* + * + * Aligned Matrices + * + * This class helps keep matrices 16-byte aligned as preferred by P4 cpus. + * It aligns matrices on the stack and on the heap or in global scope. + * It does this using __declspec(align(16)) which works on VC7 and on VC 6 + * with the processor pack. Unfortunately there is no way to detect the + * latter so this is turned on only on VC7. On other compilers this is the + * the same as D3DXMATRIX. + * Using this class on a compiler that does not actually do the alignment + * can be dangerous since it will not expose bugs that ignore alignment. + * E.g if an object of this class in inside a struct or class, and some code + * memcopys data in it assuming tight packing. This could break on a compiler + * that eventually start aligning the matrix. + * + */ #ifdef __cplusplus typedef struct _D3DXMATRIXA16 : public D3DXMATRIX { @@ -273,8 +273,8 @@ typedef struct _D3DXMATRIXA16 : public D3DXMATRIX return p; }; - // This is NOT a virtual operator. If you cast - // to D3DXMATRIX, do not delete using that + /* This is NOT a virtual operator. If you cast + * to D3DXMATRIX, do not delete using that */ void operator delete(void* p) { if(p) @@ -285,8 +285,8 @@ typedef struct _D3DXMATRIXA16 : public D3DXMATRIX } }; - // This is NOT a virtual operator. If you cast - // to D3DXMATRIX, do not delete using that + /* This is NOT a virtual operator. If you cast + * to D3DXMATRIX, do not delete using that */ void operator delete[](void* p) { if(p) @@ -304,25 +304,25 @@ typedef struct _D3DXMATRIXA16 : public D3DXMATRIX }; } _D3DXMATRIXA16; -#else //!__cplusplus +#else /* !__cplusplus */ typedef D3DXMATRIX _D3DXMATRIXA16; -#endif //!__cplusplus +#endif /* !__cplusplus */ -#if _MSC_VER >= 1300 // VC7 +#if _MSC_VER >= 1300 /* VC7 */ #define _ALIGN_16 __declspec(align(16)) #else -#define _ALIGN_16 // Earlier compiler may not understand this, do nothing. +#define _ALIGN_16 /* Earlier compiler may not understand this, do nothing. */ #endif #define D3DXMATRIXA16 _ALIGN_16 _D3DXMATRIXA16 typedef D3DXMATRIXA16 *LPD3DXMATRIXA16; -//=========================================================================== -// -// Quaternions -// -//=========================================================================== +/* + * + * Quaternions + * + */ typedef struct D3DXQUATERNION { #ifdef __cplusplus @@ -331,22 +331,22 @@ public: D3DXQUATERNION( CONST FLOAT * ); D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); D3DXQUATERNION& operator *= ( FLOAT ); D3DXQUATERNION& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXQUATERNION operator + () const; D3DXQUATERNION operator - () const; - // binary operators + /* binary operators */ D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; @@ -358,16 +358,16 @@ public: BOOL operator == ( CONST D3DXQUATERNION& ) const; BOOL operator != ( CONST D3DXQUATERNION& ) const; -#endif //__cplusplus +#endif /*__cplusplus */ FLOAT x, y, z, w; } D3DXQUATERNION, *LPD3DXQUATERNION; -//=========================================================================== -// -// Planes -// -//=========================================================================== +/* + * + * Planes + * + */ typedef struct D3DXPLANE { #ifdef __cplusplus @@ -376,28 +376,28 @@ public: D3DXPLANE( CONST FLOAT* ); D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // unary operators + /* unary operators */ D3DXPLANE operator + () const; D3DXPLANE operator - () const; - // binary operators + /* binary operators */ BOOL operator == ( CONST D3DXPLANE& ) const; BOOL operator != ( CONST D3DXPLANE& ) const; -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT a, b, c, d; } D3DXPLANE, *LPD3DXPLANE; -//=========================================================================== -// -// Colors -// -//=========================================================================== +/* + * + * Colors + * + */ typedef struct D3DXCOLOR { @@ -409,7 +409,7 @@ public: D3DXCOLOR( CONST D3DCOLORVALUE& ); D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); - // casting + /* casting */ operator DWORD () const; operator FLOAT* (); @@ -421,17 +421,17 @@ public: operator D3DCOLORVALUE& (); operator CONST D3DCOLORVALUE& () const; - // assignment operators + /* assignment operators */ D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); D3DXCOLOR& operator *= ( FLOAT ); D3DXCOLOR& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXCOLOR operator + () const; D3DXCOLOR operator - () const; - // binary operators + /* binary operators */ D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator * ( FLOAT ) const; @@ -442,29 +442,29 @@ public: BOOL operator == ( CONST D3DXCOLOR& ) const; BOOL operator != ( CONST D3DXCOLOR& ) const; -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT r, g, b, a; } D3DXCOLOR, *LPD3DXCOLOR; -//=========================================================================== -// -// D3DX math functions: -// -// NOTE: -// * All these functions can take the same object as in and out parameters. -// -// * Out parameters are typically also returned as return values, so that -// the output of one function may be used as a parameter to another. -// -//=========================================================================== +/* + * + * D3DX math functions: + * + * NOTE: + * * All these functions can take the same object as in and out parameters. + * + * * Out parameters are typically also returned as return values, so that + * the output of one function may be used as a parameter to another. + * + */ -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ -// inline +/* inline */ FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ); @@ -475,7 +475,7 @@ FLOAT D3DXVec2LengthSq FLOAT D3DXVec2Dot ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Z component of ((x1,y1,0) cross (x2,y2,0)) +/* Z component of ((x1,y1,0) cross (x2,y2,0)) */ FLOAT D3DXVec2CCW ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); @@ -485,23 +485,23 @@ D3DXVECTOR2* D3DXVec2Add D3DXVECTOR2* D3DXVec2Subtract ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2) +/* Minimize each component. x = min(x1, x2), y = min(y1, y2) */ D3DXVECTOR2* D3DXVec2Minimize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2) +/* Maximize each component. x = max(x1, x2), y = max(y1, y2) */ D3DXVECTOR2* D3DXVec2Maximize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); D3DXVECTOR2* D3DXVec2Scale ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR2* D3DXVec2Lerp ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -509,31 +509,31 @@ extern "C" { D3DXVECTOR2* WINAPI D3DXVec2Normalize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR2* WINAPI D3DXVec2Hermite ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR2* WINAPI D3DXVec2CatmullRom ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR2* WINAPI D3DXVec2BaryCentric ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, 0, 1) by matrix. +/* Transform (x, y, 0, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec2Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 1) by matrix, project result back into w=1. +/* Transform (x, y, 0, 1) by matrix, project result back into w=1. */ D3DXVECTOR2* WINAPI D3DXVec2TransformCoord ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 0) by matrix. +/* Transform (x, y, 0, 0) by matrix. */ D3DXVECTOR2* WINAPI D3DXVec2TransformNormal ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); @@ -541,12 +541,11 @@ D3DXVECTOR2* WINAPI D3DXVec2TransformNormal } #endif +/* + * 3D Vector + */ -//-------------------------- -// 3D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ); @@ -566,23 +565,23 @@ D3DXVECTOR3* D3DXVec3Add D3DXVECTOR3* D3DXVec3Subtract ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Minimize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Maximize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); D3DXVECTOR3* D3DXVec3Scale ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR3* D3DXVec3Lerp ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -590,42 +589,42 @@ extern "C" { D3DXVECTOR3* WINAPI D3DXVec3Normalize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR3* WINAPI D3DXVec3Hermite ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR3* WINAPI D3DXVec3CatmullRom ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR3* WINAPI D3DXVec3BaryCentric ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, z, 1) by matrix. +/* Transform (x, y, z, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec3Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 1) by matrix, project result back into w=1. +/* Transform (x, y, z, 1) by matrix, project result back into w=1. */ D3DXVECTOR3* WINAPI D3DXVec3TransformCoord ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 0) by matrix. If you transforming a normal by a -// non-affine matrix, the matrix you pass to this function should be the -// transpose of the inverse of the matrix you would use to transform a coord. +/* Transform (x, y, z, 0) by matrix. If you transforming a normal by a + * non-affine matrix, the matrix you pass to this function should be the + * transpose of the inverse of the matrix you would use to transform a coord. */ D3DXVECTOR3* WINAPI D3DXVec3TransformNormal ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Project vector from object space into screen space +/* Project vector from object space into screen space */ D3DXVECTOR3* WINAPI D3DXVec3Project ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT8 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); -// Project vector from screen space into object space +/* Project vector from screen space into object space */ D3DXVECTOR3* WINAPI D3DXVec3Unproject ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT8 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); @@ -634,13 +633,11 @@ D3DXVECTOR3* WINAPI D3DXVec3Unproject } #endif +/* + * 4D Vector + */ - -//-------------------------- -// 4D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ); @@ -657,28 +654,28 @@ D3DXVECTOR4* D3DXVec4Add D3DXVECTOR4* D3DXVec4Subtract ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Minimize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Maximize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); D3DXVECTOR4* D3DXVec4Scale ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR4* D3DXVec4Lerp ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Cross-product in 4 dimensions. +/* Cross-product in 4 dimensions. */ D3DXVECTOR4* WINAPI D3DXVec4Cross ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3); @@ -686,23 +683,23 @@ D3DXVECTOR4* WINAPI D3DXVec4Cross D3DXVECTOR4* WINAPI D3DXVec4Normalize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR4* WINAPI D3DXVec4Hermite ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR4* WINAPI D3DXVec4CatmullRom ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR4* WINAPI D3DXVec4BaryCentric ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); -// Transform vector by matrix. +/* Transform vector by matrix. */ D3DXVECTOR4* WINAPI D3DXVec4Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); @@ -711,11 +708,11 @@ D3DXVECTOR4* WINAPI D3DXVec4Transform #endif -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ -// inline +/* inline */ D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ); @@ -724,7 +721,7 @@ BOOL D3DXMatrixIsIdentity ( CONST D3DXMATRIX *pM ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -735,130 +732,130 @@ FLOAT WINAPI D3DXMatrixfDeterminant D3DXMATRIX* WINAPI D3DXMatrixTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); -// Matrix multiplication. The result represents the transformation M2 -// followed by the transformation M1. (Out = M1 * M2) +/* Matrix multiplication. The result represents the transformation M2 + * followed by the transformation M1. (Out = M1 * M2) */ D3DXMATRIX* WINAPI D3DXMatrixMultiply ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +/* Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) */ D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Calculate inverse of matrix. Inversion my fail, in which case NULL will -// be returned. The determinant of pM is also returned it pfDeterminant -// is non-NULL. +/* Calculate inverse of matrix. Inversion my fail, in which case NULL will + * be returned. The determinant of pM is also returned it pfDeterminant + * is non-NULL. */ D3DXMATRIX* WINAPI D3DXMatrixInverse ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); -// Build a matrix which scales by (sx, sy, sz) +/* Build a matrix which scales by (sx, sy, sz) */ D3DXMATRIX* WINAPI D3DXMatrixScaling ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); -// Build a matrix which translates by (x, y, z) +/* Build a matrix which translates by (x, y, z) */ D3DXMATRIX* WINAPI D3DXMatrixTranslation ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); -// Build a matrix which rotates around the X axis +/* Build a matrix which rotates around the X axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationX ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Y axis +/* Build a matrix which rotates around the Y axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationY ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Z axis +/* Build a matrix which rotates around the Z axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationZ ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around an arbitrary axis +/* Build a matrix which rotates around an arbitrary axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationAxis ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Build a matrix from a quaternion +/* Build a matrix from a quaternion */ D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Build transformation matrix. NULL arguments are treated as identity. -// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +/* Build transformation matrix. NULL arguments are treated as identity. + * Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixTransformation ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build affine transformation matrix. NULL arguments are treated as identity. -// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +/* Build affine transformation matrix. NULL arguments are treated as identity. + * Mout = Ms * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build a lookat matrix. (right-handed) +/* Build a lookat matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtRH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a lookat matrix. (left-handed) +/* Build a lookat matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtLH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a matrix which flattens geometry into a plane, as if casting -// a shadow from a light. +/* Build a matrix which flattens geometry into a plane, as if casting + * a shadow from a light. */ D3DXMATRIX* WINAPI D3DXMatrixShadow ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, CONST D3DXPLANE *pPlane ); -// Build a matrix which reflects the coordinate system about a plane +/* Build a matrix which reflects the coordinate system about a plane */ D3DXMATRIX* WINAPI D3DXMatrixReflect ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); @@ -867,58 +864,58 @@ D3DXMATRIX* WINAPI D3DXMatrixReflect #endif -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ -// inline +/* inline */ FLOAT D3DXQuaternionLength ( CONST D3DXQUATERNION *pQ ); -// Length squared, or "norm" +/* Length squared, or "norm" */ FLOAT D3DXQuaternionLengthSq ( CONST D3DXQUATERNION *pQ ); FLOAT D3DXQuaternionDot ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); -// (0, 0, 0, 1) +/* (0, 0, 0, 1) */ D3DXQUATERNION* D3DXQuaternionIdentity ( D3DXQUATERNION *pOut ); BOOL D3DXQuaternionIsIdentity ( CONST D3DXQUATERNION *pQ ); -// (-x, -y, -z, w) +/* (-x, -y, -z, w) */ D3DXQUATERNION* D3DXQuaternionConjugate ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +/* Compute a quaternin's axis and angle of rotation. Expects unit quaternions. */ void WINAPI D3DXQuaternionToAxisAngle ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); -// Build a quaternion from a rotation matrix. +/* Build a quaternion from a rotation matrix. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); -// Rotation about arbitrary axis. +/* Rotation about arbitrary axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Quaternion multiplication. The result represents the rotation Q2 -// followed by the rotation Q1. (Out = Q2 * Q1) +/* Quaternion multiplication. The result represents the rotation Q2 + * followed by the rotation Q1. (Out = Q2 * Q1) */ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); @@ -926,43 +923,43 @@ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply D3DXQUATERNION* WINAPI D3DXQuaternionNormalize ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Conjugate and re-norm +/* Conjugate and re-norm */ D3DXQUATERNION* WINAPI D3DXQuaternionInverse ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects unit quaternions. -// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +/* Expects unit quaternions. + * if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionLn ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects pure quaternions. (w == 0) w is ignored in calculation. -// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +/* Expects pure quaternions. (w == 0) w is ignored in calculation. + * if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionExp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). -// Expects unit quaternions. +/* Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). + * Expects unit quaternions. */ D3DXQUATERNION* WINAPI D3DXQuaternionSlerp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, FLOAT t ); -// Spherical quadrangle interpolation. -// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +/* Spherical quadrangle interpolation. + * Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) */ D3DXQUATERNION* WINAPI D3DXQuaternionSquad ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, CONST D3DXQUATERNION *pC, FLOAT t ); -// Setup control points for spherical quadrangle interpolation -// from Q1 to Q2. The control points are chosen in such a way -// to ensure the continuity of tangents with adjacent segments. +/* Setup control points for spherical quadrangle interpolation + * from Q1 to Q2. The control points are chosen in such a way + * to ensure the continuity of tangents with adjacent segments. */ void WINAPI D3DXQuaternionSquadSetup ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); -// Barycentric interpolation. -// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +/* Barycentric interpolation. + * Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) */ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, @@ -973,50 +970,50 @@ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric #endif -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ -// inline +/* inline */ -// ax + by + cz + dw +/* ax + by + cz + dw */ FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); -// ax + by + cz + d +/* ax + by + cz + d */ FLOAT D3DXPlaneDotCoord ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); -// ax + by + cz +/* ax + by + cz */ FLOAT D3DXPlaneDotNormal ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Normalize plane (so that |a,b,c| == 1) +/* Normalize plane (so that |a,b,c| == 1) */ D3DXPLANE* WINAPI D3DXPlaneNormalize ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); -// Find the intersection between a plane and a line. If the line is -// parallel to the plane, NULL is returned. +/* Find the intersection between a plane and a line. If the line is + * parallel to the plane, NULL is returned. */ D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2); -// Construct a plane from a point and a normal +/* Construct a plane from a point and a normal */ D3DXPLANE* WINAPI D3DXPlaneFromPointNormal ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); -// Construct a plane from 3 points +/* Construct a plane from 3 points */ D3DXPLANE* WINAPI D3DXPlaneFromPoints ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3); -// Transform a plane by a matrix. The vector (a,b,c) must be normal. -// M should be the inverse transpose of the transformation desired. +/* Transform a plane by a matrix. The vector (a,b,c) must be normal. + * M should be the inverse transpose of the transformation desired. */ D3DXPLANE* WINAPI D3DXPlaneTransform ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); @@ -1025,13 +1022,13 @@ D3DXPLANE* WINAPI D3DXPlaneTransform #endif -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ -// inline +/* inline */ -// (1-r, 1-g, 1-b, a) +/* (1-r, 1-g, 1-b, a) */ D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); @@ -1044,25 +1041,25 @@ D3DXCOLOR* D3DXColorSubtract D3DXCOLOR* D3DXColorScale (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// (r1*r2, g1*g2, b1*b2, a1*a2) +/* (r1*r2, g1*g2, b1*b2, a1*a2) */ D3DXCOLOR* D3DXColorModulate (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); -// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +/* Linear interpolation of r,g,b, and a. C1 + s(C2-C1) */ D3DXCOLOR* D3DXColorLerp (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Interpolate r,g,b between desaturated color and color. -// DesaturatedColor + s(Color - DesaturatedColor) +/* Interpolate r,g,b between desaturated color and color. + * DesaturatedColor + s(Color - DesaturatedColor) */ D3DXCOLOR* WINAPI D3DXColorAdjustSaturation (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +/* Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) */ D3DXCOLOR* WINAPI D3DXColorAdjustContrast (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); @@ -1070,19 +1067,16 @@ D3DXCOLOR* WINAPI D3DXColorAdjustContrast } #endif - - - -//-------------------------- -// Misc -//-------------------------- +/* + * Misc + */ #ifdef __cplusplus extern "C" { #endif -// Calculate Fresnel term given the cosine of theta (likely obtained by -// taking the dot of two normals), and the refraction index of the material. +/* Calculate Fresnel term given the cosine of theta (likely obtained by + * taking the dot of two normals), and the refraction index of the material. */ FLOAT WINAPI D3DXFresnelTerm (FLOAT CosTheta, FLOAT RefractionIndex); @@ -1090,18 +1084,16 @@ FLOAT WINAPI D3DXFresnelTerm } #endif - - -//=========================================================================== -// -// Matrix Stack -// -//=========================================================================== +/* + * + * Matrix Stack + * + */ typedef interface ID3DXMatrixStack ID3DXMatrixStack; typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; -// {E3357330-CC5E-11d2-A434-00A0C90629A8} +/* {E3357330-CC5E-11d2-A434-00A0C90629A8} */ DEFINE_GUID( IID_ID3DXMatrixStack, 0xe3357330, 0xcc5e, 0x11d2, 0xa4, 0x34, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); @@ -1111,82 +1103,78 @@ DEFINE_GUID( IID_ID3DXMatrixStack, DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) { - // - // IUnknown methods - // + /* IUnknown methods */ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - // - // ID3DXMatrixStack methods - // + /* ID3DXMatrixStack methods */ - // Pops the top of the stack, returns the current top - // *after* popping the top. + /* Pops the top of the stack, returns the current top + * *after* popping the top. */ STDMETHOD(Pop)(THIS) PURE; - // Pushes the stack by one, duplicating the current matrix. + /* Pushes the stack by one, duplicating the current matrix. */ STDMETHOD(Push)(THIS) PURE; - // Loads identity in the current matrix. + /* Loads identity in the current matrix. */ STDMETHOD(LoadIdentity)(THIS) PURE; - // Loads the given matrix into the current matrix + /* Loads the given matrix into the current matrix */ STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right-Multiplies the given matrix to the current matrix. - // (transformation is about the current world origin) + /* Right-Multiplies the given matrix to the current matrix. + * (transformation is about the current world origin) */ STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Left-Multiplies the given matrix to the current matrix - // (transformation is about the local origin of the object) + /* Left-Multiplies the given matrix to the current matrix + * (transformation is about the local origin of the object) */ STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the current world origin) */ STDMETHOD(RotateAxis) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Left multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the local origin of the object) */ STDMETHOD(RotateAxisLocal) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Right multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * current world origin) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. */ STDMETHOD(RotateYawPitchRoll) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Left multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * local origin of the object) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. */ STDMETHOD(RotateYawPitchRollLocal) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Right multiply the current matrix with the computed scale - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed scale + * matrix. (transformation is about the current world origin) */ STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Left multiply the current matrix with the computed scale - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed scale + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Right multiply the current matrix with the computed translation - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed translation + * matrix. (transformation is about the current world origin) */ STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; - // Left multiply the current matrix with the computed translation - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed translation + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; /* Obtain the current matrix at the top of the stack */ diff --git a/gfx/include/d3d8/d3dx8math.inl b/gfx/include/d3d8/d3dx8math.inl index 00f2eabdd9..ca94a797ba 100644 --- a/gfx/include/d3d8/d3dx8math.inl +++ b/gfx/include/d3d8/d3dx8math.inl @@ -1,27 +1,26 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 1998 Microsoft Corporation. All Rights Reserved. -// -// File: d3dx8math.inl -// Content: D3DX math inline functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) 1998 Microsoft Corporation. All Rights Reserved. + * + * File: d3dx8math.inl + * Content: D3DX math inline functions + * + */ #ifndef __D3DX8MATH_INL__ #define __D3DX8MATH_INL__ - -//=========================================================================== -// -// Inline Class Methods -// -//=========================================================================== +/* + * + * Inline Class Methods + * + */ #ifdef __cplusplus -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) @@ -42,7 +41,7 @@ D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) y = fy; } -// casting +/* casting */ D3DXINLINE D3DXVECTOR2::operator FLOAT* () { @@ -55,7 +54,7 @@ D3DXVECTOR2::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR2& D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) { @@ -89,7 +88,7 @@ D3DXVECTOR2::operator /= ( FLOAT f ) return *this; } -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + () const { @@ -102,7 +101,7 @@ D3DXVECTOR2::operator - () const return D3DXVECTOR2(-x, -y); } -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const { @@ -150,9 +149,9 @@ D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) { @@ -183,7 +182,7 @@ D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) } -// casting +/* casting */ D3DXINLINE D3DXVECTOR3::operator FLOAT* () { @@ -197,7 +196,7 @@ D3DXVECTOR3::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR3& D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) { @@ -235,8 +234,7 @@ D3DXVECTOR3::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + () const { @@ -249,8 +247,7 @@ D3DXVECTOR3::operator - () const return D3DXVECTOR3(-x, -y, -z); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const { @@ -296,11 +293,9 @@ D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const return x != v.x || y != v.y || z != v.z; } - - -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) { @@ -324,8 +319,7 @@ D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR4::operator FLOAT* () { @@ -339,7 +333,7 @@ D3DXVECTOR4::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR4& D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) { @@ -381,8 +375,7 @@ D3DXVECTOR4::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + () const { @@ -396,7 +389,7 @@ D3DXVECTOR4::operator - () const } -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const { @@ -443,9 +436,9 @@ D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const } -//-------------------------- -// Matrix -//-------------------------- +/* + * Matrix + */ D3DXINLINE D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) { @@ -475,9 +468,7 @@ D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, _41 = f41; _42 = f42; _43 = f43; _44 = f44; } - - -// access grants +/* access grants */ D3DXINLINE FLOAT& D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) { @@ -491,7 +482,7 @@ D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const } -// casting operators +/* casting operators */ D3DXINLINE D3DXMATRIX::operator FLOAT* () { @@ -505,7 +496,7 @@ D3DXMATRIX::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXMATRIX& D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) { @@ -554,8 +545,7 @@ D3DXMATRIX::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator + () const { @@ -571,8 +561,7 @@ D3DXMATRIX::operator - () const -_41, -_42, -_43, -_44); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const { @@ -643,9 +632,9 @@ D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) @@ -671,7 +660,7 @@ D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) } -// casting +/* casting */ D3DXINLINE D3DXQUATERNION::operator FLOAT* () { @@ -685,7 +674,7 @@ D3DXQUATERNION::operator CONST FLOAT* () const } -// assignment operators +/* assignment operators */ D3DXINLINE D3DXQUATERNION& D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) { @@ -735,7 +724,7 @@ D3DXQUATERNION::operator /= ( FLOAT f ) } -// unary operators +/* unary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + () const { @@ -749,7 +738,7 @@ D3DXQUATERNION::operator - () const } -// binary operators +/* binary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const { @@ -805,9 +794,9 @@ D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) @@ -832,8 +821,7 @@ D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) d = fd; } - -// casting +/* casting */ D3DXINLINE D3DXPLANE::operator FLOAT* () { @@ -847,7 +835,7 @@ D3DXPLANE::operator CONST FLOAT* () const } -// unary operators +/* unary operators */ D3DXINLINE D3DXPLANE D3DXPLANE::operator + () const { @@ -860,8 +848,7 @@ D3DXPLANE::operator - () const return D3DXPLANE(-a, -b, -c, -d); } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const { @@ -874,12 +861,9 @@ D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const return a != p.a || b != p.b || c != p.c || d != p.d; } - - - -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR::D3DXCOLOR( DWORD dw ) @@ -923,8 +907,7 @@ D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) a = fa; } - -// casting +/* casting */ D3DXINLINE D3DXCOLOR::operator DWORD () const { @@ -975,8 +958,7 @@ D3DXCOLOR::operator CONST D3DCOLORVALUE& () const return *((CONST D3DCOLORVALUE *) &r); } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXCOLOR& D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) { @@ -1018,8 +1000,7 @@ D3DXCOLOR::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + () const { @@ -1033,7 +1014,7 @@ D3DXCOLOR::operator - () const } -// binary operators +/* binary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const { @@ -1080,20 +1061,18 @@ D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const } -#endif //__cplusplus +#endif /* __cplusplus */ + +/* + * + * Inline functions + * + */ - -//=========================================================================== -// -// Inline functions -// -//=========================================================================== - - -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ) @@ -1223,9 +1202,9 @@ D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp } -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ) @@ -1368,9 +1347,9 @@ D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp } -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ) @@ -1501,9 +1480,9 @@ D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp } -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ) @@ -1538,9 +1517,9 @@ D3DXINLINE BOOL D3DXMatrixIsIdentity } -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE FLOAT D3DXQuaternionLength ( CONST D3DXQUATERNION *pQ ) @@ -1621,9 +1600,9 @@ D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate } -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) @@ -1659,9 +1638,9 @@ D3DXINLINE FLOAT D3DXPlaneDotNormal } -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) @@ -1754,4 +1733,4 @@ D3DXINLINE D3DXCOLOR* D3DXColorLerp } -#endif // __D3DX8MATH_INL__ +#endif /* __D3DX8MATH_INL__ */ diff --git a/gfx/include/d3d8/d3dx8tex.h b/gfx/include/d3d8/d3dx8tex.h index d437e4b052..0a2526996f 100644 --- a/gfx/include/d3d8/d3dx8tex.h +++ b/gfx/include/d3d8/d3dx8tex.h @@ -11,49 +11,48 @@ #ifndef __D3DX8TEX_H__ #define __D3DX8TEX_H__ - -//---------------------------------------------------------------------------- -// D3DX_FILTER flags: -// ------------------ -// -// A valid filter must contain one of these values: -// -// D3DX_FILTER_NONE -// No scaling or filtering will take place. Pixels outside the bounds -// of the source image are assumed to be transparent black. -// D3DX_FILTER_POINT -// Each destination pixel is computed by sampling the nearest pixel -// from the source image. -// D3DX_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. -// D3DX_FILTER_TRIANGLE -// Every pixel in the source image contributes equally to the -// destination image. This is the slowest of all the filters. -// D3DX_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: -// -// D3DX_FILTER_MIRROR_U -// Indicates that pixels off the edge of the texture on the U-axis -// should be mirrored, not wraped. -// D3DX_FILTER_MIRROR_V -// Indicates that pixels off the edge of the texture on the V-axis -// should be mirrored, not wraped. -// D3DX_FILTER_MIRROR_W -// Indicates that pixels off the edge of the texture on the W-axis -// should be mirrored, not wraped. -// D3DX_FILTER_MIRROR -// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | -// D3DX_FILTER_MIRROR_V -// D3DX_FILTER_DITHER -// Dithers the resulting image. -// -//---------------------------------------------------------------------------- +/* + * D3DX_FILTER flags: + * ------------------ + * + * A valid filter must contain one of these values: + * + * D3DX_FILTER_NONE + * No scaling or filtering will take place. Pixels outside the bounds + * of the source image are assumed to be transparent black. + * D3DX_FILTER_POINT + * Each destination pixel is computed by sampling the nearest pixel + * from the source image. + * D3DX_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. + * D3DX_FILTER_TRIANGLE + * Every pixel in the source image contributes equally to the + * destination image. This is the slowest of all the filters. + * D3DX_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: + * + * D3DX_FILTER_MIRROR_U + * Indicates that pixels off the edge of the texture on the U-axis + * should be mirrored, not wraped. + * D3DX_FILTER_MIRROR_V + * Indicates that pixels off the edge of the texture on the V-axis + * should be mirrored, not wraped. + * D3DX_FILTER_MIRROR_W + * Indicates that pixels off the edge of the texture on the W-axis + * should be mirrored, not wraped. + * D3DX_FILTER_MIRROR + * Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | + * D3DX_FILTER_MIRROR_V + * D3DX_FILTER_DITHER + * Dithers the resulting image. + * + */ #define D3DX_FILTER_NONE (1 << 0) #define D3DX_FILTER_POINT (2 << 0) @@ -67,31 +66,28 @@ #define D3DX_FILTER_MIRROR (7 << 16) #define D3DX_FILTER_DITHER (8 << 16) - -//---------------------------------------------------------------------------- -// D3DX_NORMALMAP flags: -// --------------------- -// These flags are used to control how D3DXComputeNormalMap generates normal -// maps. Any number of these flags may be OR'd together in any combination. -// -// D3DX_NORMALMAP_MIRROR_U -// Indicates that pixels off the edge of the texture on the U-axis -// should be mirrored, not wraped. -// D3DX_NORMALMAP_MIRROR_V -// Indicates that pixels off the edge of the texture on the V-axis -// should be mirrored, not wraped. -// D3DX_NORMALMAP_MIRROR -// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V -// D3DX_NORMALMAP_INVERTSIGN -// Inverts the direction of each normal -// D3DX_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. -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- +/* + * D3DX_NORMALMAP flags: + * --------------------- + * These flags are used to control how D3DXComputeNormalMap generates normal + * maps. Any number of these flags may be OR'd together in any combination. + * + * D3DX_NORMALMAP_MIRROR_U + * Indicates that pixels off the edge of the texture on the U-axis + * should be mirrored, not wraped. + * D3DX_NORMALMAP_MIRROR_V + * Indicates that pixels off the edge of the texture on the V-axis + * should be mirrored, not wraped. + * D3DX_NORMALMAP_MIRROR + * Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V + * D3DX_NORMALMAP_INVERTSIGN + * Inverts the direction of each normal + * D3DX_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. + * + */ #define D3DX_NORMALMAP_MIRROR_U (1 << 16) #define D3DX_NORMALMAP_MIRROR_V (2 << 16) @@ -99,28 +95,25 @@ #define D3DX_NORMALMAP_INVERTSIGN (8 << 16) #define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16) - - - -//---------------------------------------------------------------------------- -// D3DX_CHANNEL flags: -// ------------------- -// These flags are used by functions which operate on or more channels -// in a texture. -// -// D3DX_CHANNEL_RED -// Indicates the red channel should be used -// D3DX_CHANNEL_BLUE -// Indicates the blue channel should be used -// D3DX_CHANNEL_GREEN -// Indicates the green channel should be used -// D3DX_CHANNEL_ALPHA -// Indicates the alpha channel should be used -// D3DX_CHANNEL_LUMINANCE -// Indicates the luminaces of the red green and blue channels should be -// used. -// -//---------------------------------------------------------------------------- +/* + * D3DX_CHANNEL flags: + * ------------------- + * These flags are used by functions which operate on or more channels + * in a texture. + * + * D3DX_CHANNEL_RED + * Indicates the red channel should be used + * D3DX_CHANNEL_BLUE + * Indicates the blue channel should be used + * D3DX_CHANNEL_GREEN + * Indicates the green channel should be used + * D3DX_CHANNEL_ALPHA + * Indicates the alpha channel should be used + * D3DX_CHANNEL_LUMINANCE + * Indicates the luminaces of the red green and blue channels should be + * used. + * + */ #define D3DX_CHANNEL_RED (1 << 0) #define D3DX_CHANNEL_BLUE (1 << 1) @@ -131,12 +124,12 @@ -//---------------------------------------------------------------------------- -// D3DXIMAGE_FILEFORMAT: -// --------------------- -// This enum is used to describe supported image file formats. -// -//---------------------------------------------------------------------------- +/* + * D3DXIMAGE_FILEFORMAT: + * --------------------- + * This enum is used to describe supported image file formats. + * + */ typedef enum _D3DXIMAGE_FILEFORMAT { @@ -152,54 +145,52 @@ typedef enum _D3DXIMAGE_FILEFORMAT } D3DXIMAGE_FILEFORMAT; -//---------------------------------------------------------------------------- -// LPD3DXFILL2D and LPD3DXFILL3D: -// ------------------------------ -// Function types used by the texture fill functions. -// -// Parameters: -// pOut -// Pointer to a vector which the function uses to return its result. -// X,Y,Z,W will be mapped to R,G,B,A respectivly. -// pTexCoord -// Pointer to a vector containing the coordinates of the texel currently -// being evaluated. Textures and VolumeTexture texcoord components -// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. -// pTexelSize -// Pointer to a vector containing the dimensions of the current texel. -// pData -// Pointer to user data. -// -//---------------------------------------------------------------------------- +/* + * LPD3DXFILL2D and LPD3DXFILL3D: + * ------------------------------ + * Function types used by the texture fill functions. + * + * Parameters: + * pOut + * Pointer to a vector which the function uses to return its result. + * X,Y,Z,W will be mapped to R,G,B,A respectivly. + * pTexCoord + * Pointer to a vector containing the coordinates of the texel currently + * being evaluated. Textures and VolumeTexture texcoord components + * range from 0 to 1. CubeTexture texcoord component range from -1 to 1. + * pTexelSize + * Pointer to a vector containing the dimensions of the current texel. + * pData + * Pointer to user data. + * + */ typedef VOID (*LPD3DXFILL2D)(D3DXVECTOR4 *pOut, D3DXVECTOR2 *pTexCoord, D3DXVECTOR2 *pTexelSize, LPVOID pData); typedef VOID (*LPD3DXFILL3D)(D3DXVECTOR4 *pOut, D3DXVECTOR3 *pTexCoord, D3DXVECTOR3 *pTexelSize, LPVOID pData); - - -//---------------------------------------------------------------------------- -// D3DXIMAGE_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 -// MipLevels -// Number of mip levels in original image -// Format -// D3D format which most closely describes the data in original image -// ResourceType -// D3DRESOURCETYPE representing the type of texture stored in the file. -// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. -// ImageFileFormat -// D3DXIMAGE_FILEFORMAT representing the format of the image file. -// -//---------------------------------------------------------------------------- +/* + * D3DXIMAGE_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 + * MipLevels + * Number of mip levels in original image + * Format + * D3D format which most closely describes the data in original image + * ResourceType + * D3DRESOURCETYPE representing the type of texture stored in the file. + * D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. + * ImageFileFormat + * D3DXIMAGE_FILEFORMAT representing the format of the image file. + * + */ typedef struct _D3DXIMAGE_INFO { @@ -213,42 +204,36 @@ typedef struct _D3DXIMAGE_INFO } D3DXIMAGE_INFO; - - - - #ifdef __cplusplus extern "C" { -#endif //__cplusplus - - +#endif /* __cplusplus */ /* * Image File APIs */ -//---------------------------------------------------------------------------- -// GetImageInfoFromFile/Resource: -// ------------------------------ -// Fills in a D3DXIMAGE_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. -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file. -// -//---------------------------------------------------------------------------- +/* + * GetImageInfoFromFile/Resource: + * ------------------------------ + * Fills in a D3DXIMAGE_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. + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file. + * + */ HRESULT WINAPI D3DXGetImageInfoFromFileA( @@ -292,51 +277,48 @@ HRESULT WINAPI UINT SrcDataSize, D3DXIMAGE_INFO* pSrcInfo); +/* + * Load/Save Surface APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Load/Save Surface APIs //////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXLoadSurfaceFromFile/Resource: -// --------------------------------- -// Load surface from a file or resource -// -// Parameters: -// pDestSurface -// Destination surface, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestRect -// Destination rectangle, or NULL for entire surface -// 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. -// pSrcRect -// Source rectangle, or NULL for entire image -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file, or NULL. -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadSurfaceFromFile/Resource: + * --------------------------------- + * Load surface from a file or resource + * + * Parameters: + * pDestSurface + * Destination surface, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestRect + * Destination rectangle, or NULL for entire surface + * 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. + * pSrcRect + * Source rectangle, or NULL for entire image + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file, or NULL. + * + */ HRESULT WINAPI D3DXLoadSurfaceFromFileA( @@ -413,36 +395,34 @@ HRESULT WINAPI D3DCOLOR ColorKey, D3DXIMAGE_INFO* pSrcInfo); - - -//---------------------------------------------------------------------------- -// D3DXLoadSurfaceFromSurface: -// --------------------------- -// Load surface from another surface (with color conversion) -// -// Parameters: -// pDestSurface -// Destination surface, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestRect -// Destination rectangle, or NULL for entire surface -// pSrcSurface -// Source surface -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcRect -// Source rectangle, or NULL for entire surface -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadSurfaceFromSurface: + * --------------------------- + * Load surface from another surface (with color conversion) + * + * Parameters: + * pDestSurface + * Destination surface, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestRect + * Destination rectangle, or NULL for entire surface + * pSrcSurface + * Source surface + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcRect + * Source rectangle, or NULL for entire surface + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadSurfaceFromSurface( @@ -455,40 +435,39 @@ HRESULT WINAPI DWORD Filter, D3DCOLOR ColorKey); - -//---------------------------------------------------------------------------- -// D3DXLoadSurfaceFromMemory: -// -------------------------- -// Load surface from memory. -// -// Parameters: -// pDestSurface -// Destination surface, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestRect -// Destination rectangle, or NULL for entire surface -// pSrcMemory -// Pointer to the top-left corner of the source image in memory -// SrcFormat -// Pixel format of the source image. -// SrcPitch -// Pitch of source image, in bytes. For DXT formats, this number -// should represent the width of one row of cells, in bytes. -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcRect -// Source rectangle. -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadSurfaceFromMemory: + * -------------------------- + * Load surface from memory. + * + * Parameters: + * pDestSurface + * Destination surface, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestRect + * Destination rectangle, or NULL for entire surface + * pSrcMemory + * Pointer to the top-left corner of the source image in memory + * SrcFormat + * Pixel format of the source image. + * SrcPitch + * Pitch of source image, in bytes. For DXT formats, this number + * should represent the width of one row of cells, in bytes. + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcRect + * Source rectangle. + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadSurfaceFromMemory( @@ -504,24 +483,24 @@ HRESULT WINAPI D3DCOLOR ColorKey); -//---------------------------------------------------------------------------- -// D3DXSaveSurfaceToFile: -// ---------------------- -// Save a surface to a image file. -// -// Parameters: -// pDestFile -// File name of the destination file -// DestFormat -// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. -// pSrcSurface -// Source surface, containing the image to be saved -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcRect -// Source rectangle, or NULL for the entire image -// -//---------------------------------------------------------------------------- +/* + * D3DXSaveSurfaceToFile: + * ---------------------- + * Save a surface to a image file. + * + * Parameters: + * pDestFile + * File name of the destination file + * DestFormat + * D3DXIMAGE_FILEFORMAT specifying file format to use when saving. + * pSrcSurface + * Source surface, containing the image to be saved + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcRect + * Source rectangle, or NULL for the entire image + * + */ HRESULT WINAPI D3DXSaveSurfaceToFileA( @@ -545,51 +524,48 @@ HRESULT WINAPI #define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA #endif +/* + * Load/Save Volume APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Load/Save Volume APIs ///////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXLoadVolumeFromFile/Resource: -// -------------------------------- -// Load volume from a file or resource -// -// Parameters: -// pDestVolume -// Destination volume, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestBox -// Destination box, or NULL for entire volume -// 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. -// pSrcBox -// Source box, or NULL for entire image -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file, or NULL. -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadVolumeFromFile/Resource: + * -------------------------------- + * Load volume from a file or resource + * + * Parameters: + * pDestVolume + * Destination volume, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestBox + * Destination box, or NULL for entire volume + * 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. + * pSrcBox + * Source box, or NULL for entire image + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file, or NULL. + * + */ HRESULT WINAPI D3DXLoadVolumeFromFileA( @@ -664,36 +640,34 @@ HRESULT WINAPI D3DCOLOR ColorKey, D3DXIMAGE_INFO* pSrcInfo); - - -//---------------------------------------------------------------------------- -// D3DXLoadVolumeFromVolume: -// ------------------------- -// Load volume from another volume (with color conversion) -// -// Parameters: -// pDestVolume -// Destination volume, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestBox -// Destination box, or NULL for entire volume -// pSrcVolume -// Source volume -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcBox -// Source box, or NULL for entire volume -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadVolumeFromVolume: + * ------------------------- + * Load volume from another volume (with color conversion) + * + * Parameters: + * pDestVolume + * Destination volume, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestBox + * Destination box, or NULL for entire volume + * pSrcVolume + * Source volume + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcBox + * Source box, or NULL for entire volume + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadVolumeFromVolume( @@ -706,44 +680,42 @@ HRESULT WINAPI DWORD Filter, D3DCOLOR ColorKey); - - -//---------------------------------------------------------------------------- -// D3DXLoadVolumeFromMemory: -// ------------------------- -// Load volume from memory. -// -// Parameters: -// pDestVolume -// Destination volume, which will receive the image. -// pDestPalette -// Destination palette of 256 colors, or NULL -// pDestBox -// Destination box, or NULL for entire volume -// pSrcMemory -// Pointer to the top-left corner of the source volume in memory -// SrcFormat -// Pixel format of the source volume. -// SrcRowPitch -// Pitch of source image, in bytes. For DXT formats, this number -// should represent the size of one row of cells, in bytes. -// SrcSlicePitch -// Pitch of source image, in bytes. For DXT formats, this number -// should represent the size of one slice of cells, in bytes. -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcBox -// Source box. -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// -//---------------------------------------------------------------------------- +/* + * D3DXLoadVolumeFromMemory: + * ------------------------- + * Load volume from memory. + * + * Parameters: + * pDestVolume + * Destination volume, which will receive the image. + * pDestPalette + * Destination palette of 256 colors, or NULL + * pDestBox + * Destination box, or NULL for entire volume + * pSrcMemory + * Pointer to the top-left corner of the source volume in memory + * SrcFormat + * Pixel format of the source volume. + * SrcRowPitch + * Pitch of source image, in bytes. For DXT formats, this number + * should represent the size of one row of cells, in bytes. + * SrcSlicePitch + * Pitch of source image, in bytes. For DXT formats, this number + * should represent the size of one slice of cells, in bytes. + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcBox + * Source box. + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * + */ HRESULT WINAPI D3DXLoadVolumeFromMemory( @@ -759,26 +731,24 @@ HRESULT WINAPI DWORD Filter, D3DCOLOR ColorKey); - - -//---------------------------------------------------------------------------- -// D3DXSaveVolumeToFile: -// --------------------- -// Save a volume to a image file. -// -// Parameters: -// pDestFile -// File name of the destination file -// DestFormat -// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. -// pSrcVolume -// Source volume, containing the image to be saved -// pSrcPalette -// Source palette of 256 colors, or NULL -// pSrcBox -// Source box, or NULL for the entire volume -// -//---------------------------------------------------------------------------- +/* + * D3DXSaveVolumeToFile: + * --------------------- + * Save a volume to a image file. + * + * Parameters: + * pDestFile + * File name of the destination file + * DestFormat + * D3DXIMAGE_FILEFORMAT specifying file format to use when saving. + * pSrcVolume + * Source volume, containing the image to be saved + * pSrcPalette + * Source palette of 256 colors, or NULL + * pSrcBox + * Source box, or NULL for the entire volume + * + */ HRESULT WINAPI D3DXSaveVolumeToFileA( @@ -802,35 +772,32 @@ HRESULT WINAPI #define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA #endif +/* + * Create/Save Texture APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Create/Save Texture APIs ////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXCheckTextureRequirements: -// ----------------------------- -// Checks texture creation parameters. If parameters are invalid, this -// function returns corrected parameters. -// -// Parameters: -// -// pDevice -// The D3D device to be used -// pWidth, pHeight, pDepth, pSize -// Desired size in pixels, or NULL. Returns corrected size. -// pNumMipLevels -// Number of desired mipmap levels, or NULL. Returns corrected number. -// Usage -// Texture usage flags -// pFormat -// Desired pixel format, or NULL. Returns corrected format. -// Pool -// Memory pool to be used to create texture -// -//---------------------------------------------------------------------------- +/* + * D3DXCheckTextureRequirements: + * ----------------------------- + * Checks texture creation parameters. If parameters are invalid, this + * function returns corrected parameters. + * + * Parameters: + * + * pDevice + * The D3D device to be used + * pWidth, pHeight, pDepth, pSize + * Desired size in pixels, or NULL. Returns corrected size. + * pNumMipLevels + * Number of desired mipmap levels, or NULL. Returns corrected number. + * Usage + * Texture usage flags + * pFormat + * Desired pixel format, or NULL. Returns corrected format. + * Pool + * Memory pool to be used to create texture + * + */ HRESULT WINAPI D3DXCheckTextureRequirements( @@ -863,30 +830,30 @@ HRESULT WINAPI D3DPOOL Pool); -//---------------------------------------------------------------------------- -// D3DXCreateTexture: -// ------------------ -// Create an empty texture -// -// Parameters: -// -// pDevice -// The D3D device with which the texture is going to be used. -// Width, Height, Depth, Size -// size in pixels; these must be non-zero -// MipLevels -// number of mip levels desired; if zero or D3DX_DEFAULT, a complete -// mipmap chain will be created. -// Usage -// Texture usage flags -// Format -// Pixel format. -// Pool -// Memory pool to be used to create texture -// ppTexture, ppCubeTexture, ppVolumeTexture -// The texture object that will be created -// -//---------------------------------------------------------------------------- +/* + * D3DXCreateTexture: + * ------------------ + * Create an empty texture + * + * Parameters: + * + * pDevice + * The D3D device with which the texture is going to be used. + * Width, Height, Depth, Size + * size in pixels; these must be non-zero + * MipLevels + * number of mip levels desired; if zero or D3DX_DEFAULT, a complete + * mipmap chain will be created. + * Usage + * Texture usage flags + * Format + * Pixel format. + * Pool + * Memory pool to be used to create texture + * ppTexture, ppCubeTexture, ppVolumeTexture + * The texture object that will be created + * + */ HRESULT WINAPI D3DXCreateTexture( @@ -921,63 +888,60 @@ HRESULT WINAPI D3DPOOL Pool, LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); +/* + * D3DXCreateTextureFromFile/Resource: + * ----------------------------------- + * 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. + * Width, Height, Depth, Size + * Size in pixels; if zero or D3DX_DEFAULT, the size will be taken + * from the file. + * MipLevels + * Number of mip levels; if zero or D3DX_DEFAULT, a complete mipmap + * chain will be created. + * Usage + * Texture usage flags + * Format + * Desired pixel format. If D3DFMT_UNKNOWN, the format will be + * taken from the file. + * Pool + * Memory pool to be used to create texture + * Filter + * D3DX_FILTER flags controlling how the image is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. + * MipFilter + * D3DX_FILTER flags controlling how each miplevel is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_BOX, + * ColorKey + * Color to replace with transparent black, or 0 to disable colorkey. + * This is always a 32-bit ARGB color, independent of the source image + * format. Alpha is significant, and should usually be set to FF for + * opaque colorkeys. (ex. Opaque black == 0xff000000) + * pSrcInfo + * Pointer to a D3DXIMAGE_INFO structure to be filled in with the + * description of the data in the source image file, or NULL. + * pPalette + * 256 color palette to be filled in, or NULL + * ppTexture, ppCubeTexture, ppVolumeTexture + * The texture object that will be created + * + */ - -//---------------------------------------------------------------------------- -// D3DXCreateTextureFromFile/Resource: -// ----------------------------------- -// 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. -// Width, Height, Depth, Size -// Size in pixels; if zero or D3DX_DEFAULT, the size will be taken -// from the file. -// MipLevels -// Number of mip levels; if zero or D3DX_DEFAULT, a complete mipmap -// chain will be created. -// Usage -// Texture usage flags -// Format -// Desired pixel format. If D3DFMT_UNKNOWN, the format will be -// taken from the file. -// Pool -// Memory pool to be used to create texture -// Filter -// D3DX_FILTER flags controlling how the image is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. -// MipFilter -// D3DX_FILTER flags controlling how each miplevel is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_BOX, -// ColorKey -// Color to replace with transparent black, or 0 to disable colorkey. -// This is always a 32-bit ARGB color, independent of the source image -// format. Alpha is significant, and should usually be set to FF for -// opaque colorkeys. (ex. Opaque black == 0xff000000) -// pSrcInfo -// Pointer to a D3DXIMAGE_INFO structure to be filled in with the -// description of the data in the source image file, or NULL. -// pPalette -// 256 color palette to be filled in, or NULL -// ppTexture, ppCubeTexture, ppVolumeTexture -// The texture object that will be created -// -//---------------------------------------------------------------------------- - - -// FromFile +/* FromFile */ HRESULT WINAPI D3DXCreateTextureFromFileA( @@ -1035,8 +999,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA #endif - -// FromResource +/* FromResource */ HRESULT WINAPI D3DXCreateTextureFromResourceA( @@ -1100,8 +1063,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA #endif - -// FromFileEx +/* FromFileEx */ HRESULT WINAPI D3DXCreateTextureFromFileExA( @@ -1225,8 +1187,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA #endif - -// FromResourceEx +/* FromResourceEx */ HRESULT WINAPI D3DXCreateTextureFromResourceExA( @@ -1356,8 +1317,7 @@ HRESULT WINAPI #define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA #endif - -// FromFileInMemory +/* FromFileInMemory */ HRESULT WINAPI D3DXCreateTextureFromFileInMemory( @@ -1381,7 +1341,7 @@ HRESULT WINAPI LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); -// FromFileInMemoryEx +/* FromFileInMemoryEx */ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx( @@ -1437,25 +1397,22 @@ HRESULT WINAPI PALETTEENTRY* pPalette, LPDIRECT3DVOLUMETEXTURE8* ppVolumeTexture); - - -//---------------------------------------------------------------------------- -// D3DXSaveTextureToFile: -// ---------------------- -// Save a texture to a file. -// -// Parameters: -// pDestFile -// File name of the destination file -// DestFormat -// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. -// pSrcTexture -// Source texture, containing the image to be saved -// pSrcPalette -// Source palette of 256 colors, or NULL -// -//---------------------------------------------------------------------------- - +/* + * D3DXSaveTextureToFile: + * ---------------------- + * Save a texture to a file. + * + * Parameters: + * pDestFile + * File name of the destination file + * DestFormat + * D3DXIMAGE_FILEFORMAT specifying file format to use when saving. + * pSrcTexture + * Source texture, containing the image to be saved + * pSrcPalette + * Source palette of 256 colors, or NULL + * + */ HRESULT WINAPI D3DXSaveTextureToFileA( @@ -1477,30 +1434,27 @@ HRESULT WINAPI #define D3DXSaveTextureToFile D3DXSaveTextureToFileA #endif +/* + * Misc Texture APIs + */ - - -////////////////////////////////////////////////////////////////////////////// -// Misc Texture APIs ///////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3DXFilterTexture: -// ------------------ -// Filters mipmaps levels of a texture. -// -// Parameters: -// pBaseTexture -// The texture object to be filtered -// pPalette -// 256 color palette to be used, or NULL for non-palettized formats -// SrcLevel -// The level whose image is used to generate the subsequent levels. -// Filter -// D3DX_FILTER flags controlling how each miplevel is filtered. -// Or D3DX_DEFAULT for D3DX_FILTER_BOX, -// -//---------------------------------------------------------------------------- +/* + * D3DXFilterTexture: + * ------------------ + * Filters mipmaps levels of a texture. + * + * Parameters: + * pBaseTexture + * The texture object to be filtered + * pPalette + * 256 color palette to be used, or NULL for non-palettized formats + * SrcLevel + * The level whose image is used to generate the subsequent levels. + * Filter + * D3DX_FILTER flags controlling how each miplevel is filtered. + * Or D3DX_DEFAULT for D3DX_FILTER_BOX, + * + */ HRESULT WINAPI D3DXFilterTexture( @@ -1512,24 +1466,22 @@ HRESULT WINAPI #define D3DXFilterCubeTexture D3DXFilterTexture #define D3DXFilterVolumeTexture D3DXFilterTexture - - -//---------------------------------------------------------------------------- -// D3DXFillTexture: -// ---------------- -// Uses a user provided function to fill each texel of each mip level of a -// given texture. -// -// Paramters: -// pTexture, pCubeTexture, pVolumeTexture -// Pointer to the texture to be filled. -// pFunction -// Pointer to user provided evalutor function which will be used to -// compute the value of each texel. -// pData -// Pointer to an arbitrary block of user defined data. This pointer -// will be passed to the function provided in pFunction -//----------------------------------------------------------------------------- +/* + * D3DXFillTexture: + * ---------------- + * Uses a user provided function to fill each texel of each mip level of a + * given texture. + * + * Paramters: + * pTexture, pCubeTexture, pVolumeTexture + * Pointer to the texture to be filled. + * pFunction + * Pointer to user provided evalutor function which will be used to + * compute the value of each texel. + * pData + * Pointer to an arbitrary block of user defined data. This pointer + * will be passed to the function provided in pFunction + */ HRESULT WINAPI D3DXFillTexture( @@ -1549,28 +1501,26 @@ HRESULT WINAPI LPD3DXFILL3D pFunction, LPVOID pData); - - -//---------------------------------------------------------------------------- -// D3DXComputeNormalMap: -// --------------------- -// 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 -// pTexture -// Pointer to the destination texture -// pSrcTexture -// Pointer to the source heightmap texture -// pSrcPalette -// Source palette of 256 colors, or NULL -// Flags -// D3DX_NORMALMAP flags -// Channel -// D3DX_CHANNEL specifying source of height information -// Amplitude -// The constant value which the height information is multiplied by. -//--------------------------------------------------------------------------- +/* + * D3DXComputeNormalMap: + * --------------------- + * 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 + * pTexture + * Pointer to the destination texture + * pSrcTexture + * Pointer to the source heightmap texture + * pSrcPalette + * Source palette of 256 colors, or NULL + * Flags + * D3DX_NORMALMAP flags + * Channel + * D3DX_CHANNEL specifying source of height information + * Amplitude + * The constant value which the height information is multiplied by. + */ HRESULT WINAPI D3DXComputeNormalMap( diff --git a/gfx/include/d3d9/d3dx9mesh.h b/gfx/include/d3d9/d3dx9mesh.h index beccf99ff6..3d15c50542 100644 --- a/gfx/include/d3d9/d3dx9mesh.h +++ b/gfx/include/d3d9/d3dx9mesh.h @@ -48,32 +48,32 @@ typedef enum _D3DXPATCHMESHTYPE /* Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags */ enum _D3DXMESH { - D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. - D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB. - D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB. - D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB. - D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB. - D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER - D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB. - D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB. - D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB. - D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB. - D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER - D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB. - D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB. - D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB. - D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + D3DXMESH_32BIT = 0x001, /* If set, then use 32 bit indices, if not set use 16 bit indices. */ + D3DXMESH_DONOTCLIP = 0x002, /* Use D3DUSAGE_DONOTCLIP for VB & IB. */ + D3DXMESH_POINTS = 0x004, /* Use D3DUSAGE_POINTS for VB & IB. */ + D3DXMESH_RTPATCHES = 0x008, /* Use D3DUSAGE_RTPATCHES for VB & IB. */ + D3DXMESH_NPATCHES = 0x4000,/* Use D3DUSAGE_NPATCHES for VB & IB. */ + D3DXMESH_VB_SYSTEMMEM = 0x010, /* Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER */ + D3DXMESH_VB_MANAGED = 0x020, /* Use D3DPOOL_MANAGED for VB. */ + D3DXMESH_VB_WRITEONLY = 0x040, /* Use D3DUSAGE_WRITEONLY for VB. */ + D3DXMESH_VB_DYNAMIC = 0x080, /* Use D3DUSAGE_DYNAMIC for VB. */ + D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, /* Use D3DUSAGE_SOFTWAREPROCESSING for VB. */ + D3DXMESH_IB_SYSTEMMEM = 0x100, /* Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER */ + D3DXMESH_IB_MANAGED = 0x200, /* Use D3DPOOL_MANAGED for IB. */ + D3DXMESH_IB_WRITEONLY = 0x400, /* Use D3DUSAGE_WRITEONLY for IB. */ + D3DXMESH_IB_DYNAMIC = 0x800, /* Use D3DUSAGE_DYNAMIC for IB. */ + D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, /* Use D3DUSAGE_SOFTWAREPROCESSING for IB. */ - D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + D3DXMESH_VB_SHARE = 0x1000, /* Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer */ - D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinInfo::ConvertToBlendedMesh + D3DXMESH_USEHWONLY = 0x2000, /* Valid for ID3DXSkinInfo::ConvertToBlendedMesh */ - // Helper options - D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM - D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED - D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY - D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC - D3DXMESH_SOFTWAREPROCESSING = 0x18000 // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + /* Helper options */ + D3DXMESH_SYSTEMMEM = 0x110, /* D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM */ + D3DXMESH_MANAGED = 0x220, /* D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED */ + D3DXMESH_WRITEONLY = 0x440, /* D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY */ + D3DXMESH_DYNAMIC = 0x880, /* D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC */ + D3DXMESH_SOFTWAREPROCESSING = 0x18000 /* D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING */ }; /* patch mesh options */ @@ -512,31 +512,35 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE; STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; - // This function returns the size of the tessellated mesh given a tessellation level. - // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must - // be set to TRUE and TessellationLevel should be the max tessellation. - // This will result in the max mesh size necessary for adaptive tessellation. + /* This function returns the size of the tessellated mesh given a tessellation level. + * This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must + * be set to TRUE and TessellationLevel should be the max tessellation. + * This will result in the max mesh size necessary for adaptive tessellation. + */ STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE; - //GenerateAdjacency determines which patches are adjacent with provided tolerance - //this information is used internally to optimize tessellation + /*GenerateAdjacency determines which patches are adjacent with provided tolerance + *this information is used internally to optimize tessellation */ STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE; - //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer - //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh - //has adjacency, the new mesh will also have adjacency + /*CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer + *to the new decl. Entries in the new decl which are new are set to 0. If the current mesh + *has adjacency, the new mesh will also have adjacency + */ STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE; - // Optimizes the patchmesh for efficient tessellation. This function is designed - // to perform one time optimization for patch meshes that need to be tessellated - // repeatedly by calling the Tessellate() method. The optimization performed is - // independent of the actual tessellation level used. - // Currently Flags is unused. - // If vertices are changed, Optimize must be called again + /* Optimizes the patchmesh for efficient tessellation. This function is designed + * to perform one time optimization for patch meshes that need to be tessellated + * repeatedly by calling the Tessellate() method. The optimization performed is + * independent of the actual tessellation level used. + * Currently Flags is unused. + * If vertices are changed, Optimize must be called again + */ STDMETHOD(Optimize)(THIS_ DWORD flags) PURE; - //gets and sets displacement parameters - //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + /*gets and sets displacement parameters + *displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + */ STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture, D3DTEXTUREFILTERTYPE MinFilter, D3DTEXTUREFILTERTYPE MagFilter, @@ -551,16 +555,18 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) D3DTEXTUREADDRESS *Wrap, DWORD *dwLODBias) PURE; - // Performs the uniform tessellation based on the tessellation level. - // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + /* Performs the uniform tessellation based on the tessellation level. + * This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + */ STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE; - // Performs adaptive tessellation based on the Z based adaptive tessellation criterion. - // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex - // adaptive tessellation amount. Each edge is tessellated to the average of the criterion - // at the 2 vertices it connects. - // MaxTessLevel specifies the upper limit for adaptive tesselation. - // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + /* Performs adaptive tessellation based on the Z based adaptive tessellation criterion. + * pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex + * adaptive tessellation amount. Each edge is tessellated to the average of the criterion + * at the 2 vertices it connects. + * MaxTessLevel specifies the upper limit for adaptive tesselation. + * This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + */ STDMETHOD(TessellateAdaptive)(THIS_ CONST D3DXVECTOR4 *pTrans, DWORD dwMaxTessLevel, @@ -574,12 +580,12 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // Specify the which vertices do each bones influence and by how much + /* Specify the which vertices do each bones influence and by how much */ STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE; STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE; @@ -589,44 +595,44 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) STDMETHOD_(DWORD, GetNumBones)(THIS) PURE; STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE; - // This gets the max face influences based on a triangle mesh with the specified index buffer + /* This gets the max face influences based on a triangle mesh with the specified index buffer */ STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE; - // Set min bone influence. Bone influences that are smaller than this are ignored + /* Set min bone influence. Bone influences that are smaller than this are ignored */ STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE; - // Get min bone influence. + /* Get min bone influence. */ STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE; - // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object - STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; // pName is copied to an internal string buffer - STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; // A pointer to an internal string buffer is returned. Do not free this. + /* Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object */ + STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; /* pName is copied to an internal string buffer */ + STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; /* A pointer to an internal string buffer is returned. Do not free this. */ - // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object - STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; // pBoneTransform is copied to an internal buffer - STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; // A pointer to an internal matrix is returned. Do not free this. + /* Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object */ + STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; /* pBoneTransform is copied to an internal buffer */ + STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; /* A pointer to an internal matrix is returned. Do not free this. */ - // Clone a skin info object + /* Clone a skin info object */ STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE; - // Update bone influence information to match vertices after they are reordered. This should be called - // if the target vertex buffer has been reordered externally. + /* Update bone influence information to match vertices after they are reordered. This should be called + * if the target vertex buffer has been reordered externally. */ STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE; - // These methods enable the modification of the vertex layout of the vertices that will be skinned + /* These methods enable the modification of the vertex layout of the vertices that will be skinned */ STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE; STDMETHOD_(DWORD, GetFVF)(THIS) PURE; STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; - // Apply SW skinning based on current pose matrices to the target vertices. + /* Apply SW skinning based on current pose matrices to the target vertices. */ STDMETHOD(UpdateSkinnedMesh)(THIS_ CONST D3DXMATRIX* pBoneTransforms, CONST D3DXMATRIX* pBoneInvTransposeTransforms, LPCVOID pVerticesSrc, PVOID pVerticesDst) PURE; - // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination - // table that describes which bones affect which subsets of the mesh + /* Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination + * table that describes which bones affect which subsets of the mesh */ STDMETHOD(ConvertToBlendedMesh)(THIS_ LPD3DXMESH pMesh, DWORD Options, @@ -639,8 +645,8 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) LPD3DXBUFFER* ppBoneCombinationTable, LPD3DXMESH* ppMesh) PURE; - // Takes a mesh and returns a new mesh with per vertex blend weights and indices - // and a bone combination table that describes which bones palettes affect which subsets of the mesh + /* Takes a mesh and returns a new mesh with per vertex blend weights and indices + * and a bone combination table that describes which bones palettes affect which subsets of the mesh */ STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_ LPD3DXMESH pMesh, DWORD Options, @@ -657,8 +663,7 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) #ifdef __cplusplus extern "C" { -#endif //__cplusplus - +#endif /* __cplusplus */ HRESULT WINAPI D3DXCreateMesh( @@ -686,7 +691,7 @@ HRESULT WINAPI CONST FLOAT *pVertexWeights, LPD3DXSPMESH* ppSMesh); -// clean a mesh up for simplification, try to make manifold +/* clean a mesh up for simplification, try to make manifold */ HRESULT WINAPI D3DXCleanMesh( D3DXCLEANTYPE CleanType, @@ -724,17 +729,17 @@ HRESULT WINAPI HRESULT WINAPI D3DXComputeBoundingSphere( - CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + CONST D3DXVECTOR3 *pFirstPosition, /* pointer to first position */ DWORD NumVertices, - DWORD dwStride, // count in bytes to subsequent position vectors + DWORD dwStride, /* count in bytes to subsequent position vectors */ D3DXVECTOR3 *pCenter, FLOAT *pRadius); HRESULT WINAPI D3DXComputeBoundingBox( - CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + CONST D3DXVECTOR3 *pFirstPosition, /* pointer to first position */ DWORD NumVertices, - DWORD dwStride, // count in bytes to subsequent position vectors + DWORD dwStride, /* count in bytes to subsequent position vectors */ D3DXVECTOR3 *pMin, D3DXVECTOR3 *pMax); @@ -841,8 +846,8 @@ HRESULT WINAPI DWORD* pNumMaterials, LPD3DXPMESH *ppPMesh); -// Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices -// The bone names and initial bone transforms are not filled in the skin info object by this method. +/* Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices + * The bone names and initial bone transforms are not filled in the skin info object by this method. */ HRESULT WINAPI D3DXCreateSkinInfo( DWORD NumVertices, @@ -850,8 +855,8 @@ HRESULT WINAPI DWORD NumBones, LPD3DXSKININFO* ppSkinInfo); -// Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices -// The bone names and initial bone transforms are not filled in the skin info object by this method. +/* Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices + * The bone names and initial bone transforms are not filled in the skin info object by this method. */ HRESULT WINAPI D3DXCreateSkinInfoFVF( DWORD NumVertices, @@ -863,7 +868,7 @@ HRESULT WINAPI } extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ HRESULT WINAPI D3DXLoadMeshFromXof( @@ -876,8 +881,8 @@ HRESULT WINAPI DWORD *pNumMaterials, LPD3DXMESH *ppMesh); -// This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file -// If skinning info is not present, ppSkinInfo will be NULL +/* This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file + * If skinning info is not present, ppSkinInfo will be NULL */ HRESULT WINAPI D3DXLoadSkinMeshFromXof( LPD3DXFILEDATA pxofMesh, @@ -891,11 +896,12 @@ HRESULT WINAPI LPD3DXMESH* ppMesh); -// The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from -// the mesh and the bone combination table and populates a skin info object with that data. The bone -// names and initial bone transforms are not filled in the skin info object by this method. This works -// with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to -// determine what type it is. +/* The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from + * the mesh and the bone combination table and populates a skin info object with that data. The bone + * names and initial bone transforms are not filled in the skin info object by this method. This works + * with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to + * determine what type it is. + */ HRESULT WINAPI D3DXCreateSkinInfoFromBlendedMesh( LPD3DXBASEMESH pMesh, @@ -908,24 +914,26 @@ HRESULT WINAPI LPD3DXMESH pMeshIn, CONST DWORD* pAdjacencyIn, FLOAT NumSegs, - BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic + BOOL QuadraticInterpNormals, /* if false use linear intrep for normals, if true use quadratic */ LPD3DXMESH *ppMeshOut, LPD3DXBUFFER *ppAdjacencyOut); -//generates implied outputdecl from input decl -//the decl generated from this should be used to generate the output decl for -//the tessellator subroutines. +/* generates implied outputdecl from input decl + * the decl generated from this should be used to generate the output decl for + * the tessellator subroutines. + */ HRESULT WINAPI D3DXGenerateOutputDecl( D3DVERTEXELEMENT9 *pOutput, CONST D3DVERTEXELEMENT9 *pInput); -//loads patches from an XFileData -//since an X file can have up to 6 different patch meshes in it, -//returns them in an array - pNumPatches will contain the number of -//meshes in the actual file. +/* loads patches from an XFileData + * since an X file can have up to 6 different patch meshes in it, + * returns them in an array - pNumPatches will contain the number of + * meshes in the actual file. + */ HRESULT WINAPI D3DXLoadPatchMeshFromXof( LPD3DXFILEDATA pXofObjMesh, @@ -936,23 +944,23 @@ HRESULT WINAPI PDWORD pNumMaterials, LPD3DXPATCHMESH *ppMesh); -//computes the size a single rect patch. +/* computes the size a single rect patch. */ HRESULT WINAPI D3DXRectPatchSize( - CONST FLOAT *pfNumSegs, //segments for each edge (4) - DWORD *pdwTriangles, //output number of triangles - DWORD *pdwVertices); //output number of vertices + CONST FLOAT *pfNumSegs, /* segments for each edge (4) */ + DWORD *pdwTriangles, /* output number of triangles */ + DWORD *pdwVertices); /* output number of vertices */ -//computes the size of a single triangle patch +/* computes the size of a single triangle patch */ HRESULT WINAPI D3DXTriPatchSize( - CONST FLOAT *pfNumSegs, //segments for each edge (3) - DWORD *pdwTriangles, //output number of triangles - DWORD *pdwVertices); //output number of vertices + CONST FLOAT *pfNumSegs, /* segments for each edge (3) */ + DWORD *pdwTriangles, /* output number of triangles */ + DWORD *pdwVertices); /* output number of vertices */ -//tessellates a patch into a created mesh -//similar to D3D RT patch +/*tessellates a patch into a created mesh + *similar to D3D RT patch */ HRESULT WINAPI D3DXTessellateRectPatch( LPDIRECT3DVERTEXBUFFER9 pVB, @@ -970,29 +978,26 @@ HRESULT WINAPI CONST D3DTRIPATCH_INFO *pTriPatchInfo, LPD3DXMESH pMesh); - - -//creates an NPatch PatchMesh from a D3DXMESH +/*creates an NPatch PatchMesh from a D3DXMESH */ HRESULT WINAPI D3DXCreateNPatchMesh( LPD3DXMESH pMeshSysMem, LPD3DXPATCHMESH *pPatchMesh); - -//creates a patch mesh +/*creates a patch mesh */ HRESULT WINAPI D3DXCreatePatchMesh( - CONST D3DXPATCHINFO *pInfo, //patch type - DWORD dwNumPatches, //number of patches - DWORD dwNumVertices, //number of control vertices - DWORD dwOptions, //options - CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices + CONST D3DXPATCHINFO *pInfo, /* patch type */ + DWORD dwNumPatches, /* number of patches */ + DWORD dwNumVertices, /* number of control vertices */ + DWORD dwOptions, /* options */ + CONST D3DVERTEXELEMENT9 *pDecl, /* format of control vertices */ LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPATCHMESH *pPatchMesh); -//returns the number of degenerates in a patch mesh - -//text output put in string. +/*returns the number of degenerates in a patch mesh - + *text output put in string. */ HRESULT WINAPI D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh, DWORD *dwcDegenerateVertices, @@ -1030,10 +1035,10 @@ HRESULT WINAPI typedef struct _D3DXINTERSECTINFO { - DWORD FaceIndex; // index of face intersected - FLOAT U; // Barycentric Hit Coordinates - FLOAT V; // Barycentric Hit Coordinates - FLOAT Dist; // Ray-Intersection Parameter Distance + DWORD FaceIndex; /* index of face intersected */ + FLOAT U; /* Barycentric Hit Coordinates */ + FLOAT V; /* Barycentric Hit Coordinates */ + FLOAT Dist; /* Ray-Intersection Parameter Distance */ } D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; @@ -1042,13 +1047,13 @@ HRESULT WINAPI LPD3DXBASEMESH pMesh, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, - BOOL *pHit, // True if any faces were intersected - DWORD *pFaceIndex, // index of closest face intersected - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist, // Ray-Intersection Parameter Distance - LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) - DWORD *pCountOfHits); // Number of entries in AllHits array + BOOL *pHit, /* True if any faces were intersected */ + DWORD *pFaceIndex, /* index of closest face intersected */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist, /* Ray-Intersection Parameter Distance */ + LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */ + DWORD *pCountOfHits); /* Number of entries in AllHits array */ HRESULT WINAPI D3DXIntersectSubset( @@ -1056,13 +1061,13 @@ HRESULT WINAPI DWORD AttribId, CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, - BOOL *pHit, // True if any faces were intersected - DWORD *pFaceIndex, // index of closest face intersected - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist, // Ray-Intersection Parameter Distance - LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) - DWORD *pCountOfHits); // Number of entries in AllHits array + BOOL *pHit, /* True if any faces were intersected */ + DWORD *pFaceIndex, /* index of closest face intersected */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist, /* Ray-Intersection Parameter Distance */ + LPD3DXBUFFER *ppAllHits, /* Array of D3DXINTERSECTINFOs for all hits (not just closest) */ + DWORD *pCountOfHits); /* Number of entries in AllHits array */ HRESULT WINAPI D3DXSplitMesh @@ -1080,14 +1085,14 @@ HRESULT WINAPI D3DXSplitMesh BOOL WINAPI D3DXIntersectTri ( - CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position - CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position - CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position - CONST D3DXVECTOR3 *pRayPos, // Ray origin - CONST D3DXVECTOR3 *pRayDir, // Ray direction - FLOAT *pU, // Barycentric Hit Coordinates - FLOAT *pV, // Barycentric Hit Coordinates - FLOAT *pDist); // Ray-Intersection Parameter Distance + CONST D3DXVECTOR3 *p0, /* Triangle vertex 0 position */ + CONST D3DXVECTOR3 *p1, /* Triangle vertex 1 position */ + CONST D3DXVECTOR3 *p2, /* Triangle vertex 2 position */ + CONST D3DXVECTOR3 *pRayPos, /* Ray origin */ + CONST D3DXVECTOR3 *pRayDir, /* Ray direction */ + FLOAT *pU, /* Barycentric Hit Coordinates */ + FLOAT *pV, /* Barycentric Hit Coordinates */ + FLOAT *pDist); /* Ray-Intersection Parameter Distance */ BOOL WINAPI D3DXSphereBoundProbe( @@ -1125,21 +1130,22 @@ HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh, ID3DXBuffer **ppVertexMapping); -//D3DXComputeTangent -// -//Computes the Tangent vectors for the TexStage texture coordinates -//and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL -//puts the binorm in BINORM[BinormIndex] also specified in the decl. -// -//If neither the binorm or the tangnet are in the meshes declaration, -//the function will fail. -// -//If a tangent or Binorm field is in the Decl, but the user does not -//wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified -//in the TangentIndex or BinormIndex will cause it to ignore the specified -//semantic. -// -//Wrap should be specified if the texture coordinates wrap. +/*D3DXComputeTangent + * + *Computes the Tangent vectors for the TexStage texture coordinates + *and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL + *puts the binorm in BINORM[BinormIndex] also specified in the decl. + * + *If neither the binorm or the tangnet are in the meshes declaration, + *the function will fail. + * + *If a tangent or Binorm field is in the Decl, but the user does not + *wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified + *in the TangentIndex or BinormIndex will cause it to ignore the specified + *semantic. + * + *Wrap should be specified if the texture coordinates wrap. + */ HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, DWORD TexStage, @@ -1148,90 +1154,92 @@ HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, DWORD Wrap, CONST DWORD *pAdjacency); -//============================================================================ -// -// UVAtlas apis -// -//============================================================================ +/* + * + * UVAtlas apis + * + */ typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext); -// This function creates atlases for meshes. There are two modes of operation, -// either based on the number of charts, or the maximum allowed stretch. If the -// maximum allowed stretch is 0, then each triangle will likely be in its own -// chart. +/* This function creates atlases for meshes. There are two modes of operation, + * either based on the number of charts, or the maximum allowed stretch. If the + * maximum allowed stretch is 0, then each triangle will likely be in its own + * chart. + */ -// -// The parameters are as follows: -// pMesh - Input mesh to calculate an atlas for. This must have a position -// channel and at least a 2-d texture channel. -// uMaxChartNumber - The maximum number of charts required for the atlas. -// If this is 0, it will be parameterized based solely on -// stretch. -// fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed, -// if 1, then any amount of stretching is allowed. -// uWidth - The width of the texture the atlas will be used on. -// uHeight - The height of the texture the atlas will be used on. -// fGutter - The minimum distance, in texels between two charts on the atlas. -// this gets scaled by the width, so if fGutter is 2.5, and it is -// used on a 512x512 texture, then the minimum distance will be -// 2.5 / 512 in u-v space. -// dwTextureIndex - Specifies which texture coordinate to write to in the -// output mesh (which is cloned from the input mesh). Useful -// if your vertex has multiple texture coordinates. -// pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating -// which triangles are adjacent to each other. -// pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating -// at each face, whether an edge is a false edge or not (using -// the same ordering as the adjacency data structure). If this -// is NULL, then it is assumed that there are no false edges. If -// not NULL, then a non-false edge is indicated by -1 and a false -// edge is indicated by any other value (it is not required, but -// it may be useful for the caller to use the original adjacency -// value). This allows you to parameterize a mesh of quads, and -// the edges down the middle of each quad will not be cut when -// parameterizing the mesh. -// pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the -// integrated metric tensor for that face. This lets you control -// the way this triangle may be stretched in the atlas. The IMT -// passed in will be 3 floats (a,b,c) and specify a symmetric -// matrix (a b) that, given a vector (s,t), specifies the -// (b c) -// distance between a vector v1 and a vector v2 = v1 + (s,t) as -// sqrt((s, t) * M * (s, t)^T). -// In other words, this lets one specify the magnitude of the -// stretch in an arbitrary direction in u-v space. For example -// if a = b = c = 1, then this scales the vector (1,1) by 2, and -// the vector (1,-1) by 0. Note that this is multiplying the edge -// length by the square of the matrix, so if you want the face to -// stretch to twice its -// size with no shearing, the IMT value should be (2, 0, 2), which -// is just the identity matrix times 2. -// Note that this assumes you have an orientation for the triangle -// in some 2-D space. For D3DXUVAtlas, this space is created by -// letting S be the direction from the first to the second -// vertex, and T be the cross product between the normal and S. -// -// pStatusCallback - Since the atlas creation process can be very CPU intensive, -// this allows the programmer to specify a function to be called -// periodically, similarly to how it is done in the PRT simulation -// engine. -// fCallbackFrequency - This lets you specify how often the callback will be -// called. A decent default should be 0.0001f. -// pUserContext - a void pointer to be passed back to the callback function -// dwOptions - A combination of flags in the D3DXUVATLAS enum -// ppMeshOut - A pointer to a location to store a pointer for the newly created -// mesh. -// ppFacePartitioning - A pointer to a location to store a pointer for an array, -// one DWORD per face, giving the final partitioning -// created by the atlasing algorithm. -// ppVertexRemapArray - A pointer to a location to store a pointer for an array, -// one DWORD per vertex, giving the vertex it was copied -// from, if any vertices needed to be split. -// pfMaxStretchOut - A location to store the maximum stretch resulting from the -// atlasing algorithm. -// puNumChartsOut - A location to store the number of charts created, or if the -// maximum number of charts was too low, this gives the minimum -// number of charts needed to create an atlas. +/* + * The parameters are as follows: + * pMesh - Input mesh to calculate an atlas for. This must have a position + * channel and at least a 2-d texture channel. + * uMaxChartNumber - The maximum number of charts required for the atlas. + * If this is 0, it will be parameterized based solely on + * stretch. + * fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed, + * if 1, then any amount of stretching is allowed. + * uWidth - The width of the texture the atlas will be used on. + * uHeight - The height of the texture the atlas will be used on. + * fGutter - The minimum distance, in texels between two charts on the atlas. + * this gets scaled by the width, so if fGutter is 2.5, and it is + * used on a 512x512 texture, then the minimum distance will be + * 2.5 / 512 in u-v space. + * dwTextureIndex - Specifies which texture coordinate to write to in the + * output mesh (which is cloned from the input mesh). Useful + * if your vertex has multiple texture coordinates. + * pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating + * which triangles are adjacent to each other. + * pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating + * at each face, whether an edge is a false edge or not (using + * the same ordering as the adjacency data structure). If this + * is NULL, then it is assumed that there are no false edges. If + * not NULL, then a non-false edge is indicated by -1 and a false + * edge is indicated by any other value (it is not required, but + * it may be useful for the caller to use the original adjacency + * value). This allows you to parameterize a mesh of quads, and + * the edges down the middle of each quad will not be cut when + * parameterizing the mesh. + * pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the + * integrated metric tensor for that face. This lets you control + * the way this triangle may be stretched in the atlas. The IMT + * passed in will be 3 floats (a,b,c) and specify a symmetric + * matrix (a b) that, given a vector (s,t), specifies the + * (b c) + * distance between a vector v1 and a vector v2 = v1 + (s,t) as + * sqrt((s, t) * M * (s, t)^T). + * In other words, this lets one specify the magnitude of the + * stretch in an arbitrary direction in u-v space. For example + * if a = b = c = 1, then this scales the vector (1,1) by 2, and + * the vector (1,-1) by 0. Note that this is multiplying the edge + * length by the square of the matrix, so if you want the face to + * stretch to twice its + * size with no shearing, the IMT value should be (2, 0, 2), which + * is just the identity matrix times 2. + * Note that this assumes you have an orientation for the triangle + * in some 2-D space. For D3DXUVAtlas, this space is created by + * letting S be the direction from the first to the second + * vertex, and T be the cross product between the normal and S. + * + * pStatusCallback - Since the atlas creation process can be very CPU intensive, + * this allows the programmer to specify a function to be called + * periodically, similarly to how it is done in the PRT simulation + * engine. + * fCallbackFrequency - This lets you specify how often the callback will be + * called. A decent default should be 0.0001f. + * pUserContext - a void pointer to be passed back to the callback function + * dwOptions - A combination of flags in the D3DXUVATLAS enum + * ppMeshOut - A pointer to a location to store a pointer for the newly created + * mesh. + * ppFacePartitioning - A pointer to a location to store a pointer for an array, + * one DWORD per face, giving the final partitioning + * created by the atlasing algorithm. + * ppVertexRemapArray - A pointer to a location to store a pointer for an array, + * one DWORD per vertex, giving the vertex it was copied + * from, if any vertices needed to be split. + * pfMaxStretchOut - A location to store the maximum stretch resulting from the + * atlasing algorithm. + * puNumChartsOut - A location to store the number of charts created, or if the + * maximum number of charts was too low, this gives the minimum + * number of charts needed to create an atlas. + */ HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, UINT uMaxChartNumber, @@ -1253,33 +1261,32 @@ HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, FLOAT *pfMaxStretchOut, UINT *puNumChartsOut); -// This has the same exact arguments as Create, except that it does not perform the -// final packing step. This method allows one to get a partitioning out, and possibly -// modify it before sending it to be repacked. Note that if you change the -// partitioning, you'll also need to calculate new texture coordinates for any faces -// that have switched charts. -// -// The partition result adjacency output parameter is meant to be passed to the -// UVAtlasPack function, this adjacency cuts edges that are between adjacent -// charts, and also can include cuts inside of a chart in order to make it -// equivalent to a disc. For example: -// -// _______ -// | ___ | -// | |_| | -// |_____| -// -// In order to make this equivalent to a disc, we would need to add a cut, and it -// Would end up looking like: -// _______ -// | ___ | -// | |_|_| -// |_____| -// -// The resulting partition adjacency parameter cannot be NULL, because it is -// required for the packing step. - - +/* This has the same exact arguments as Create, except that it does not perform the + * final packing step. This method allows one to get a partitioning out, and possibly + * modify it before sending it to be repacked. Note that if you change the + * partitioning, you'll also need to calculate new texture coordinates for any faces + * that have switched charts. + * + * The partition result adjacency output parameter is meant to be passed to the + * UVAtlasPack function, this adjacency cuts edges that are between adjacent + * charts, and also can include cuts inside of a chart in order to make it + * equivalent to a disc. For example: + * + * _______ + * | ___ | + * | |_| | + * |_____| + * + * In order to make this equivalent to a disc, we would need to add a cut, and it + * Would end up looking like: + * _______ + * | ___ | + * | |_|_| + * |_____| + * + * The resulting partition adjacency parameter cannot be NULL, because it is + * required for the packing step. + */ HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, UINT uMaxChartNumber, @@ -1299,12 +1306,13 @@ HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, FLOAT *pfMaxStretchOut, UINT *puNumChartsOut); -// This takes the face partitioning result from Partition and packs it into an -// atlas of the given size. pdwPartitionResultAdjacency should be derived from -// the adjacency returned from the partition step. This value cannot be NULL -// because Pack needs to know where charts were cut in the partition step in -// order to find the edges of each chart. -// The options parameter is currently reserved. +/* This takes the face partitioning result from Partition and packs it into an + * atlas of the given size. pdwPartitionResultAdjacency should be derived from + * the adjacency returned from the partition step. This value cannot be NULL + * because Pack needs to know where charts were cut in the partition step in + * order to find the edges of each chart. + * The options parameter is currently reserved. + */ HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, UINT uWidth, UINT uHeight, @@ -1318,27 +1326,28 @@ HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, LPD3DXBUFFER pFacePartitioning); -//============================================================================ -// -// IMT Calculation apis -// -// These functions all compute the Integrated Metric Tensor for use in the -// UVAtlas API. They all calculate the IMT with respect to the canonical -// triangle, where the coordinate system is set up so that the u axis goes -// from vertex 0 to 1 and the v axis is N x u. So, for example, the second -// vertex's canonical uv coordinates are (d,0) where d is the distance between -// vertices 0 and 1. This way the IMT does not depend on the parameterization -// of the mesh, and if the signal over the surface doesn't change, then -// the IMT doesn't need to be recalculated. -//============================================================================ +/* + * + * IMT Calculation apis + * + * These functions all compute the Integrated Metric Tensor for use in the + * UVAtlas API. They all calculate the IMT with respect to the canonical + * triangle, where the coordinate system is set up so that the u axis goes + * from vertex 0 to 1 and the v axis is N x u. So, for example, the second + * vertex's canonical uv coordinates are (d,0) where d is the distance between + * vertices 0 and 1. This way the IMT does not depend on the parameterization + * of the mesh, and if the signal over the surface doesn't change, then + * the IMT doesn't need to be recalculated. + *============================================================================ -// This callback is used by D3DXComputeIMTFromSignal. -// -// uv - The texture coordinate for the vertex. -// uPrimitiveID - Face ID of the triangle on which to compute the signal. -// uSignalDimension - The number of floats to store in pfSignalOut. -// pUserData - The pUserData pointer passed in to ComputeIMTFromSignal. -// pfSignalOut - A pointer to where to store the signal data. + * This callback is used by D3DXComputeIMTFromSignal. + * + * uv - The texture coordinate for the vertex. + * uPrimitiveID - Face ID of the triangle on which to compute the signal. + * uSignalDimension - The number of floats to store in pfSignalOut. + * pUserData - The pUserData pointer passed in to ComputeIMTFromSignal. + * pfSignalOut - A pointer to where to store the signal data. + */ typedef HRESULT (WINAPI* LPD3DXIMTSIGNALCALLBACK) (CONST D3DXVECTOR2 *uv, UINT uPrimitiveID, @@ -1346,72 +1355,75 @@ typedef HRESULT (WINAPI* LPD3DXIMTSIGNALCALLBACK) VOID *pUserData, FLOAT *pfSignalOut); -// This function is used to calculate the IMT from per vertex data. It sets -// up a linear system over the triangle, solves for the jacobian J, then -// constructs the IMT from that (J^TJ). -// This function allows you to calculate the IMT based off of any value in a -// mesh (color, normal, etc) by specifying the correct stride of the array. -// The IMT computed will cause areas of the mesh that have similar values to -// take up less space in the texture. -// -// pMesh - The mesh to calculate the IMT for. -// pVertexSignal - A float array of size uSignalStride * v, where v is the -// number of vertices in the mesh. -// uSignalDimension - How many floats per vertex to use in calculating the IMT. -// uSignalStride - The number of bytes per vertex in the array. This must be -// a multiple of sizeof(float) -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is used to calculate the IMT from per vertex data. It sets + * up a linear system over the triangle, solves for the jacobian J, then + * constructs the IMT from that (J^TJ). + * This function allows you to calculate the IMT based off of any value in a + * mesh (color, normal, etc) by specifying the correct stride of the array. + * The IMT computed will cause areas of the mesh that have similar values to + * take up less space in the texture. + * + * pMesh - The mesh to calculate the IMT for. + * pVertexSignal - A float array of size uSignalStride * v, where v is the + * number of vertices in the mesh. + * uSignalDimension - How many floats per vertex to use in calculating the IMT. + * uSignalStride - The number of bytes per vertex in the array. This must be + * a multiple of sizeof(float) + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromPerVertexSignal ( LPD3DXMESH pMesh, - CONST FLOAT *pfVertexSignal, // uSignalDimension floats per vertex + CONST FLOAT *pfVertexSignal, /* uSignalDimension floats per vertex */ UINT uSignalDimension, - UINT uSignalStride, // stride of signal in bytes - DWORD dwOptions, // reserved for future use + UINT uSignalStride, /* stride of signal in bytes */ + DWORD dwOptions, /* reserved for future use */ LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData); -// This function is used to calculate the IMT from data that varies over the -// surface of the mesh (generally at a higher frequency than vertex data). -// This function requires the mesh to already be parameterized (so it already -// has texture coordinates). It allows the user to define a signal arbitrarily -// over the surface of the mesh. -// -// pMesh - The mesh to calculate the IMT for. -// dwTextureIndex - This describes which set of texture coordinates in the -// mesh to use. -// uSignalDimension - How many components there are in the signal. -// fMaxUVDistance - The subdivision will continue until the distance between -// all vertices is at most fMaxUVDistance. -// dwOptions - reserved for future use -// pSignalCallback - The callback to use to get the signal. -// pUserData - A pointer that will be passed in to the callback. -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is used to calculate the IMT from data that varies over the + * surface of the mesh (generally at a higher frequency than vertex data). + * This function requires the mesh to already be parameterized (so it already + * has texture coordinates). It allows the user to define a signal arbitrarily + * over the surface of the mesh. + * + * pMesh - The mesh to calculate the IMT for. + * dwTextureIndex - This describes which set of texture coordinates in the + * mesh to use. + * uSignalDimension - How many components there are in the signal. + * fMaxUVDistance - The subdivision will continue until the distance between + * all vertices is at most fMaxUVDistance. + * dwOptions - reserved for future use + * pSignalCallback - The callback to use to get the signal. + * pUserData - A pointer that will be passed in to the callback. + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromSignal( LPD3DXMESH pMesh, DWORD dwTextureIndex, UINT uSignalDimension, FLOAT fMaxUVDistance, - DWORD dwOptions, // reserved for future use + DWORD dwOptions, /* reserved for future use */ LPD3DXIMTSIGNALCALLBACK pSignalCallback, VOID *pUserData, LPD3DXUVATLASCB pStatusCallback, LPVOID pUserContext, LPD3DXBUFFER *ppIMTData); -// This function is used to calculate the IMT from texture data. Given a texture -// that maps over the surface of the mesh, the algorithm computes the IMT for -// each face. This will cause large areas that are very similar to take up less -// room when parameterized with UVAtlas. The texture is assumed to be -// interpolated over the mesh bilinearly. -// -// pMesh - The mesh to calculate the IMT for. -// pTexture - The texture to load data from. -// dwTextureIndex - This describes which set of texture coordinates in the -// mesh to use. -// dwOptions - Combination of one or more D3DXIMT flags. -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is used to calculate the IMT from texture data. Given a texture + * that maps over the surface of the mesh, the algorithm computes the IMT for + * each face. This will cause large areas that are very similar to take up less + * room when parameterized with UVAtlas. The texture is assumed to be + * interpolated over the mesh bilinearly. + * + * pMesh - The mesh to calculate the IMT for. + * pTexture - The texture to load data from. + * dwTextureIndex - This describes which set of texture coordinates in the + * mesh to use. + * dwOptions - Combination of one or more D3DXIMT flags. + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromTexture ( LPD3DXMESH pMesh, LPDIRECT3DTEXTURE9 pTexture, @@ -1421,21 +1433,22 @@ HRESULT WINAPI D3DXComputeIMTFromTexture ( LPVOID pUserContext, LPD3DXBUFFER *ppIMTData); -// This function is very similar to ComputeIMTFromTexture, but it uses a -// float array to pass in the data, and it can calculate higher dimensional -// values than 4. -// -// pMesh - The mesh to calculate the IMT for. -// dwTextureIndex - This describes which set of texture coordinates in the -// mesh to use. -// pfFloatArray - a pointer to a float array of size -// uWidth*uHeight*uComponents -// uWidth - The width of the texture -// uHeight - The height of the texture -// uSignalDimension - The number of floats per texel in the signal -// uComponents - The number of floats in each texel -// dwOptions - Combination of one or more D3DXIMT flags -// ppIMTData - Where to store the buffer holding the IMT data +/* This function is very similar to ComputeIMTFromTexture, but it uses a + * float array to pass in the data, and it can calculate higher dimensional + * values than 4. + * + * pMesh - The mesh to calculate the IMT for. + * dwTextureIndex - This describes which set of texture coordinates in the + * mesh to use. + * pfFloatArray - a pointer to a float array of size + * uWidth*uHeight*uComponents + * uWidth - The width of the texture + * uHeight - The height of the texture + * uSignalDimension - The number of floats per texel in the signal + * uComponents - The number of floats in each texel + * dwOptions - Combination of one or more D3DXIMT flags + * ppIMTData - Where to store the buffer holding the IMT data + */ HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal( LPD3DXMESH pMesh, DWORD dwTextureIndex, @@ -1468,29 +1481,29 @@ HRESULT WINAPI DWORD *pNumStrips); -//============================================================================ -// -// D3DXOptimizeFaces: -// -------------------- -// Generate a face remapping for a triangle list that more effectively utilizes -// vertex caches. This optimization is identical to the one provided -// by ID3DXMesh::Optimize with the hardware independent option enabled. -// -// Parameters: -// pbIndices -// Triangle list indices to use for generating a vertex ordering -// NumFaces -// Number of faces in the triangle list -// NumVertices -// Number of vertices referenced by the triangle list -// b32BitIndices -// TRUE if indices are 32 bit, FALSE if indices are 16 bit -// pFaceRemap -// Destination buffer to store face ordering -// The number stored for a given element is where in the new ordering -// the face will have come from. See ID3DXMesh::Optimize for more info. -// -//============================================================================ +/* + * + * D3DXOptimizeFaces: + * -------------------- + * Generate a face remapping for a triangle list that more effectively utilizes + * vertex caches. This optimization is identical to the one provided + * by ID3DXMesh::Optimize with the hardware independent option enabled. + * + * Parameters: + * pbIndices + * Triangle list indices to use for generating a vertex ordering + * NumFaces + * Number of faces in the triangle list + * NumVertices + * Number of vertices referenced by the triangle list + * b32BitIndices + * TRUE if indices are 32 bit, FALSE if indices are 16 bit + * pFaceRemap + * Destination buffer to store face ordering + * The number stored for a given element is where in the new ordering + * the face will have come from. See ID3DXMesh::Optimize for more info. + * + */ HRESULT WINAPI D3DXOptimizeFaces( LPCVOID pbIndices, @@ -1499,29 +1512,29 @@ HRESULT WINAPI BOOL b32BitIndices, DWORD* pFaceRemap); -//============================================================================ -// -// D3DXOptimizeVertices: -// -------------------- -// Generate a vertex remapping to optimize for in order use of vertices for -// a given set of indices. This is commonly used after applying the face -// remap generated by D3DXOptimizeFaces -// -// Parameters: -// pbIndices -// Triangle list indices to use for generating a vertex ordering -// NumFaces -// Number of faces in the triangle list -// NumVertices -// Number of vertices referenced by the triangle list -// b32BitIndices -// TRUE if indices are 32 bit, FALSE if indices are 16 bit -// pVertexRemap -// Destination buffer to store vertex ordering -// The number stored for a given element is where in the new ordering -// the vertex will have come from. See ID3DXMesh::Optimize for more info. -// -//============================================================================ +/* + * + * D3DXOptimizeVertices: + * -------------------- + * Generate a vertex remapping to optimize for in order use of vertices for + * a given set of indices. This is commonly used after applying the face + * remap generated by D3DXOptimizeFaces + * + * Parameters: + * pbIndices + * Triangle list indices to use for generating a vertex ordering + * NumFaces + * Number of faces in the triangle list + * NumVertices + * Number of vertices referenced by the triangle list + * b32BitIndices + * TRUE if indices are 32 bit, FALSE if indices are 16 bit + * pVertexRemap + * Destination buffer to store vertex ordering + * The number stored for a given element is where in the new ordering + * the vertex will have come from. See ID3DXMesh::Optimize for more info. + * + */ HRESULT WINAPI D3DXOptimizeVertices( LPCVOID pbIndices, @@ -1532,15 +1545,15 @@ HRESULT WINAPI #ifdef __cplusplus } -#endif //__cplusplus +#endif /* __cplusplus */ -//=========================================================================== -// -// Data structures for Spherical Harmonic Precomputation -// -// -//============================================================================ +/* + * + * Data structures for Spherical Harmonic Precomputation + * + * + */ typedef enum _D3DXSHCOMPRESSQUALITYTYPE { D3DXSHCQUAL_FASTLOWQUALITY = 1, @@ -1559,72 +1572,76 @@ typedef enum _D3DXSHGPUSIMOPT { D3DXSHGPUSIMOPT_FORCE_DWORD = 0x7fffffff } D3DXSHGPUSIMOPT; -// for all properties that are colors the luminance is computed -// if the simulator is run with a single channel using the following -// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 +/* for all properties that are colors the luminance is computed + * if the simulator is run with a single channel using the following + * formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + */ typedef struct _D3DXSHMATERIAL { - D3DCOLORVALUE Diffuse; // Diffuse albedo of the surface. (Ignored if object is a Mirror) - BOOL bMirror; // Must be set to FALSE. bMirror == TRUE not currently supported - BOOL bSubSurf; // true if the object does subsurface scattering - can't do this and be a mirror + D3DCOLORVALUE Diffuse; /* Diffuse albedo of the surface. (Ignored if object is a Mirror) */ + BOOL bMirror; /* Must be set to FALSE. bMirror == TRUE not currently supported */ + BOOL bSubSurf; /* true if the object does subsurface scattering - can't do this and be a mirror */ - // subsurface scattering parameters + /* subsurface scattering parameters */ FLOAT RelativeIndexOfRefraction; D3DCOLORVALUE Absorption; D3DCOLORVALUE ReducedScattering; } D3DXSHMATERIAL; -// allocated in D3DXSHPRTCompSplitMeshSC -// vertices are duplicated into multiple super clusters but -// only have a valid status in one super cluster (fill in the rest) +/* allocated in D3DXSHPRTCompSplitMeshSC + * vertices are duplicated into multiple super clusters but + * only have a valid status in one super cluster (fill in the rest) + */ typedef struct _D3DXSHPRTSPLITMESHVERTDATA { - UINT uVertRemap; // vertex in original mesh this corresponds to - UINT uSubCluster; // cluster index relative to super cluster - UCHAR ucVertStatus; // 1 if vertex has valid data, 0 if it is "fill" + UINT uVertRemap; /* vertex in original mesh this corresponds to */ + UINT uSubCluster; /* cluster index relative to super cluster */ + UCHAR ucVertStatus; /* 1 if vertex has valid data, 0 if it is "fill" */ } D3DXSHPRTSPLITMESHVERTDATA; -// used in D3DXSHPRTCompSplitMeshSC -// information for each super cluster that maps into face/vert arrays +/* used in D3DXSHPRTCompSplitMeshSC + * information for each super cluster that maps into face/vert arrays + */ typedef struct _D3DXSHPRTSPLITMESHCLUSTERDATA { - UINT uVertStart; // initial index into remapped vertex array - UINT uVertLength; // number of vertices in this super cluster + UINT uVertStart; /* initial index into remapped vertex array */ + UINT uVertLength; /* number of vertices in this super cluster */ - UINT uFaceStart; // initial index into face array - UINT uFaceLength; // number of faces in this super cluster + UINT uFaceStart; /* initial index into face array */ + UINT uFaceLength; /* number of faces in this super cluster */ - UINT uClusterStart; // initial index into cluster array - UINT uClusterLength; // number of clusters in this super cluster + UINT uClusterStart; /* initial index into cluster array */ + UINT uClusterLength; /* number of clusters in this super cluster */ } D3DXSHPRTSPLITMESHCLUSTERDATA; -// call back function for simulator -// return S_OK to keep running the simulator - anything else represents -// failure and the simulator will abort. +/* call back function for simulator + * return S_OK to keep running the simulator - anything else represents + * failure and the simulator will abort. + */ typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float fPercentDone, LPVOID lpUserContext); -// interfaces for PRT buffers/simulator +/* interfaces for PRT buffers/simulator */ -// GUIDs -// {F1827E47-00A8-49cd-908C-9D11955F8728} +/* GUIDs + * {F1827E47-00A8-49cd-908C-9D11955F8728} */ DEFINE_GUID(IID_ID3DXPRTBuffer, 0xf1827e47, 0xa8, 0x49cd, 0x90, 0x8c, 0x9d, 0x11, 0x95, 0x5f, 0x87, 0x28); -// {A758D465-FE8D-45ad-9CF0-D01E56266A07} +/* {A758D465-FE8D-45ad-9CF0-D01E56266A07} */ DEFINE_GUID(IID_ID3DXPRTCompBuffer, 0xa758d465, 0xfe8d, 0x45ad, 0x9c, 0xf0, 0xd0, 0x1e, 0x56, 0x26, 0x6a, 0x7); -// {838F01EC-9729-4527-AADB-DF70ADE7FEA9} +/* {838F01EC-9729-4527-AADB-DF70ADE7FEA9} */ DEFINE_GUID(IID_ID3DXTextureGutterHelper, 0x838f01ec, 0x9729, 0x4527, 0xaa, 0xdb, 0xdf, 0x70, 0xad, 0xe7, 0xfe, 0xa9); -// {683A4278-CD5F-4d24-90AD-C4E1B6855D53} +/* {683A4278-CD5F-4d24-90AD-C4E1B6855D53} */ DEFINE_GUID(IID_ID3DXPRTEngine, 0x683a4278, 0xcd5f, 0x4d24, 0x90, 0xad, 0xc4, 0xe1, 0xb6, 0x85, 0x5d, 0x53); -// interface defenitions +/* interface defenitions */ typedef interface ID3DXTextureGutterHelper ID3DXTextureGutterHelper; typedef interface ID3DXPRTBuffer ID3DXPRTBuffer; @@ -1632,18 +1649,19 @@ typedef interface ID3DXPRTBuffer ID3DXPRTBuffer; #undef INTERFACE #define INTERFACE ID3DXPRTBuffer -// Buffer interface - contains "NumSamples" samples -// each sample in memory is stored as NumCoeffs scalars per channel (1 or 3) -// Same interface is used for both Vertex and Pixel PRT buffers +/* Buffer interface - contains "NumSamples" samples + * each sample in memory is stored as NumCoeffs scalars per channel (1 or 3) + * Same interface is used for both Vertex and Pixel PRT buffers + */ DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXPRTBuffer + /* ID3DXPRTBuffer */ STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; @@ -1652,37 +1670,42 @@ DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) STDMETHOD_(UINT, GetWidth)(THIS) PURE; STDMETHOD_(UINT, GetHeight)(THIS) PURE; - // changes the number of samples allocated in the buffer + /* changes the number of samples allocated in the buffer */ STDMETHOD(Resize)(THIS_ UINT NewSize) PURE; - // ppData will point to the memory location where sample Start begins - // pointer is valid for at least NumSamples samples + /* ppData will point to the memory location where sample Start begins + * pointer is valid for at least NumSamples samples + */ STDMETHOD(LockBuffer)(THIS_ UINT Start, UINT NumSamples, FLOAT **ppData) PURE; STDMETHOD(UnlockBuffer)(THIS) PURE; - // every scalar in buffer is multiplied by Scale + /* every scalar in buffer is multiplied by Scale */ STDMETHOD(ScaleBuffer)(THIS_ FLOAT Scale) PURE; - // every scalar contains the sum of this and pBuffers values - // pBuffer must have the same storage class/dimensions + /* every scalar contains the sum of this and pBuffers values + * pBuffer must have the same storage class/dimensions + */ STDMETHOD(AddBuffer)(THIS_ LPD3DXPRTBUFFER pBuffer) PURE; - // GutterHelper (described below) will fill in the gutter - // regions of a texture by interpolating "internal" values + /* GutterHelper (described below) will fill in the gutter + * regions of a texture by interpolating "internal" values + */ STDMETHOD(AttachGH)(THIS_ LPD3DXTEXTUREGUTTERHELPER) PURE; STDMETHOD(ReleaseGH)(THIS) PURE; - // Evaluates attached gutter helper on the contents of this buffer + /* Evaluates attached gutter helper on the contents of this buffer */ STDMETHOD(EvalGH)(THIS) PURE; - // extracts a given channel into texture pTexture - // NumCoefficients starting from StartCoefficient are copied + /* extracts a given channel into texture pTexture + * NumCoefficients starting from StartCoefficient are copied + */ STDMETHOD(ExtractTexture)(THIS_ UINT Channel, UINT StartCoefficient, UINT NumCoefficients, LPDIRECT3DTEXTURE9 pTexture) PURE; - // extracts NumCoefficients coefficients into mesh - only applicable on single channel - // buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients - // should be Order^2 + /* extracts NumCoefficients coefficients into mesh - only applicable on single channel + * buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients + * should be Order^2 + */ STDMETHOD(ExtractToMesh)(THIS_ UINT NumCoefficients, D3DDECLUSAGE Usage, UINT UsageIndexStart, LPD3DXMESH pScene) PURE; @@ -1694,18 +1717,18 @@ typedef interface ID3DXPRTCompBuffer *LPD3DXPRTCOMPBUFFER; #undef INTERFACE #define INTERFACE ID3DXPRTCompBuffer -// compressed buffers stored a compressed version of a PRTBuffer +/* compressed buffers stored a compressed version of a PRTBuffer */ DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DPRTCompBuffer + /* ID3DPRTCompBuffer */ - // NumCoeffs and NumChannels are properties of input buffer + /* NumCoeffs and NumChannels are properties of input buffer */ STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; @@ -1714,33 +1737,38 @@ DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) STDMETHOD_(UINT, GetWidth)(THIS) PURE; STDMETHOD_(UINT, GetHeight)(THIS) PURE; - // number of clusters, and PCA vectors per-cluster + /* number of clusters, and PCA vectors per-cluster */ STDMETHOD_(UINT, GetNumClusters)(THIS) PURE; STDMETHOD_(UINT, GetNumPCA)(THIS) PURE; - // normalizes PCA weights so that they are between [-1,1] - // basis vectors are modified to reflect this + /* normalizes PCA weights so that they are between [-1,1] + * basis vectors are modified to reflect this + */ STDMETHOD(NormalizeData)(THIS) PURE; - // copies basis vectors for cluster "Cluster" into pClusterBasis - // (NumPCA+1)*NumCoeffs*NumChannels floats + /* copies basis vectors for cluster "Cluster" into pClusterBasis + * (NumPCA+1)*NumCoeffs*NumChannels floats + */ STDMETHOD(ExtractBasis)(THIS_ UINT Cluster, FLOAT *pClusterBasis) PURE; - // UINT per sample - which cluster it belongs to + /* UINT per sample - which cluster it belongs to */ STDMETHOD(ExtractClusterIDs)(THIS_ UINT *pClusterIDs) PURE; - // copies NumExtract PCA projection coefficients starting at StartPCA - // into pPCACoefficients - NumSamples*NumExtract floats copied + /* copies NumExtract PCA projection coefficients starting at StartPCA + * into pPCACoefficients - NumSamples*NumExtract floats copied + */ STDMETHOD(ExtractPCA)(THIS_ UINT StartPCA, UINT NumExtract, FLOAT *pPCACoefficients) PURE; - // copies NumPCA projection coefficients starting at StartPCA - // into pTexture - should be able to cope with signed formats + /* copies NumPCA projection coefficients starting at StartPCA + * into pTexture - should be able to cope with signed formats + */ STDMETHOD(ExtractTexture)(THIS_ UINT StartPCA, UINT NumpPCA, LPDIRECT3DTEXTURE9 pTexture) PURE; - // copies NumPCA projection coefficients into mesh pScene - // Usage is D3DDECLUSAGE where coefficients are to be stored - // UsageIndexStart is starting index + /* copies NumPCA projection coefficients into mesh pScene + * Usage is D3DDECLUSAGE where coefficients are to be stored + * UsageIndexStart is starting index + */ STDMETHOD(ExtractToMesh)(THIS_ UINT NumPCA, D3DDECLUSAGE Usage, UINT UsageIndexStart, LPD3DXMESH pScene) PURE; }; @@ -1749,123 +1777,137 @@ DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) #undef INTERFACE #define INTERFACE ID3DXTextureGutterHelper -// ID3DXTextureGutterHelper will build and manage -// "gutter" regions in a texture - this will allow for -// bi-linear interpolation to not have artifacts when rendering -// It generates a map (in texture space) where each texel -// is in one of 3 states: -// 0 Invalid - not used at all -// 1 Inside triangle -// 2 Gutter texel -// 4 represents a gutter texel that will be computed during PRT -// For each Inside/Gutter texel it stores the face it -// belongs to and barycentric coordinates for the 1st two -// vertices of that face. Gutter vertices are assigned to -// the closest edge in texture space. -// -// When used with PRT this requires a unique parameterization -// of the model - every texel must correspond to a single point -// on the surface of the model and vice versa +/* ID3DXTextureGutterHelper will build and manage + * "gutter" regions in a texture - this will allow for + * bi-linear interpolation to not have artifacts when rendering + * It generates a map (in texture space) where each texel + * is in one of 3 states: + * 0 Invalid - not used at all + * 1 Inside triangle + * 2 Gutter texel + * 4 represents a gutter texel that will be computed during PRT + * For each Inside/Gutter texel it stores the face it + * belongs to and barycentric coordinates for the 1st two + * vertices of that face. Gutter vertices are assigned to + * the closest edge in texture space. + * + * When used with PRT this requires a unique parameterization + * of the model - every texel must correspond to a single point + * on the surface of the model and vice versa + */ DECLARE_INTERFACE_(ID3DXTextureGutterHelper, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXTextureGutterHelper + /* ID3DXTextureGutterHelper */ - // dimensions of texture this is bound too + /* dimensions of texture this is bound too */ STDMETHOD_(UINT, GetWidth)(THIS) PURE; STDMETHOD_(UINT, GetHeight)(THIS) PURE; - // Applying gutters recomputes all of the gutter texels of class "2" - // based on texels of class "1" or "4" + /* Applying gutters recomputes all of the gutter texels of class "2" + * based on texels of class "1" or "4" + */ - // Applies gutters to a raw float buffer - each texel is NumCoeffs floats - // Width and Height must match GutterHelper + /* Applies gutters to a raw float buffer - each texel is NumCoeffs floats + * Width and Height must match GutterHelper + */ STDMETHOD(ApplyGuttersFloat)(THIS_ FLOAT *pDataIn, UINT NumCoeffs, UINT Width, UINT Height); - // Applies gutters to pTexture - // Dimensions must match GutterHelper + /* Applies gutters to pTexture + * Dimensions must match GutterHelper + */ STDMETHOD(ApplyGuttersTex)(THIS_ LPDIRECT3DTEXTURE9 pTexture); - // Applies gutters to a D3DXPRTBuffer - // Dimensions must match GutterHelper + /* Applies gutters to a D3DXPRTBuffer + * Dimensions must match GutterHelper + */ STDMETHOD(ApplyGuttersPRT)(THIS_ LPD3DXPRTBUFFER pBuffer); - // Resamples a texture from a mesh onto this gutterhelpers - // parameterization. It is assumed that the UV coordinates - // for this gutter helper are in TEXTURE 0 (usage/usage index) - // and the texture coordinates should all be within [0,1] for - // both sets. - // - // pTextureIn - texture represented using parameterization in pMeshIn - // pMeshIn - Mesh with texture coordinates that represent pTextureIn - // pTextureOut texture coordinates are assumed to be in - // TEXTURE 0 - // Usage - field in DECL for pMeshIn that stores texture coordinates - // for pTextureIn - // UsageIndex - which index for Usage above for pTextureIn - // pTextureOut- Resampled texture - // - // Usage would generally be D3DDECLUSAGE_TEXCOORD and UsageIndex other than zero + /* Resamples a texture from a mesh onto this gutterhelpers + * parameterization. It is assumed that the UV coordinates + * for this gutter helper are in TEXTURE 0 (usage/usage index) + * and the texture coordinates should all be within [0,1] for + * both sets. + * + * pTextureIn - texture represented using parameterization in pMeshIn + * pMeshIn - Mesh with texture coordinates that represent pTextureIn + * pTextureOut texture coordinates are assumed to be in + * TEXTURE 0 + * Usage - field in DECL for pMeshIn that stores texture coordinates + * for pTextureIn + * UsageIndex - which index for Usage above for pTextureIn + * pTextureOut- Resampled texture + * + * Usage would generally be D3DDECLUSAGE_TEXCOORD and UsageIndex other than zero + */ STDMETHOD(ResampleTex)(THIS_ LPDIRECT3DTEXTURE9 pTextureIn, LPD3DXMESH pMeshIn, D3DDECLUSAGE Usage, UINT UsageIndex, LPDIRECT3DTEXTURE9 pTextureOut); - // the routines below provide access to the data structures - // used by the Apply functions + /* the routines below provide access to the data structures + * used by the Apply functions - // face map is a UINT per texel that represents the - // face of the mesh that texel belongs too - - // only valid if same texel is valid in pGutterData - // pFaceData must be allocated by the user + * face map is a UINT per texel that represents the + * face of the mesh that texel belongs too - + * only valid if same texel is valid in pGutterData + * pFaceData must be allocated by the user + */ STDMETHOD(GetFaceMap)(THIS_ UINT *pFaceData) PURE; - // BaryMap is a D3DXVECTOR2 per texel - // the 1st two barycentric coordinates for the corresponding - // face (3rd weight is always 1-sum of first two) - // only valid if same texel is valid in pGutterData - // pBaryData must be allocated by the user + /* BaryMap is a D3DXVECTOR2 per texel + * the 1st two barycentric coordinates for the corresponding + * face (3rd weight is always 1-sum of first two) + * only valid if same texel is valid in pGutterData + * pBaryData must be allocated by the user + */ STDMETHOD(GetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; - // TexelMap is a D3DXVECTOR2 per texel that - // stores the location in pixel coordinates where the - // corresponding texel is mapped - // pTexelData must be allocated by the user + /* TexelMap is a D3DXVECTOR2 per texel that + * stores the location in pixel coordinates where the + * corresponding texel is mapped + * pTexelData must be allocated by the user + */ STDMETHOD(GetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; - // GutterMap is a BYTE per texel - // 0/1/2 for Invalid/Internal/Gutter texels - // 4 represents a gutter texel that will be computed - // during PRT - // pGutterData must be allocated by the user + /* GutterMap is a BYTE per texel + * 0/1/2 for Invalid/Internal/Gutter texels + * 4 represents a gutter texel that will be computed + * during PRT + * pGutterData must be allocated by the user + */ STDMETHOD(GetGutterMap)(THIS_ BYTE *pGutterData) PURE; - // face map is a UINT per texel that represents the - // face of the mesh that texel belongs too - - // only valid if same texel is valid in pGutterData + /* face map is a UINT per texel that represents the + * face of the mesh that texel belongs too - + * only valid if same texel is valid in pGutterData + */ STDMETHOD(SetFaceMap)(THIS_ UINT *pFaceData) PURE; - // BaryMap is a D3DXVECTOR2 per texel - // the 1st two barycentric coordinates for the corresponding - // face (3rd weight is always 1-sum of first two) - // only valid if same texel is valid in pGutterData + /* BaryMap is a D3DXVECTOR2 per texel + * the 1st two barycentric coordinates for the corresponding + * face (3rd weight is always 1-sum of first two) + * only valid if same texel is valid in pGutterData + */ STDMETHOD(SetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; - // TexelMap is a D3DXVECTOR2 per texel that - // stores the location in pixel coordinates where the - // corresponding texel is mapped + /* TexelMap is a D3DXVECTOR2 per texel that + * stores the location in pixel coordinates where the + * corresponding texel is mapped + */ STDMETHOD(SetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; - // GutterMap is a BYTE per texel - // 0/1/2 for Invalid/Internal/Gutter texels - // 4 represents a gutter texel that will be computed - // during PRT + /* GutterMap is a BYTE per texel + * 0/1/2 for Invalid/Internal/Gutter texels + * 4 represents a gutter texel that will be computed + * during PRT + */ STDMETHOD(SetGutterMap)(THIS_ BYTE *pGutterData) PURE; }; @@ -1876,191 +1918,205 @@ typedef interface ID3DXPRTEngine *LPD3DXPRTENGINE; #undef INTERFACE #define INTERFACE ID3DXPRTEngine -// ID3DXPRTEngine is used to compute a PRT simulation -// Use the following steps to compute PRT for SH -// (1) create an interface (which includes a scene) -// (2) call SetSamplingInfo -// (3) [optional] Set MeshMaterials/albedo's (required if doing bounces) -// (4) call ComputeDirectLightingSH -// (5) [optional] call ComputeBounce -// repeat step 5 for as many bounces as wanted. -// if you want to model subsurface scattering you -// need to call ComputeSS after direct lighting and -// each bounce. -// If you want to bake the albedo into the PRT signal, you -// must call MutliplyAlbedo, otherwise the user has to multiply -// the albedo themselves. Not multiplying the albedo allows you -// to model albedo variation at a finer scale then illumination, and -// can result in better compression results. -// Luminance values are computed from RGB values using the following -// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 +/* ID3DXPRTEngine is used to compute a PRT simulation + * Use the following steps to compute PRT for SH + * (1) create an interface (which includes a scene) + * (2) call SetSamplingInfo + * (3) [optional] Set MeshMaterials/albedo's (required if doing bounces) + * (4) call ComputeDirectLightingSH + * (5) [optional] call ComputeBounce + * repeat step 5 for as many bounces as wanted. + * if you want to model subsurface scattering you + * need to call ComputeSS after direct lighting and + * each bounce. + * If you want to bake the albedo into the PRT signal, you + * must call MutliplyAlbedo, otherwise the user has to multiply + * the albedo themselves. Not multiplying the albedo allows you + * to model albedo variation at a finer scale then illumination, and + * can result in better compression results. + * Luminance values are computed from RGB values using the following + * formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + */ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) { - // IUnknown + /* IUnknown */ STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; - // ID3DXPRTEngine + /* ID3DXPRTEngine - // This sets a material per attribute in the scene mesh and it is - // the only way to specify subsurface scattering parameters. if - // bSetAlbedo is FALSE, NumChannels must match the current - // configuration of the PRTEngine. If you intend to change - // NumChannels (through some other SetAlbedo function) it must - // happen before SetMeshMaterials is called. - // - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects - // bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex - // albedo that might have been set before. FALSE won't clobber. - // fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube - // and scaled by this amount + * This sets a material per attribute in the scene mesh and it is + * the only way to specify subsurface scattering parameters. if + * bSetAlbedo is FALSE, NumChannels must match the current + * configuration of the PRTEngine. If you intend to change + * NumChannels (through some other SetAlbedo function) it must + * happen before SetMeshMaterials is called. + * + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + * bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex + * albedo that might have been set before. FALSE won't clobber. + * fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube + * and scaled by this amount + */ STDMETHOD(SetMeshMaterials)(THIS_ CONST D3DXSHMATERIAL **ppMaterials, UINT NumMeshes, UINT NumChannels, BOOL bSetAlbedo, FLOAT fLengthScale) PURE; - // setting albedo per-vertex or per-texel over rides the albedos stored per mesh - // but it does not over ride any other settings + /* setting albedo per-vertex or per-texel over rides the albedos stored per mesh + * but it does not over ride any other settings - // sets an albedo to be used per vertex - the albedo is represented as a float - // pDataIn input pointer (pointint to albedo of 1st sample) - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects - // Stride - stride in bytes to get to next samples albedo + * sets an albedo to be used per vertex - the albedo is represented as a float + * pDataIn input pointer (pointint to albedo of 1st sample) + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + * Stride - stride in bytes to get to next samples albedo + */ STDMETHOD(SetPerVertexAlbedo)(THIS_ CONST VOID *pDataIn, UINT NumChannels, UINT Stride) PURE; - // represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used) - // pAlbedoTexture - texture that stores the albedo (dimension arbitrary) - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects - // pGH - optional gutter helper, otherwise one is constructed in computation routines and - // destroyed (if not attached to buffers) + /* represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used) + * pAlbedoTexture - texture that stores the albedo (dimension arbitrary) + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + * pGH - optional gutter helper, otherwise one is constructed in computation routines and + * destroyed (if not attached to buffers) + */ STDMETHOD(SetPerTexelAlbedo)(THIS_ LPDIRECT3DTEXTURE9 pAlbedoTexture, UINT NumChannels, LPD3DXTEXTUREGUTTERHELPER pGH) PURE; - // gets the per-vertex albedo + /* gets the per-vertex albedo */ STDMETHOD(GetVertexAlbedo)(THIS_ D3DXCOLOR *pVertColors, UINT NumVerts) PURE; - // If pixel PRT is being computed normals default to ones that are interpolated - // from the vertex normals. This specifies a texture that stores an object - // space normal map instead (must use a texture format that can represent signed values) - // pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed + /* If pixel PRT is being computed normals default to ones that are interpolated + * from the vertex normals. This specifies a texture that stores an object + * space normal map instead (must use a texture format that can represent signed values) + * pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed + */ STDMETHOD(SetPerTexelNormal)(THIS_ LPDIRECT3DTEXTURE9 pNormalTexture) PURE; - // Copies per-vertex albedo from mesh - // pMesh - mesh that represents the scene. It must have the same - // properties as the mesh used to create the PRTEngine - // Usage - D3DDECLUSAGE to extract albedos from - // NumChannels 1 implies "grayscale" materials, set this to 3 to enable - // color bleeding effects + /* Copies per-vertex albedo from mesh + * pMesh - mesh that represents the scene. It must have the same + * properties as the mesh used to create the PRTEngine + * Usage - D3DDECLUSAGE to extract albedos from + * NumChannels 1 implies "grayscale" materials, set this to 3 to enable + * color bleeding effects + */ STDMETHOD(ExtractPerVertexAlbedo)(THIS_ LPD3DXMESH pMesh, D3DDECLUSAGE Usage, UINT NumChannels) PURE; - // Resamples the input buffer into the output buffer - // can be used to move between per-vertex and per-texel buffers. This can also be used - // to convert single channel buffers to 3-channel buffers and vice-versa. + /* Resamples the input buffer into the output buffer + * can be used to move between per-vertex and per-texel buffers. This can also be used + * to convert single channel buffers to 3-channel buffers and vice-versa. + */ STDMETHOD(ResampleBuffer)(THIS_ LPD3DXPRTBUFFER pBufferIn, LPD3DXPRTBUFFER pBufferOut) PURE; - // Returns the scene mesh - including modifications from adaptive spatial sampling - // The returned mesh only has positions, normals and texture coordinates (if defined) - // pD3DDevice - d3d device that will be used to allocate the mesh - // pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from - // if the face hasn't been subdivided this will be an identity mapping - // pVertRemap - each vertex contains 3 vertices that this is a linear combination of - // pVertWeights - weights for each of above indices (sum to 1.0f) - // ppMesh - mesh that will be allocated and filled + /* Returns the scene mesh - including modifications from adaptive spatial sampling + * The returned mesh only has positions, normals and texture coordinates (if defined) + * pD3DDevice - d3d device that will be used to allocate the mesh + * pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from + * if the face hasn't been subdivided this will be an identity mapping + * pVertRemap - each vertex contains 3 vertices that this is a linear combination of + * pVertWeights - weights for each of above indices (sum to 1.0f) + * ppMesh - mesh that will be allocated and filled + */ STDMETHOD(GetAdaptedMesh)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice,UINT *pFaceRemap, UINT *pVertRemap, FLOAT *pfVertWeights, LPD3DXMESH *ppMesh) PURE; - // Number of vertices currently allocated (includes new vertices from adaptive sampling) + /* Number of vertices currently allocated (includes new vertices from adaptive sampling) */ STDMETHOD_(UINT, GetNumVerts)(THIS) PURE; - // Number of faces currently allocated (includes new faces) + /* Number of faces currently allocated (includes new faces) */ STDMETHOD_(UINT, GetNumFaces)(THIS) PURE; - // Sets the Minimum/Maximum intersection distances, this can be used to control - // maximum distance that objects can shadow/reflect light, and help with "bad" - // art that might have near features that you don't want to shadow. This does not - // apply for GPU simulations. - // fMin - minimum intersection distance, must be positive and less than fMax - // fMax - maximum intersection distance, if 0.0f use the previous value, otherwise - // must be strictly greater than fMin + /* Sets the Minimum/Maximum intersection distances, this can be used to control + * maximum distance that objects can shadow/reflect light, and help with "bad" + * art that might have near features that you don't want to shadow. This does not + * apply for GPU simulations. + * fMin - minimum intersection distance, must be positive and less than fMax + * fMax - maximum intersection distance, if 0.0f use the previous value, otherwise + * must be strictly greater than fMin + */ STDMETHOD(SetMinMaxIntersection)(THIS_ FLOAT fMin, FLOAT fMax) PURE; - // This will subdivide faces on a mesh so that adaptively simulations can - // use a more conservative threshold (it won't miss features.) - // MinEdgeLength - minimum edge length that will be generated, if 0.0f a - // reasonable default will be used - // MaxSubdiv - maximum level of subdivision, if 0 is specified a default - // value will be used (5) + /* This will subdivide faces on a mesh so that adaptively simulations can + * use a more conservative threshold (it won't miss features.) + * MinEdgeLength - minimum edge length that will be generated, if 0.0f a + * reasonable default will be used + * MaxSubdiv - maximum level of subdivision, if 0 is specified a default + * value will be used (5) + */ STDMETHOD(RobustMeshRefine)(THIS_ FLOAT MinEdgeLength, UINT MaxSubdiv) PURE; - // This sets to sampling information used by the simulator. Adaptive sampling - // parameters are currently ignored. - // NumRays - number of rays to shoot per sample - // UseSphere - if TRUE uses spherical samples, otherwise samples over - // the hemisphere. Should only be used with GPU and Vol computations - // UseCosine - if TRUE uses a cosine weighting - not used for Vol computations - // or if only the visiblity function is desired - // Adaptive - if TRUE adaptive sampling (angular) is used - // AdaptiveThresh - threshold used to terminate adaptive angular sampling - // ignored if adaptive sampling is not set + /* This sets to sampling information used by the simulator. Adaptive sampling + * parameters are currently ignored. + * NumRays - number of rays to shoot per sample + * UseSphere - if TRUE uses spherical samples, otherwise samples over + * the hemisphere. Should only be used with GPU and Vol computations + * UseCosine - if TRUE uses a cosine weighting - not used for Vol computations + * or if only the visiblity function is desired + * Adaptive - if TRUE adaptive sampling (angular) is used + * AdaptiveThresh - threshold used to terminate adaptive angular sampling + * ignored if adaptive sampling is not set + */ STDMETHOD(SetSamplingInfo)(THIS_ UINT NumRays, BOOL UseSphere, BOOL UseCosine, BOOL Adaptive, FLOAT AdaptiveThresh) PURE; - // Methods that compute the direct lighting contribution for objects - // always represente light using spherical harmonics (SH) - // the albedo is not multiplied by the signal - it just integrates - // incoming light. If NumChannels is not 1 the vector is replicated - // - // SHOrder - order of SH to use - // pDataOut - PRT buffer that is generated. Can be single channel + /* Methods that compute the direct lighting contribution for objects + * always represente light using spherical harmonics (SH) + * the albedo is not multiplied by the signal - it just integrates + * incoming light. If NumChannels is not 1 the vector is replicated + * + * SHOrder - order of SH to use + * pDataOut - PRT buffer that is generated. Can be single channel + */ STDMETHOD(ComputeDirectLightingSH)(THIS_ UINT SHOrder, LPD3DXPRTBUFFER pDataOut) PURE; - // Adaptive variant of above function. This will refine the mesh - // generating new vertices/faces to approximate the PRT signal - // more faithfully. - // SHOrder - order of SH to use - // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) - // if value is less then 1e-6f, 1e-6f is specified - // MinEdgeLength - minimum edge length that will be generated - // if value is too small a fairly conservative model dependent value - // is used - // MaxSubdiv - maximum subdivision level, if 0 is specified it - // will default to 4 - // pDataOut - PRT buffer that is generated. Can be single channel. + /* Adaptive variant of above function. This will refine the mesh + * generating new vertices/faces to approximate the PRT signal + * more faithfully. + * SHOrder - order of SH to use + * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + * if value is less then 1e-6f, 1e-6f is specified + * MinEdgeLength - minimum edge length that will be generated + * if value is too small a fairly conservative model dependent value + * is used + * MaxSubdiv - maximum subdivision level, if 0 is specified it + * will default to 4 + * pDataOut - PRT buffer that is generated. Can be single channel. + */ STDMETHOD(ComputeDirectLightingSHAdaptive)(THIS_ UINT SHOrder, FLOAT AdaptiveThresh, FLOAT MinEdgeLength, UINT MaxSubdiv, LPD3DXPRTBUFFER pDataOut) PURE; - // Function that computes the direct lighting contribution for objects - // light is always represented using spherical harmonics (SH) - // This is done on the GPU and is much faster then using the CPU. - // The albedo is not multiplied by the signal - it just integrates - // incoming light. If NumChannels is not 1 the vector is replicated. - // ZBias/ZAngleBias are akin to parameters used with shadow zbuffers. - // A reasonable default for both values is 0.005, but the user should - // experiment (ZAngleBias can be zero, ZBias should not be.) - // Callbacks should not use the Direct3D9Device the simulator is using. - // SetSamplingInfo must be called with TRUE for UseSphere and - // FALSE for UseCosine before this method is called. - // - // pD3DDevice - device used to run GPU simulator - must support PS2.0 - // and FP render targets - // Flags - parameters for the GPU simulator, combination of one or more - // D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and - // the defaults is 512 - // SHOrder - order of SH to use - // ZBias - bias in normal direction (for depth test) - // ZAngleBias - scaled by one minus cosine of angle with light (offset in depth) - // pDataOut - PRT buffer that is filled in. Can be single channel + /* Function that computes the direct lighting contribution for objects + * light is always represented using spherical harmonics (SH) + * This is done on the GPU and is much faster then using the CPU. + * The albedo is not multiplied by the signal - it just integrates + * incoming light. If NumChannels is not 1 the vector is replicated. + * ZBias/ZAngleBias are akin to parameters used with shadow zbuffers. + * A reasonable default for both values is 0.005, but the user should + * experiment (ZAngleBias can be zero, ZBias should not be.) + * Callbacks should not use the Direct3D9Device the simulator is using. + * SetSamplingInfo must be called with TRUE for UseSphere and + * FALSE for UseCosine before this method is called. + * + * pD3DDevice - device used to run GPU simulator - must support PS2.0 + * and FP render targets + * Flags - parameters for the GPU simulator, combination of one or more + * D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and + * the defaults is 512 + * SHOrder - order of SH to use + * ZBias - bias in normal direction (for depth test) + * ZAngleBias - scaled by one minus cosine of angle with light (offset in depth) + * pDataOut - PRT buffer that is filled in. Can be single channel + */ STDMETHOD(ComputeDirectLightingSHGPU)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice, UINT Flags, UINT SHOrder, @@ -2069,57 +2125,61 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut) PURE; - // Functions that computes subsurface scattering (using material properties) - // Albedo is not multiplied by result. This only works for per-vertex data - // use ResampleBuffer to move per-vertex data into a texture and back. - // - // pDataIn - input data (previous bounce) - // pDataOut - result of subsurface scattering simulation - // pDataTotal - [optional] results can be summed into this buffer + /* Functions that computes subsurface scattering (using material properties) + * Albedo is not multiplied by result. This only works for per-vertex data + * use ResampleBuffer to move per-vertex data into a texture and back. + * + * pDataIn - input data (previous bounce) + * pDataOut - result of subsurface scattering simulation + * pDataTotal - [optional] results can be summed into this buffer + */ STDMETHOD(ComputeSS)(THIS_ LPD3DXPRTBUFFER pDataIn, LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Adaptive version of ComputeSS. - // - // pDataIn - input data (previous bounce) - // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) - // if value is less then 1e-6f, 1e-6f is specified - // MinEdgeLength - minimum edge length that will be generated - // if value is too small a fairly conservative model dependent value - // is used - // MaxSubdiv - maximum subdivision level, if 0 is specified it - // will default to 4 - // pDataOut - result of subsurface scattering simulation - // pDataTotal - [optional] results can be summed into this buffer + /* Adaptive version of ComputeSS. + * + * pDataIn - input data (previous bounce) + * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + * if value is less then 1e-6f, 1e-6f is specified + * MinEdgeLength - minimum edge length that will be generated + * if value is too small a fairly conservative model dependent value + * is used + * MaxSubdiv - maximum subdivision level, if 0 is specified it + * will default to 4 + * pDataOut - result of subsurface scattering simulation + * pDataTotal - [optional] results can be summed into this buffer + */ STDMETHOD(ComputeSSAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, FLOAT AdaptiveThresh, FLOAT MinEdgeLength, UINT MaxSubdiv, LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // computes a single bounce of inter-reflected light - // works for SH based PRT or generic lighting - // Albedo is not multiplied by result - // - // pDataIn - previous bounces data - // pDataOut - PRT buffer that is generated - // pDataTotal - [optional] can be used to keep a running sum + /* computes a single bounce of inter-reflected light + * works for SH based PRT or generic lighting + * Albedo is not multiplied by result + * + * pDataIn - previous bounces data + * pDataOut - PRT buffer that is generated + * pDataTotal - [optional] can be used to keep a running sum + */ STDMETHOD(ComputeBounce)(THIS_ LPD3DXPRTBUFFER pDataIn, LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Adaptive version of above function. - // - // pDataIn - previous bounces data, can be single channel - // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) - // if value is less then 1e-6f, 1e-6f is specified - // MinEdgeLength - minimum edge length that will be generated - // if value is too small a fairly conservative model dependent value - // is used - // MaxSubdiv - maximum subdivision level, if 0 is specified it - // will default to 4 - // pDataOut - PRT buffer that is generated - // pDataTotal - [optional] can be used to keep a running sum + /* Adaptive version of above function. + * + * pDataIn - previous bounces data, can be single channel + * AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + * if value is less then 1e-6f, 1e-6f is specified + * MinEdgeLength - minimum edge length that will be generated + * if value is too small a fairly conservative model dependent value + * is used + * MaxSubdiv - maximum subdivision level, if 0 is specified it + * will default to 4 + * pDataOut - PRT buffer that is generated + * pDataTotal - [optional] can be used to keep a running sum + */ STDMETHOD(ComputeBounceAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, FLOAT AdaptiveThresh, FLOAT MinEdgeLength, @@ -2127,65 +2187,68 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Computes projection of distant SH radiance into a local SH radiance - // function. This models how direct lighting is attenuated by the - // scene and is a form of "neighborhood transfer." The result is - // a linear operator (matrix) at every sample point, if you multiply - // this matrix by the distant SH lighting coefficients you get an - // approximation of the local incident radiance function from - // direct lighting. These resulting lighting coefficients can - // than be projected into another basis or used with any rendering - // technique that uses spherical harmonics as input. - // SetSamplingInfo must be called with TRUE for UseSphere and - // FALSE for UseCosine before this method is called. - // Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars - // per channel at each sample location. - // - // SHOrderIn - Order of the SH representation of distant lighting - // SHOrderOut - Order of the SH representation of local lighting - // NumVolSamples - Number of sample locations - // pSampleLocs - position of sample locations - // pDataOut - PRT Buffer that will store output results + /* Computes projection of distant SH radiance into a local SH radiance + * function. This models how direct lighting is attenuated by the + * scene and is a form of "neighborhood transfer." The result is + * a linear operator (matrix) at every sample point, if you multiply + * this matrix by the distant SH lighting coefficients you get an + * approximation of the local incident radiance function from + * direct lighting. These resulting lighting coefficients can + * than be projected into another basis or used with any rendering + * technique that uses spherical harmonics as input. + * SetSamplingInfo must be called with TRUE for UseSphere and + * FALSE for UseCosine before this method is called. + * Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars + * per channel at each sample location. + * + * SHOrderIn - Order of the SH representation of distant lighting + * SHOrderOut - Order of the SH representation of local lighting + * NumVolSamples - Number of sample locations + * pSampleLocs - position of sample locations + * pDataOut - PRT Buffer that will store output results + */ STDMETHOD(ComputeVolumeSamplesDirectSH)(THIS_ UINT SHOrderIn, UINT SHOrderOut, UINT NumVolSamples, CONST D3DXVECTOR3 *pSampleLocs, LPD3DXPRTBUFFER pDataOut) PURE; - // At each sample location computes a linear operator (matrix) that maps - // the representation of source radiance (NumCoeffs in pSurfDataIn) - // into a local incident radiance function approximated with spherical - // harmonics. For example if a light map data is specified in pSurfDataIn - // the result is an SH representation of the flow of light at each sample - // point. If PRT data for an outdoor scene is used, each sample point - // contains a matrix that models how distant lighting bounces of the objects - // in the scene and arrives at the given sample point. Combined with - // ComputeVolumeSamplesDirectSH this gives the complete representation for - // how light arrives at each sample point parameterized by distant lighting. - // SetSamplingInfo must be called with TRUE for UseSphere and - // FALSE for UseCosine before this method is called. - // Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars - // per channel at each sample location. - // - // pSurfDataIn - previous bounce data - // SHOrder - order of SH to generate projection with - // NumVolSamples - Number of sample locations - // pSampleLocs - position of sample locations - // pDataOut - PRT Buffer that will store output results + /* At each sample location computes a linear operator (matrix) that maps + * the representation of source radiance (NumCoeffs in pSurfDataIn) + * into a local incident radiance function approximated with spherical + * harmonics. For example if a light map data is specified in pSurfDataIn + * the result is an SH representation of the flow of light at each sample + * point. If PRT data for an outdoor scene is used, each sample point + * contains a matrix that models how distant lighting bounces of the objects + * in the scene and arrives at the given sample point. Combined with + * ComputeVolumeSamplesDirectSH this gives the complete representation for + * how light arrives at each sample point parameterized by distant lighting. + * SetSamplingInfo must be called with TRUE for UseSphere and + * FALSE for UseCosine before this method is called. + * Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars + * per channel at each sample location. + * + * pSurfDataIn - previous bounce data + * SHOrder - order of SH to generate projection with + * NumVolSamples - Number of sample locations + * pSampleLocs - position of sample locations + * pDataOut - PRT Buffer that will store output results + */ STDMETHOD(ComputeVolumeSamples)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, UINT SHOrder, UINT NumVolSamples, CONST D3DXVECTOR3 *pSampleLocs, LPD3DXPRTBUFFER pDataOut) PURE; - // Computes direct lighting (SH) for a point not on the mesh - // with a given normal - cannot use texture buffers. - // - // SHOrder - order of SH to use - // NumSamples - number of sample locations - // pSampleLocs - position for each sample - // pSampleNorms - normal for each sample - // pDataOut - PRT Buffer that will store output results + /* Computes direct lighting (SH) for a point not on the mesh + * with a given normal - cannot use texture buffers. + * + * SHOrder - order of SH to use + * NumSamples - number of sample locations + * pSampleLocs - position for each sample + * pSampleNorms - normal for each sample + * pDataOut - PRT Buffer that will store output results + */ STDMETHOD(ComputeSurfSamplesDirectSH)(THIS_ UINT SHOrder, UINT NumSamples, CONST D3DXVECTOR3 *pSampleLocs, @@ -2193,15 +2256,16 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut) PURE; - // given the solution for PRT or light maps, computes transfer vector at arbitrary - // position/normal pairs in space - // - // pSurfDataIn - input data - // NumSamples - number of sample locations - // pSampleLocs - position for each sample - // pSampleNorms - normal for each sample - // pDataOut - PRT Buffer that will store output results - // pDataTotal - optional buffer to sum results into - can be NULL + /* given the solution for PRT or light maps, computes transfer vector at arbitrary + * position/normal pairs in space + * + * pSurfDataIn - input data + * NumSamples - number of sample locations + * pSampleLocs - position for each sample + * pSampleNorms - normal for each sample + * pDataOut - PRT Buffer that will store output results + * pDataTotal - optional buffer to sum results into - can be NULL + */ STDMETHOD(ComputeSurfSamplesBounce)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, UINT NumSamples, CONST D3DXVECTOR3 *pSampleLocs, @@ -2209,112 +2273,120 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; - // Frees temporary data structures that can be created for subsurface scattering - // this data is freed when the PRTComputeEngine is freed and is lazily created + /* Frees temporary data structures that can be created for subsurface scattering + * this data is freed when the PRTComputeEngine is freed and is lazily created + */ STDMETHOD(FreeSSData)(THIS) PURE; - // Frees temporary data structures that can be created for bounce simulations - // this data is freed when the PRTComputeEngine is freed and is lazily created + /* Frees temporary data structures that can be created for bounce simulations + * this data is freed when the PRTComputeEngine is freed and is lazily created + */ STDMETHOD(FreeBounceData)(THIS) PURE; - // This computes the Local Deformable PRT (LDPRT) coefficients relative to the - // per sample normals that minimize error in a least squares sense with respect - // to the input PRT data set. These coefficients can be used with skinned/transformed - // normals to model global effects with dynamic objects. Shading normals can - // optionally be solved for - these normals (along with the LDPRT coefficients) can - // more accurately represent the PRT signal. The coefficients are for zonal - // harmonics oriented in the normal/shading normal direction. - // - // pDataIn - SH PRT dataset that is input - // SHOrder - Order of SH to compute conv coefficients for - // pNormOut - Optional array of vectors (passed in) that will be filled with - // "shading normals", LDPRT coefficients are optimized for - // these normals. This array must be the same size as the number of - // samples in pDataIn - // pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample) + /* This computes the Local Deformable PRT (LDPRT) coefficients relative to the + * per sample normals that minimize error in a least squares sense with respect + * to the input PRT data set. These coefficients can be used with skinned/transformed + * normals to model global effects with dynamic objects. Shading normals can + * optionally be solved for - these normals (along with the LDPRT coefficients) can + * more accurately represent the PRT signal. The coefficients are for zonal + * harmonics oriented in the normal/shading normal direction. + * + * pDataIn - SH PRT dataset that is input + * SHOrder - Order of SH to compute conv coefficients for + * pNormOut - Optional array of vectors (passed in) that will be filled with + * "shading normals", LDPRT coefficients are optimized for + * these normals. This array must be the same size as the number of + * samples in pDataIn + * pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample) + */ STDMETHOD(ComputeLDPRTCoeffs)(THIS_ LPD3DXPRTBUFFER pDataIn, UINT SHOrder, D3DXVECTOR3 *pNormOut, LPD3DXPRTBUFFER pDataOut) PURE; - // scales all the samples associated with a given sub mesh - // can be useful when using subsurface scattering - // fScale - value to scale each vector in submesh by + /* scales all the samples associated with a given sub mesh + * can be useful when using subsurface scattering + * fScale - value to scale each vector in submesh by + */ STDMETHOD(ScaleMeshChunk)(THIS_ UINT uMeshChunk, FLOAT fScale, LPD3DXPRTBUFFER pDataOut) PURE; - // mutliplies each PRT vector by the albedo - can be used if you want to have the albedo - // burned into the dataset, often better not to do this. If this is not done the user - // must mutliply the albedo themselves when rendering - just multiply the albedo times - // the result of the PRT dot product. - // If pDataOut is a texture simulation result and there is an albedo texture it - // must be represented at the same resolution as the simulation buffer. You can use - // LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must - // be careful about how the gutters are handled. - // - // pDataOut - dataset that will get albedo pushed into it + /* mutliplies each PRT vector by the albedo - can be used if you want to have the albedo + * burned into the dataset, often better not to do this. If this is not done the user + * must mutliply the albedo themselves when rendering - just multiply the albedo times + * the result of the PRT dot product. + * If pDataOut is a texture simulation result and there is an albedo texture it + * must be represented at the same resolution as the simulation buffer. You can use + * LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must + * be careful about how the gutters are handled. + * + * pDataOut - dataset that will get albedo pushed into it + */ STDMETHOD(MultiplyAlbedo)(THIS_ LPD3DXPRTBUFFER pDataOut) PURE; - // Sets a pointer to an optional call back function that reports back to the - // user percentage done and gives them the option of quitting - // pCB - pointer to call back function, return S_OK for the simulation - // to continue - // Frequency - 1/Frequency is roughly the number of times the call back - // will be invoked - // lpUserContext - will be passed back to the users call back + /* Sets a pointer to an optional call back function that reports back to the + * user percentage done and gives them the option of quitting + * pCB - pointer to call back function, return S_OK for the simulation + * to continue + * Frequency - 1/Frequency is roughly the number of times the call back + * will be invoked + * lpUserContext - will be passed back to the users call back + */ STDMETHOD(SetCallBack)(THIS_ LPD3DXSHPRTSIMCB pCB, FLOAT Frequency, LPVOID lpUserContext) PURE; - // Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function - // takes into account settings from SetMinMaxIntersection. If the closest intersection - // is not needed this function is more efficient compared to the ClosestRayIntersection - // method. - // pRayPos - origin of ray - // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + /* Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function + * takes into account settings from SetMinMaxIntersection. If the closest intersection + * is not needed this function is more efficient compared to the ClosestRayIntersection + * method. + * pRayPos - origin of ray + * pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + */ STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir) PURE; - // Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an - // intersection the closest face that was intersected and its first two barycentric coordinates - // are returned. This function takes into account settings from SetMinMaxIntersection. - // This is a slower function compared to ShadowRayIntersects and should only be used where - // needed. The third vertices barycentric coordinates will be 1 - pU - pV. - // pRayPos - origin of ray - // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) - // pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh - // faces before the faces from pMesh - // pU - Barycentric coordinate for vertex 0 - // pV - Barycentric coordinate for vertex 1 - // pDist - Distance along ray where the intersection occured + /* Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an + * intersection the closest face that was intersected and its first two barycentric coordinates + * are returned. This function takes into account settings from SetMinMaxIntersection. + * This is a slower function compared to ShadowRayIntersects and should only be used where + * needed. The third vertices barycentric coordinates will be 1 - pU - pV. + * pRayPos - origin of ray + * pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + * pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh + * faces before the faces from pMesh + * pU - Barycentric coordinate for vertex 0 + * pV - Barycentric coordinate for vertex 1 + * pDist - Distance along ray where the intersection occured + */ STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist) PURE; }; -// API functions for creating interfaces +/* API functions for creating interfaces */ #ifdef __cplusplus extern "C" { -#endif //__cplusplus +#endif /* __cplusplus */ -//============================================================================ -// -// D3DXCreatePRTBuffer: -// -------------------- -// Generates a PRT Buffer that can be compressed or filled by a simulator -// This function should be used to create per-vertex or volume buffers. -// When buffers are created all values are initialized to zero. -// -// Parameters: -// NumSamples -// Number of sample locations represented -// NumCoeffs -// Number of coefficients per sample location (order^2 for SH) -// NumChannels -// Number of color channels to represent (1 or 3) -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXCreatePRTBuffer: + * -------------------- + * Generates a PRT Buffer that can be compressed or filled by a simulator + * This function should be used to create per-vertex or volume buffers. + * When buffers are created all values are initialized to zero. + * + * Parameters: + * NumSamples + * Number of sample locations represented + * NumCoeffs + * Number of coefficients per sample location (order^2 for SH) + * NumChannels + * Number of color channels to represent (1 or 3) + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXCreatePRTBuffer( @@ -2323,27 +2395,27 @@ HRESULT WINAPI UINT NumChannels, LPD3DXPRTBUFFER* ppBuffer); -//============================================================================ -// -// D3DXCreatePRTBufferTex: -// -------------------- -// Generates a PRT Buffer that can be compressed or filled by a simulator -// This function should be used to create per-pixel buffers. -// When buffers are created all values are initialized to zero. -// -// Parameters: -// Width -// Width of texture -// Height -// Height of texture -// NumCoeffs -// Number of coefficients per sample location (order^2 for SH) -// NumChannels -// Number of color channels to represent (1 or 3) -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXCreatePRTBufferTex: + * -------------------- + * Generates a PRT Buffer that can be compressed or filled by a simulator + * This function should be used to create per-pixel buffers. + * When buffers are created all values are initialized to zero. + * + * Parameters: + * Width + * Width of texture + * Height + * Height of texture + * NumCoeffs + * Number of coefficients per sample location (order^2 for SH) + * NumChannels + * Number of color channels to represent (1 or 3) + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXCreatePRTBufferTex( @@ -2353,19 +2425,19 @@ HRESULT WINAPI UINT NumChannels, LPD3DXPRTBUFFER* ppBuffer); -//============================================================================ -// -// D3DXLoadPRTBufferFromFile: -// -------------------- -// Loads a PRT buffer that has been saved to disk. -// -// Parameters: -// pFilename -// Name of the file to load -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXLoadPRTBufferFromFile: + * -------------------- + * Loads a PRT buffer that has been saved to disk. + * + * Parameters: + * pFilename + * Name of the file to load + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXLoadPRTBufferFromFileA( @@ -2384,19 +2456,19 @@ HRESULT WINAPI #endif -//============================================================================ -// -// D3DXSavePRTBufferToFile: -// -------------------- -// Saves a PRTBuffer to disk. -// -// Parameters: -// pFilename -// Name of the file to save -// pBuffer -// Buffer that will be saved -// -//============================================================================ +/* + * + * D3DXSavePRTBufferToFile: + * -------------------- + * Saves a PRTBuffer to disk. + * + * Parameters: + * pFilename + * Name of the file to save + * pBuffer + * Buffer that will be saved + * + */ HRESULT WINAPI D3DXSavePRTBufferToFileA( @@ -2415,19 +2487,19 @@ HRESULT WINAPI #endif -//============================================================================ -// -// D3DXLoadPRTCompBufferFromFile: -// -------------------- -// Loads a PRTComp buffer that has been saved to disk. -// -// Parameters: -// pFilename -// Name of the file to load -// ppBuffer -// Buffer that will be allocated -// -//============================================================================ +/* + * + * D3DXLoadPRTCompBufferFromFile: + * -------------------- + * Loads a PRTComp buffer that has been saved to disk. + * + * Parameters: + * pFilename + * Name of the file to load + * ppBuffer + * Buffer that will be allocated + * + */ HRESULT WINAPI D3DXLoadPRTCompBufferFromFileA( @@ -2445,19 +2517,19 @@ HRESULT WINAPI #define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileA #endif -//============================================================================ -// -// D3DXSavePRTCompBufferToFile: -// -------------------- -// Saves a PRTCompBuffer to disk. -// -// Parameters: -// pFilename -// Name of the file to save -// pBuffer -// Buffer that will be saved -// -//============================================================================ +/* + * + * D3DXSavePRTCompBufferToFile: + * -------------------- + * Saves a PRTCompBuffer to disk. + * + * Parameters: + * pFilename + * Name of the file to save + * pBuffer + * Buffer that will be saved + * + */ HRESULT WINAPI D3DXSavePRTCompBufferToFileA( @@ -2475,30 +2547,30 @@ HRESULT WINAPI #define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileA #endif -//============================================================================ -// -// D3DXCreatePRTCompBuffer: -// -------------------- -// Compresses a PRT buffer (vertex or texel) -// -// Parameters: -// D3DXSHCOMPRESSQUALITYTYPE -// Quality of compression - low is faster (computes PCA per voronoi cluster) -// high is slower but better quality (clusters based on distance to affine subspace) -// NumClusters -// Number of clusters to compute -// NumPCA -// Number of basis vectors to compute -// pCB -// Optional Callback function -// lpUserContext -// Optional user context -// pBufferIn -// Buffer that will be compressed -// ppBufferOut -// Compressed buffer that will be created -// -//============================================================================ +/* + * + * D3DXCreatePRTCompBuffer: + * -------------------- + * Compresses a PRT buffer (vertex or texel) + * + * Parameters: + * D3DXSHCOMPRESSQUALITYTYPE + * Quality of compression - low is faster (computes PCA per voronoi cluster) + * high is slower but better quality (clusters based on distance to affine subspace) + * NumClusters + * Number of clusters to compute + * NumPCA + * Number of basis vectors to compute + * pCB + * Optional Callback function + * lpUserContext + * Optional user context + * pBufferIn + * Buffer that will be compressed + * ppBufferOut + * Compressed buffer that will be created + * + */ HRESULT WINAPI @@ -2512,27 +2584,28 @@ HRESULT WINAPI LPD3DXPRTCOMPBUFFER *ppBufferOut ); -//============================================================================ -// -// D3DXCreateTextureGutterHelper: -// -------------------- -// Generates a "GutterHelper" for a given set of meshes and texture -// resolution -// -// Parameters: -// Width -// Width of texture -// Height -// Height of texture -// pMesh -// Mesh that represents the scene -// GutterSize -// Number of texels to over rasterize in texture space -// this should be at least 1.0 -// ppBuffer -// GutterHelper that will be created -// -//============================================================================ +/* + * + * D3DXCreateTextureGutterHelper: + * -------------------- + * Generates a "GutterHelper" for a given set of meshes and texture + * resolution + * + * Parameters: + * Width + * Width of texture + * Height + * Height of texture + * pMesh + * Mesh that represents the scene + * GutterSize + * Number of texels to over rasterize in texture space + * this should be at least 1.0 + * ppBuffer + * GutterHelper that will be created + * + * + */ HRESULT WINAPI @@ -2544,28 +2617,28 @@ HRESULT WINAPI LPD3DXTEXTUREGUTTERHELPER* ppBuffer); -//============================================================================ -// -// D3DXCreatePRTEngine: -// -------------------- -// Computes a PRTEngine which can efficiently generate PRT simulations -// of a scene -// -// Parameters: -// pMesh -// Mesh that represents the scene - must have an AttributeTable -// where vertices are in a unique attribute. -// pAdjacency -// Optional adjacency information -// ExtractUVs -// Set this to true if textures are going to be used for albedos -// or to store PRT vectors -// pBlockerMesh -// Optional mesh that just blocks the scene -// ppEngine -// PRTEngine that will be created -// -//============================================================================ +/* + * + * D3DXCreatePRTEngine: + * -------------------- + * Computes a PRTEngine which can efficiently generate PRT simulations + * of a scene + * + * Parameters: + * pMesh + * Mesh that represents the scene - must have an AttributeTable + * where vertices are in a unique attribute. + * pAdjacency + * Optional adjacency information + * ExtractUVs + * Set this to true if textures are going to be used for albedos + * or to store PRT vectors + * pBlockerMesh + * Optional mesh that just blocks the scene + * ppEngine + * PRTEngine that will be created + * + */ HRESULT WINAPI @@ -2576,38 +2649,38 @@ HRESULT WINAPI LPD3DXMESH pBlockerMesh, LPD3DXPRTENGINE* ppEngine); -//============================================================================ -// -// D3DXConcatenateMeshes: -// -------------------- -// Concatenates a group of meshes into one common mesh. This can optionaly transform -// each sub mesh or its texture coordinates. If no DECL is given it will -// generate a union of all of the DECL's of the sub meshes, promoting channels -// and types if neccesary. It will create an AttributeTable if possible, one can -// call OptimizeMesh with attribute sort and compacting enabled to ensure this. -// -// Parameters: -// ppMeshes -// Array of pointers to meshes that can store PRT vectors -// NumMeshes -// Number of meshes -// Options -// Passed through to D3DXCreateMesh -// pGeomXForms -// [optional] Each sub mesh is transformed by the corresponding -// matrix if this array is supplied -// pTextureXForms -// [optional] UV coordinates for each sub mesh are transformed -// by corresponding matrix if supplied -// pDecl -// [optional] Only information in this DECL is used when merging -// data -// pD3DDevice -// D3D device that is used to create the new mesh -// ppMeshOut -// Mesh that will be created -// -//============================================================================ +/* + * + * D3DXConcatenateMeshes: + * -------------------- + * Concatenates a group of meshes into one common mesh. This can optionaly transform + * each sub mesh or its texture coordinates. If no DECL is given it will + * generate a union of all of the DECL's of the sub meshes, promoting channels + * and types if neccesary. It will create an AttributeTable if possible, one can + * call OptimizeMesh with attribute sort and compacting enabled to ensure this. + * + * Parameters: + * ppMeshes + * Array of pointers to meshes that can store PRT vectors + * NumMeshes + * Number of meshes + * Options + * Passed through to D3DXCreateMesh + * pGeomXForms + * [optional] Each sub mesh is transformed by the corresponding + * matrix if this array is supplied + * pTextureXForms + * [optional] UV coordinates for each sub mesh are transformed + * by corresponding matrix if supplied + * pDecl + * [optional] Only information in this DECL is used when merging + * data + * pD3DDevice + * D3D device that is used to create the new mesh + * ppMeshOut + * Mesh that will be created + * + */ HRESULT WINAPI @@ -2621,31 +2694,31 @@ HRESULT WINAPI LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH *ppMeshOut); -//============================================================================ -// -// D3DXSHPRTCompSuperCluster: -// -------------------------- -// Used with compressed results of D3DXSHPRTSimulation. -// Generates "super clusters" - groups of clusters that can be drawn in -// the same draw call. A greedy algorithm that minimizes overdraw is used -// to group the clusters. -// -// Parameters: -// pClusterIDs -// NumVerts cluster ID's (extracted from a compressed buffer) -// pScene -// Mesh that represents composite scene passed to the simulator -// MaxNumClusters -// Maximum number of clusters allocated per super cluster -// NumClusters -// Number of clusters computed in the simulator -// pSuperClusterIDs -// Array of length NumClusters, contains index of super cluster -// that corresponding cluster was assigned to -// pNumSuperClusters -// Returns the number of super clusters allocated -// -//============================================================================ +/* + * + * D3DXSHPRTCompSuperCluster: + * -------------------------- + * Used with compressed results of D3DXSHPRTSimulation. + * Generates "super clusters" - groups of clusters that can be drawn in + * the same draw call. A greedy algorithm that minimizes overdraw is used + * to group the clusters. + * + * Parameters: + * pClusterIDs + * NumVerts cluster ID's (extracted from a compressed buffer) + * pScene + * Mesh that represents composite scene passed to the simulator + * MaxNumClusters + * Maximum number of clusters allocated per super cluster + * NumClusters + * Number of clusters computed in the simulator + * pSuperClusterIDs + * Array of length NumClusters, contains index of super cluster + * that corresponding cluster was assigned to + * pNumSuperClusters + * Returns the number of super clusters allocated + * + */ HRESULT WINAPI D3DXSHPRTCompSuperCluster( @@ -2656,60 +2729,60 @@ HRESULT WINAPI UINT *pSuperClusterIDs, UINT *pNumSuperClusters); -//============================================================================ -// -// D3DXSHPRTCompSplitMeshSC: -// ------------------------- -// Used with compressed results of the vertex version of the PRT simulator. -// After D3DXSHRTCompSuperCluster has been called this function can be used -// to split the mesh into a group of faces/vertices per super cluster. -// Each super cluster contains all of the faces that contain any vertex -// classified in one of its clusters. All of the vertices connected to this -// set of faces are also included with the returned array ppVertStatus -// indicating whether or not the vertex belongs to the supercluster. -// -// Parameters: -// pClusterIDs -// NumVerts cluster ID's (extracted from a compressed buffer) -// NumVertices -// Number of vertices in original mesh -// NumClusters -// Number of clusters (input parameter to compression) -// pSuperClusterIDs -// Array of size NumClusters that will contain super cluster ID's (from -// D3DXSHCompSuerCluster) -// NumSuperClusters -// Number of superclusters allocated in D3DXSHCompSuerCluster -// pInputIB -// Raw index buffer for mesh - format depends on bInputIBIs32Bit -// InputIBIs32Bit -// Indicates whether the input index buffer is 32-bit (otherwise 16-bit -// is assumed) -// NumFaces -// Number of faces in the original mesh (pInputIB is 3 times this length) -// ppIBData -// LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces. -// Format determined by bIBIs32Bit. Allocated by function -// pIBDataLength -// Length of ppIBData, assigned in function -// OutputIBIs32Bit -// Indicates whether the output index buffer is to be 32-bit (otherwise -// 16-bit is assumed) -// ppFaceRemap -// LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is -// *pIBDataLength/3. Optional paramter, allocated in function -// ppVertData -// LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength -// pVertDataLength -// Number of new vertices in split mesh. Assigned in function -// pSCClusterList -// Array of length NumClusters which pSCData indexes into (Cluster* fields) -// for each SC, contains clusters sorted by super cluster -// pSCData -// Structure per super cluster - contains indices into ppIBData, -// pSCClusterList and ppVertData -// -//============================================================================ +/* + * + * D3DXSHPRTCompSplitMeshSC: + * ------------------------- + * Used with compressed results of the vertex version of the PRT simulator. + * After D3DXSHRTCompSuperCluster has been called this function can be used + * to split the mesh into a group of faces/vertices per super cluster. + * Each super cluster contains all of the faces that contain any vertex + * classified in one of its clusters. All of the vertices connected to this + * set of faces are also included with the returned array ppVertStatus + * indicating whether or not the vertex belongs to the supercluster. + * + * Parameters: + * pClusterIDs + * NumVerts cluster ID's (extracted from a compressed buffer) + * NumVertices + * Number of vertices in original mesh + * NumClusters + * Number of clusters (input parameter to compression) + * pSuperClusterIDs + * Array of size NumClusters that will contain super cluster ID's (from + * D3DXSHCompSuerCluster) + * NumSuperClusters + * Number of superclusters allocated in D3DXSHCompSuerCluster + * pInputIB + * Raw index buffer for mesh - format depends on bInputIBIs32Bit + * InputIBIs32Bit + * Indicates whether the input index buffer is 32-bit (otherwise 16-bit + * is assumed) + * NumFaces + * Number of faces in the original mesh (pInputIB is 3 times this length) + * ppIBData + * LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces. + * Format determined by bIBIs32Bit. Allocated by function + * pIBDataLength + * Length of ppIBData, assigned in function + * OutputIBIs32Bit + * Indicates whether the output index buffer is to be 32-bit (otherwise + * 16-bit is assumed) + * ppFaceRemap + * LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is + * *pIBDataLength/3. Optional paramter, allocated in function + * ppVertData + * LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength + * pVertDataLength + * Number of new vertices in split mesh. Assigned in function + * pSCClusterList + * Array of length NumClusters which pSCData indexes into (Cluster* fields) + * for each SC, contains clusters sorted by super cluster + * pSCData + * Structure per super cluster - contains indices into ppIBData, + * pSCClusterList and ppVertData + * + */ HRESULT WINAPI D3DXSHPRTCompSplitMeshSC( @@ -2749,63 +2822,63 @@ DEFINE_GUID(DXFILEOBJ_XSkinMeshHeader, DEFINE_GUID(DXFILEOBJ_VertexDuplicationIndices, 0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3); -// {A64C844A-E282-4756-8B80-250CDE04398C} +/* {A64C844A-E282-4756-8B80-250CDE04398C} */ DEFINE_GUID(DXFILEOBJ_FaceAdjacency, 0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0xc, 0xde, 0x4, 0x39, 0x8c); -// {6F0D123B-BAD2-4167-A0D0-80224F25FABB} +/* {6F0D123B-BAD2-4167-A0D0-80224F25FABB} */ DEFINE_GUID(DXFILEOBJ_SkinWeights, 0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb); -// {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} +/* {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} */ DEFINE_GUID(DXFILEOBJ_Patch, 0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6); -// {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} +/* {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} */ DEFINE_GUID(DXFILEOBJ_PatchMesh, 0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4b, 0xbf); -// {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} +/* {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} */ DEFINE_GUID(DXFILEOBJ_PatchMesh9, 0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x2, 0xc0, 0xea); -// {B6C3E656-EC8B-4b92-9B62-681659522947} +/* {B6C3E656-EC8B-4b92-9B62-681659522947} */ DEFINE_GUID(DXFILEOBJ_PMInfo, 0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47); -// {917E0427-C61E-4a14-9C64-AFE65F9E9844} +/* {917E0427-C61E-4a14-9C64-AFE65F9E9844} */ DEFINE_GUID(DXFILEOBJ_PMAttributeRange, 0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44); -// {574CCC14-F0B3-4333-822D-93E8A8A08E4C} +/* {574CCC14-F0B3-4333-822D-93E8A8A08E4C} */ DEFINE_GUID(DXFILEOBJ_PMVSplitRecord, 0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c); -// {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} +/* {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} */ DEFINE_GUID(DXFILEOBJ_FVFData, 0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97); -// {F752461C-1E23-48f6-B9F8-8350850F336F} +/* {F752461C-1E23-48f6-B9F8-8350850F336F} */ DEFINE_GUID(DXFILEOBJ_VertexElement, 0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0xf, 0x33, 0x6f); -// {BF22E553-292C-4781-9FEA-62BD554BDD93} +/* {BF22E553-292C-4781-9FEA-62BD554BDD93} */ DEFINE_GUID(DXFILEOBJ_DeclData, 0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93); -// {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} +/* {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} */ DEFINE_GUID(DXFILEOBJ_EffectFloats, 0xf1cfe2b3, 0xde3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0xa, 0x28, 0x2d); -// {D55B097E-BDB6-4c52-B03D-6051C89D0E42} +/* {D55B097E-BDB6-4c52-B03D-6051C89D0E42} */ DEFINE_GUID(DXFILEOBJ_EffectString, 0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0xe, 0x42); -// {622C0ED0-956E-4da9-908A-2AF94F3CE716} +/* {622C0ED0-956E-4da9-908A-2AF94F3CE716} */ DEFINE_GUID(DXFILEOBJ_EffectDWord, 0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16); -// {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} +/* {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} */ DEFINE_GUID(DXFILEOBJ_EffectParamFloats, 0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b);