00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 #ifndef VRS_SKY_H_
00090 #define VRS_SKY_H_
00091
00092 #include <vrs/color.h>
00093 #include <vrs/shape.h>
00094 #include <vrs/cache.h>
00095 #include <vrs/polygonset.h>
00096
00097 namespace VRS {
00098
00100 class VRS_CORE_API Sky : public Shape {
00101
00102 public:
00103 Sky(bool calcRealSkyColor = false,
00104 const Color& skyColor = Color(0.3, 0.3, 0.9), const Color& fogColor = Color(1.0, 1.0, 1.0),
00105 double colorDiff = 0.005,
00106 bool sunOnOff = true, const Vector& sunDirection = Vector(0.0, 1.0, 0.0),
00107 double turbitdity = 3.0);
00109
00113 Sky(unsigned int day, unsigned short hour, unsigned short minute, unsigned short second, double latitude,
00114 bool calcRealSkyColor = false,
00115 const Color& skyColor = Color(0.3, 0.3, 0.9), const Color& fogColor = Color(1.0, 1.0, 1.0),
00116 double colorDiff = 0.005,
00117 bool sunOnOff = true,
00118 double turbitdity = 3.0);
00120
00122 virtual ~Sky();
00123
00124 void setSun(bool onOff);
00126 bool getSun() const;
00128 void setSunDirection(const Vector& sunDirection);
00130
00131 const Vector& getSunDirection() const;
00133
00134 void setCalcRealSkyColor(bool calcRealSkyColor);
00136
00142 bool getCalcRealSkyColor() const;
00144 void setSkyColor(const Color& skyColor);
00146 const Color& getSkyColor() const;
00148 void setFogColor(const Color& fogColor);
00150 const Color& getFogColor() const;
00152
00153 void setTurbidity(double trubidity);
00155
00161 double getTurbidity() const;
00163
00164 void calculateSunDirection(unsigned int day = 173, unsigned short hour = 12, unsigned short minute = 0,
00165 unsigned short second = 0, double latitude = 52.0);
00167
00173 void setTessellationError(double colorDiff);
00175
00182 void setTessellationForStaticSky();
00184
00188 void setTessellationForDynamicSky();
00190
00194 double getTessellationError() const;
00196
00197 virtual void modified();
00199
00200 Bounds boundingBox() const;
00202
00203 bool getUpdateTessellation() const;
00205 void setUpdateTessellation(bool updateTessellation);
00207 Cache* getTessellation() const;
00209 void setTessellation(PolygonSet* tessellation);
00211
00212 VRS_TYPEINFO(Sky, Shape);
00213 VRS_SERIALIZABLE(Sky);
00214
00215 private:
00216 bool calcRealSkyColor_;
00217 Color skyColor_;
00218 Color fogColor_;
00219 double colorDiff_;
00220
00221 bool sun_;
00222 Vector sunDirection_;
00223
00224 double turbidity_;
00225
00226
00227 bool updateTessellation_;
00228 SO<Cache> tessellation_;
00229 };
00230
00231 inline bool Sky::getSun() const { return sun_; }
00232 inline const Vector& Sky::getSunDirection() const { return sunDirection_; }
00233
00234 inline bool Sky::getCalcRealSkyColor() const { return calcRealSkyColor_; }
00235 inline const Color& Sky::getSkyColor() const { return skyColor_; }
00236 inline const Color& Sky::getFogColor() const { return fogColor_; }
00237
00238 inline double Sky::getTurbidity() const { return turbidity_; }
00239
00240 inline double Sky::getTessellationError() const { return colorDiff_; }
00241
00242 inline Bounds Sky::boundingBox() const { return Bounds(); }
00243
00244 }
00245
00246 #endif // VRS_SKY_H_