lltoolbrush.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLTOOLBRUSH_H
00033 #define LL_LLTOOLBRUSH_H
00034 
00035 #include "lltool.h"
00036 #include "v3math.h"
00037 #include "lleditmenuhandler.h"
00038 
00039 class LLSurface;
00040 class LLVector3d;
00041 class LLViewerRegion;
00042 
00043 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00044 // Class LLToolBrushLand
00045 //
00046 // A toolbrush that modifies the land.
00047 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00048 
00049 class LLToolBrushLand : public LLTool, public LLEditMenuHandler, public LLSingleton<LLToolBrushLand>
00050 {
00051         typedef std::set<LLViewerRegion*> region_list_t;
00052 
00053 public:
00054         LLToolBrushLand();
00055         
00056         // x,y in window coords, 0,0 = left,bot
00057         virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
00058         virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );          
00059         virtual BOOL handleHover( S32 x, S32 y, MASK mask );
00060         virtual void handleSelect();
00061         virtual void handleDeselect();
00062 
00063         // isAlwaysRendered() - return true if this is a tool that should
00064         // always be rendered regardless of selection.
00065         virtual BOOL isAlwaysRendered() { return TRUE; }
00066 
00067         // Draw the area that will be affected.
00068         virtual void render();
00069 
00070         // on Idle is where the land modification actually occurs
00071         static void onIdle(void* brush_tool);  
00072 
00073         void                    onMouseCaptureLost();
00074 
00075         void modifyLandInSelectionGlobal();
00076         virtual void    undo();
00077         virtual BOOL    canUndo() const { return TRUE; }
00078 
00079 protected:
00080         void brush( void );
00081         void modifyLandAtPointGlobal( const LLVector3d &spot, MASK mask );
00082 
00083         void determineAffectedRegions(region_list_t& regions,
00084                                                                   const LLVector3d& spot) const;
00085         void renderOverlay(LLSurface& land, const LLVector3& pos_region,
00086                                            const LLVector3& pos_world);
00087 
00088         // Does region allow terraform, or are we a god?
00089         bool canTerraform(LLViewerRegion* regionp) const;
00090 
00091         // Modal dialog that you can't terraform the region
00092         void alertNoTerraform(LLViewerRegion* regionp);
00093 
00094 protected:
00095         F32 mStartingZ;
00096         S32 mMouseX;
00097         S32 mMouseY;
00098         S32 mBrushIndex;
00099         BOOL mGotHover;
00100         BOOL mLastShowParcelOwners;
00101         BOOL mBrushSelected;
00102         // Order doesn't matter and we do check for existance of regions, so use a set
00103         region_list_t mLastAffectedRegions;
00104 };
00105 
00106 
00107 #endif // LL_LLTOOLBRUSH_H

Generated on Fri May 16 08:34:06 2008 for SecondLife by  doxygen 1.5.5