lldrawpoolwlsky.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * @file lldrawpoolwlsky.h
  3. * @brief LLDrawPoolWLSky class definition
  4. *
  5. * $LicenseInfo:firstyear=2007&license=viewergpl$
  6. *
  7. * Copyright (c) 2007-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_DRAWPOOLWLSKY_H
  33. #define LL_DRAWPOOLWLSKY_H
  34. #include "llsettingssky.h"
  35. #include "lldrawpool.h"
  36. class LLGLSLShader;
  37. class LLImageGL;
  38. class LLDrawPoolWLSky final : public LLDrawPool
  39. {
  40. protected:
  41. LOG_CLASS(LLDrawPoolWLSky);
  42. public:
  43. static constexpr U32 SKY_VERTEX_DATA_MASK =
  44. LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0;
  45. static constexpr U32 STAR_VERTEX_DATA_MASK =
  46. LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR |
  47. LLVertexBuffer::MAP_TEXCOORD0;
  48. static constexpr U32 ADV_ATMO_SKY_VERTEX_DATA_MASK =
  49. LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0;
  50. LLDrawPoolWLSky();
  51. LL_INLINE U32 getVertexDataMask() override { return SKY_VERTEX_DATA_MASK; }
  52. LL_INLINE bool isDead() override { return false; }
  53. void prerender() override;
  54. // For EE rendering only
  55. void beginRenderPass(S32) override;
  56. void endRenderPass(S32) override;
  57. void render(S32 pass = 0) override;
  58. LL_INLINE S32 getNumDeferredPasses() override { return 1; }
  59. void beginDeferredPass(S32) override;
  60. void endDeferredPass(S32) override;
  61. void renderDeferred(S32 pass) override;
  62. // Verify that all data in the draw pool is correct
  63. LL_INLINE bool verify() const override { return true; }
  64. LL_INLINE bool isFacePool() override { return false; }
  65. LL_INLINE static void cleanupGL() {}
  66. static void restoreGL();
  67. // Returns an empty string on success, or an error message otherwise. HB
  68. static std::string loadHDRISky(const std::string& filename);
  69. // Returns a pointer on the HDRI sky image, or NULL when there is none. HB
  70. static LLImageGL* getHDRISky();
  71. static void resetHDRISky();
  72. // For speed, we use the cached result for this set or render passes. HB
  73. LL_INLINE static bool useHDRI() { return sUseHDRI; }
  74. private:
  75. void renderDome(LLGLSLShader* shaderp) const;
  76. void renderSkyHaze() const;
  77. // NOTE: LL's EEP viewer also got a renderSkyCloudsDeferred() method , but
  78. // it is exactly identical to their renderSkyClouds() method.
  79. void renderSkyClouds() const;
  80. void renderStars() const;
  81. void renderHeavenlyBodies();
  82. // Extended environment specific methods
  83. void renderSkyHazeDeferred() const;
  84. void renderStarsDeferred() const;
  85. private:
  86. LLSettingsSky::ptr_t mCurrentSky;
  87. LLVector3 mCameraOrigin;
  88. F32 mCamHeightLocal;
  89. static LLGLSLShader* sCloudShader;
  90. static LLGLSLShader* sSkyShader;
  91. static LLGLSLShader* sSunShader;
  92. static LLGLSLShader* sMoonShader;
  93. static LLPointer<LLViewerTexture> sCloudNoiseTexture;
  94. static LLPointer<LLImageRaw> sCloudNoiseRawImage;
  95. static LLPointer<LLImageGL> sEXRImage;
  96. static bool sUseHDRI;
  97. };
  98. #endif // LL_DRAWPOOLWLSKY_H