]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/iselectedface.h
set eol-style
[xonotic/netradiant.git] / include / iselectedface.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 // Quick interface hack for selected face interface
26 // this one really needs more work, but I'm in a hurry with TexTool
27
28 #ifndef __ISELECTEDFACE_H_
29 #define __ISELECTEDFACE_H_
30
31 #define SELECTEDFACE_MAJOR "selectedface"
32 // v2.0
33 // support for multiple faces selection (first use in textool v2)
34 // using the g_ptrSelectedFaces indexes, get the face_t* with GETFACE
35 // still relies on the _QERFaceData*, unless you cast the face_t* to do your own stuff
36 // removed PFN_TEXTUREFORNAME, it's in the IShaders API now
37
38 //++timo TODO: this interface needs some cleanup with the new texture / shaders interface
39
40 // number of selected textures
41 typedef int   (WINAPI* PFN_GETSELECTEDFACECOUNT) ();
42 // retrieve the corresponding brush_t* (we need it when we need to explicitely rebuild stuff)
43 typedef brush_t*    (WINAPI* PFN_GETFACEBRUSH) (int iface);
44 // retrieve a given face_t*
45 typedef face_t*     (WINAPI* PFN_GETFACE) (int iface);
46 // winding_t is assumed to have MAX_POINTS_ON_WINDING allocated and waiting
47 typedef int             (WINAPI* PFN_GETFACEINFO)               (int iface, _QERFaceData*, winding_t* );
48 // tell editor to update the selected face data
49 typedef int             (WINAPI* PFN_SETFACEINFO)               (int iface, _QERFaceData*);
50 // retrieve the texture number to bind to
51 typedef int             (WINAPI* PFN_GETTEXTURENUMBER)  (int iface);
52 // retrieving some texture information
53 typedef void    (WINAPI* PFN_GETTEXTURESIZE)    (int iface, int Size[2] );
54 // straight func pointer to Select_SetTexture
55 // last parameter must be casted to an IPluginTexdef
56 typedef void    (WINAPI* PFN_SELECT_SETTEXTURE)         (texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef);
57
58 // NOTE: some things in there are not really related to the selected face
59 // having some stuff moved into a textures-dedicated part ?
60 struct _QERSelectedFaceTable
61 {
62         int m_nSize;
63   PFN_GETSELECTEDFACECOUNT  m_pfnGetSelectedFaceCount;
64   PFN_GETFACEBRUSH          m_pfnGetFaceBrush;
65   PFN_GETFACE               m_pfnGetFace;
66   PFN_GETFACEINFO                             m_pfnGetFaceInfo;
67   PFN_SETFACEINFO                             m_pfnSetFaceInfo;
68   PFN_GETTEXTURENUMBER      m_pfnGetTextureNumber;
69   PFN_GETTEXTURESIZE                m_pfnGetTextureSize;
70   PFN_SELECT_SETTEXTURE     m_pfnSelect_SetTexture;     
71 };
72
73 #ifdef USE_SELECTEDFACETABLE_DEFINE
74   #ifndef __SELECTEDFACETABLENAME
75     #define __SELECTEDFACETABLENAME g_SelectedFaceTable
76   #endif
77
78   #define GetSelectedFaceCount __SELECTEDFACETABLENAME.m_pfnGetSelectedFaceCount
79   #define GetFaceBrush __SELECTEDFACETABLENAME.m_pfnGetFaceBrush
80   #define GetFace __SELECTEDFACETABLENAME.m_pfnGetFace
81   #define GetFaceInfo __SELECTEDFACETABLENAME.m_pfnGetFaceInfo
82   #define SetFaceInfo __SELECTEDFACETABLENAME.m_pfnSetFaceInfo
83   #define GetTextureNumber __SELECTEDFACETABLENAME.m_pfnGetTextureNumber
84   #define GetTextureSize __SELECTEDFACETABLENAME.m_pfnGetTextureSize
85   #define Select_SetTexture __SELECTEDFACETABLENAME.m_pfnSelect_SetTexture
86 #endif
87
88 #endif