summaryrefslogtreecommitdiff
path: root/scene/resources/sky.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/sky.h')
-rw-r--r--scene/resources/sky.h130
1 files changed, 5 insertions, 125 deletions
diff --git a/scene/resources/sky.h b/scene/resources/sky.h
index 09ebbd88a0..37f0a589f9 100644
--- a/scene/resources/sky.h
+++ b/scene/resources/sky.h
@@ -32,6 +32,7 @@
#define SKY_H
#include "core/os/thread.h"
+#include "scene/resources/material.h"
#include "scene/resources/texture.h"
class Sky : public Resource {
@@ -58,6 +59,7 @@ private:
RID sky;
ProcessMode mode;
RadianceSize radiance_size;
+ Ref<Material> sky_material;
protected:
static void _bind_methods();
@@ -69,6 +71,9 @@ public:
void set_process_mode(ProcessMode p_mode);
ProcessMode get_process_mode() const;
+ void set_material(const Ref<Material> &p_material);
+ Ref<Material> get_material() const;
+
virtual RID get_rid() const;
Sky();
@@ -78,129 +83,4 @@ public:
VARIANT_ENUM_CAST(Sky::RadianceSize)
VARIANT_ENUM_CAST(Sky::ProcessMode)
-class PanoramaSky : public Sky {
- GDCLASS(PanoramaSky, Sky);
-
-private:
- Ref<Texture2D> panorama;
-
-protected:
- static void _bind_methods();
-
-public:
- void set_panorama(const Ref<Texture2D> &p_panorama);
- Ref<Texture2D> get_panorama() const;
-
- PanoramaSky();
- ~PanoramaSky();
-};
-
-class ProceduralSky : public Sky {
- GDCLASS(ProceduralSky, Sky);
-
-public:
- enum TextureSize {
- TEXTURE_SIZE_256,
- TEXTURE_SIZE_512,
- TEXTURE_SIZE_1024,
- TEXTURE_SIZE_2048,
- TEXTURE_SIZE_4096,
- TEXTURE_SIZE_MAX
- };
-
-private:
- Thread *sky_thread;
- Color sky_top_color;
- Color sky_horizon_color;
- float sky_curve;
- float sky_energy;
-
- Color ground_bottom_color;
- Color ground_horizon_color;
- float ground_curve;
- float ground_energy;
-
- Color sun_color;
- float sun_latitude;
- float sun_longitude;
- float sun_angle_min;
- float sun_angle_max;
- float sun_curve;
- float sun_energy;
-
- TextureSize texture_size;
-
- RID texture;
-
- bool update_queued;
- bool regen_queued;
-
- bool first_time;
-
- void _thread_done(const Ref<Image> &p_image);
- static void _thread_function(void *p_ud);
-
-protected:
- static void _bind_methods();
-
- Ref<Image> _generate_sky();
- void _update_sky();
-
- void _queue_update();
-
-public:
- void set_sky_top_color(const Color &p_sky_top);
- Color get_sky_top_color() const;
-
- void set_sky_horizon_color(const Color &p_sky_horizon);
- Color get_sky_horizon_color() const;
-
- void set_sky_curve(float p_curve);
- float get_sky_curve() const;
-
- void set_sky_energy(float p_energy);
- float get_sky_energy() const;
-
- void set_ground_bottom_color(const Color &p_ground_bottom);
- Color get_ground_bottom_color() const;
-
- void set_ground_horizon_color(const Color &p_ground_horizon);
- Color get_ground_horizon_color() const;
-
- void set_ground_curve(float p_curve);
- float get_ground_curve() const;
-
- void set_ground_energy(float p_energy);
- float get_ground_energy() const;
-
- void set_sun_color(const Color &p_sun);
- Color get_sun_color() const;
-
- void set_sun_latitude(float p_angle);
- float get_sun_latitude() const;
-
- void set_sun_longitude(float p_angle);
- float get_sun_longitude() const;
-
- void set_sun_angle_min(float p_angle);
- float get_sun_angle_min() const;
-
- void set_sun_angle_max(float p_angle);
- float get_sun_angle_max() const;
-
- void set_sun_curve(float p_curve);
- float get_sun_curve() const;
-
- void set_sun_energy(float p_energy);
- float get_sun_energy() const;
-
- void set_texture_size(TextureSize p_size);
- TextureSize get_texture_size() const;
-
- ProceduralSky(bool p_desaturate = false);
- ~ProceduralSky();
-};
-
-VARIANT_ENUM_CAST(ProceduralSky::TextureSize)
-
#endif // SKY_H