d3dx9xof.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: d3dx9xof.h
  6. // Content: D3DX .X File types and functions
  7. //
  8. ///////////////////////////////////////////////////////////////////////////
  9. #include "d3dx9.h"
  10. #if !defined( __D3DX9XOF_H__ )
  11. #define __D3DX9XOF_H__
  12. #if defined( __cplusplus )
  13. extern "C" {
  14. #endif // defined( __cplusplus )
  15. //----------------------------------------------------------------------------
  16. // D3DXF_FILEFORMAT
  17. // This flag is used to specify what file type to use when saving to disk.
  18. // _BINARY, and _TEXT are mutually exclusive, while
  19. // _COMPRESSED is an optional setting that works with all file types.
  20. //----------------------------------------------------------------------------
  21. typedef DWORD D3DXF_FILEFORMAT;
  22. #define D3DXF_FILEFORMAT_BINARY 0
  23. #define D3DXF_FILEFORMAT_TEXT 1
  24. #define D3DXF_FILEFORMAT_COMPRESSED 2
  25. //----------------------------------------------------------------------------
  26. // D3DXF_FILESAVEOPTIONS
  27. // This flag is used to specify where to save the file to. Each flag is
  28. // mutually exclusive, indicates the data location of the file, and also
  29. // chooses which additional data will specify the location.
  30. // _TOFILE is paired with a filename (LPCSTR)
  31. // _TOWFILE is paired with a filename (LPWSTR)
  32. //----------------------------------------------------------------------------
  33. typedef DWORD D3DXF_FILESAVEOPTIONS;
  34. #define D3DXF_FILESAVE_TOFILE 0x00L
  35. #define D3DXF_FILESAVE_TOWFILE 0x01L
  36. //----------------------------------------------------------------------------
  37. // D3DXF_FILELOADOPTIONS
  38. // This flag is used to specify where to load the file from. Each flag is
  39. // mutually exclusive, indicates the data location of the file, and also
  40. // chooses which additional data will specify the location.
  41. // _FROMFILE is paired with a filename (LPCSTR)
  42. // _FROMWFILE is paired with a filename (LPWSTR)
  43. // _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description.
  44. // _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description.
  45. //----------------------------------------------------------------------------
  46. typedef DWORD D3DXF_FILELOADOPTIONS;
  47. #define D3DXF_FILELOAD_FROMFILE 0x00L
  48. #define D3DXF_FILELOAD_FROMWFILE 0x01L
  49. #define D3DXF_FILELOAD_FROMRESOURCE 0x02L
  50. #define D3DXF_FILELOAD_FROMMEMORY 0x03L
  51. //----------------------------------------------------------------------------
  52. // D3DXF_FILELOADRESOURCE:
  53. //----------------------------------------------------------------------------
  54. typedef struct _D3DXF_FILELOADRESOURCE
  55. {
  56. HMODULE hModule; // Desc
  57. LPCSTR lpName; // Desc
  58. LPCSTR lpType; // Desc
  59. } D3DXF_FILELOADRESOURCE;
  60. //----------------------------------------------------------------------------
  61. // D3DXF_FILELOADMEMORY:
  62. //----------------------------------------------------------------------------
  63. typedef struct _D3DXF_FILELOADMEMORY
  64. {
  65. LPCVOID lpMemory; // Desc
  66. SIZE_T dSize; // Desc
  67. } D3DXF_FILELOADMEMORY;
  68. #if defined( _WIN32 ) && !defined( _NO_COM )
  69. // {cef08cf9-7b4f-4429-9624-2a690a933201}
  70. DEFINE_GUID( IID_ID3DXFile,
  71. 0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  72. // {cef08cfa-7b4f-4429-9624-2a690a933201}
  73. DEFINE_GUID( IID_ID3DXFileSaveObject,
  74. 0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  75. // {cef08cfb-7b4f-4429-9624-2a690a933201}
  76. DEFINE_GUID( IID_ID3DXFileSaveData,
  77. 0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  78. // {cef08cfc-7b4f-4429-9624-2a690a933201}
  79. DEFINE_GUID( IID_ID3DXFileEnumObject,
  80. 0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  81. // {cef08cfd-7b4f-4429-9624-2a690a933201}
  82. DEFINE_GUID( IID_ID3DXFileData,
  83. 0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 );
  84. #endif // defined( _WIN32 ) && !defined( _NO_COM )
  85. #if defined( __cplusplus )
  86. #if !defined( DECLSPEC_UUID )
  87. #if _MSC_VER >= 1100
  88. #define DECLSPEC_UUID( x ) __declspec( uuid( x ) )
  89. #else // !( _MSC_VER >= 1100 )
  90. #define DECLSPEC_UUID( x )
  91. #endif // !( _MSC_VER >= 1100 )
  92. #endif // !defined( DECLSPEC_UUID )
  93. interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" )
  94. ID3DXFile;
  95. interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" )
  96. ID3DXFileSaveObject;
  97. interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" )
  98. ID3DXFileSaveData;
  99. interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" )
  100. ID3DXFileEnumObject;
  101. interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" )
  102. ID3DXFileData;
  103. #if defined( _COM_SMARTPTR_TYPEDEF )
  104. _COM_SMARTPTR_TYPEDEF( ID3DXFile,
  105. __uuidof( ID3DXFile ) );
  106. _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject,
  107. __uuidof( ID3DXFileSaveObject ) );
  108. _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData,
  109. __uuidof( ID3DXFileSaveData ) );
  110. _COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject,
  111. __uuidof( ID3DXFileEnumObject ) );
  112. _COM_SMARTPTR_TYPEDEF( ID3DXFileData,
  113. __uuidof( ID3DXFileData ) );
  114. #endif // defined( _COM_SMARTPTR_TYPEDEF )
  115. #endif // defined( __cplusplus )
  116. typedef interface ID3DXFile ID3DXFile;
  117. typedef interface ID3DXFileSaveObject ID3DXFileSaveObject;
  118. typedef interface ID3DXFileSaveData ID3DXFileSaveData;
  119. typedef interface ID3DXFileEnumObject ID3DXFileEnumObject;
  120. typedef interface ID3DXFileData ID3DXFileData;
  121. //////////////////////////////////////////////////////////////////////////////
  122. // ID3DXFile /////////////////////////////////////////////////////////////////
  123. //////////////////////////////////////////////////////////////////////////////
  124. #undef INTERFACE
  125. #define INTERFACE ID3DXFile
  126. DECLARE_INTERFACE_( ID3DXFile, IUnknown )
  127. {
  128. STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  129. STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  130. STDMETHOD_( ULONG, Release )( THIS ) PURE;
  131. STDMETHOD( CreateEnumObject )( THIS_ LPCVOID, D3DXF_FILELOADOPTIONS,
  132. ID3DXFileEnumObject** ) PURE;
  133. STDMETHOD( CreateSaveObject )( THIS_ LPCVOID, D3DXF_FILESAVEOPTIONS,
  134. D3DXF_FILEFORMAT, ID3DXFileSaveObject** ) PURE;
  135. STDMETHOD( RegisterTemplates )( THIS_ LPCVOID, SIZE_T ) PURE;
  136. STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE;
  137. };
  138. //////////////////////////////////////////////////////////////////////////////
  139. // ID3DXFileSaveObject ///////////////////////////////////////////////////////
  140. //////////////////////////////////////////////////////////////////////////////
  141. #undef INTERFACE
  142. #define INTERFACE ID3DXFileSaveObject
  143. DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown )
  144. {
  145. STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  146. STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  147. STDMETHOD_( ULONG, Release )( THIS ) PURE;
  148. STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE;
  149. STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*,
  150. SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE;
  151. STDMETHOD( Save )( THIS ) PURE;
  152. };
  153. //////////////////////////////////////////////////////////////////////////////
  154. // ID3DXFileSaveData /////////////////////////////////////////////////////////
  155. //////////////////////////////////////////////////////////////////////////////
  156. #undef INTERFACE
  157. #define INTERFACE ID3DXFileSaveData
  158. DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown )
  159. {
  160. STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  161. STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  162. STDMETHOD_( ULONG, Release )( THIS ) PURE;
  163. STDMETHOD( GetSave )( THIS_ ID3DXFileSaveObject** ) PURE;
  164. STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE;
  165. STDMETHOD( GetId )( THIS_ LPGUID ) PURE;
  166. STDMETHOD( GetType )( THIS_ GUID* ) PURE;
  167. STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*,
  168. SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE;
  169. STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE;
  170. };
  171. //////////////////////////////////////////////////////////////////////////////
  172. // ID3DXFileEnumObject ///////////////////////////////////////////////////////
  173. //////////////////////////////////////////////////////////////////////////////
  174. #undef INTERFACE
  175. #define INTERFACE ID3DXFileEnumObject
  176. DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown )
  177. {
  178. STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  179. STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  180. STDMETHOD_( ULONG, Release )( THIS ) PURE;
  181. STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE;
  182. STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE;
  183. STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE;
  184. STDMETHOD( GetDataObjectById )( THIS_ REFGUID, ID3DXFileData** ) PURE;
  185. STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE;
  186. };
  187. //////////////////////////////////////////////////////////////////////////////
  188. // ID3DXFileData /////////////////////////////////////////////////////////////
  189. //////////////////////////////////////////////////////////////////////////////
  190. #undef INTERFACE
  191. #define INTERFACE ID3DXFileData
  192. DECLARE_INTERFACE_( ID3DXFileData, IUnknown )
  193. {
  194. STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE;
  195. STDMETHOD_( ULONG, AddRef )( THIS ) PURE;
  196. STDMETHOD_( ULONG, Release )( THIS ) PURE;
  197. STDMETHOD( GetEnum )( THIS_ ID3DXFileEnumObject** ) PURE;
  198. STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE;
  199. STDMETHOD( GetId )( THIS_ LPGUID ) PURE;
  200. STDMETHOD( Lock )( THIS_ SIZE_T*, LPCVOID* ) PURE;
  201. STDMETHOD( Unlock )( THIS ) PURE;
  202. STDMETHOD( GetType )( THIS_ GUID* ) PURE;
  203. STDMETHOD_( BOOL, IsReference )( THIS ) PURE;
  204. STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE;
  205. STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE;
  206. };
  207. STDAPI D3DXFileCreate( ID3DXFile** lplpDirectXFile );
  208. /*
  209. * DirectX File errors.
  210. */
  211. #define _FACD3DXF 0x876
  212. #define D3DXFERR_BADOBJECT MAKE_HRESULT( 1, _FACD3DXF, 900 )
  213. #define D3DXFERR_BADVALUE MAKE_HRESULT( 1, _FACD3DXF, 901 )
  214. #define D3DXFERR_BADTYPE MAKE_HRESULT( 1, _FACD3DXF, 902 )
  215. #define D3DXFERR_NOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 903 )
  216. #define D3DXFERR_NOTDONEYET MAKE_HRESULT( 1, _FACD3DXF, 904 )
  217. #define D3DXFERR_FILENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 905 )
  218. #define D3DXFERR_RESOURCENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 906 )
  219. #define D3DXFERR_BADRESOURCE MAKE_HRESULT( 1, _FACD3DXF, 907 )
  220. #define D3DXFERR_BADFILETYPE MAKE_HRESULT( 1, _FACD3DXF, 908 )
  221. #define D3DXFERR_BADFILEVERSION MAKE_HRESULT( 1, _FACD3DXF, 909 )
  222. #define D3DXFERR_BADFILEFLOATSIZE MAKE_HRESULT( 1, _FACD3DXF, 910 )
  223. #define D3DXFERR_BADFILE MAKE_HRESULT( 1, _FACD3DXF, 911 )
  224. #define D3DXFERR_PARSEERROR MAKE_HRESULT( 1, _FACD3DXF, 912 )
  225. #define D3DXFERR_BADARRAYSIZE MAKE_HRESULT( 1, _FACD3DXF, 913 )
  226. #define D3DXFERR_BADDATAREFERENCE MAKE_HRESULT( 1, _FACD3DXF, 914 )
  227. #define D3DXFERR_NOMOREOBJECTS MAKE_HRESULT( 1, _FACD3DXF, 915 )
  228. #define D3DXFERR_NOMOREDATA MAKE_HRESULT( 1, _FACD3DXF, 916 )
  229. #define D3DXFERR_BADCACHEFILE MAKE_HRESULT( 1, _FACD3DXF, 917 )
  230. /*
  231. * DirectX File object types.
  232. */
  233. #ifndef WIN_TYPES
  234. #define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype
  235. #endif
  236. WIN_TYPES(ID3DXFile, D3DXFILE);
  237. WIN_TYPES(ID3DXFileEnumObject, D3DXFILEENUMOBJECT);
  238. WIN_TYPES(ID3DXFileSaveObject, D3DXFILESAVEOBJECT);
  239. WIN_TYPES(ID3DXFileData, D3DXFILEDATA);
  240. WIN_TYPES(ID3DXFileSaveData, D3DXFILESAVEDATA);
  241. #if defined( __cplusplus )
  242. } // extern "C"
  243. #endif // defined( __cplusplus )
  244. #endif // !defined( __D3DX9XOF_H__ )