PageRenderTime 25ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/newview/lltoolbrush.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 104 lines | 46 code | 20 blank | 38 comment | 0 complexity | a9c717977fa8d9563f5357c94d68c2b7 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltoolbrush.h
  3. * @brief toolbrush class header file
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLTOOLBRUSH_H
  27. #define LL_LLTOOLBRUSH_H
  28. #include "lltool.h"
  29. #include "v3math.h"
  30. #include "lleditmenuhandler.h"
  31. class LLSurface;
  32. class LLVector3d;
  33. class LLViewerRegion;
  34. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. // Class LLToolBrushLand
  36. //
  37. // A toolbrush that modifies the land.
  38. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  39. class LLToolBrushLand : public LLTool, public LLEditMenuHandler, public LLSingleton<LLToolBrushLand>
  40. {
  41. typedef std::set<LLViewerRegion*> region_list_t;
  42. public:
  43. LLToolBrushLand();
  44. // x,y in window coords, 0,0 = left,bot
  45. virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
  46. virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
  47. virtual BOOL handleHover( S32 x, S32 y, MASK mask );
  48. virtual void handleSelect();
  49. virtual void handleDeselect();
  50. // isAlwaysRendered() - return true if this is a tool that should
  51. // always be rendered regardless of selection.
  52. virtual BOOL isAlwaysRendered() { return TRUE; }
  53. // Draw the area that will be affected.
  54. virtual void render();
  55. // on Idle is where the land modification actually occurs
  56. static void onIdle(void* brush_tool);
  57. void onMouseCaptureLost();
  58. void modifyLandInSelectionGlobal();
  59. virtual void undo();
  60. virtual BOOL canUndo() const { return TRUE; }
  61. protected:
  62. void brush( void );
  63. void modifyLandAtPointGlobal( const LLVector3d &spot, MASK mask );
  64. void determineAffectedRegions(region_list_t& regions,
  65. const LLVector3d& spot) const;
  66. void renderOverlay(LLSurface& land, const LLVector3& pos_region,
  67. const LLVector3& pos_world);
  68. // Does region allow terraform, or are we a god?
  69. bool canTerraform(LLViewerRegion* regionp) const;
  70. // Modal dialog that you can't terraform the region
  71. void alertNoTerraform(LLViewerRegion* regionp);
  72. protected:
  73. F32 mStartingZ;
  74. S32 mMouseX;
  75. S32 mMouseY;
  76. F32 mBrushSize;
  77. BOOL mGotHover;
  78. BOOL mBrushSelected;
  79. // Order doesn't matter and we do check for existance of regions, so use a set
  80. region_list_t mLastAffectedRegions;
  81. private:
  82. U8 getBrushIndex();
  83. };
  84. #endif // LL_LLTOOLBRUSH_H