Cafu Engine
UpdateUVCoords.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_MODELEDITOR_UPDATE_UV_COORDS_HPP_INCLUDED
8 #define CAFU_MODELEDITOR_UPDATE_UV_COORDS_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 #include "Math3D/Vector3.hpp"
12 
13 
14 class AnimPoseT;
15 
16 
17 namespace ModelEditor
18 {
19  class ModelDocumentT;
20 
22  {
23  public:
24 
25  struct CoordT
26  {
27  bool operator == (const CoordT& C) { return u==C.u && v==C.v; }
28  bool operator != (const CoordT& C) { return u!=C.u || v!=C.v; }
29 
30  float u;
31  float v;
32  };
33 
34  CommandUpdateUVCoordsT(ModelDocumentT* ModelDoc, unsigned int MeshNr, const AnimPoseT& Pose, const Vector3fT& u, const Vector3fT& v);
35  CommandUpdateUVCoordsT(ModelDocumentT* ModelDoc, unsigned int MeshNr, const ArrayT<CoordT>& NewUVs);
36 
37  // CommandT implementation.
38  bool Do();
39  void Undo();
40  wxString GetName() const;
41 
42 
43  private:
44 
45  ArrayT<CoordT> GetNewUVs(const AnimPoseT& Pose, const Vector3fT& u, const Vector3fT& v) const;
46  ArrayT<CoordT> GetOldUVs() const;
47 
48  ModelDocumentT* m_ModelDoc;
49  const unsigned int m_MeshNr;
50 
51  const ArrayT<CoordT> m_NewUVs;
52  const ArrayT<CoordT> m_OldUVs;
53  };
54 }
55 
56 #endif
void Undo()
This method un-does the command.
Definition: UpdateUVCoords.cpp:60
Definition: UpdateUVCoords.hpp:21
bool Do()
This method executes the command.
Definition: UpdateUVCoords.cpp:33
wxString GetName() const
Returns the name (a description) of the command.
Definition: UpdateUVCoords.cpp:83
Definition: UpdateUVCoords.hpp:25
This class describes a specific pose of an associated model.
Definition: AnimPose.hpp:35
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
Definition: ModelDocument.hpp:30
Definition: Renderer.hpp:16