Small adjustements
This commit is contained in:
parent
1131972759
commit
123e434b0a
3 changed files with 17 additions and 8 deletions
|
@ -58,7 +58,7 @@ void OpenGLTerrain::initialize()
|
|||
program->addFragmentSource("terrain");
|
||||
|
||||
// Add terrain chunks
|
||||
int chunks = 16;
|
||||
int chunks = 20;
|
||||
double size = 800.0;
|
||||
double chunksize = size / (double) chunks;
|
||||
double start = -size / 2.0;
|
||||
|
|
|
@ -57,12 +57,13 @@ public:
|
|||
|
||||
virtual double getDensity(const Vector3 &location) const override
|
||||
{
|
||||
Vector3 location_ext(location.x * 0.5, location.y, location.z * 0.5);
|
||||
double ymin, ymax, thickness;
|
||||
getAltitudeRange(&ymin, &ymax);
|
||||
thickness = ymax - ymin;
|
||||
|
||||
Vector3 center(0.0, ymin + thickness * 0.5, 0.0);
|
||||
double distance = 2.0 * location.sub(center).getNorm() / thickness;
|
||||
double distance = 2.0 * location_ext.sub(center).getNorm() / thickness;
|
||||
double fallout = 0.7;
|
||||
if (distance > 1.0)
|
||||
{
|
||||
|
@ -75,7 +76,7 @@ public:
|
|||
else
|
||||
{
|
||||
double factor = (1.0 - distance) / fallout;
|
||||
return real_model->getDensity(location) * (1.0 - factor) + factor;
|
||||
return real_model->getDensity(location_ext) * (1.0 - factor) + factor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,9 +121,9 @@ Color CloudsAspectPreviewRenderer::getColor2D(double x, double y, double)
|
|||
model->getAltitudeRange(&ymin, &ymax);
|
||||
thickness = ymax - ymin;
|
||||
|
||||
start.x = x * thickness * 0.5;
|
||||
start.x = x * thickness;
|
||||
start.y = ymin + (1.0 - y) * thickness * 0.5;
|
||||
start.z = thickness * 0.5;
|
||||
start.z = thickness;
|
||||
|
||||
end.x = start.x;
|
||||
end.y = start.y;
|
||||
|
|
|
@ -171,13 +171,13 @@ Color CloudBasicLayerRenderer::getColor(BaseCloudsModel *model, const Vector3 &e
|
|||
|
||||
double ymin, ymax;
|
||||
model->getAltitudeRange(&ymin, &ymax);
|
||||
double transparency_depth = (ymax - ymin) * 0.3;
|
||||
double transparency_depth = (ymax - ymin) * 0.5;
|
||||
|
||||
segment_count = _findSegments(model, parent, start, direction, 20, transparency_depth, max_length, &inside_length, &total_length, segments);
|
||||
for (i = segment_count - 1; i >= 0; i--)
|
||||
{
|
||||
SurfaceMaterial material;
|
||||
material.base = colorToHSL(Color(3.0, 3.0, 3.0));
|
||||
material.base = colorToHSL(COLOR_WHITE);
|
||||
material.hardness = 0.25;
|
||||
material.reflection = 0.0;
|
||||
material.shininess = 0.0;
|
||||
|
@ -185,6 +185,14 @@ Color CloudBasicLayerRenderer::getColor(BaseCloudsModel *model, const Vector3 &e
|
|||
|
||||
col = parent->applyLightingToSurface(segments[i].start, parent->getAtmosphereRenderer()->getSunDirection(), material);
|
||||
|
||||
double power = col.getPower();
|
||||
if (power > 0.2)
|
||||
{
|
||||
col.r += (power - 0.2) * 1.5;
|
||||
col.g += (power - 0.2) * 1.5;
|
||||
col.b += (power - 0.2) * 1.5;
|
||||
}
|
||||
|
||||
col.a = (segments[i].length >= transparency_depth) ? 1.0 : (segments[i].length / transparency_depth);
|
||||
result.mask(col);
|
||||
}
|
||||
|
@ -216,7 +224,7 @@ bool CloudBasicLayerRenderer::alterLight(BaseCloudsModel *model, LightComponent*
|
|||
|
||||
double ymin, ymax;
|
||||
model->getAltitudeRange(&ymin, &ymax);
|
||||
double light_traversal = (ymax - ymin) * 0.8;
|
||||
double light_traversal = (ymax - ymin) * 1.2;
|
||||
_findSegments(model, parent, start, direction, 20, light_traversal, end.sub(start).getNorm(), &inside_depth, &total_depth, segments);
|
||||
|
||||
if (light_traversal < 0.0001)
|
||||
|
|
Loading…
Reference in a new issue