summaryrefslogtreecommitdiff
path: root/scene/resources/sky_box.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-08-18 19:16:32 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-08-18 19:16:32 -0300
commit3f8efdef498c17df4cb6d697fe3f1a5358894ced (patch)
tree879cd9faced95230ee5e48104b37be5ec596a545 /scene/resources/sky_box.h
parentcbcf40bd31649d18b24952aec0051cdfbfa78606 (diff)
ProceduralSky now regenerates in a thread (the second time, first does not), closes #9138
Diffstat (limited to 'scene/resources/sky_box.h')
-rw-r--r--scene/resources/sky_box.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h
index 8298d1b3c0..9bd60cddaf 100644
--- a/scene/resources/sky_box.h
+++ b/scene/resources/sky_box.h
@@ -30,8 +30,8 @@
#ifndef Sky_H
#define Sky_H
+#include "os/thread.h"
#include "scene/resources/texture.h"
-
class Sky : public Resource {
GDCLASS(Sky, Resource);
@@ -97,6 +97,7 @@ public:
};
private:
+ Thread *sky_thread;
Color sky_top_color;
Color sky_horizon_color;
float sky_curve;
@@ -121,12 +122,20 @@ private:
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();
virtual void _radiance_changed();
+ Ref<Image> _generate_sky();
void _update_sky();
+
void _queue_update();
public: