]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/isurfaceplugin.h
61e2fdbab80d209fd768c31eb572f57d5c1bd3d2
[xonotic/netradiant.git] / include / isurfaceplugin.h
1 /*
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
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.
11
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.
16
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
20 */
21
22 //-----------------------------------------------------------------------------
23 //
24 // DESCRIPTION:
25 // 
26 //
27
28 #ifndef __ISURFACEPLUGIN_H_
29 #define __ISURFACEPLUGIN_H_
30
31 typedef struct _GtkWidget GtkWidget;
32 typedef struct _GtkWindow GtkWindow;
33
34 #define SURFACEDIALOG_MAJOR "surfdialog"
35
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
40
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, ... );
43
44 class IPluginTexdef
45 {
46 public:
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;
52 };
53
54
55
56 // Nurail: For SI module
57 class texdef_to_face_t
58 {
59 public:
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 };
66
67
68 typedef void (* PFN_QERPLUG_DOSURFACE)                  ();
69 typedef void (* PFN_QERPLUG_TOGGLESURFACE)      ();
70 typedef void (* PFN_QERPLUG_UPDATESURFACEDIALOG)        ();
71 typedef void (* PFN_QERPLUG_SURFACEDLGFITALL)   ();
72 typedef GtkWidget* (* PFN_GET_SI_MODULE_WIDGET) ();
73
74 struct _QERPlugSurfaceTable
75 {
76         int m_nSize;
77         PFN_QERPLUG_TOGGLESURFACE               m_pfnToggleSurface;
78         PFN_QERPLUG_DOSURFACE                           m_pfnDoSurface;
79         PFN_QERPLUG_UPDATESURFACEDIALOG         m_pfnUpdateSurfaceDialog;
80         PFN_QERPLUG_SURFACEDLGFITALL            m_pfnSurfaceDlgFitAll;
81         PFN_GET_SI_MODULE_WIDGET                m_pfnGet_SI_Module_Widget;
82 };
83
84 // this one is used by the plugin to access some Radiant stuff
85
86 #define APPSURFACEDIALOG_MAJOR "appsurfdialog"
87
88 // {42BAE4C0-9787-11d3-8EF3-0000E8E8657B}
89 static const GUID QERAppSurfaceTable_GUID = 
90 { 0x42bae4c0, 0x9787, 0x11d3, { 0x8e, 0xf3, 0x0, 0x0, 0xe8, 0xe8, 0x65, 0x7b } };
91
92 typedef bool (* PFN_PATCHESSELECTED)    ();
93 // retrieve g_qeglobals.texturewin_t
94 //++timo FIXME: this should move in a dedicated table for all g_qeglobals stuff
95 typedef texturewin_t* (* PFN_QEGLOBALSTEXTUREWIN) ();
96 // look for the first selected patch mesh
97 //++timo FIXME: this is a convenient func since there's no way to scan patches ( yet )
98 typedef patchMesh_t* (* PFN_GETSELECTEDPATCH) ();
99 //++timo FIXME: this one in particular is a hack
100 typedef void (* PFN_GETTWOSELECTEDPATCH) (patchMesh_t **p1, patchMesh_t **p2);
101
102
103 // leo FIXME: hacks uglier than the ones above
104 typedef void (* PFN_TEXMATTOFAKETEXCOORDS) (vec_t texMat[2][3], float shift[2], float *rot, float scale[2]);
105 typedef void (* PFN_CONVERTTEXMATWITHQTEXTURE) (brushprimit_texdef_t *texMat1, qtexture_t *qtex1, brushprimit_texdef_t *texMat2, qtexture_t *qtex2);
106 typedef void (* PFN_FAKETEXCOORDSTOTEXMAT) (float shift[2], float rot, float scale[2], vec_t texMat[2][3]);
107 typedef void (* PFN_PATCH_RESETTEXTURING) (float fx, float fy);
108 typedef void (* PFN_PATCH_FITTEXTURING) ();
109 typedef void (* PFN_PATCH_NATURALIZESELECTED) (bool bCap);
110 typedef const char* (* PFN_PATCH_GETTEXTURENAME) (); 
111 typedef qboolean (* PFN_QE_SINGLEBRUSH) (bool bQuiet);
112 typedef qboolean (* PFN_ISBRUSHPRIMITMODE) ();
113 typedef void (* PFN_SELECT_FITTEXTURE)(int nHeight, int nWidth);
114 typedef void (*PFN_COMPUTEAXISBASE)(vec3_t normal,vec3_t texS,vec3_t texT );
115 typedef void (*PFN_BPMATMUL)(vec_t A[2][3], vec_t B[2][3], vec_t C[2][3]);
116 typedef void (*PFN_EMITBRUSHPRIMITTEXCOORDS)(face_t * f, winding_t * w);
117 typedef texdef_t* (*PFN_QEGLOBALSSAVEDINFO_SIINC) ();
118 typedef float (* PFN_QEGLOBALSGETGRIDSIZE) ();
119 typedef void (* PFN_FACELIST_FITTEXTURE) (texdef_to_face_t* texdef_face_list, int nHeight, int nWidth);
120 typedef GtkWindow* (* PFN_GETMAINWINDOW)();
121 typedef void (* PFN_SETWINPOS_FROM_PREFS) (GtkWidget *win);
122 typedef int (* PFN_GETSELECTEDFACECOUNT_BRUSH) ();
123 typedef void (* PFN_GETSELFACESTEXDEF) (texdef_to_face_t *);
124 typedef void (* PFN_SETTEXDEF_FACELIST) (texdef_to_face_t* texdef_face_list, bool b_SetUndoPoint, bool bFit_to_Scale);
125 typedef void (* PFN_SETACTIVEINRADIANT) ();
126
127
128 struct _QERAppSurfaceTable
129 {
130   int m_nSize;
131   PFN_PATCHESSELECTED           m_pfnOnlyPatchesSelected;
132   PFN_PATCHESSELECTED           m_pfnAnyPatchesSelected;
133   PFN_GETSELECTEDPATCH          m_pfnGetSelectedPatch;
134   PFN_GETTWOSELECTEDPATCH               m_pfnGetTwoSelectedPatch;
135   PFN_TEXMATTOFAKETEXCOORDS     m_pfnTexMatToFakeTexCoords;
136   PFN_CONVERTTEXMATWITHQTEXTURE m_pfnConvertTexMatWithQTexture;
137   PFN_FAKETEXCOORDSTOTEXMAT     m_pfnFakeTexCoordsToTexMat;
138   PFN_PATCH_RESETTEXTURING      m_pfnPatch_ResetTexturing;
139   PFN_PATCH_FITTEXTURING                m_pfnPatch_FitTexturing;
140   PFN_PATCH_NATURALIZESELECTED  m_pfnPatch_NaturalizeSelected;
141   PFN_PATCH_GETTEXTURENAME      m_pfnPatch_GetTextureName;
142   PFN_QE_SINGLEBRUSH            m_pfnQE_SingleBrush;
143   PFN_ISBRUSHPRIMITMODE         m_pfnIsBrushPrimitMode;
144   PFN_COMPUTEAXISBASE           m_pfnComputeAxisBase;
145   PFN_BPMATMUL                  m_pfnBPMatMul;
146   PFN_EMITBRUSHPRIMITTEXCOORDS  m_pfnEmitBrushPrimitTextureCoordinates;
147   PFN_QEGLOBALSTEXTUREWIN               m_pfnQeglobalsTexturewin;
148   PFN_SELECT_FITTEXTURE         m_pfnSelect_FitTexture;
149   PFN_QEGLOBALSSAVEDINFO_SIINC          m_pfnQERApp_QeglobalsSavedinfo_SIInc;
150   PFN_QEGLOBALSGETGRIDSIZE      m_pfnQeglobalsGetGridSize;
151   PFN_FACELIST_FITTEXTURE               m_pfnFaceList_FitTexture;
152   PFN_GETMAINWINDOW             m_pfnGetMainWindow;
153   PFN_SETWINPOS_FROM_PREFS      m_pfnSetWinPos_From_Prefs;
154   PFN_GETSELECTEDFACECOUNT_BRUSH  m_pfnGetSelectedFaceCountfromBrushes;
155   PFN_GETSELFACESTEXDEF         m_pfnGetSelFacesTexdef;
156   PFN_SETTEXDEF_FACELIST                m_pfnSetTexdef_FaceList;
157 };
158
159 #endif