1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 11:39:16 +02:00

Added hillshading lightening setting

This commit is contained in:
2024-06-15 11:24:50 +02:00
parent 8730206939
commit 96fe90cc3f
7 changed files with 16 additions and 1 deletions

View File

@ -31,6 +31,7 @@ int HillShading::_blur = 3;
int HillShading::_azimuth = 315;
int HillShading::_altitude = 45;
double HillShading::_z = 0.6;
double HillShading::_l = 0.2;
static void getConstants(double azimuth, double elevation, Constants &c)
{
@ -92,7 +93,7 @@ QImage HillShading::render(const MatrixD &m, int extend)
if (std::isnan(L))
pixel = 0;
else {
L = sqrt(L * 0.8 + 0.2);
L = sqrt(L * (1.0 - _l) + _l);
quint8 val = (L < 0) ? 0 : L * _alpha;
pixel = (_alpha - val)<<24;
}

View File

@ -16,6 +16,7 @@ public:
static void setAzimuth(int azimuth) {_azimuth = azimuth;}
static void setAltitude(int altitude) {_altitude = altitude;}
static void setZFactor(double z) {_z = z;}
static void setLightening(double b) {_l = b;}
private:
static int _alpha;
@ -23,6 +24,7 @@ private:
static int _azimuth;
static int _altitude;
static double _z;
static double _l;
};
#endif // HILLSHADING_H