diff options
author | Bastiaan Olij <mux213@gmail.com> | 2022-03-20 22:28:24 +1100 |
---|---|---|
committer | Bastiaan Olij <mux213@gmail.com> | 2022-03-21 12:22:43 +1100 |
commit | 0fe06e9467caa3eb832ee175e5f219f12d45a72e (patch) | |
tree | 84583038519b160c9b28d8d89d99c6a84e0f4044 /servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp | |
parent | aa8ff21b2a37e6235b7024e5b2804219337a7e74 (diff) |
Extract Decal and Decal atlas from Storage class
Diffstat (limited to 'servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp')
-rw-r--r-- | servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp index a09f228b71..e56e263540 100644 --- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp @@ -35,6 +35,7 @@ #include "core/math/math_defs.h" #include "core/math/math_funcs.h" #include "renderer_compositor_rd.h" +#include "servers/rendering/renderer_rd/storage_rd/decal_atlas_storage.h" #include "servers/rendering/rendering_server_default.h" void RendererCanvasRenderRD::_update_transform_2d_to_mat4(const Transform2D &p_transform, float *p_mat4) { @@ -947,7 +948,7 @@ RID RendererCanvasRenderRD::_create_base_uniform_set(RID p_to_render_target, boo RD::Uniform u; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; u.binding = 3; - u.append_id(storage->decal_atlas_get_texture()); + u.append_id(RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture()); uniforms.push_back(u); } @@ -1253,7 +1254,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p } if (clight->texture.is_valid()) { - Rect2 atlas_rect = storage->decal_atlas_get_texture_rect(clight->texture); + Rect2 atlas_rect = RendererRD::DecalAtlasStorage::get_singleton()->decal_atlas_get_texture_rect(clight->texture); state.light_uniforms[index].atlas_rect[0] = atlas_rect.position.x; state.light_uniforms[index].atlas_rect[1] = atlas_rect.position.y; state.light_uniforms[index].atlas_rect[2] = atlas_rect.size.width; @@ -1479,18 +1480,20 @@ RID RendererCanvasRenderRD::light_create() { } void RendererCanvasRenderRD::light_set_texture(RID p_rid, RID p_texture) { + RendererRD::DecalAtlasStorage *decal_atlas_storage = RendererRD::DecalAtlasStorage::get_singleton(); + CanvasLight *cl = canvas_light_owner.get_or_null(p_rid); ERR_FAIL_COND(!cl); if (cl->texture == p_texture) { return; } if (cl->texture.is_valid()) { - storage->texture_remove_from_decal_atlas(cl->texture); + decal_atlas_storage->texture_remove_from_decal_atlas(cl->texture); } cl->texture = p_texture; if (cl->texture.is_valid()) { - storage->texture_add_to_decal_atlas(cl->texture); + decal_atlas_storage->texture_add_to_decal_atlas(cl->texture); } } |