3 * Declares the MeshVisitor class.
4 * @ingroup meshtex-util
8 * Copyright 2012 Joel Baxter
10 * This file is part of MeshTex.
12 * MeshTex is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 2 of the License, or
15 * (at your option) any later version.
17 * MeshTex is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with MeshTex. If not, see <http://www.gnu.org/licenses/>.
26 #if !defined(INCLUDED_MESHVISITOR_H)
27 #define INCLUDED_MESHVISITOR_H
29 #include "RefCounted.h"
30 #include "MeshEntity.h"
32 #include "iselection.h"
35 * Visitor that will invoke Execute with a MeshEntity argument if the visited
36 * node is a valid mesh. Subclasses should override Execute to perform
37 * operations on the MeshEntity.
39 * @ingroup meshtex-util
41 class MeshVisitor : public SelectionSystem::Visitor, public RefCounted
43 public: // public methods
46 virtual ~MeshVisitor();
47 void ResetVisitedCount();
48 unsigned GetVisitedCount();
49 void visit(scene::Instance& instance) const;
51 protected: // protected methods
53 virtual bool Execute(MeshEntity& meshEntity) const;
55 private: // private static member vars
57 /// @name Callbacks to use when constructing the MeshEntity
59 static const MeshEntity::MessageCallback _infoReportCallback;
60 static const MeshEntity::MessageCallback _warningReportCallback;
61 static const MeshEntity::MessageCallback _errorReportCallback;
64 private: // private member vars
67 * Track the number of Execute invocations.
69 mutable unsigned _visitedCount;
72 #endif // #if !defined(INCLUDED_MESHVISITOR_H)