00001
00002
00003
00004
00005 #ifndef MERCATOR_FILL_GRASS_SHADER_H
00006 #define MERCATOR_FILL_GRASS_SHADER_H
00007
00008 #include <Mercator/Shader.h>
00009 #include <Mercator/Surface.h>
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 namespace Mercator {
00041
00042 class GrassShader : public Shader {
00043 private:
00044 float m_lowThreshold;
00045 float m_highThreshold;
00046 float m_cutoff;
00047 float m_intercept;
00048
00049 ColorT slopeToAlpha(float height, float slope) const;
00050 public:
00051 static const std::string key_lowThreshold;
00052 static const std::string key_highThreshold;
00053 static const std::string key_cutoff;
00054 static const std::string key_intercept;
00055
00056 static const float default_lowThreshold;
00057 static const float default_highThreshold;
00058 static const float default_cutoff;
00059 static const float default_intercept;
00060
00061 explicit GrassShader(float lowThreshold = default_lowThreshold,
00062 float highThreshold = default_highThreshold,
00063 float cutoff = default_cutoff,
00064 float intercept = default_intercept);
00065 explicit GrassShader(const Parameters & params);
00066 virtual ~GrassShader();
00067
00068 const float lowThreshold() const { return m_lowThreshold; }
00069 const float highThreshold() const { return m_highThreshold; }
00070 const float cutoff() const { return m_cutoff; }
00071 const float intercept() const { return m_intercept; }
00072
00073 virtual bool checkIntersect(const Segment &) const;
00074 virtual void shade(Surface &) const;
00075 };
00076
00077 }
00078
00079 #endif // MERCATOR_FILL_GRASS_SHADER_H