PageRenderTime 30ms CodeModel.GetById 9ms app.highlight 14ms RepoModel.GetById 1ms 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
  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
 27#ifndef LL_LLTOOLBRUSH_H
 28#define LL_LLTOOLBRUSH_H
 29
 30#include "lltool.h"
 31#include "v3math.h"
 32#include "lleditmenuhandler.h"
 33
 34class LLSurface;
 35class LLVector3d;
 36class LLViewerRegion;
 37
 38//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 39// Class LLToolBrushLand
 40//
 41// A toolbrush that modifies the land.
 42//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 43
 44class LLToolBrushLand : public LLTool, public LLEditMenuHandler, public LLSingleton<LLToolBrushLand>
 45{
 46	typedef std::set<LLViewerRegion*> region_list_t;
 47
 48public:
 49	LLToolBrushLand();
 50	
 51	// x,y in window coords, 0,0 = left,bot
 52	virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
 53	virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );		
 54	virtual BOOL handleHover( S32 x, S32 y, MASK mask );
 55	virtual void handleSelect();
 56	virtual void handleDeselect();
 57
 58	// isAlwaysRendered() - return true if this is a tool that should
 59	// always be rendered regardless of selection.
 60	virtual BOOL isAlwaysRendered() { return TRUE; }
 61
 62	// Draw the area that will be affected.
 63	virtual void render();
 64
 65	// on Idle is where the land modification actually occurs
 66	static void onIdle(void* brush_tool);  
 67
 68	void			onMouseCaptureLost();
 69
 70	void modifyLandInSelectionGlobal();
 71	virtual void	undo();
 72	virtual BOOL	canUndo() const	{ return TRUE; }
 73
 74protected:
 75	void brush( void );
 76	void modifyLandAtPointGlobal( const LLVector3d &spot, MASK mask );
 77
 78	void determineAffectedRegions(region_list_t& regions,
 79								  const LLVector3d& spot) const;
 80	void renderOverlay(LLSurface& land, const LLVector3& pos_region,
 81					   const LLVector3& pos_world);
 82
 83	// Does region allow terraform, or are we a god?
 84	bool canTerraform(LLViewerRegion* regionp) const;
 85
 86	// Modal dialog that you can't terraform the region
 87	void alertNoTerraform(LLViewerRegion* regionp);
 88
 89protected:
 90	F32 mStartingZ;
 91	S32 mMouseX;
 92	S32 mMouseY;
 93	F32 mBrushSize;
 94	BOOL mGotHover;
 95	BOOL mBrushSelected;
 96	// Order doesn't matter and we do check for existance of regions, so use a set
 97	region_list_t mLastAffectedRegions;
 98
 99private:
100	U8 getBrushIndex();
101};
102
103
104#endif // LL_LLTOOLBRUSH_H