2013-11-16 18:12:42 +00:00
|
|
|
#ifndef TEXTURELAYERDEFINITION_H
|
|
|
|
#define TEXTURELAYERDEFINITION_H
|
|
|
|
|
|
|
|
#include "definition_global.h"
|
|
|
|
|
2015-08-12 20:21:10 +00:00
|
|
|
#include "DefinitionNode.h"
|
2013-11-16 18:12:42 +00:00
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace definition {
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
class DEFINITIONSHARED_EXPORT TextureLayerDefinition : public DefinitionNode {
|
|
|
|
public:
|
|
|
|
typedef enum { TEXTURES_MERGE_FADE, TEXTURES_MERGE_DISSOLVE, TEXTURES_MERGE_DISPLACEMENT_VALUE } TextureMergeMode;
|
|
|
|
typedef enum {
|
2013-11-16 18:12:42 +00:00
|
|
|
TEXTURES_LAYER_PRESET_MUD,
|
|
|
|
TEXTURES_LAYER_PRESET_ROCK,
|
|
|
|
TEXTURES_LAYER_PRESET_GRASS,
|
|
|
|
TEXTURES_LAYER_PRESET_SAND,
|
|
|
|
TEXTURES_LAYER_PRESET_SNOW
|
|
|
|
} TextureLayerPreset;
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
public:
|
2015-12-10 23:36:50 +00:00
|
|
|
TextureLayerDefinition(DefinitionNode *parent, const string &name);
|
2013-11-16 18:12:42 +00:00
|
|
|
virtual ~TextureLayerDefinition();
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
virtual void save(PackStream *stream) const override;
|
|
|
|
virtual void load(PackStream *stream) override;
|
2013-11-16 18:12:42 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
virtual void copy(DefinitionNode *destination) const override;
|
2013-11-16 18:12:42 +00:00
|
|
|
virtual void validate() override;
|
|
|
|
|
2015-12-10 18:40:39 +00:00
|
|
|
void applyPreset(TextureLayerPreset preset, RandomGenerator &random = RandomGeneratorDefault);
|
2013-11-16 18:12:42 +00:00
|
|
|
|
2016-01-06 00:46:25 +00:00
|
|
|
inline NoiseNode *propDisplacementNoise() const {
|
|
|
|
return displacement_noise;
|
|
|
|
}
|
2016-01-04 00:13:14 +00:00
|
|
|
inline NoiseNode *propDetailNoise() const {
|
|
|
|
return detail_noise;
|
|
|
|
}
|
|
|
|
|
2016-01-06 00:46:25 +00:00
|
|
|
/**
|
|
|
|
* Return true if the texture applies a displacement noise on terrain.
|
|
|
|
*/
|
|
|
|
bool hasDisplacement() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the maximal (positive or negative) displacement this layer may apply on terrain.
|
|
|
|
*/
|
|
|
|
double getMaximalDisplacement() const;
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
public:
|
|
|
|
Zone *terrain_zone;
|
|
|
|
SurfaceMaterial *material;
|
2013-11-16 18:12:42 +00:00
|
|
|
|
2016-01-04 00:13:14 +00:00
|
|
|
private:
|
2016-01-06 00:46:25 +00:00
|
|
|
NoiseNode *displacement_noise;
|
2016-01-04 00:13:14 +00:00
|
|
|
NoiseNode *detail_noise;
|
2013-11-16 18:12:42 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TEXTURELAYERDEFINITION_H
|