diff --git a/include/cullable.h b/include/cullable.h index 6b77bba4..db8d9094 100644 --- a/include/cullable.h +++ b/include/cullable.h @@ -22,9 +22,8 @@ #pragma once #include "generic/constant.h" +#include "math/vectorfwd.h" -template class BasicVector3; -typedef BasicVector3 Vector3; template class Plane3___; typedef Plane3___ Plane3; class Matrix4; diff --git a/include/icamera.h b/include/icamera.h index 3b383c32..f6a15089 100644 --- a/include/icamera.h +++ b/include/icamera.h @@ -46,8 +46,7 @@ public: virtual void setCameraView( CameraView* view, const Callback& disconnect ) = 0; }; -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" typedef void ( *PFN_GETCAMERA )( Vector3& origin, Vector3& angles ); typedef void ( *PFN_SETCAMERA )( const Vector3& origin, const Vector3& angles ); diff --git a/include/iselection.h b/include/iselection.h index 17b8cd61..b53ed184 100644 --- a/include/iselection.h +++ b/include/iselection.h @@ -25,6 +25,7 @@ #include "generic/constant.h" #include "generic/callback.h" #include "signal/signalfwd.h" +#include "math/vectorfwd.h" class Renderer; class View; @@ -49,10 +50,6 @@ public: virtual void onSelectedChanged( scene::Instance& instance ) = 0; }; -template class BasicVector3; -typedef BasicVector3 Vector3; -template class BasicVector4; -typedef BasicVector4 Vector4; typedef Vector4 Quaternion; class AABB; diff --git a/include/qerplugin.h b/include/qerplugin.h index a2e263fd..c4e671e1 100644 --- a/include/qerplugin.h +++ b/include/qerplugin.h @@ -26,6 +26,7 @@ #pragma once #include "generic/constant.h" +#include "generic/vector.h" // ======================================== @@ -64,10 +65,9 @@ typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( QWidget *parent, const cha typedef const char* ( *PFN_QERAPP_FILEDIALOG )( QWidget *parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ ); typedef QString ( *PFN_QERAPP_DIRDIALOG )( QWidget *parent, const QString& path /* = {} */ ); + // return true if the user closed the dialog with 'Ok' // 'color' is used to set the initial value and store the selected value -template class BasicVector3; -typedef BasicVector3 Vector3; typedef bool ( *PFN_QERAPP_COLORDIALOG )( QWidget *parent, Vector3& color, const char* title /* = "Choose Color"*/ ); @@ -87,7 +87,6 @@ class ModuleObserver; #include "signal/signalfwd.h" #include "windowobserver.h" -#include "generic/vector.h" typedef SignalHandler3 MouseEventHandler; typedef SignalFwd::handler_id_type MouseEventHandlerId; diff --git a/include/windowobserver.h b/include/windowobserver.h index 49021d1d..19bf1829 100644 --- a/include/windowobserver.h +++ b/include/windowobserver.h @@ -70,9 +70,7 @@ const ButtonIdentifier c_buttonMiddle( ButtonEnumeration::MIDDLE ); const ButtonIdentifier c_buttonRight( ButtonEnumeration::RIGHT ); -template -class BasicVector2; -typedef BasicVector2 Vector2; +#include "math/vectorfwd.h" typedef Vector2 WindowVector; class WindowObserver diff --git a/libs/math/vectorfwd.h b/libs/math/vectorfwd.h new file mode 100644 index 00000000..0aa6ec52 --- /dev/null +++ b/libs/math/vectorfwd.h @@ -0,0 +1,29 @@ +/* + 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 + */ + +#pragma once + +template class BasicVector2; +typedef BasicVector2 Vector2; +template class BasicVector3; +typedef BasicVector3 Vector3; +template class BasicVector4; +typedef BasicVector4 Vector4; diff --git a/radiant/brushmanip.h b/radiant/brushmanip.h index f32dea0b..64c96283 100644 --- a/radiant/brushmanip.h +++ b/radiant/brushmanip.h @@ -24,6 +24,7 @@ #include #include "string/stringfwd.h" #include "generic/callback.h" +#include "math/vectorfwd.h" enum class EBrushPrefab { @@ -37,6 +38,7 @@ enum class EBrushPrefab class TextureProjection; class ContentsFlagsValue; +class texdef_t; namespace scene { class Graph; @@ -74,9 +76,6 @@ void Scene_BrushSelectByShader( scene::Graph& graph, const char* name ); void Scene_BrushSelectByShader_Component( scene::Graph& graph, const char* name ); void Scene_BrushFacesSelectByShader( scene::Graph& graph, const char* name ); -#include "itexdef.h" -template class BasicVector3; -typedef BasicVector3 Vector3; void Scene_BrushProjectTexture_Selected( scene::Graph& graph, const texdef_t& texdef, const Vector3* direction ); void Scene_BrushProjectTexture_Component_Selected( scene::Graph& graph, const texdef_t& texdef, const Vector3* direction ); void Scene_BrushProjectTexture_Selected( scene::Graph& graph, const TextureProjection& projection, const Vector3& normal ); diff --git a/radiant/colors.h b/radiant/colors.h index 4344126f..aa15c5da 100644 --- a/radiant/colors.h +++ b/radiant/colors.h @@ -21,8 +21,7 @@ #pragma once -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" void SetWorldspawnColour( const Vector3& colour ); void Colors_registerCommands(); diff --git a/radiant/entity.h b/radiant/entity.h index 4522b2dc..ac209ee9 100644 --- a/radiant/entity.h +++ b/radiant/entity.h @@ -21,8 +21,8 @@ #pragma once -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" + void Entity_createFromSelection( const char* name, const Vector3& origin ); void Scene_EntitySetKeyValue_Selected( const char* key, const char* value ); diff --git a/radiant/gtkmisc.h b/radiant/gtkmisc.h index 66ecb703..2fa7da03 100644 --- a/radiant/gtkmisc.h +++ b/radiant/gtkmisc.h @@ -52,8 +52,8 @@ QAction* toolbar_append_button( QToolBar* toolbar, const char* description, cons // this also sets up the shortcut using command_connect_accelerator QAction* toolbar_append_toggle_button( QToolBar* toolbar, const char* description, const char* icon, const char* commandName ); -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" + bool color_dialog( QWidget *parent, Vector3& color, const char* title = "Choose Color" ); #include "string/stringfwd.h" diff --git a/radiant/map.h b/radiant/map.h index 76b0ee31..bf7dc6a1 100644 --- a/radiant/map.h +++ b/radiant/map.h @@ -25,6 +25,7 @@ #include "generic/callback.h" #include "signal/signalfwd.h" #include "string/stringfwd.h" +#include "math/vectorfwd.h" class Map; extern Map g_map; @@ -91,9 +92,6 @@ scene::Node* Map_GetWorldspawn( const Map& map ); scene::Node* Map_FindWorldspawn( Map& map ); scene::Node& Map_FindOrInsertWorldspawn( Map& map ); -template class BasicVector3; -typedef BasicVector3 Vector3; - extern Vector3 g_region_mins, g_region_maxs; extern bool g_region_active; diff --git a/radiant/modelwindow.h b/radiant/modelwindow.h index f86e5cfc..8daf80e4 100644 --- a/radiant/modelwindow.h +++ b/radiant/modelwindow.h @@ -31,8 +31,7 @@ void ModelBrowser_destroyWindow(); void ModelBrowser_flushReferences(); -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" const Vector3& ModelBrowser_getBackgroundColour(); void ModelBrowser_setBackgroundColour( const Vector3& colour ); diff --git a/radiant/patchmanip.h b/radiant/patchmanip.h index 70de3341..98de5ba5 100644 --- a/radiant/patchmanip.h +++ b/radiant/patchmanip.h @@ -22,6 +22,7 @@ #pragma once #include "string/stringfwd.h" +#include "math/vectorfwd.h" void Patch_registerCommands(); void Patch_constructToolbar( class QToolBar* toolbar ); @@ -43,11 +44,8 @@ bool Scene_PatchGetShaderTexdef_Selected( scene::Graph& graph, CopiedString& nam void Patch_SetTexdef( const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation ); void Scene_PatchCapTexture_Selected( scene::Graph& graph ); -class texdef_t; -template class BasicVector3; -typedef BasicVector3 Vector3; -void Scene_PatchProjectTexture_Selected( scene::Graph& graph, const texdef_t& texdef, const Vector3* direction ); -class TextureProjection; + +void Scene_PatchProjectTexture_Selected( scene::Graph& graph, const class texdef_t& texdef, const Vector3* direction ); void Scene_PatchProjectTexture_Selected( scene::Graph& graph, const TextureProjection& projection, const Vector3& normal ); void Scene_PatchNaturalTexture_Selected( scene::Graph& graph ); void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ); diff --git a/radiant/pluginapi.h b/radiant/pluginapi.h index a1eff203..21846a21 100644 --- a/radiant/pluginapi.h +++ b/radiant/pluginapi.h @@ -21,8 +21,7 @@ #pragma once -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" // camera API void QERApp_GetCamera( Vector3& origin, Vector3& angles ); diff --git a/radiant/selection.h b/radiant/selection.h index 0d4708b9..c949ab0e 100644 --- a/radiant/selection.h +++ b/radiant/selection.h @@ -39,7 +39,6 @@ public: SelectionSystemWindowObserver* NewWindowObserver(); -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" void Scene_Intersect( const View& view, const Vector2& device_point, const Vector2& device_epsilon, Vector3& intersection ); diff --git a/radiant/texwindow.h b/radiant/texwindow.h index f35e7376..1f992df0 100644 --- a/radiant/texwindow.h +++ b/radiant/texwindow.h @@ -23,6 +23,7 @@ #include "generic/callback.h" #include "signal/signalfwd.h" +#include "math/vectorfwd.h" class QWidget; QWidget* TextureBrowser_constructWindow( QWidget* toplevel ); @@ -42,8 +43,6 @@ void TextureBrowser_exportTitle( const StringImportCallback& importer ); typedef FreeCaller TextureBrowserExportTitleCaller; -template class BasicVector3; -typedef BasicVector3 Vector3; const Vector3& TextureBrowser_getBackgroundColour(); void TextureBrowser_setBackgroundColour( const Vector3& colour ); diff --git a/tools/quake3/common/inout_xml.h b/tools/quake3/common/inout_xml.h index 73055e95..c5281588 100644 --- a/tools/quake3/common/inout_xml.h +++ b/tools/quake3/common/inout_xml.h @@ -25,8 +25,7 @@ typedef struct _xmlNode xmlNode; typedef xmlNode *xmlNodePtr; -template class BasicVector3; -typedef BasicVector3 Vector3; +#include "math/vectorfwd.h" // some useful xml routines xmlNodePtr xml_NodeForVec( const Vector3& v );