123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #ifndef NOISE_TEXTURE_H
- #define NOISE_TEXTURE_H
- #include "open_simplex_noise.h"
- #include "core/image.h"
- #include "core/reference.h"
- #include "editor/editor_node.h"
- #include "editor/editor_plugin.h"
- #include "editor/property_editor.h"
- class NoiseTexture : public Texture {
- GDCLASS(NoiseTexture, Texture)
- private:
- Ref<Image> data;
- Thread *noise_thread;
- bool first_time;
- bool update_queued;
- bool regen_queued;
- RID texture;
- uint32_t flags;
- Ref<OpenSimplexNoise> noise;
- Vector2i size;
- bool seamless;
- bool as_normalmap;
- void _thread_done(const Ref<Image> &p_image);
- static void _thread_function(void *p_ud);
- void _queue_update();
- Ref<Image> _generate_texture();
- void _update_texture();
- void _set_texture_data(const Ref<Image> &p_image);
- protected:
- static void _bind_methods();
- public:
- void set_noise(Ref<OpenSimplexNoise> p_noise);
- Ref<OpenSimplexNoise> get_noise();
- void set_width(int p_width);
- void set_height(int p_hieght);
- void set_seamless(bool p_seamless);
- bool get_seamless();
- void set_as_normalmap(bool p_seamless);
- bool is_normalmap();
- int get_width() const;
- int get_height() const;
- virtual void set_flags(uint32_t p_flags);
- virtual uint32_t get_flags() const;
- virtual RID get_rid() const { return texture; }
- virtual bool has_alpha() const { return false; }
- virtual Ref<Image> get_data() const;
- NoiseTexture();
- virtual ~NoiseTexture();
- };
- #endif
|