diff options
author | Bastiaan Olij <mux213@gmail.com> | 2019-09-15 19:58:38 +1000 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2020-03-19 18:30:39 -0700 |
commit | c3fee7ba6cdefd285255b9e1198bc1fdf585b1ac (patch) | |
tree | b198d6c7473eed95130b09c991686e2f20540864 /drivers | |
parent | 1a532d53ccfd11cae7efdda1d406fd26da5cdb1e (diff) |
Add shader based background mode
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dummy/rasterizer_dummy.h | 1 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_scene_gles2.cpp | 7 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_scene_gles2.h | 3 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.cpp | 2 |
4 files changed, 13 insertions, 0 deletions
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 4dc634aefa..c78b82792b 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -67,6 +67,7 @@ public: void environment_set_sky(RID p_env, RID p_sky) {} void environment_set_sky_custom_fov(RID p_env, float p_scale) {} void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {} + void environment_set_bg_material(RID p_env, RID p_material) {} void environment_set_bg_color(RID p_env, const Color &p_color) {} void environment_set_bg_energy(RID p_env, float p_energy) {} void environment_set_canvas_max_layer(RID p_env, int p_max_layer) {} diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index c433886545..068b9f5538 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -718,6 +718,13 @@ void RasterizerSceneGLES2::environment_set_sky_orientation(RID p_env, const Basi env->sky_orientation = p_orientation; } +void RasterizerSceneGLES2::environment_set_bg_material(RID p_env, RID p_material) { + Environment *env = environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->bg_material = p_material; +} + void RasterizerSceneGLES2::environment_set_bg_color(RID p_env, const Color &p_color) { Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h index 174cdd8e2e..fda46072a5 100644 --- a/drivers/gles2/rasterizer_scene_gles2.h +++ b/drivers/gles2/rasterizer_scene_gles2.h @@ -242,6 +242,8 @@ public: float sky_custom_fov; Basis sky_orientation; + RID bg_material; + Color bg_color; float bg_energy; float sky_ambient; @@ -357,6 +359,7 @@ public: virtual void environment_set_sky(RID p_env, RID p_sky); virtual void environment_set_sky_custom_fov(RID p_env, float p_scale); virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation); + virtual void environment_set_bg_material(RID p_env, RID p_material); virtual void environment_set_bg_color(RID p_env, const Color &p_color); virtual void environment_set_bg_energy(RID p_env, float p_energy); virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer); diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 0f5452effc..f76c7da8e1 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -1427,6 +1427,8 @@ void RasterizerStorageGLES2::shader_set_code(RID p_shader, const String &p_code) mode = VS::SHADER_CANVAS_ITEM; else if (mode_string == "particles") mode = VS::SHADER_PARTICLES; + else if (mode_string == "sky") + mode = VS::SHADER_SKY; else mode = VS::SHADER_SPATIAL; |