MeshMoldTool.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // MeshMoldTool.h
  19. // Terrain shaping tools for worldbuilder.
  20. // Author: John Ahlquist, Oct. 2001
  21. #pragma once
  22. #ifndef MESHMOLDTOOL_H
  23. #define MESHMOLDTOOL_H
  24. #include "Tool.h"
  25. class WorldHeightMapEdit;
  26. /*************************************************************************/
  27. /** MeshMoldTool
  28. Does the Mesh Mold tool operation.
  29. ***************************************************************************/
  30. /// Height brush tool.
  31. class MeshMoldTool : public Tool
  32. {
  33. protected:
  34. CPoint m_prevViewPt; ///< Previous tracking location in view coords.
  35. Bool m_offsettingZ; ///< True if we are raising or lowering the mesh along z axis.
  36. Coord3D m_prevDocPt; ///< Previous tracking location in doc coords.
  37. static Coord3D m_toolPos; ///< Current location of the mesh on the terrain.
  38. static Bool m_tracking; ///< True if we are tracking a mesh on screen.
  39. static WorldHeightMapEdit *m_htMapEditCopy; ///< ref counted.
  40. public:
  41. MeshMoldTool(void);
  42. ~MeshMoldTool(void);
  43. protected:
  44. static void applyMesh(CWorldBuilderDoc *pDoc); ///< Apply the mesh to copy of terrain.
  45. public:
  46. static void apply(CWorldBuilderDoc *pDoc); ///< Apply the mesh to the terrain & execute undoable.
  47. public: //Tool methods.
  48. virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  49. virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  50. virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  51. virtual WorldHeightMapEdit *getHeightMap(void) {return m_htMapEditCopy;};
  52. virtual void activate(); ///< Become the current tool.
  53. virtual void deactivate(); ///< Become the current tool.
  54. virtual Bool followsTerrain(void) {return false;};
  55. public: // Methods specific to MeshMoldTool.
  56. static void updateMeshLocation(Bool changePreview);
  57. };
  58. #endif //MESHMOLDTOOL_H