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