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 "llvoground.h" 00043 00044 const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees 00045 const F32 NIGHTTIME_ELEVATION_COS = (F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD); 00046 00047 class LLViewerCamera; 00048 00049 class LLVOWLSky; 00050 class LLVOWLClouds; 00051 00052 00053 class LLSky 00054 { 00055 public: 00056 LLSky(); 00057 ~LLSky(); 00058 00059 void init(const LLVector3 &sun_direction); 00060 void free(); 00061 00062 void cleanup(); 00063 00064 void setOverrideSun(BOOL override); 00065 BOOL getOverrideSun() { return mOverrideSimSunPosition; } 00066 void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity); 00067 void setSunTargetDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity); 00068 00069 LLColor4 getFogColor() const; 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 getSunAmbientColor() const; 00092 LLColor4 getMoonAmbientColor() const; 00093 LLColor4 getTotalAmbientColor() const; 00094 BOOL sunUp() const; 00095 00096 F32 getSunPhase() const; 00097 void setSunPhase(const F32 phase); 00098 00099 void destroyGL(); 00100 void restoreGL(); 00101 void resetVertexBuffers(); 00102 00103 public: 00104 LLPointer<LLVOSky> mVOSkyp; // Pointer to the LLVOSky object (only one, ever!) 00105 LLPointer<LLVOGround> mVOGroundp; 00106 00107 LLPointer<LLVOWLSky> mVOWLSkyp; 00108 00109 LLVector3 mSunTargDir; 00110 00111 // Legacy stuff 00112 LLVector3 mSunDefaultPosition; 00113 00114 protected: 00115 BOOL mOverrideSimSunPosition; 00116 00117 F32 mSunPhase; 00118 LLColor4 mFogColor; // Color to use for fog and haze 00119 00120 F32 mHaze; // a multiplier to scale the lighting 00121 F32 mDomeRadius; // sky dome size 00122 00123 LLVector3 mLastSunDirection; 00124 }; 00125 00126 extern LLSky gSky; 00127 #endif