2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 //-----------------------------------------------------------------------------
28 #ifndef __ISURFACEPLUGIN_H_
29 #define __ISURFACEPLUGIN_H_
31 typedef struct _GtkWidget GtkWidget;
32 typedef struct _GtkWindow GtkWindow;
34 #define SURFACEDIALOG_MAJOR "surfdialog"
36 // there's a void* in each qtexture_t, must be casted to a IPluginTexdef*
37 // there's a void* in each face_t, must be casted to a IPluginTexdef*
38 // NOTE: IPluginTexdef stores a pointer to the qtexture_t or face_t it's stored in
39 // members of IPluginTexdef often access the qtexture_t or face_t they are connected to
41 // Write texdef needs a function pointer, because Radiant either writes into a FILE or a CMemFile
42 typedef void (* PFN_QERAPP_MAPPRINTF) ( char *text, ... );
47 virtual ~IPluginTexdef() { }
48 // Increment the number of references to this object
49 virtual void IncRef () = 0;
50 // Decrement the reference count
51 virtual void DecRef () = 0;
56 // Nurail: For SI module
57 class texdef_to_face_t
60 texdef_to_face_t* next;
61 brush_t *brush; // Brush faces belong to (for Undo)
62 face_t *face; // Face of Texdef
63 texdef_t texdef; // Working texdef
64 texdef_t orig_texdef; // Original, for baselining changes
65 brushprimit_texdef_t orig_bp_texdef; // Original, for undo
69 typedef void (* PFN_QERPLUG_DOSURFACE) ();
70 typedef void (* PFN_QERPLUG_TOGGLESURFACE) ();
71 typedef void (* PFN_QERPLUG_UPDATESURFACEDIALOG) ();
72 typedef void (* PFN_QERPLUG_SURFACEDLGFITALL) ();
73 typedef GtkWidget* (* PFN_GET_SI_MODULE_WIDGET) ();
75 struct _QERPlugSurfaceTable
78 PFN_QERPLUG_TOGGLESURFACE m_pfnToggleSurface;
79 PFN_QERPLUG_DOSURFACE m_pfnDoSurface;
80 PFN_QERPLUG_UPDATESURFACEDIALOG m_pfnUpdateSurfaceDialog;
81 PFN_QERPLUG_SURFACEDLGFITALL m_pfnSurfaceDlgFitAll;
82 PFN_GET_SI_MODULE_WIDGET m_pfnGet_SI_Module_Widget;
85 // this one is used by the plugin to access some Radiant stuff
87 #define APPSURFACEDIALOG_MAJOR "appsurfdialog"
89 // {42BAE4C0-9787-11d3-8EF3-0000E8E8657B}
90 static const GUID QERAppSurfaceTable_GUID =
91 { 0x42bae4c0, 0x9787, 0x11d3, { 0x8e, 0xf3, 0x0, 0x0, 0xe8, 0xe8, 0x65, 0x7b } };
93 typedef bool (* PFN_PATCHESSELECTED) ();
94 // retrieve g_qeglobals.texturewin_t
95 //++timo FIXME: this should move in a dedicated table for all g_qeglobals stuff
96 typedef texturewin_t* (* PFN_QEGLOBALSTEXTUREWIN) ();
97 // look for the first selected patch mesh
98 //++timo FIXME: this is a convenient func since there's no way to scan patches ( yet )
99 typedef patchMesh_t* (* PFN_GETSELECTEDPATCH) ();
100 //++timo FIXME: this one in particular is a hack
101 typedef void (* PFN_GETTWOSELECTEDPATCH) (patchMesh_t **p1, patchMesh_t **p2);
104 // leo FIXME: hacks uglier than the ones above
105 typedef void (* PFN_TEXMATTOFAKETEXCOORDS) (vec_t texMat[2][3], float shift[2], float *rot, float scale[2]);
106 typedef void (* PFN_CONVERTTEXMATWITHQTEXTURE) (brushprimit_texdef_t *texMat1, qtexture_t *qtex1, brushprimit_texdef_t *texMat2, qtexture_t *qtex2);
107 typedef void (* PFN_FAKETEXCOORDSTOTEXMAT) (float shift[2], float rot, float scale[2], vec_t texMat[2][3]);
108 typedef void (* PFN_PATCH_RESETTEXTURING) (float fx, float fy);
109 typedef void (* PFN_PATCH_FITTEXTURING) ();
110 typedef void (* PFN_PATCH_NATURALIZESELECTED) (bool bCap);
111 typedef const char* (* PFN_PATCH_GETTEXTURENAME) ();
112 typedef qboolean (* PFN_QE_SINGLEBRUSH) (bool bQuiet);
113 typedef qboolean (* PFN_ISBRUSHPRIMITMODE) ();
114 typedef void (* PFN_SELECT_FITTEXTURE)(int nHeight, int nWidth);
115 typedef void (*PFN_COMPUTEAXISBASE)(vec3_t normal,vec3_t texS,vec3_t texT );
116 typedef void (*PFN_BPMATMUL)(vec_t A[2][3], vec_t B[2][3], vec_t C[2][3]);
117 typedef void (*PFN_EMITBRUSHPRIMITTEXCOORDS)(face_t * f, winding_t * w);
118 typedef texdef_t* (*PFN_QEGLOBALSSAVEDINFO_SIINC) ();
119 typedef float (* PFN_QEGLOBALSGETGRIDSIZE) ();
120 typedef void (* PFN_FACELIST_FITTEXTURE) (texdef_to_face_t* texdef_face_list, int nHeight, int nWidth);
121 typedef GtkWindow* (* PFN_GETMAINWINDOW)();
122 typedef void (* PFN_SETWINPOS_FROM_PREFS) (GtkWidget *win);
123 typedef int (* PFN_GETSELECTEDFACECOUNT_BRUSH) ();
124 typedef void (* PFN_GETSELFACESTEXDEF) (texdef_to_face_t *);
125 typedef void (* PFN_SETTEXDEF_FACELIST) (texdef_to_face_t* texdef_face_list, bool b_SetUndoPoint, bool bFit_to_Scale);
126 typedef void (* PFN_SETACTIVEINRADIANT) ();
129 struct _QERAppSurfaceTable
132 PFN_PATCHESSELECTED m_pfnOnlyPatchesSelected;
133 PFN_PATCHESSELECTED m_pfnAnyPatchesSelected;
134 PFN_GETSELECTEDPATCH m_pfnGetSelectedPatch;
135 PFN_GETTWOSELECTEDPATCH m_pfnGetTwoSelectedPatch;
136 PFN_TEXMATTOFAKETEXCOORDS m_pfnTexMatToFakeTexCoords;
137 PFN_CONVERTTEXMATWITHQTEXTURE m_pfnConvertTexMatWithQTexture;
138 PFN_FAKETEXCOORDSTOTEXMAT m_pfnFakeTexCoordsToTexMat;
139 PFN_PATCH_RESETTEXTURING m_pfnPatch_ResetTexturing;
140 PFN_PATCH_FITTEXTURING m_pfnPatch_FitTexturing;
141 PFN_PATCH_NATURALIZESELECTED m_pfnPatch_NaturalizeSelected;
142 PFN_PATCH_GETTEXTURENAME m_pfnPatch_GetTextureName;
143 PFN_QE_SINGLEBRUSH m_pfnQE_SingleBrush;
144 PFN_ISBRUSHPRIMITMODE m_pfnIsBrushPrimitMode;
145 PFN_COMPUTEAXISBASE m_pfnComputeAxisBase;
146 PFN_BPMATMUL m_pfnBPMatMul;
147 PFN_EMITBRUSHPRIMITTEXCOORDS m_pfnEmitBrushPrimitTextureCoordinates;
148 PFN_QEGLOBALSTEXTUREWIN m_pfnQeglobalsTexturewin;
149 PFN_SELECT_FITTEXTURE m_pfnSelect_FitTexture;
150 PFN_QEGLOBALSSAVEDINFO_SIINC m_pfnQERApp_QeglobalsSavedinfo_SIInc;
151 PFN_QEGLOBALSGETGRIDSIZE m_pfnQeglobalsGetGridSize;
152 PFN_FACELIST_FITTEXTURE m_pfnFaceList_FitTexture;
153 PFN_GETMAINWINDOW m_pfnGetMainWindow;
154 PFN_SETWINPOS_FROM_PREFS m_pfnSetWinPos_From_Prefs;
155 PFN_GETSELECTEDFACECOUNT_BRUSH m_pfnGetSelectedFaceCountfromBrushes;
156 PFN_GETSELFACESTEXDEF m_pfnGetSelFacesTexdef;
157 PFN_SETTEXDEF_FACELIST m_pfnSetTexdef_FaceList;