Cafu Engine
ApplyMaterial.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_COMMAND_APPLY_MATERIAL_HPP_INCLUDED
8 #define CAFU_COMMAND_APPLY_MATERIAL_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 
12 
13 class MapBrushT;
14 class MapBezierPatchT;
15 class MapDocumentT;
16 class MapElementT;
17 class MapTerrainT;
18 class EditorMaterialI;
19 
20 
22 {
23  public:
24 
25  /// Constructor to apply the given material to an array of objects.
26  CommandApplyMaterialT(MapDocumentT& MapDoc, const ArrayT<MapElementT*>& Objects, EditorMaterialI* Material);
27 
28  // Implementation of the CommandT interface.
29  bool Do();
30  void Undo();
31  wxString GetName() const;
32 
33 
34  private:
35 
36  MapDocumentT& m_MapDoc;
37  EditorMaterialI* m_Material;
38  ArrayT<MapElementT*> m_Objects;
39 
40  ArrayT<MapBrushT*> m_Brushes;
41  ArrayT<MapBezierPatchT*> m_BezierPatches;
42  ArrayT<MapTerrainT*> m_Terrains;
43 
44  ArrayT< ArrayT<EditorMaterialI*> > m_OldBrushMats;
45  ArrayT<EditorMaterialI*> m_OldBezierPatchMats;
46  ArrayT<EditorMaterialI*> m_OldTerrainMats;
47 };
48 
49 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
wxString GetName() const
Returns the name (a description) of the command.
Definition: ApplyMaterial.cpp:120
bool Do()
This method executes the command.
Definition: ApplyMaterial.cpp:67
Definition: ApplyMaterial.hpp:21
Definition: MapBrush.hpp:15
The TerrainT class represents a terrain in a map.
Definition: MapTerrain.hpp:22
This class represents a bezier patch.
Definition: MapBezierPatch.hpp:44
Definition: EditorMaterial.hpp:21
void Undo()
This method un-does the command.
Definition: ApplyMaterial.cpp:94
CommandApplyMaterialT(MapDocumentT &MapDoc, const ArrayT< MapElementT * > &Objects, EditorMaterialI *Material)
Constructor to apply the given material to an array of objects.
Definition: ApplyMaterial.cpp:15
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57