]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/isurfaceplugin.h
eol style
[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         // Increment the number of references to this object
48         virtual void IncRef () = 0;
49         // Decrement the reference count
50         virtual void DecRef () = 0;
51 };
52
53
54
55 // Nurail: For SI module
56 class texdef_to_face_t
57 {
58 public:
59   texdef_to_face_t* next;
60   brush_t *brush;   // Brush faces belong to (for Undo)
61   face_t *face;     // Face of Texdef
62   texdef_t texdef;  // Working texdef
63   texdef_t orig_texdef;  // Original, for baselining changes
64 };
65
66
67 typedef void (* PFN_QERPLUG_DOSURFACE)                  ();
68 typedef void (* PFN_QERPLUG_TOGGLESURFACE)      ();
69 typedef void (* PFN_QERPLUG_UPDATESURFACEDIALOG)        ();
70 typedef void (* PFN_QERPLUG_SURFACEDLGFITALL)   ();
71 typedef GtkWidget* (* PFN_GET_SI_MODULE_WIDGET) ();
72
73 struct _QERPlugSurfaceTable
74 {
75         int m_nSize;
76         PFN_QERPLUG_TOGGLESURFACE               m_pfnToggleSurface;
77         PFN_QERPLUG_DOSURFACE                           m_pfnDoSurface;
78         PFN_QERPLUG_UPDATESURFACEDIALOG         m_pfnUpdateSurfaceDialog;
79         PFN_QERPLUG_SURFACEDLGFITALL            m_pfnSurfaceDlgFitAll;
80         PFN_GET_SI_MODULE_WIDGET                m_pfnGet_SI_Module_Widget;
81 };
82
83 // this one is used by the plugin to access some Radiant stuff
84
85 #define APPSURFACEDIALOG_MAJOR "appsurfdialog"
86
87 // {42BAE4C0-9787-11d3-8EF3-0000E8E8657B}
88 static const GUID QERAppSurfaceTable_GUID = 
89 { 0x42bae4c0, 0x9787, 0x11d3, { 0x8e, 0xf3, 0x0, 0x0, 0xe8, 0xe8, 0x65, 0x7b } };
90
91 typedef bool (* PFN_PATCHESSELECTED)    ();
92 // retrieve g_qeglobals.texturewin_t
93 //++timo FIXME: this should move in a dedicated table for all g_qeglobals stuff
94 typedef texturewin_t* (* PFN_QEGLOBALSTEXTUREWIN) ();
95 // look for the first selected patch mesh
96 //++timo FIXME: this is a convenient func since there's no way to scan patches ( yet )
97 typedef patchMesh_t* (* PFN_GETSELECTEDPATCH) ();
98 //++timo FIXME: this one in particular is a hack
99 typedef void (* PFN_GETTWOSELECTEDPATCH) (patchMesh_t **p1, patchMesh_t **p2);
100
101
102 // leo FIXME: hacks uglier than the ones above
103 typedef void (* PFN_TEXMATTOFAKETEXCOORDS) (vec_t texMat[2][3], float shift[2], float *rot, float scale[2]);
104 typedef void (* PFN_CONVERTTEXMATWITHQTEXTURE) (brushprimit_texdef_t *texMat1, qtexture_t *qtex1, brushprimit_texdef_t *texMat2, qtexture_t *qtex2);
105 typedef void (* PFN_FAKETEXCOORDSTOTEXMAT) (float shift[2], float rot, float scale[2], vec_t texMat[2][3]);
106 typedef void (* PFN_PATCH_RESETTEXTURING) (float fx, float fy);
107 typedef void (* PFN_PATCH_FITTEXTURING) ();
108 typedef void (* PFN_PATCH_NATURALIZESELECTED) (bool bCap);
109 typedef const char* (* PFN_PATCH_GETTEXTURENAME) (); 
110 typedef qboolean (* PFN_QE_SINGLEBRUSH) (bool bQuiet);
111 typedef qboolean (* PFN_ISBRUSHPRIMITMODE) ();
112 typedef void (* PFN_SELECT_FITTEXTURE)(int nHeight, int nWidth);
113 typedef void (*PFN_COMPUTEAXISBASE)(vec3_t normal,vec3_t texS,vec3_t texT );
114 typedef void (*PFN_BPMATMUL)(vec_t A[2][3], vec_t B[2][3], vec_t C[2][3]);
115 typedef void (*PFN_EMITBRUSHPRIMITTEXCOORDS)(face_t * f, winding_t * w);
116 typedef texdef_t* (*PFN_QEGLOBALSSAVEDINFO_SIINC) ();
117 typedef float (* PFN_QEGLOBALSGETGRIDSIZE) ();
118 typedef void (* PFN_FACELIST_FITTEXTURE) (texdef_to_face_t* texdef_face_list, int nHeight, int nWidth);
119 typedef GtkWindow* (* PFN_GETMAINWINDOW)();
120 typedef void (* PFN_SETWINPOS_FROM_PREFS) (GtkWidget *win);
121 typedef int (* PFN_GETSELECTEDFACECOUNT_BRUSH) ();
122 typedef void (* PFN_GETSELFACESTEXDEF) (texdef_to_face_t *);
123 typedef void (* PFN_SETTEXDEF_FACELIST) (texdef_to_face_t* texdef_face_list, bool b_SetUndoPoint, bool bFit_to_Scale);
124 typedef void (* PFN_SETACTIVEINRADIANT) ();
125
126
127 struct _QERAppSurfaceTable
128 {
129   int m_nSize;
130   PFN_PATCHESSELECTED           m_pfnOnlyPatchesSelected;
131   PFN_PATCHESSELECTED           m_pfnAnyPatchesSelected;
132   PFN_GETSELECTEDPATCH          m_pfnGetSelectedPatch;
133   PFN_GETTWOSELECTEDPATCH               m_pfnGetTwoSelectedPatch;
134   PFN_TEXMATTOFAKETEXCOORDS     m_pfnTexMatToFakeTexCoords;
135   PFN_CONVERTTEXMATWITHQTEXTURE m_pfnConvertTexMatWithQTexture;
136   PFN_FAKETEXCOORDSTOTEXMAT     m_pfnFakeTexCoordsToTexMat;
137   PFN_PATCH_RESETTEXTURING      m_pfnPatch_ResetTexturing;
138   PFN_PATCH_FITTEXTURING                m_pfnPatch_FitTexturing;
139   PFN_PATCH_NATURALIZESELECTED  m_pfnPatch_NaturalizeSelected;
140   PFN_PATCH_GETTEXTURENAME      m_pfnPatch_GetTextureName;
141   PFN_QE_SINGLEBRUSH            m_pfnQE_SingleBrush;
142   PFN_ISBRUSHPRIMITMODE         m_pfnIsBrushPrimitMode;
143   PFN_COMPUTEAXISBASE           m_pfnComputeAxisBase;
144   PFN_BPMATMUL                  m_pfnBPMatMul;
145   PFN_EMITBRUSHPRIMITTEXCOORDS  m_pfnEmitBrushPrimitTextureCoordinates;
146   PFN_QEGLOBALSTEXTUREWIN               m_pfnQeglobalsTexturewin;
147   PFN_SELECT_FITTEXTURE         m_pfnSelect_FitTexture;
148   PFN_QEGLOBALSSAVEDINFO_SIINC          m_pfnQERApp_QeglobalsSavedinfo_SIInc;
149   PFN_QEGLOBALSGETGRIDSIZE      m_pfnQeglobalsGetGridSize;
150   PFN_FACELIST_FITTEXTURE               m_pfnFaceList_FitTexture;
151   PFN_GETMAINWINDOW             m_pfnGetMainWindow;
152   PFN_SETWINPOS_FROM_PREFS      m_pfnSetWinPos_From_Prefs;
153   PFN_GETSELECTEDFACECOUNT_BRUSH  m_pfnGetSelectedFaceCountfromBrushes;
154   PFN_GETSELFACESTEXDEF         m_pfnGetSelFacesTexdef;
155   PFN_SETTEXDEF_FACELIST                m_pfnSetTexdef_FaceList;
156 };
157
158 #endif