2020-12-31 07:32:16 -08:00
|
|
|
// Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details
|
2012-09-15 17:59:15 -07:00
|
|
|
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
2012-09-12 04:38:30 -07:00
|
|
|
|
2011-10-17 20:34:29 -07:00
|
|
|
#include "Terrain.h"
|
|
|
|
#include "TerrainNoise.h"
|
|
|
|
|
|
|
|
using namespace TerrainNoise;
|
|
|
|
|
2011-10-20 02:26:31 -07:00
|
|
|
template <>
|
|
|
|
const char *TerrainColorFractal<TerrainColorStarWhiteDwarf>::GetColorFractalName() const { return "StarWhiteDwarf"; }
|
|
|
|
|
2011-10-19 22:42:47 -07:00
|
|
|
template <>
|
2019-01-02 08:59:07 -08:00
|
|
|
TerrainColorFractal<TerrainColorStarWhiteDwarf>::TerrainColorFractal(const SystemBody *body) :
|
|
|
|
Terrain(body)
|
2011-10-19 22:42:47 -07:00
|
|
|
{
|
2019-01-02 08:59:07 -08:00
|
|
|
double height = m_maxHeightInMeters * 0.1;
|
2019-03-03 03:12:11 -08:00
|
|
|
SetFracDef(0, height, 3e9, 100.0); //why on Earth we need a feature size of 3,000,000 KM (2.2x the sun) I don't know, but we do... :)
|
|
|
|
SetFracDef(1, height, 1e7, 100.0);
|
2011-10-20 22:42:46 -07:00
|
|
|
//Original settings with correct feature size, does not seem to work anymore:
|
|
|
|
//SetFracDef(0, height, 3e5, 10.0*m_fracmult);
|
|
|
|
//SetFracDef(1, height, 1e5, 10.0*m_fracmult);
|
2011-10-19 22:42:47 -07:00
|
|
|
}
|
|
|
|
|
2011-10-17 20:34:29 -07:00
|
|
|
template <>
|
2013-03-24 13:55:35 -07:00
|
|
|
vector3d TerrainColorFractal<TerrainColorStarWhiteDwarf>::GetColor(const vector3d &p, double height, const vector3d &norm) const
|
2011-10-17 20:34:29 -07:00
|
|
|
{
|
|
|
|
double n;
|
|
|
|
vector3d col;
|
2019-01-02 08:59:07 -08:00
|
|
|
n = ridged_octavenoise(GetFracDef(0), 0.8, p * p.x);
|
2011-10-17 20:34:29 -07:00
|
|
|
n += ridged_octavenoise(GetFracDef(1), 0.8, p);
|
|
|
|
n += voronoiscam_octavenoise(GetFracDef(0), 0.8 * octavenoise(GetFracDef(1), 0.6, p), p);
|
2019-01-02 08:59:07 -08:00
|
|
|
n *= n * n;
|
2011-10-17 20:34:29 -07:00
|
|
|
if (n > 0.666) {
|
2019-01-02 08:59:07 -08:00
|
|
|
n -= 0.666;
|
|
|
|
n *= 3.0;
|
2011-10-17 20:34:29 -07:00
|
|
|
col = interpolate_color(n, vector3d(.8, .8, 1.0), vector3d(1.0, 1.0, 1.0));
|
|
|
|
return col;
|
|
|
|
} else if (n > 0.333) {
|
2019-01-02 08:59:07 -08:00
|
|
|
n -= 0.333;
|
|
|
|
n *= 3.0;
|
2011-10-17 20:34:29 -07:00
|
|
|
col = interpolate_color(n, vector3d(.6, .8, .8), vector3d(.8, .8, 1.0));
|
|
|
|
return col;
|
|
|
|
} else {
|
|
|
|
n *= 3.0;
|
|
|
|
col = interpolate_color(n, vector3d(.0, .0, .9), vector3d(.6, .8, .8));
|
|
|
|
return col;
|
|
|
|
}
|
|
|
|
}
|