Removed unused definition members
This commit is contained in:
parent
cd9f1bd34c
commit
4347d7f454
6 changed files with 17 additions and 47 deletions
1
TODO
1
TODO
|
@ -1,6 +1,7 @@
|
||||||
Technlology Preview 2 :
|
Technlology Preview 2 :
|
||||||
- Rewrite UI in QtQuick, with full-window OpenGL editor.
|
- Rewrite UI in QtQuick, with full-window OpenGL editor.
|
||||||
- Streamline the definition system, with undo and events.
|
- Streamline the definition system, with undo and events.
|
||||||
|
- Switch all noise generators to FractalNoise, and restore detail-based fractal levels.
|
||||||
- Implement copy-on-write on definitions (to avoid copying whole heightmaps for instance).
|
- Implement copy-on-write on definitions (to avoid copying whole heightmaps for instance).
|
||||||
- Add clouds to OpenGL with 3d textures.
|
- Add clouds to OpenGL with 3d textures.
|
||||||
- Refactor medium traversal to unify clouds, atmosphere and god rays.
|
- Refactor medium traversal to unify clouds, atmosphere and god rays.
|
||||||
|
|
|
@ -5,8 +5,6 @@ FractalNoise::FractalNoise() {
|
||||||
height = 1.0;
|
height = 1.0;
|
||||||
step_scaling = 2.0;
|
step_scaling = 2.0;
|
||||||
step_height = 0.5;
|
step_height = 0.5;
|
||||||
slope = 0.0;
|
|
||||||
ridge = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FractalNoise::~FractalNoise() {
|
FractalNoise::~FractalNoise() {
|
||||||
|
@ -22,14 +20,6 @@ void FractalNoise::setStep(double scaling_factor, double height_factor) {
|
||||||
this->step_height = scaling_factor * height_factor;
|
this->step_height = scaling_factor * height_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FractalNoise::setSlope(double slope_factor) {
|
|
||||||
this->slope = slope_factor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FractalNoise::setRidge(double ridge_factor) {
|
|
||||||
this->ridge = ridge_factor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FractalNoise::setState(const NoiseState &state) {
|
void FractalNoise::setState(const NoiseState &state) {
|
||||||
state.copy(&this->state);
|
state.copy(&this->state);
|
||||||
}
|
}
|
||||||
|
@ -38,8 +28,8 @@ double FractalNoise::get1d(double detail, double x) const {
|
||||||
double current_scaling = scaling;
|
double current_scaling = scaling;
|
||||||
double current_height = height;
|
double current_height = height;
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
int state_level_count = state.level_offsets.size();
|
auto state_level_count = state.level_offsets.size();
|
||||||
int i = 0;
|
decltype(state_level_count) i = 0;
|
||||||
|
|
||||||
while (current_height >= detail) {
|
while (current_height >= detail) {
|
||||||
const NoiseState::NoiseOffset &offset = state.level_offsets[i];
|
const NoiseState::NoiseOffset &offset = state.level_offsets[i];
|
||||||
|
@ -62,8 +52,8 @@ double FractalNoise::get2d(double detail, double x, double y) const {
|
||||||
double current_scaling = scaling;
|
double current_scaling = scaling;
|
||||||
double current_height = height;
|
double current_height = height;
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
int state_level_count = state.level_offsets.size();
|
auto state_level_count = state.level_offsets.size();
|
||||||
int i = 0;
|
decltype(state_level_count) i = 0;
|
||||||
|
|
||||||
while (current_height >= detail) {
|
while (current_height >= detail) {
|
||||||
const NoiseState::NoiseOffset &offset = state.level_offsets[i];
|
const NoiseState::NoiseOffset &offset = state.level_offsets[i];
|
||||||
|
@ -86,8 +76,8 @@ double FractalNoise::get3d(double detail, double x, double y, double z) const {
|
||||||
double current_scaling = scaling;
|
double current_scaling = scaling;
|
||||||
double current_height = height;
|
double current_height = height;
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
int state_level_count = state.level_offsets.size();
|
auto state_level_count = state.level_offsets.size();
|
||||||
int i = 0;
|
decltype(state_level_count) i = 0;
|
||||||
|
|
||||||
while (current_height >= detail) {
|
while (current_height >= detail) {
|
||||||
const NoiseState::NoiseOffset &offset = state.level_offsets[i];
|
const NoiseState::NoiseOffset &offset = state.level_offsets[i];
|
||||||
|
|
|
@ -31,8 +31,6 @@ class BASICSSHARED_EXPORT FractalNoise {
|
||||||
|
|
||||||
void setScaling(double scaling, double height = 1.0);
|
void setScaling(double scaling, double height = 1.0);
|
||||||
void setStep(double scaling_factor, double height_factor = 1.0);
|
void setStep(double scaling_factor, double height_factor = 1.0);
|
||||||
void setSlope(double slope_factor);
|
|
||||||
void setRidge(double ridge_factor);
|
|
||||||
void setState(const NoiseState &state);
|
void setState(const NoiseState &state);
|
||||||
|
|
||||||
double get1d(double detail, double x) const;
|
double get1d(double detail, double x) const;
|
||||||
|
@ -50,8 +48,6 @@ class BASICSSHARED_EXPORT FractalNoise {
|
||||||
double height;
|
double height;
|
||||||
double step_scaling;
|
double step_scaling;
|
||||||
double step_height;
|
double step_height;
|
||||||
double slope;
|
|
||||||
double ridge;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,20 +54,19 @@ void TextureLayerDefinition::validate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureLayerDefinition::copy(DefinitionNode *_destination) const {
|
void TextureLayerDefinition::copy(DefinitionNode *destination) const {
|
||||||
DefinitionNode::copy(_destination);
|
DefinitionNode::copy(destination);
|
||||||
|
|
||||||
TextureLayerDefinition *destination = (TextureLayerDefinition *)_destination;
|
if (auto tex_destination = static_cast<TextureLayerDefinition *>(destination)) {
|
||||||
|
terrain_zone->copy(tex_destination->terrain_zone);
|
||||||
|
|
||||||
terrain_zone->copy(destination->terrain_zone);
|
tex_destination->displacement_scaling = displacement_scaling;
|
||||||
|
tex_destination->displacement_height = displacement_height;
|
||||||
|
*tex_destination->material = *material;
|
||||||
|
|
||||||
destination->displacement_scaling = displacement_scaling;
|
_displacement_noise->copy(tex_destination->_displacement_noise);
|
||||||
destination->displacement_height = displacement_height;
|
_detail_noise->copy(tex_destination->_detail_noise);
|
||||||
destination->displacement_offset = displacement_offset;
|
}
|
||||||
*destination->material = *material;
|
|
||||||
|
|
||||||
_displacement_noise->copy(destination->_displacement_noise);
|
|
||||||
_detail_noise->copy(destination->_detail_noise);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureLayerDefinition::save(PackStream *stream) const {
|
void TextureLayerDefinition::save(PackStream *stream) const {
|
||||||
|
@ -76,7 +75,6 @@ void TextureLayerDefinition::save(PackStream *stream) const {
|
||||||
terrain_zone->save(stream);
|
terrain_zone->save(stream);
|
||||||
stream->write(&displacement_scaling);
|
stream->write(&displacement_scaling);
|
||||||
stream->write(&displacement_height);
|
stream->write(&displacement_height);
|
||||||
stream->write(&displacement_offset);
|
|
||||||
material->save(stream);
|
material->save(stream);
|
||||||
|
|
||||||
_displacement_noise->save(stream);
|
_displacement_noise->save(stream);
|
||||||
|
@ -89,7 +87,6 @@ void TextureLayerDefinition::load(PackStream *stream) {
|
||||||
terrain_zone->load(stream);
|
terrain_zone->load(stream);
|
||||||
stream->read(&displacement_scaling);
|
stream->read(&displacement_scaling);
|
||||||
stream->read(&displacement_height);
|
stream->read(&displacement_height);
|
||||||
stream->read(&displacement_offset);
|
|
||||||
material->load(stream);
|
material->load(stream);
|
||||||
|
|
||||||
_displacement_noise->load(stream);
|
_displacement_noise->load(stream);
|
||||||
|
@ -106,7 +103,6 @@ void TextureLayerDefinition::applyPreset(TextureLayerPreset preset, RandomGenera
|
||||||
case TEXTURES_LAYER_PRESET_MUD:
|
case TEXTURES_LAYER_PRESET_MUD:
|
||||||
displacement_height = 0.02;
|
displacement_height = 0.02;
|
||||||
displacement_scaling = 3.0;
|
displacement_scaling = 3.0;
|
||||||
displacement_offset = 0.0;
|
|
||||||
material->setColor(0.015, 0.014, 0.014, 1.0);
|
material->setColor(0.015, 0.014, 0.014, 1.0);
|
||||||
material->reflection = 0.003;
|
material->reflection = 0.003;
|
||||||
material->shininess = 4.0;
|
material->shininess = 4.0;
|
||||||
|
@ -115,7 +111,6 @@ void TextureLayerDefinition::applyPreset(TextureLayerPreset preset, RandomGenera
|
||||||
terrain_zone->addHeightRangeQuick(1.0, 0.6, 0.7, 1.0, 1.0);
|
terrain_zone->addHeightRangeQuick(1.0, 0.6, 0.7, 1.0, 1.0);
|
||||||
displacement_height = 0.3;
|
displacement_height = 0.3;
|
||||||
displacement_scaling = 2.0;
|
displacement_scaling = 2.0;
|
||||||
displacement_offset = 0.0;
|
|
||||||
material->setColor(0.6, 0.55, 0.57, 1.0);
|
material->setColor(0.6, 0.55, 0.57, 1.0);
|
||||||
material->reflection = 0.006;
|
material->reflection = 0.006;
|
||||||
material->shininess = 6.0;
|
material->shininess = 6.0;
|
||||||
|
@ -125,7 +120,6 @@ void TextureLayerDefinition::applyPreset(TextureLayerPreset preset, RandomGenera
|
||||||
terrain_zone->addSlopeRangeQuick(1.0, 0.0, 0.0, 0.05, 0.4);
|
terrain_zone->addSlopeRangeQuick(1.0, 0.0, 0.0, 0.05, 0.4);
|
||||||
displacement_height = 0.0;
|
displacement_height = 0.0;
|
||||||
displacement_scaling = 1.0;
|
displacement_scaling = 1.0;
|
||||||
displacement_offset = 0.0;
|
|
||||||
material->setColor(0.12, 0.19, 0.035, 1.0);
|
material->setColor(0.12, 0.19, 0.035, 1.0);
|
||||||
material->reflection = 0.001;
|
material->reflection = 0.001;
|
||||||
material->shininess = 4.0;
|
material->shininess = 4.0;
|
||||||
|
@ -135,7 +129,6 @@ void TextureLayerDefinition::applyPreset(TextureLayerPreset preset, RandomGenera
|
||||||
terrain_zone->addSlopeRangeQuick(1.0, 0.0, 0.0, 0.1, 0.4);
|
terrain_zone->addSlopeRangeQuick(1.0, 0.0, 0.0, 0.1, 0.4);
|
||||||
displacement_height = 0.05;
|
displacement_height = 0.05;
|
||||||
displacement_scaling = 5.0;
|
displacement_scaling = 5.0;
|
||||||
displacement_offset = 0.0;
|
|
||||||
material->setColor(1.2, 1.1, 0.9, 1.0);
|
material->setColor(1.2, 1.1, 0.9, 1.0);
|
||||||
material->reflection = 0.008;
|
material->reflection = 0.008;
|
||||||
material->shininess = 1.0;
|
material->shininess = 1.0;
|
||||||
|
@ -145,13 +138,10 @@ void TextureLayerDefinition::applyPreset(TextureLayerPreset preset, RandomGenera
|
||||||
terrain_zone->addSlopeRangeQuick(1.0, 0.0, 0.0, 0.2, 1.0);
|
terrain_zone->addSlopeRangeQuick(1.0, 0.0, 0.0, 0.2, 1.0);
|
||||||
displacement_height = 0.1;
|
displacement_height = 0.1;
|
||||||
displacement_scaling = 1.0;
|
displacement_scaling = 1.0;
|
||||||
displacement_offset = 0.0;
|
|
||||||
material->setColor(5.0, 5.0, 5.0, 1.0);
|
material->setColor(5.0, 5.0, 5.0, 1.0);
|
||||||
material->reflection = 0.02;
|
material->reflection = 0.02;
|
||||||
material->shininess = 0.6;
|
material->shininess = 0.6;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
|
|
@ -35,16 +35,10 @@ class DEFINITIONSHARED_EXPORT TextureLayerDefinition : public DefinitionNode {
|
||||||
Zone *terrain_zone;
|
Zone *terrain_zone;
|
||||||
double displacement_scaling;
|
double displacement_scaling;
|
||||||
double displacement_height;
|
double displacement_height;
|
||||||
double displacement_offset;
|
|
||||||
/*double detail_scaling;
|
|
||||||
double detail_height;*/
|
|
||||||
SurfaceMaterial *material;
|
SurfaceMaterial *material;
|
||||||
/*double cancel_displacement_factor;
|
|
||||||
TexturesMergeMode merge_mode;*/
|
|
||||||
|
|
||||||
NoiseGenerator *_displacement_noise;
|
NoiseGenerator *_displacement_noise;
|
||||||
NoiseGenerator *_detail_noise;
|
NoiseGenerator *_detail_noise;
|
||||||
/*Curve* _local_slope_condition;*/
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,6 @@ static void testGroundShadowQuality() {
|
||||||
TextureLayerDefinition texture(NULL, "test");
|
TextureLayerDefinition texture(NULL, "test");
|
||||||
texture.displacement_height = 0.3;
|
texture.displacement_height = 0.3;
|
||||||
texture.displacement_scaling = 2.0;
|
texture.displacement_scaling = 2.0;
|
||||||
texture.displacement_offset = 0.0;
|
|
||||||
texture.material->setColor(0.6, 0.55, 0.57, 1.0);
|
texture.material->setColor(0.6, 0.55, 0.57, 1.0);
|
||||||
texture.material->reflection = 0.006;
|
texture.material->reflection = 0.006;
|
||||||
texture.material->shininess = 6.0;
|
texture.material->shininess = 6.0;
|
||||||
|
|
Loading…
Reference in a new issue