llvlmanager.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /**
  2. * @file llvlmanager.h
  3. * @brief LLVLManager class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLVLMANAGER_H
  33. #define LL_LLVLMANAGER_H
  34. // This class manages the data coming in for viewer layers from the network.
  35. #include <vector>
  36. #include "llerror.h"
  37. const char CLOUD_LAYER_CODE = '8';
  38. const char WIND_LAYER_CODE = '7';
  39. const char LAND_LAYER_CODE = 'L';
  40. const char WATER_LAYER_CODE = 'W';
  41. const char AURORA_CLOUD_LAYER_CODE = ':';
  42. const char AURORA_WIND_LAYER_CODE = '9';
  43. const char AURORA_LAND_LAYER_CODE = 'M';
  44. const char AURORA_WATER_LAYER_CODE = 'X';
  45. class LLVLData;
  46. class LLViewerRegion;
  47. class LLVLManager
  48. {
  49. protected:
  50. LOG_CLASS(LLVLManager);
  51. public:
  52. LLVLManager();
  53. ~LLVLManager();
  54. void addLayerData(LLVLData* vl_datap, S32 mesg_size);
  55. void unpackData(S32 num_packets = 10);
  56. LL_INLINE S32 getLandBits() const { return mLandBits; }
  57. LL_INLINE S32 getWindBits() const { return mWindBits; }
  58. LL_INLINE S32 getCloudBits() const { return mCloudBits; }
  59. LL_INLINE S32 getTotalBytes() const
  60. {
  61. return (mLandBits + mWindBits + mCloudBits) / 8;
  62. }
  63. LL_INLINE void resetBitCounts()
  64. {
  65. mLandBits = mWindBits = mCloudBits = 0;
  66. }
  67. void cleanupData(LLViewerRegion* regionp);
  68. protected:
  69. std::vector<LLVLData*> mPacketData;
  70. U32 mLandBits;
  71. U32 mWindBits;
  72. U32 mCloudBits;
  73. };
  74. class LLVLData
  75. {
  76. public:
  77. LL_INLINE LLVLData(LLViewerRegion* regionp, S8 type, U8* data, S32 size)
  78. : mRegionp(regionp),
  79. mType(type),
  80. mData(data),
  81. mSize(size)
  82. {
  83. }
  84. LL_INLINE ~LLVLData()
  85. {
  86. delete[] mData;
  87. mData = NULL;
  88. mRegionp = NULL;
  89. }
  90. public:
  91. LLViewerRegion* mRegionp;
  92. U8* mData;
  93. S32 mSize;
  94. S8 mType;
  95. };
  96. extern LLVLManager gVLManager;
  97. #endif // LL_LLVIEWERLAYERMANAGER_H