llsky.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLSKY_H
00033 #define LL_LLSKY_H
00034 
00035 #include "llmath.h"
00036 //#include "vmath.h"
00037 #include "v3math.h"
00038 #include "v4math.h"
00039 #include "v4color.h"
00040 #include "v4coloru.h"
00041 #include "llvosky.h"
00042 #include "llvostars.h"
00043 #include "llvoground.h"
00044 
00045 const F32 NIGHTTIME_ELEVATION                   = -8.0f;        // degrees
00046 const F32 NIGHTTIME_ELEVATION_COS               = (F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD);
00047 
00048 class LLViewerCamera;
00049 
00050 
00051 class LLSky  
00052 {
00053 public:
00054         LLSky();
00055         ~LLSky();
00056 
00057         void init(const LLVector3 &sun_direction);
00058         void free();
00059 
00060         void cleanup();
00061 
00062         void setOverrideSun(BOOL override);
00063         BOOL getOverrideSun() { return mOverrideSimSunPosition; }
00064         void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity);
00065         void setSunTargetDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity);
00066 
00067 
00068         LLColor4 getFogColor() const;
00069 
00070 
00071         void setCloudDensityAtAgent(F32 cloud_density);
00072         void setWind(const LLVector3& wind);
00073 
00074         void updateFog(const F32 distance);
00075         void updateCull();
00076         void updateSky();
00077 
00078         void propagateHeavenlyBodies(F32 dt);                                   // dt = seconds
00079 
00080         S32  mLightingGeneration;
00081         BOOL mUpdatedThisFrame;
00082 
00083         void setFogRatio(const F32 fog_ratio);          // Fog distance as fraction of cull distance.
00084         F32 getFogRatio() const;
00085         LLColor4U getFadeColor() const;
00086 
00087         LLVector3 getSunDirection() const;
00088         LLVector3 getMoonDirection() const;
00089         LLColor4 getSunDiffuseColor() const;
00090         LLColor4 getMoonDiffuseColor() const;
00091         LLColor4 getTotalAmbientColor() const;
00092         BOOL sunUp() const;
00093         LLColor4 calcInScatter(LLColor4& transp, const LLVector3 &point, F32 exag) const;
00094 
00095         F32 getSunPhase() const;
00096         void setSunPhase(const F32 phase);
00097 
00098         void destroyGL();
00099         void restoreGL();
00100 
00101 public:
00102         LLPointer<LLVOSky>              mVOSkyp;        // Pointer to the LLVOSky object (only one, ever!)
00103         LLPointer<LLVOStars>    mVOStarsp;      // Pointer to the LLVOStars object (only one, ever!)
00104         LLPointer<LLVOGround>   mVOGroundp;
00105 
00106         LLVector3 mSunTargDir;
00107 
00108         // Legacy stuff
00109         LLVector3 mSunDefaultPosition;
00110 
00111 protected:
00112         BOOL                    mOverrideSimSunPosition;
00113 
00114         F32                             mSunPhase;
00115         LLColor4                mFogColor;                              // Color to use for fog and haze
00116 
00117         F32                             mHaze;                                  // a multiplier to scale the lighting
00118         F32                             mDomeRadius;                    // sky dome size
00119 
00120         LLVector3               mLastSunDirection;
00121 };
00122 
00123 extern LLSky    gSky;
00124 #endif

Generated on Thu Jul 1 06:09:11 2010 for Second Life Viewer by  doxygen 1.4.7