2020-01-26 14:43:47 -08:00
|
|
|
#ifndef VOXEL_GENERATOR_NOISE_H
|
|
|
|
#define VOXEL_GENERATOR_NOISE_H
|
2019-05-05 10:27:33 -07:00
|
|
|
|
2019-05-11 09:42:56 -07:00
|
|
|
#include "../util/float_buffer_3d.h"
|
2020-01-26 14:34:26 -08:00
|
|
|
#include "voxel_generator.h"
|
2019-05-05 10:27:33 -07:00
|
|
|
#include <modules/opensimplex/open_simplex_noise.h>
|
|
|
|
|
2020-01-26 14:34:26 -08:00
|
|
|
class VoxelGeneratorNoise : public VoxelGenerator {
|
|
|
|
GDCLASS(VoxelGeneratorNoise, VoxelGenerator)
|
2020-01-10 06:46:59 -08:00
|
|
|
|
2019-05-05 10:27:33 -07:00
|
|
|
public:
|
2020-02-14 11:12:13 -08:00
|
|
|
void set_channel(VoxelBuffer::ChannelId channel);
|
|
|
|
VoxelBuffer::ChannelId get_channel() const;
|
|
|
|
int get_used_channels_mask() const override;
|
|
|
|
|
2019-05-05 10:27:33 -07:00
|
|
|
void set_noise(Ref<OpenSimplexNoise> noise);
|
|
|
|
Ref<OpenSimplexNoise> get_noise() const;
|
|
|
|
|
|
|
|
void set_height_start(real_t y);
|
|
|
|
real_t get_height_start() const;
|
|
|
|
|
|
|
|
void set_height_range(real_t hrange);
|
|
|
|
real_t get_height_range() const;
|
|
|
|
|
2020-01-26 14:34:26 -08:00
|
|
|
void generate_block(VoxelBlockRequest &input) override;
|
2019-05-05 10:27:33 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
private:
|
2020-02-14 11:12:13 -08:00
|
|
|
VoxelBuffer::ChannelId _channel = VoxelBuffer::CHANNEL_SDF;
|
2019-05-05 10:27:33 -07:00
|
|
|
Ref<OpenSimplexNoise> _noise;
|
2019-05-11 09:42:56 -07:00
|
|
|
FloatBuffer3D _noise_buffer;
|
2019-05-05 10:27:33 -07:00
|
|
|
float _height_start = 0;
|
|
|
|
float _height_range = 300;
|
|
|
|
};
|
|
|
|
|
2020-01-26 14:43:47 -08:00
|
|
|
#endif // VOXEL_GENERATOR_NOISE_H
|