00001 #ifndef SKYDOMEPAINTER_H
00002 #define SKYDOMEPAINTER_H
00003
00004 #include <vrs/environment/config.h>
00005 #include <vrs/container/dictionary.h>
00006 #include <vrs/shapepainter.h>
00007 #include <vrs/time.h>
00008
00009 namespace VRS {
00010 class Clock;
00011 class MappedVertexAttributeShapeGL;
00012 class EngineGL;
00013 }
00014
00015 namespace EnvironmentRenderer {
00016
00017 class CloudLayer;
00018
00019
00020 class VRS_ENV_API SkyDomePainter : public VRS::ShapePainter {
00021 public:
00022
00024 virtual VRS::ID target() const;
00025
00027 virtual bool render(VRS::Engine*, const VRS::Shape*);
00028
00029 VRS_TYPEINFO(SkyDomePainter, VRS::ShapePainter);
00030
00031 private:
00032 VRS::Vector sphereCoord(double r, double phi, double theta);
00033 VRS::SO<VRS::Iterator<VRS::Vector> > buildVertexData(double radius, double angle, const VRS::VertexData<2, unsigned int>& detail);
00034 VRS::SO<VRS::Iterator<VRS::Vector> > buildTexCoordData(VRS::SO<const VRS::Iterator<VRS::Vector> > const vertices, double height);
00035 unsigned int index(unsigned int slice, unsigned stack, const VRS::VertexData<2, unsigned int>& detail, double angle);
00036 VRS::SO<VRS::Iterator<unsigned int> > buildIndexData(double angle, const VRS::VertexData<2, unsigned int>& detail);
00037 void updateDome(VRS::EngineGL*, const VRS::VertexData<2, unsigned int> detail, double angle, VRS::SO<VRS::MappedVertexAttributeShapeGL>& dome, double planetRadius, double height, bool texCoords);
00038
00039
00040 VRS::SO<VRS::NonPersistentDictionary<CloudLayer*, VRS::VertexData<3, float> > > m_cloudTranslations;
00041
00042 VRS::SO<VRS::Callback1<VRS::SharedObj*> > m_destructionCallback;
00043 void removeFromPainter(VRS::SharedObj* s);
00044
00045 VRS::VRSTime m_currentFrameTime, m_lastFrameTime;
00046 double m_elapsedTime;
00047
00048 VRS::SO<VRS::Clock> m_lastClock;
00049 };
00050
00051 }
00052
00053 #endif // SKYDOMEPAINTER_H
00054