Cafu Engine
ToolNewBezierPatch.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_TOOL_NEW_BEZIER_PATCH_HPP_INCLUDED
8 #define CAFU_TOOL_NEW_BEZIER_PATCH_HPP_INCLUDED
9 
10 #include "Tool.hpp"
11 #include "Math3D/Vector3.hpp"
12 #include "Templates/Array.hpp"
13 
14 
15 class MapBezierPatchT;
17 class ViewWindowT;
18 
19 
20 class ToolNewBezierPatchT : public ToolT
21 {
22  public:
23 
24  ToolNewBezierPatchT(MapDocumentT& MapDoc, ToolManagerT& ToolMan, wxWindow* ParentOptionsBar);
25 
27 
28  // Implementations/overrides of ToolT methods.
29  int GetWxEventID() const { return ChildFrameT::ID_MENU_TOOLS_TOOL_NEWBEZIERPATCH; }
30  wxWindow* GetOptionsBar();
31 
32  bool OnKeyDown2D (ViewWindow2DT& ViewWindow, wxKeyEvent& KE);
33  bool OnLMouseDown2D(ViewWindow2DT& ViewWindow, wxMouseEvent& ME);
34  bool OnLMouseUp2D (ViewWindow2DT& ViewWindow, wxMouseEvent& ME);
35  bool OnMouseMove2D (ViewWindow2DT& ViewWindow, wxMouseEvent& ME);
36 
37  bool OnKeyDown3D (ViewWindow3DT& ViewWindow, wxKeyEvent& KE);
38  bool OnLMouseDown3D(ViewWindow3DT& ViewWindow, wxMouseEvent& ME);
39  bool OnMouseMove3D (ViewWindow3DT& ViewWindow, wxMouseEvent& ME);
40 
41  void RenderTool2D(Renderer2DT& Renderer) const;
42  void RenderTool3D(Renderer3DT& Renderer) const;
43 
44  // The TypeSys related declarations for this class.
45  virtual const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; }
46  static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params);
47  static const cf::TypeSys::TypeInfoT TypeInfo;
48 
49 
50  private:
51 
52  bool OnKeyDown(ViewWindowT& ViewWindow, wxKeyEvent& KE);
53  void UpdateNewBPs(ViewWindow2DT& ViewWindow); ///< Updates the m_NewBPs member according to the given drag rectangle.
54  void DeleteNewBPs(); ///< Deletes the bezier patches kept in m_NewBPs and clears the array.
55 
56  ArrayT<MapBezierPatchT*> m_NewBPs; ///< The new bezier patch(es) that is/are currently being dragged. The array is empty when no dragging is in progress.
57  // int m_NewBPType; ///< Describes the type of bezier patch(es) that we are currently creating: simple, cylinder, cone, spheroid, ...
58  Vector3fT m_DragBegin; ///< The point in world space where the dragging began (first corner of the dragging rectangle).
59  Vector3fT m_DragCurrent; ///< The current point in world space of the drag (second corner of the dragging rectangle).
60 
61  OptionsBar_NewBezierPatchToolT* m_OptionsBar; ///< The options bar for this tool.
62 };
63 
64 #endif
This class provides auxiliary means for rendering a 3D view.
Definition: Renderer3D.hpp:30
This class implements the rendering into a 2D view.
Definition: Renderer2D.hpp:22
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
wxWindow * GetOptionsBar()
Returns the options bar window associated with this tool. NULL if no options bar has been assigned...
Definition: ToolNewBezierPatch.cpp:64
bool OnLMouseDown3D(ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction).
Definition: ToolNewBezierPatch.cpp:193
The options bar for the New Bezier Patch tool.
Definition: ToolOptionsBars.hpp:111
Definition: ToolNewBezierPatch.hpp:20
bool OnLMouseDown2D(ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction).
Definition: ToolNewBezierPatch.cpp:78
This class represents a bezier patch.
Definition: MapBezierPatch.hpp:44
This class represents a (superclass of a) 2D or 3D map view window.
Definition: ChildFrameViewWin.hpp:21
Definition: ChildFrameViewWin2D.hpp:24
Definition: ChildFrameViewWin3D.hpp:21
int GetWxEventID() const
Returns the ID of the wxWidgets event (menu selection or toolbar button click) that is associated wit...
Definition: ToolNewBezierPatch.hpp:29
Definition: ToolManager.hpp:20
This is the base class for all tools in the map editor.
Definition: Tool.hpp:34
Definition: TypeSys.hpp:52
This class keeps type information (about an entity class that occurs in the game).
Definition: TypeSys.hpp:79