WIP on clouds
This commit is contained in:
parent
6a5b55b077
commit
14d8b29666
7 changed files with 8 additions and 17 deletions
|
@ -59,8 +59,4 @@ void SurfaceMaterial::copy(SurfaceMaterial *destination) const {
|
|||
destination->hardness = hardness;
|
||||
destination->reflection = reflection;
|
||||
destination->shininess = shininess;
|
||||
destination->validate();
|
||||
}
|
||||
|
||||
void SurfaceMaterial::validate() {
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ class DEFINITIONSHARED_EXPORT SurfaceMaterial {
|
|||
void save(PackStream *stream) const;
|
||||
void load(PackStream *stream);
|
||||
void copy(SurfaceMaterial *destination) const;
|
||||
void validate();
|
||||
|
||||
public:
|
||||
Color *base;
|
||||
|
|
|
@ -30,8 +30,6 @@ TextureLayerDefinition::~TextureLayerDefinition() {
|
|||
void TextureLayerDefinition::validate() {
|
||||
DefinitionNode::validate();
|
||||
|
||||
material->validate();
|
||||
|
||||
// Update zone height range
|
||||
if (auto scenery = getScenery()) {
|
||||
TerrainDefinition *terrain = scenery->getTerrain();
|
||||
|
|
|
@ -13,13 +13,11 @@ VegetationModelDefinition::VegetationModelDefinition(DefinitionNode *parent) : D
|
|||
solid_material->reflection = 0.002;
|
||||
solid_material->shininess = 1.0;
|
||||
solid_material->hardness = 0.3;
|
||||
solid_material->validate();
|
||||
|
||||
foliage_material = new SurfaceMaterial(Color(0.4, 0.8, 0.45));
|
||||
foliage_material->reflection = 0.007;
|
||||
foliage_material->shininess = 2.0;
|
||||
foliage_material->hardness = 0.2;
|
||||
foliage_material->validate();
|
||||
|
||||
randomize();
|
||||
}
|
||||
|
|
|
@ -103,9 +103,6 @@ void WaterDefinition::validate() {
|
|||
foam_material->reflection = 0.1;
|
||||
foam_material->shininess = 1.5;
|
||||
foam_material->hardness = 0.2;
|
||||
|
||||
material->validate();
|
||||
foam_material->validate();
|
||||
}
|
||||
|
||||
void WaterDefinition::applyPreset(WaterPreset preset, RandomGenerator &random) {
|
||||
|
|
|
@ -171,17 +171,19 @@ Color CloudBasicLayerRenderer::getColor(BaseCloudsModel *model, const Vector3 &e
|
|||
double transparency_depth = (ymax - ymin);
|
||||
|
||||
SurfaceMaterial material(COLOR_WHITE.scaled(8.0));
|
||||
material.ambient = 0.8;
|
||||
material.hardness = 0.0;
|
||||
material.reflection = 0.2;
|
||||
material.shininess = 3.0;
|
||||
material.validate();
|
||||
|
||||
segment_count = findSegments(model, start, direction, 30, transparency_depth, max_length, &inside_length,
|
||||
&total_length, segments, 0.001);
|
||||
for (i = segment_count - 1; i >= 0; i--) {
|
||||
const Vector3 &location = segments[i].start;
|
||||
col = parent->applyLightingToSurface(location, model->getNormal(location, 1.0), material);
|
||||
Vector3 normal = model->getNormal(location, 1.0);
|
||||
|
||||
material.ambient = 1.0 - normal.getNorm() * 0.2;
|
||||
material.reflection = 0.2 * normal.getNorm();
|
||||
|
||||
col = parent->applyLightingToSurface(location, normal.normalize(), material);
|
||||
|
||||
col.a = (segments[i].length >= transparency_depth) ? 1.0 : (segments[i].length / transparency_depth);
|
||||
result.mask(col);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "BaseCloudsModel.h"
|
||||
|
||||
#include "Maths.h"
|
||||
#include "CloudLayerDefinition.h"
|
||||
#include "Vector3.h"
|
||||
|
||||
|
@ -46,5 +47,5 @@ Vector3 BaseCloudsModel::getNormal(const Vector3 &location, double quality) cons
|
|||
normal = normal.add(_getPseudoNormal(this, location, VECTOR_WEST, base_density, precision));
|
||||
normal = normal.add(_getPseudoNormal(this, location, VECTOR_NORTH, base_density, precision));
|
||||
normal = normal.add(_getPseudoNormal(this, location, VECTOR_SOUTH, base_density, precision));
|
||||
return normal.normalize();
|
||||
return normal.normalize().scale(Maths::smoothstep(0.0, 1.0, normal.getNorm()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue