WIP on clouds

This commit is contained in:
Michaël Lemaire 2016-02-03 22:41:27 +01:00
parent 14d8b29666
commit 386d9d0258
2 changed files with 7 additions and 6 deletions

View file

@ -7,7 +7,8 @@
CloudModelStratoCumulus::CloudModelStratoCumulus(CloudLayerDefinition *layer) : BaseCloudsModel(layer) {
noise = new NoiseFunctionSimplex();
base_detail = 0.1;
shape_level = 0.1;
detail_level = 0.001;
}
CloudModelStratoCumulus::~CloudModelStratoCumulus() {
@ -16,9 +17,8 @@ CloudModelStratoCumulus::~CloudModelStratoCumulus() {
void CloudModelStratoCumulus::update() {
noise->setState(layer->getNoiseState());
noise->setScaling(30.0 * layer->scaling);
noise->normalizeRange(1.0, base_detail);
noise->setScaling(layer->scaling);
noise->normalizeRange(1.0);
}
void CloudModelStratoCumulus::getAltitudeRange(double *min_altitude, double *max_altitude) const {
@ -37,7 +37,7 @@ BaseCloudsModel::CloudDensityInfo CloudModelStratoCumulus::getDensity(const Vect
} else if (location.y > max_altitude) {
return {0.0, location.y - max_altitude};
} else {
val = noise->get3d(base_detail, 0.3 * location.x, location.y - min_altitude, 0.3 * location.z);
val = noise->get3d(shape_level, location.x * 0.01, (location.y - min_altitude) * 0.03, location.z * 0.01);
val = val - 0.8 + layer->coverage;
return {val, fabs(val)};
}

View file

@ -20,7 +20,8 @@ class CloudModelStratoCumulus : public BaseCloudsModel {
private:
FractalNoise *noise;
double base_detail;
double shape_level;
double detail_level;
};
}
}