godot_voxel/generators/simple/voxel_generator_noise.h

57 lines
1.3 KiB
C
Raw Normal View History

2020-01-26 22:43:47 +00:00
#ifndef VOXEL_GENERATOR_NOISE_H
#define VOXEL_GENERATOR_NOISE_H
2019-05-05 18:27:33 +01:00
#include "../../storage/voxel_buffer_gd.h"
#include "../voxel_generator.h"
#include <modules/noise/noise.h>
2019-05-05 18:27:33 +01:00
2022-01-09 22:13:10 +00:00
namespace zylann::voxel {
class VoxelGeneratorNoise : public VoxelGenerator {
GDCLASS(VoxelGeneratorNoise, VoxelGenerator)
2019-05-05 18:27:33 +01:00
public:
VoxelGeneratorNoise();
2021-01-16 13:41:46 +00:00
~VoxelGeneratorNoise();
void set_channel(VoxelBufferInternal::ChannelId p_channel);
VoxelBufferInternal::ChannelId get_channel() const;
2020-02-15 03:12:13 +08:00
int get_used_channels_mask() const override;
void set_noise(Ref<Noise> noise);
Ref<Noise> get_noise() const;
2019-05-05 18:27:33 +01:00
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;
Result generate_block(VoxelGenerator::VoxelQueryData &input) override;
2019-05-05 18:27:33 +01:00
private:
void _on_noise_changed();
void _b_set_channel(gd::VoxelBuffer::ChannelId p_channel);
gd::VoxelBuffer::ChannelId _b_get_channel() const;
2019-05-05 18:27:33 +01:00
static void _bind_methods();
Ref<Noise> _noise;
2021-01-16 13:41:46 +00:00
struct Parameters {
2022-01-09 22:13:10 +00:00
VoxelBufferInternal::ChannelId channel = VoxelBufferInternal::CHANNEL_SDF;
Ref<Noise> noise;
2021-01-16 13:41:46 +00:00
float height_start = 0;
float height_range = 300;
};
Parameters _parameters;
RWLock _parameters_lock;
2019-05-05 18:27:33 +01:00
};
2022-01-09 22:13:10 +00:00
} // namespace zylann::voxel
2020-01-26 22:43:47 +00:00
#endif // VOXEL_GENERATOR_NOISE_H