llsky.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. * @file llsky.h
  3. * @brief It's, uh, the sky!
  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_LLSKY_H
  33. #define LL_LLSKY_H
  34. #include "llmath.h"
  35. #include "llpointer.h"
  36. #include "llvector3.h"
  37. #include "llvector4.h"
  38. #include "llcolor4.h"
  39. #include "llcolor4u.h"
  40. #include "llvosky.h"
  41. class LLVOWLSky;
  42. class LLSky
  43. {
  44. public:
  45. LLSky();
  46. void init();
  47. void cleanup();
  48. void destroyGL();
  49. void restoreGL();
  50. void resetVertexBuffers();
  51. // *TODO: do culling for WL sky properly -Brad
  52. LL_INLINE void updateCull() {}
  53. void updateSky();
  54. void addSunMoonBeacons();
  55. void setCloudDensityAtAgent(F32 cloud_density);
  56. void setWind(const LLVector3& wind);
  57. void updateFog(F32 distance);
  58. // Windlight specific methods
  59. void setSunDirection(const LLVector3& sun_direction,
  60. const LLVector3& sun_ang_velocity);
  61. void setOverrideSun(bool override_sun);
  62. LL_INLINE bool getOverrideSun() { return mOverrideSimSunPosition; }
  63. LL_INLINE void setSunTargetDirection(const LLVector3& sun_direction,
  64. const LLVector3& sun_ang_velocity)
  65. {
  66. mSunTargDir = sun_direction;
  67. }
  68. void propagateHeavenlyBodies(F32 dt); // dt = seconds
  69. LLVector3 getSunDirection() const;
  70. LLVector3 getMoonDirection() const;
  71. bool sunUp() const;
  72. // Extended environment specific methods
  73. void setSunScale(F32 sun_scale);
  74. void setMoonScale(F32 moon_scale);
  75. // These directions should be in CFR coord sys (+x at, +z up, +y right)
  76. void setSunAndMoonDirectionsCFR(const LLVector3& sun_direction,
  77. const LLVector3& moon_direction);
  78. void setSunDirectionCFR(const LLVector3& sun_direction);
  79. void setMoonDirectionCFR(const LLVector3& moon_direction);
  80. void setSunTextures(const LLUUID& sun_tex1,
  81. const LLUUID& sun_tex2 = LLUUID::null);
  82. void setMoonTextures(const LLUUID& moon_tex1,
  83. const LLUUID& moon_tex2 = LLUUID::null);
  84. void setCloudNoiseTextures(const LLUUID& cld_tex1,
  85. const LLUUID& cld_tex2 = LLUUID::null);
  86. void setBloomTextures(const LLUUID& bloom_tex1,
  87. const LLUUID& bloom_tex2 = LLUUID::null);
  88. public:
  89. // Pointer to the LLVOSky object (only one, ever !)
  90. LLPointer<LLVOSky> mVOSkyp;
  91. LLPointer<LLVOWLSky> mVOWLSkyp;
  92. LLVector3 mSunTargDir;
  93. S32 mLightingGeneration;
  94. bool mUpdatedThisFrame;
  95. protected:
  96. bool mOverrideSimSunPosition;
  97. LLVector3 mLastSunDirection;
  98. };
  99. extern LLSky gSky;
  100. #endif