2 Copyright (C) 2001-2006, William Joseph.
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 #if !defined(INCLUDED_IBRUSH_H)
23 #define INCLUDED_IBRUSH_H
25 #include "generic/constant.h"
26 #include "generic/callback.h"
27 #include "generic/vector.h"
39 virtual const char* GetShader() const = 0;
40 virtual void SetShader(const char* name) = 0;
41 virtual const TextureProjection& GetTexdef() const = 0;
42 virtual void GetTexdef(TextureProjection& projection) const = 0;
43 virtual void SetTexdef(const TextureProjection& projection) = 0;
44 virtual void GetFlags(ContentsFlagsValue& flags) const = 0;
45 virtual void SetFlags(const ContentsFlagsValue& flags) = 0;
46 virtual void ShiftTexdef(float s, float t) = 0;
47 virtual void ScaleTexdef(float s, float t) = 0;
48 virtual void RotateTexdef(float angle) = 0;
49 virtual void FitTexture(float s_repeat, float t_repeat) = 0;
50 virtual bool isDetail() const = 0;
51 virtual void setDetail(bool detail) = 0;
57 STRING_CONSTANT(Name, "IBrush");
58 virtual void reserve(std::size_t count) = 0;
59 virtual void clear() = 0;
60 virtual void copy(const IBrush& other) = 0;
61 virtual IBrushFace* addPlane(const Vector3& p0, const Vector3& p1, const Vector3& p2, const char* shader, const TextureProjection& projection) = 0;
62 virtual const AABB& localAABB() const = 0;
63 virtual void removeEmptyFaces() = 0;
66 class IBrushFaceInstance
69 virtual IBrushFace& getFace() = 0;
70 virtual const IBrushFace& getFace() const = 0;
71 virtual bool isSelected() const = 0;
72 virtual void setSelected(SelectionSystem::EComponentMode mode, bool select) const = 0;
78 STRING_CONSTANT(Name, "IBrushInstance");
79 virtual void forEachFaceInstance(const BrushInstanceVisitor& visitor) = 0;
86 _QERFaceData() : m_shader(""), contents(0), flags(0), value(0)
99 typedef Callback1<const _QERFaceData&> BrushFaceDataCallback;
104 INTEGER_CONSTANT(Version, 1);
105 STRING_CONSTANT(Name, "brush");
106 virtual scene::Node& createBrush() = 0;
107 virtual bool useAlternativeTextureProjection() const = 0;
108 virtual void Brush_forEachFace(scene::Node& brush, const BrushFaceDataCallback& callback) = 0;
109 virtual bool Brush_addFace(scene::Node& brush, const _QERFaceData& faceData) = 0;
112 #include "modulesystem.h"
114 template<typename Type>
116 typedef GlobalModule<BrushCreator> GlobalBrushModule;
118 template<typename Type>
119 class GlobalModuleRef;
120 typedef GlobalModuleRef<BrushCreator> GlobalBrushModuleRef;
122 inline BrushCreator& GlobalBrushCreator()
124 return GlobalBrushModule::getTable();