Cafu Engine
Mirror.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_MIRROR_HPP_INCLUDED
8 #define CAFU_COMMAND_MIRROR_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 
12 
13 class MapDocumentT;
14 class MapElementT;
15 class TrafoMementoT;
16 
17 
18 /// Command to mirror map elements along a given mirror plane.
19 class CommandMirrorT : public CommandT
20 {
21  public:
22 
23  /// The constructor.
24  CommandMirrorT(MapDocumentT& MapDoc, const ArrayT<MapElementT*>& Elems, unsigned int NormalAxis, float Dist, bool LockTexCoords);
25 
26  /// Destructor.
28 
29  // Implementation of the CommandT interface.
30  bool Do();
31  void Undo();
32  wxString GetName() const;
33 
34 
35  private:
36 
37  MapDocumentT& m_MapDoc;
38  const ArrayT<MapElementT*> m_MirrorElems;
39  ArrayT<TrafoMementoT*> m_OldStates;
40  const unsigned int m_NormalAxis; ///< The number of the axis along which the normal vector of the mirror plane points: 0, 1 or 2 for the x-, y- or z-axis respectively.
41  const float m_Dist; ///< The position of the mirror plane along its normal vector, where it intersects the NormalAxis.
42  const bool m_LockTexCoords;
43 };
44 
45 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
bool Do()
This method executes the command.
Definition: Mirror.cpp:34
An instance of this class encapsulates the transform-related state of a MapElementT.
Definition: MapElement.hpp:39
void Undo()
This method un-does the command.
Definition: Mirror.cpp:56
Command to mirror map elements along a given mirror plane.
Definition: Mirror.hpp:19
wxString GetName() const
Returns the name (a description) of the command.
Definition: Mirror.cpp:76
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
CommandMirrorT(MapDocumentT &MapDoc, const ArrayT< MapElementT * > &Elems, unsigned int NormalAxis, float Dist, bool LockTexCoords)
The constructor.
Definition: Mirror.cpp:12
~CommandMirrorT()
Destructor.
Definition: Mirror.cpp:25
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57