X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fbrushnode.h;h=ad6b636ad45555840c16e04e0adc0725e6e5386c;hb=9dfae1c9b270ee369c6362903a9205b30751b95f;hp=5e1465e3a4d79a0c88805513b1a5d61023494a88;hpb=12b372f89ce109a4db9d510884fbe7d05af79870;p=xonotic%2Fnetradiant.git diff --git a/radiant/brushnode.h b/radiant/brushnode.h index 5e1465e3..ad6b636a 100644 --- a/radiant/brushnode.h +++ b/radiant/brushnode.h @@ -1,25 +1,25 @@ /* -Copyright (C) 2001-2006, William Joseph. -All Rights Reserved. + Copyright (C) 2001-2006, William Joseph. + All Rights Reserved. -This file is part of GtkRadiant. + 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 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. + 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 -*/ + 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_BRUSHNODE_H) +#if !defined( INCLUDED_BRUSHNODE_H ) #define INCLUDED_BRUSHNODE_H #include "instancelib.h" @@ -28,140 +28,155 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "brushxml.h" class BrushNode : -public scene::Node::Symbiot, -public scene::Instantiable, -public scene::Cloneable -{ - class TypeCasts - { - NodeTypeCastTable m_casts; - public: - TypeCasts() - { - NodeStaticCast::install(m_casts); - NodeStaticCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - NodeContainedCast::install(m_casts); - } - NodeTypeCastTable& get() - { - return m_casts; - } - }; - - - scene::Node m_node; - InstanceSet m_instances; - Brush m_brush; - BrushTokenImporter m_mapImporter; - BrushTokenExporter m_mapExporter; - BrushXMLImporter m_xmlImporter; - BrushXMLExporter m_xmlExporter; + public scene::Node::Symbiot, + public scene::Instantiable, + public scene::Cloneable { + class TypeCasts { + NodeTypeCastTable m_casts; + public: + TypeCasts() + { + NodeStaticCast::install(m_casts); + NodeStaticCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + NodeContainedCast::install(m_casts); + } + + NodeTypeCastTable &get() + { + return m_casts; + } + }; + + + scene::Node m_node; + InstanceSet m_instances; + Brush m_brush; + BrushTokenImporter m_mapImporter; + BrushTokenExporter m_mapExporter; + BrushXMLImporter m_xmlImporter; + BrushXMLExporter m_xmlExporter; public: - typedef LazyStatic StaticTypeCasts; - - Snappable& get(NullType) - { - return m_brush; - } - TransformNode& get(NullType) - { - return m_brush; - } - Brush& get(NullType) - { - return m_brush; - } - XMLImporter& get(NullType) - { - return m_xmlImporter; - } - XMLExporter& get(NullType) - { - return m_xmlExporter; - } - MapImporter& get(NullType) - { - return m_mapImporter; - } - MapExporter& get(NullType) - { - return m_mapExporter; - } - Nameable& get(NullType) - { - return m_brush; - } - BrushDoom3& get(NullType) - { - return m_brush; - } - - BrushNode() : - m_node(this, this, StaticTypeCasts::instance().get()), - m_brush(m_node, InstanceSetEvaluateTransform::Caller(m_instances), InstanceSet::BoundsChangedCaller(m_instances)), - m_mapImporter(m_brush), - m_mapExporter(m_brush), - m_xmlImporter(m_brush), - m_xmlExporter(m_brush) - { - } - BrushNode(const BrushNode& other) : - scene::Node::Symbiot(other), - scene::Instantiable(other), - scene::Cloneable(other), - m_node(this, this, StaticTypeCasts::instance().get()), - m_brush(other.m_brush, m_node, InstanceSetEvaluateTransform::Caller(m_instances), InstanceSet::BoundsChangedCaller(m_instances)), - m_mapImporter(m_brush), - m_mapExporter(m_brush), - m_xmlImporter(m_brush), - m_xmlExporter(m_brush) - { - } - void release() - { - delete this; - } - scene::Node& node() - { - return m_node; - } - - scene::Node& clone() const - { - return (new BrushNode(*this))->node(); - } - - scene::Instance* create(const scene::Path& path, scene::Instance* parent) - { - return new BrushInstance(path, parent, m_brush); - } - void forEachInstance(const scene::Instantiable::Visitor& visitor) - { - m_instances.forEachInstance(visitor); - } - void insert(scene::Instantiable::Observer* observer, const scene::Path& path, scene::Instance* instance) - { - m_instances.insert(observer, path, instance); - } - scene::Instance* erase(scene::Instantiable::Observer* observer, const scene::Path& path) - { - return m_instances.erase(observer, path); - } + typedef LazyStatic StaticTypeCasts; + + Snappable &get(NullType) + { + return m_brush; + } + + TransformNode &get(NullType) + { + return m_brush; + } + + Brush &get(NullType) + { + return m_brush; + } + + XMLImporter &get(NullType) + { + return m_xmlImporter; + } + + XMLExporter &get(NullType) + { + return m_xmlExporter; + } + + MapImporter &get(NullType) + { + return m_mapImporter; + } + + MapExporter &get(NullType) + { + return m_mapExporter; + } + + Nameable &get(NullType) + { + return m_brush; + } + + BrushDoom3 &get(NullType) + { + return m_brush; + } + + BrushNode() : + m_node(this, this, StaticTypeCasts::instance().get()), + m_brush(m_node, InstanceSetEvaluateTransform::Caller(m_instances), + InstanceSet::BoundsChangedCaller(m_instances)), + m_mapImporter(m_brush), + m_mapExporter(m_brush), + m_xmlImporter(m_brush), + m_xmlExporter(m_brush) + { + } + + BrushNode(const BrushNode &other) : + scene::Node::Symbiot(other), + scene::Instantiable(other), + scene::Cloneable(other), + m_node(this, this, StaticTypeCasts::instance().get()), + m_brush(other.m_brush, m_node, InstanceSetEvaluateTransform::Caller(m_instances), + InstanceSet::BoundsChangedCaller(m_instances)), + m_mapImporter(m_brush), + m_mapExporter(m_brush), + m_xmlImporter(m_brush), + m_xmlExporter(m_brush) + { + } + + void release() + { + delete this; + } + + scene::Node &node() + { + return m_node; + } + + scene::Node &clone() const + { + return (new BrushNode(*this))->node(); + } + + scene::Instance *create(const scene::Path &path, scene::Instance *parent) + { + return new BrushInstance(path, parent, m_brush); + } + + void forEachInstance(const scene::Instantiable::Visitor &visitor) + { + m_instances.forEachInstance(visitor); + } + + void insert(scene::Instantiable::Observer *observer, const scene::Path &path, scene::Instance *instance) + { + m_instances.insert(observer, path, instance); + } + + scene::Instance *erase(scene::Instantiable::Observer *observer, const scene::Path &path) + { + return m_instances.erase(observer, path); + } }; -inline Brush* Node_getBrush(scene::Node& node) +inline Brush *Node_getBrush(scene::Node &node) { - return NodeTypeCast::cast(node); + return NodeTypeCast::cast(node); } #endif