lldrawpoolwater.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**
  2. * @file lldrawpoolwater.h
  3. * @brief LLDrawPoolWater 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_LLDRAWPOOLWATER_H
  33. #define LL_LLDRAWPOOLWATER_H
  34. #include "lldrawpool.h"
  35. class LLFace;
  36. class LLGLSLShader;
  37. class LLHeavenBody;
  38. class LLWaterSurface;
  39. class LLDrawPoolWater final : public LLFacePool
  40. {
  41. public:
  42. enum
  43. {
  44. VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
  45. LLVertexBuffer::MAP_NORMAL |
  46. LLVertexBuffer::MAP_TEXCOORD0
  47. };
  48. LL_INLINE U32 getVertexDataMask() override
  49. {
  50. return VERTEX_DATA_MASK;
  51. }
  52. LLDrawPoolWater();
  53. void prerender() override;
  54. S32 getNumPasses() override; // Returns 0 in PBR mode
  55. // The three following methods are only for use by the EE renderer.
  56. void render(S32 pass = 0) override;
  57. S32 getNumDeferredPasses() override;
  58. void renderDeferred(S32 pass = 0) override;
  59. // The two following methods are only for use by the PBR renderer.
  60. S32 getNumPostDeferredPasses() override;
  61. void renderPostDeferred(S32) override;
  62. void setOpaqueTexture(const LLUUID& tex_id);
  63. void setTransparentTextures(const LLUUID& tex1_id,
  64. const LLUUID& tex2_id = LLUUID::null);
  65. void setNormalMaps(const LLUUID& tex1_id,
  66. const LLUUID& tex2_id = LLUUID::null);
  67. LL_INLINE static void restoreGL()
  68. {
  69. sNeedsReflectionUpdate = sNeedsTexturesReload = true;
  70. }
  71. private:
  72. S32 getWaterPasses();
  73. // Methods for use by the EE renderer only
  74. void renderReflection(LLFace* facep);
  75. void renderWater();
  76. void renderOpaqueLegacyWater();
  77. void shadeWater(LLGLSLShader* shaderp, bool edge);
  78. // Only for use by the PBR renderer
  79. void shadeWaterPBR(LLGLSLShader* shaderp, bool edge);
  80. private:
  81. LLPointer<LLViewerTexture> mWaterImagep[2];
  82. LLPointer<LLViewerTexture> mWaterNormp[2];
  83. LLPointer<LLViewerTexture> mOpaqueWaterImagep;
  84. LLVector3 mLightDir;
  85. LLColor4 mLightColor;
  86. LLColor3 mLightDiffuse;
  87. public:
  88. static LLColor4 sWaterFogColor;
  89. static bool sNeedsReflectionUpdate;
  90. static bool sNeedsTexturesReload;
  91. };
  92. #endif // LL_LLDRAWPOOLWATER_H