paysages3d/src/definition/NoiseNode.cpp

39 lines
1.1 KiB
C++
Raw Normal View History

2015-10-18 22:26:25 +00:00
#include "NoiseNode.h"
#include "NoiseFunctionSimplex.h"
2015-10-18 22:26:25 +00:00
#include "Logs.h"
NoiseNode::NoiseNode(DefinitionNode *parent, const string &name) : DefinitionNode(parent, name) {
noise = new NoiseFunctionSimplex();
2015-10-18 22:26:25 +00:00
}
NoiseNode::~NoiseNode() {
2015-10-18 22:26:25 +00:00
delete noise;
}
void NoiseNode::save(PackStream *stream) const {
2015-10-18 22:26:25 +00:00
noise->save(stream);
}
void NoiseNode::load(PackStream *stream) {
2015-10-18 22:26:25 +00:00
noise->load(stream);
}
void NoiseNode::copy(DefinitionNode *destination) const {
if (destination->getTypeName() == getTypeName()) {
auto tdestination = static_cast<NoiseNode *>(destination);
if (tdestination) {
noise->copy(tdestination->noise);
}
} else {
2015-12-13 19:08:38 +00:00
Logs::error("Definition") << "Can't copy from " << getTypeName() << " to " << destination->getTypeName()
<< endl;
2015-10-18 22:26:25 +00:00
}
}
string NoiseNode::toString(int indent) const {
return DefinitionNode::toString(indent) + " - scaling: " + to_string(noise->getScaling()) + " step " +
to_string(noise->getStepScaling()) + " - height: " + to_string(noise->getHeight()) + " step " +
to_string(noise->getStepScaling());
2015-10-18 22:26:25 +00:00
}