]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - include/ibrush.h
Remove <gtk/gtk.h> from gtkutil/toolbar.h
[xonotic/netradiant.git] / include / ibrush.h
index 47eb7a816be4284686779fff9de8e61829b6ab13..1171f8a7199980cada591c7fbe0a1597737465b5 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#ifndef _IBRUSH_H_\r
-#define _IBRUSH_H_\r
-\r
-//\r
-// API for brush stuff\r
-//\r
-\r
-#define BRUSH_MAJOR "brush"\r
-// {c1c3f567-2541-4aa3-9d5b-031fbe2a013b}\r
-static const GUID QERBrushTable_GUID = \r
-{ 0xc1c3f567, 0x2541, 0x4aa3, { 0x9d, 0x5b, 0x03, 0x1f, 0xbe, 0x2a, 0x01, 0x3b } };\r
-\r
-typedef void       (* PFN_BRUSHADDTOLIST)  (brush_t *b, brush_t *lst);\r
-typedef void      (* PFN_BRUSHBUILD)      (brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool bFilterTest);\r
-typedef brush_t*  (* PFN_BRUSHCREATE)     (vec3_t mins, vec3_t maxs, texdef_t *texdef);\r
-typedef void      (* PFN_BRUSHFREE)       (brush_t *b, bool bRemoveNode);\r
-typedef void      (* PFN_BRUSHROTATE)     (brush_t *b, vec3_t vAngle, vec3_t vOrigin, bool bBuild);\r
-typedef brush_t*  (* PFN_BRUSHALLOC)      ();\r
-typedef int       (* PFN_BPMESSAGEBOX)    (int);\r
-typedef face_t*   (* PFN_FACEALLOC)       (void);\r
-typedef eclass_t* (* PFN_HASMODEL)        (brush_t *b);\r
-\r
-struct _QERBrushTable\r
-{\r
-  int m_nSize;\r
-  PFN_BRUSHADDTOLIST m_pfnBrush_AddToList;\r
-  PFN_BRUSHBUILD m_pfnBrush_Build;\r
-  PFN_BRUSHCREATE m_pfnBrush_Create;\r
-  PFN_BRUSHFREE m_pfnBrush_Free;\r
-  PFN_BRUSHROTATE m_pfnBrush_Rotate;\r
-  PFN_BRUSHALLOC m_pfnBrushAlloc;\r
-  PFN_BPMESSAGEBOX m_pfnBP_MessageBox;\r
-  PFN_FACEALLOC m_pfnFace_Alloc;\r
-  PFN_HASMODEL m_pfnHasModel;\r
-};\r
-\r
-#ifdef USE_BRUSHTABLE_DEFINE\r
-#ifndef __BRUSHTABLENAME\r
-#define __BRUSHTABLENAME g_BrushTable\r
-#endif\r
-#define Brush_AddToList __BRUSHTABLENAME.m_pfnBrush_AddToList\r
-#define Brush_Build __BRUSHTABLENAME.m_pfnBrush_Build\r
-#define Brush_Create __BRUSHTABLENAME.m_pfnBrush_Create\r
-#define Brush_Free __BRUSHTABLENAME.m_pfnBrush_Free\r
-#define Brush_Rotate __BRUSHTABLENAME.m_pfnBrush_Rotate\r
-#define Brush_Alloc __BRUSHTABLENAME.m_pfnBrushAlloc\r
-#define BP_MessageBox __BRUSHTABLENAME.m_pfnBP_MessageBox\r
-#define Face_Alloc __BRUSHTABLENAME.m_pfnFace_Alloc\r
-#define HasModel __BRUSHTABLENAME.m_pfnHasModel\r
-#endif\r
-\r
-#endif\r
+/*
+   Copyright (C) 2001-2006, William Joseph.
+   All Rights Reserved.
+
+   This file is part of GtkRadiant.
+
+   GtkRadiant is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   GtkRadiant is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GtkRadiant; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#if !defined( INCLUDED_IBRUSH_H )
+#define INCLUDED_IBRUSH_H
+
+#include "generic/constant.h"
+#include "generic/callback.h"
+#include "generic/vector.h"
+#include "itexdef.h"
+
+namespace scene
+{
+class Node;
+}
+
+#if 0
+class IBrushFace
+{
+public:
+virtual const char* GetShader() const = 0;
+virtual void SetShader( const char* name ) = 0;
+virtual const TextureProjection& GetTexdef() const = 0;
+virtual void GetTexdef( TextureProjection& projection ) const = 0;
+virtual void SetTexdef( const TextureProjection& projection ) = 0;
+virtual void GetFlags( ContentsFlagsValue& flags ) const = 0;
+virtual void SetFlags( const ContentsFlagsValue& flags ) = 0;
+virtual void ShiftTexdef( float s, float t ) = 0;
+virtual void ScaleTexdef( float s, float t ) = 0;
+virtual void RotateTexdef( float angle ) = 0;
+virtual void FitTexture( float s_repeat, float t_repeat ) = 0;
+virtual bool isDetail() const = 0;
+virtual void setDetail( bool detail ) = 0;
+};
+
+class IBrush
+{
+public:
+STRING_CONSTANT( Name, "IBrush" );
+virtual void reserve( std::size_t count ) = 0;
+virtual void clear() = 0;
+virtual void copy( const IBrush& other ) = 0;
+virtual IBrushFace* addPlane( const Vector3& p0, const Vector3& p1, const Vector3& p2, const char* shader, const TextureProjection& projection ) = 0;
+virtual const AABB& localAABB() const = 0;
+virtual void removeEmptyFaces() = 0;
+};
+
+class IBrushFaceInstance
+{
+public:
+virtual IBrushFace& getFace() = 0;
+virtual const IBrushFace& getFace() const = 0;
+virtual bool isSelected() const = 0;
+virtual void setSelected( SelectionSystem::EComponentMode mode, bool select ) const = 0;
+};
+
+class IBrushInstance
+{
+public:
+STRING_CONSTANT( Name, "IBrushInstance" );
+virtual void forEachFaceInstance( const BrushInstanceVisitor& visitor ) = 0;
+};
+#endif
+
+class _QERFaceData
+{
+public:
+_QERFaceData() : m_shader( "" ), contents( 0 ), flags( 0 ), value( 0 ){
+}
+Vector3 m_p0;
+Vector3 m_p1;
+Vector3 m_p2;
+texdef_t m_texdef;
+const char* m_shader;
+int contents;
+int flags;
+int value;
+};
+
+typedef Callback1<const _QERFaceData&> BrushFaceDataCallback;
+
+class BrushCreator
+{
+public:
+INTEGER_CONSTANT( Version, 1 );
+STRING_CONSTANT( Name, "brush" );
+virtual scene::Node& createBrush() = 0;
+virtual bool useAlternativeTextureProjection() const = 0;
+virtual void Brush_forEachFace( scene::Node& brush, const BrushFaceDataCallback& callback ) = 0;
+virtual bool Brush_addFace( scene::Node& brush, const _QERFaceData& faceData ) = 0;
+};
+
+#include "modulesystem.h"
+
+template<typename Type>
+class GlobalModule;
+typedef GlobalModule<BrushCreator> GlobalBrushModule;
+
+template<typename Type>
+class GlobalModuleRef;
+typedef GlobalModuleRef<BrushCreator> GlobalBrushModuleRef;
+
+inline BrushCreator& GlobalBrushCreator(){
+       return GlobalBrushModule::getTable();
+}
+
+#endif