llviewerparceloverlay.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLVIEWERPARCELOVERLAY_H
00033 #define LL_LLVIEWERPARCELOVERLAY_H
00034 
00035 // The ownership data for land parcels.
00036 // One of these structures per region.
00037 
00038 #include "lldarray.h"
00039 #include "llframetimer.h"
00040 #include "lluuid.h"
00041 #include "llviewerimage.h"
00042 
00043 class LLViewerRegion;
00044 class LLVector3;
00045 class LLColor4U;
00046 class LLVector2;
00047 
00048 class LLViewerParcelOverlay
00049 {
00050 public:
00051         LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters);
00052         ~LLViewerParcelOverlay();
00053 
00054         // ACCESS
00055         LLImageGL*              getTexture() const              { return mTexture; }
00056 
00057         BOOL                    isOwned(const LLVector3& pos) const;
00058         BOOL                    isOwnedSelf(const LLVector3& pos) const;
00059         BOOL                    isOwnedGroup(const LLVector3& pos) const;
00060         BOOL                    isOwnedOther(const LLVector3& pos) const;
00061         BOOL                    isSoundLocal(const LLVector3& pos) const;
00062 
00063         BOOL                    isBuildCameraAllowed(const LLVector3& pos) const;
00064         F32                             getOwnedRatio() const;
00065 
00066         // Returns the number of vertices drawn
00067         S32                             renderPropertyLines();
00068 
00069         U8                              ownership( const LLVector3& pos) const;
00070 
00071         // MANIPULATE
00072         void    uncompressLandOverlay(S32 chunk, U8 *compressed_overlay);
00073 
00074         // Indicate property lines and overlay texture need to be rebuilt.
00075         void    setDirty();
00076 
00077         void    idleUpdate(bool update_now = false);
00078 
00079 private:
00080         // This is in parcel rows and columns, not grid rows and columns
00081         // Stored in bottom three bits.
00082         U8              ownership(S32 row, S32 col) const       
00083                                 { return 0x7 & mOwnership[row * mParcelGridsPerEdge + col]; }
00084 
00085         void    addPropertyLine(LLDynamicArray<LLVector3, 256>& vertex_array,
00086                                 LLDynamicArray<LLColor4U, 256>& color_array,
00087                                 LLDynamicArray<LLVector2, 256>& coord_array,
00088                                 const F32 start_x, const F32 start_y, 
00089                                 const U32 edge, 
00090                                 const LLColor4U& color);
00091 
00092         void    updateOverlayTexture();
00093         void    updatePropertyLines();
00094         
00095 private:
00096         // Back pointer to the region that owns this structure.
00097         LLViewerRegion* mRegion;
00098 
00099         S32                             mParcelGridsPerEdge;
00100 
00101         LLPointer<LLImageGL> mTexture;
00102         LLPointer<LLImageRaw> mImageRaw;
00103         
00104         // Size: mParcelGridsPerEdge * mParcelGridsPerEdge
00105         // Each value is 0-3, PARCEL_AVAIL to PARCEL_SELF in the two low bits
00106         // and other flags in the upper bits.
00107         U8                              *mOwnership;
00108 
00109         // Update propery lines and overlay texture
00110         BOOL                    mDirty;
00111         LLFrameTimer    mTimeSinceLastUpdate;
00112         S32                             mOverlayTextureIdx;
00113         
00114         LLUUID                  mLineImageID;
00115         S32                             mVertexCount;
00116         F32*                    mVertexArray;
00117         U8*                             mColorArray;
00118 };
00119 
00120 #endif

Generated on Thu Jul 1 06:09:33 2010 for Second Life Viewer by  doxygen 1.4.7