isurfaceplugin.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. //-----------------------------------------------------------------------------
  19. //
  20. // $LogFile$
  21. // $Revision: 1.1.1.4.2.1 $
  22. // $Author: ttimo $
  23. // $Date: 2000/02/13 17:25:04 $
  24. // $Log: isurfaceplugin.h,v $
  25. // Revision 1.1.1.4.2.1 2000/02/13 17:25:04 ttimo
  26. // started cleanup
  27. //
  28. // Revision 1.1.1.4 2000/01/18 00:17:13 ttimo
  29. // merging in for RC
  30. //
  31. // Revision 1.3 2000/01/17 23:53:44 TBesset
  32. // ready for merge in sourceforge (RC candidate)
  33. //
  34. // Revision 1.2 2000/01/07 16:40:13 TBesset
  35. // merged from BSP frontend
  36. //
  37. // Revision 1.1.1.3 1999/12/29 18:31:28 TBesset
  38. // Q3Radiant public version
  39. //
  40. // Revision 1.1.1.1.2.1 1999/12/29 21:39:45 TBesset
  41. // updated to update3 from Robert
  42. //
  43. // Revision 1.1.1.3 1999/12/29 18:31:28 TBesset
  44. // Q3Radiant public version
  45. // Revision 1.1.1.3 1999/12/29 18:31:28 TBesset
  46. // Q3Radiant public version
  47. //
  48. // Revision 1.2 1999/11/22 17:46:48 Timo & Christine
  49. // merged EARadiant into the main tree
  50. // bug fixes for Q3Plugin / EAPlugin
  51. // export for Robert
  52. //
  53. // Revision 1.1.2.4 1999/11/20 12:13:02 Timo & Christine
  54. // first release to Wolfen and Spog
  55. // with TexTool and DeQbsp3 plugin
  56. //
  57. // Revision 1.1.2.3 1999/11/16 14:23:13 Timo & Christine
  58. // merged 173 into Q3Radiant, EARadiant branch
  59. // see Timo\changelog.txt for merge log
  60. //
  61. // Revision 1.1.2.2 1999/11/14 16:26:15 Timo & Christine
  62. // first beta of the ritualmap surface plugin
  63. //
  64. // Revision 1.1.2.1 1999/10/08 16:28:15 Timo & Christine
  65. // started plugin extensions for EA features support in Q3Radiant
  66. // MEAN files plugin, and Surface Properties plugin
  67. //
  68. //
  69. // DESCRIPTION:
  70. //
  71. //
  72. #ifndef __ISURFACEPLUGIN_H_
  73. #define __ISURFACEPLUGIN_H_
  74. #ifndef Q3RADIANT
  75. // this is plugin included, define miptex_t
  76. //++timo FIXME: move definition into qertypes.h ? or assume plugin knows ?
  77. #define MIPLEVELS 4
  78. typedef struct miptex_s
  79. {
  80. char name[32];
  81. unsigned width, height;
  82. unsigned offsets[MIPLEVELS]; // four mip maps stored
  83. char animname[32]; // next frame in animation chain
  84. int flags;
  85. int contents;
  86. int value;
  87. } miptex_t;
  88. #endif
  89. /*
  90. // there's a void* in each qtexture_t, must be casted to a IPluginQTexture*
  91. class IPluginQTexture
  92. {
  93. public:
  94. // Increment the number of references to this object
  95. virtual void IncRef () = 0;
  96. // Decrement the reference count
  97. virtual void DecRef () = 0;
  98. // Init for a miptex_t
  99. virtual void InitForMiptex( miptex_t* ) = 0;
  100. // set default texdef
  101. virtual void SetDefaultTexdef() = 0;
  102. };
  103. // use this macro
  104. #define GETPLUGINQTEXTURE(pQTexture) (static_cast<IPluginQTexture *>(pQTexture->pData))
  105. */
  106. // there's a void* in each qtexture_t, must be casted to a IPluginTexdef*
  107. // there's a void* in each face_t, must be casted to a IPluginTexdef*
  108. // NOTE: IPluginTexdef stores a pointer to the qtexture_t or face_t it's stored in
  109. // members of IPluginTexdef often access the qtexture_t or face_t they are connected to
  110. // Write texdef needs a function pointer, because Radiant either writes into a FILE or a CMemFile
  111. typedef void (WINAPI* PFN_QERAPP_MAPPRINTF) ( char *text, ... );
  112. class IPluginTexdef
  113. {
  114. public:
  115. // Increment the number of references to this object
  116. virtual void IncRef () = 0;
  117. // Decrement the reference count
  118. virtual void DecRef () = 0;
  119. // Build a copy of this one, sets refCount to 1
  120. virtual IPluginTexdef* Copy() = 0;
  121. // refers to a face_t -----------------------
  122. // Parse texdef
  123. virtual void ParseTexdef () = 0;
  124. // Write texdef
  125. virtual void WriteTexdef (PFN_QERAPP_MAPPRINTF MapPrintf) = 0;
  126. // hook to a face
  127. virtual void Hook( face_t* ) = 0;
  128. // ------------------------------------------
  129. // refers to a qtexture_t -------------------
  130. // Init for a miptex_t
  131. //++timo NOTE: miptex_t is used only for .WAL format .. a bit outdated
  132. virtual void InitForMiptex( miptex_t* ) = 0;
  133. // set default texdef
  134. virtual void SetDefaultTexdef() = 0;
  135. // ------------------------------------------
  136. // refers to a patchMesh_t ------------------
  137. virtual void ParsePatchTexdef () = 0;
  138. // write texdef for a patch
  139. virtual void WritePatchTexdef (PFN_QERAPP_MAPPRINTF MapPrintf) = 0;
  140. // hook to a patch
  141. virtual void Hook( patchMesh_t* ) = 0;
  142. // ------------------------------------------
  143. };
  144. // use this macro
  145. #define GETPLUGINTEXDEF(pFace) (static_cast<IPluginTexdef *>(pFace->pData))
  146. // this one is used by Radiant to access the surface plugin
  147. // {7DA59920-93D8-11d3-8EF3-0000E8E8657B}
  148. static const GUID QERPlugSurfaceTable_GUID =
  149. { 0x7da59920, 0x93d8, 0x11d3, { 0x8e, 0xf3, 0x0, 0x0, 0xe8, 0xe8, 0x65, 0x7b } };
  150. typedef void (WINAPI* PFN_QERPLUG_DOSURFACE) ();
  151. typedef bool (WINAPI* PFN_QERPLUG_BYEBYESURFACEDIALOG) ();
  152. typedef void (WINAPI* PFN_QERPLUG_UPDATESURFACEDIALOG) ();
  153. // allocates a new IPluginTexdef, linked to a face_t, refCount is set to 1
  154. typedef IPluginTexdef* (WINAPI* PFN_QERPLUG_TEXDEFALLOC) ( face_t* );
  155. // allocates a new IPluginTexdef, linked to a qtexture_t, refCount is set to 1
  156. typedef IPluginTexdef* (WINAPI* PFN_QERPLUG_QTEXTUREALLOC) ( qtexture_t* );
  157. // allocates a new IPluginTexdef, linked to a patchMesh_t, refCount is set to 1
  158. typedef IPluginTexdef* (WINAPI* PFN_QERPLUG_PATCHALLOC) ( patchMesh_t* );
  159. struct _QERPlugSurfaceTable
  160. {
  161. int m_nSize;
  162. PFN_QERPLUG_BYEBYESURFACEDIALOG m_pfnByeByeSurfaceDialog;
  163. PFN_QERPLUG_DOSURFACE m_pfnDoSurface;
  164. PFN_QERPLUG_UPDATESURFACEDIALOG m_pfnUpdateSurfaceDialog;
  165. PFN_QERPLUG_TEXDEFALLOC m_pfnTexdefAlloc;
  166. PFN_QERPLUG_QTEXTUREALLOC m_pfnQTextureAlloc;
  167. PFN_QERPLUG_PATCHALLOC m_pfnPatchAlloc;
  168. };
  169. // this one is used by the plugin to access some Radiant stuff
  170. // {42BAE4C0-9787-11d3-8EF3-0000E8E8657B}
  171. static const GUID QERAppSurfaceTable_GUID =
  172. { 0x42bae4c0, 0x9787, 0x11d3, { 0x8e, 0xf3, 0x0, 0x0, 0xe8, 0xe8, 0x65, 0x7b } };
  173. typedef bool (WINAPI* PFN_PATCHESSELECTED) ();
  174. // retrieve g_qeglobals.texturewin_t
  175. //++timo FIXME: this should move in a dedicated table for all g_qeglobals stuff
  176. typedef texturewin_t* (WINAPI* PFN_QEGLOBALSTEXTUREWIN) ();
  177. // look for the first selected patch mesh
  178. //++timo FIXME: this is a convenient func since there's no way to scan patches ( yet )
  179. typedef patchMesh_t* (WINAPI* PFN_GETSELECTEDPATCH) ();
  180. typedef void (WINAPI* PFN_PATCHREBUILD) (patchMesh_t *p);
  181. //++timo FIXME: this one in particular is a hack
  182. typedef void (WINAPI* PFN_GETTWOSELECTEDPATCH) (patchMesh_t **p1, patchMesh_t **p2);
  183. struct _QERAppSurfaceTable
  184. {
  185. int m_nSize;
  186. PFN_PATCHESSELECTED m_pfnOnlyPatchesSelected;
  187. PFN_PATCHESSELECTED m_pfnAnyPatchesSelected;
  188. PFN_QEGLOBALSTEXTUREWIN m_pfnQeglobalsTexturewin;
  189. PFN_GETSELECTEDPATCH m_pfnGetSelectedPatch;
  190. PFN_PATCHREBUILD m_pfnPatchRebuild;
  191. PFN_GETTWOSELECTEDPATCH m_pfnGetTwoSelectedPatch;
  192. };
  193. #endif