PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llviewerparceloverlay.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 125 lines | 59 code | 25 blank | 41 comment | 0 complexity | 5567db150a836e06fd6c45e072d96f58 MD5 | raw file
  1/** 
  2 * @file llviewerparceloverlay.h
  3 * @brief LLViewerParcelOverlay 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_LLVIEWERPARCELOVERLAY_H
 28#define LL_LLVIEWERPARCELOVERLAY_H
 29
 30// The ownership data for land parcels.
 31// One of these structures per region.
 32
 33#include "llbbox.h"
 34#include "lldarray.h"
 35#include "llframetimer.h"
 36#include "lluuid.h"
 37#include "llviewertexture.h"
 38#include "llgl.h"
 39
 40class LLViewerRegion;
 41class LLVector3;
 42class LLColor4U;
 43class LLVector2;
 44
 45class LLViewerParcelOverlay : public LLGLUpdate
 46{
 47public:
 48	LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters);
 49	~LLViewerParcelOverlay();
 50
 51	// ACCESS
 52	LLViewerTexture*		getTexture() const		{ return mTexture; }
 53
 54	BOOL			isOwned(const LLVector3& pos) const;
 55	BOOL			isOwnedSelf(const LLVector3& pos) const;
 56	BOOL			isOwnedGroup(const LLVector3& pos) const;
 57	BOOL			isOwnedOther(const LLVector3& pos) const;
 58
 59	// "encroaches" means the prim hangs over the parcel, but its center
 60	// might be in another parcel. for now, we simply test axis aligned 
 61	// bounding boxes which isn't perfect, but is close
 62	bool encroachesOwned(const std::vector<LLBBox>& boxes) const;
 63	bool encroachesOnUnowned(const std::vector<LLBBox>& boxes) const;
 64	bool encroachesOnNearbyParcel(const std::vector<LLBBox>& boxes) const;
 65	
 66	BOOL			isSoundLocal(const LLVector3& pos) const;
 67
 68	BOOL			isBuildCameraAllowed(const LLVector3& pos) const;
 69	F32				getOwnedRatio() const;
 70
 71	// Returns the number of vertices drawn
 72	S32				renderPropertyLines();
 73
 74	U8				ownership( const LLVector3& pos) const;
 75
 76	// MANIPULATE
 77	void	uncompressLandOverlay(S32 chunk, U8 *compressed_overlay);
 78
 79	// Indicate property lines and overlay texture need to be rebuilt.
 80	void	setDirty();
 81
 82	void	idleUpdate(bool update_now = false);
 83	void	updateGL();
 84
 85private:
 86	// This is in parcel rows and columns, not grid rows and columns
 87	// Stored in bottom three bits.
 88	U8		ownership(S32 row, S32 col) const	
 89				{ return 0x7 & mOwnership[row * mParcelGridsPerEdge + col]; }
 90
 91	void	addPropertyLine(LLDynamicArray<LLVector3, 256>& vertex_array,
 92				LLDynamicArray<LLColor4U, 256>& color_array,
 93				LLDynamicArray<LLVector2, 256>& coord_array,
 94				const F32 start_x, const F32 start_y, 
 95				const U32 edge, 
 96				const LLColor4U& color);
 97
 98	void 	updateOverlayTexture();
 99	void	updatePropertyLines();
100	
101private:
102	// Back pointer to the region that owns this structure.
103	LLViewerRegion*	mRegion;
104
105	S32				mParcelGridsPerEdge;
106
107	LLPointer<LLViewerTexture> mTexture;
108	LLPointer<LLImageRaw> mImageRaw;
109	
110	// Size: mParcelGridsPerEdge * mParcelGridsPerEdge
111	// Each value is 0-3, PARCEL_AVAIL to PARCEL_SELF in the two low bits
112	// and other flags in the upper bits.
113	U8				*mOwnership;
114
115	// Update propery lines and overlay texture
116	BOOL			mDirty;
117	LLFrameTimer	mTimeSinceLastUpdate;
118	S32				mOverlayTextureIdx;
119	
120	S32				mVertexCount;
121	F32*			mVertexArray;
122	U8*				mColorArray;
123};
124
125#endif