llvowater.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. * @file llvowater.h
  3. * @brief Description of LLVOWater class
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-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_VOWATER_H
  33. #define LL_VOWATER_H
  34. #include "llvector2.h"
  35. #include "llpipeline.h"
  36. #include "llviewerobject.h"
  37. #include "llviewerregion.h"
  38. #include "llviewertexture.h"
  39. constexpr U32 N_RES = 16; // Number of subdivisions of wave tile
  40. constexpr U8 WAVE_STEP = 8;
  41. class LLSurface;
  42. class LLHeavenBody;
  43. class LLVOSky;
  44. class LLFace;
  45. class LLVOWater : public LLStaticViewerObject
  46. {
  47. public:
  48. enum
  49. {
  50. VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
  51. (1 << LLVertexBuffer::TYPE_NORMAL) |
  52. (1 << LLVertexBuffer::TYPE_TEXCOORD0)
  53. };
  54. LLVOWater(const LLUUID& id, LLViewerRegion* regionp,
  55. // This is LL_VO_VOID_WATER for LLVOVoidWater.
  56. LLPCode pcode = LL_VO_WATER);
  57. // Initialize data that's only inited once per class.
  58. static void initClass() {}
  59. static void cleanupClass() {}
  60. // Nothing to do.
  61. LL_INLINE void idleUpdate(F64) override {}
  62. LLDrawable* createDrawable() override;
  63. bool updateGeometry(LLDrawable* drawable) override;
  64. void updateSpatialExtents(LLVector4a& new_min,
  65. LLVector4a& new_max) override;
  66. LL_INLINE void updateTextures() override {}
  67. // Generates accurate apparent angle and area
  68. void setPixelAreaAndAngle() override;
  69. LL_INLINE U32 getPartitionType() const override
  70. {
  71. return LLViewerRegion::PARTITION_WATER;
  72. }
  73. // Whether this object needs to do an idleUpdate.
  74. LL_INLINE bool isActive() const override { return false; }
  75. LL_INLINE void setUseTexture(bool b) { mUseTexture = b; }
  76. LL_INLINE void setIsEdgePatch(bool b) { mIsEdgePatch = b; }
  77. LL_INLINE bool getUseTexture() const { return mUseTexture; }
  78. LL_INLINE bool getIsEdgePatch() const { return mIsEdgePatch; }
  79. protected:
  80. bool mUseTexture;
  81. bool mIsEdgePatch;
  82. S32 mRenderType;
  83. };
  84. class LLVOVoidWater final : public LLVOWater
  85. {
  86. public:
  87. LL_INLINE LLVOVoidWater(const LLUUID& id, LLViewerRegion* regionp)
  88. : LLVOWater(id, regionp, LL_VO_VOID_WATER)
  89. {
  90. mRenderType = LLPipeline::RENDER_TYPE_VOIDWATER;
  91. }
  92. LL_INLINE U32 getPartitionType() const override
  93. {
  94. return LLViewerRegion::PARTITION_VOIDWATER;
  95. }
  96. };
  97. #endif // LL_VOSURFACEPATCH_H