diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 6c616ca..2cefc67 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -36,19 +36,6 @@ #include "servers/rendering/rasterizer.h" #include "servers/rendering_server.h" -class RasterizerSceneDummy : public RasterizerScene { -public: - void render_scene(const Transform &p_cam_transform, const Projection &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count) {} - - void set_scene_pass(uint64_t p_pass) {} - void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) {} - - bool free(RID p_rid) { return true; } - - RasterizerSceneDummy() {} - ~RasterizerSceneDummy() {} -}; - class RasterizerStorageDummy : public RasterizerStorage { public: /* TEXTURE API */ @@ -214,9 +201,6 @@ public: bool material_is_animated(RID p_material) { return false; } bool material_casts_shadows(RID p_material) { return false; } - void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {} - void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {} - /* MESH API */ RID mesh_create() { @@ -460,7 +444,6 @@ class RasterizerDummy : public Rasterizer { protected: RasterizerCanvasDummy canvas; RasterizerStorageDummy storage; - RasterizerSceneDummy scene; public: RasterizerStorage *get_storage() { return &storage; } diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 9f05b4a..5749ee7 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -1670,32 +1670,6 @@ bool RasterizerStorageGLES2::material_uses_ensure_correct_normals(RID p_material return material->shader->spatial.uses_ensure_correct_normals; } -void RasterizerStorageGLES2::material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) { - Material *material = material_owner.getornull(p_material); - ERR_FAIL_COND(!material); - - RBMap::Element *E = material->instance_owners.find(p_instance); - if (E) { - E->get()++; - } else { - material->instance_owners[p_instance] = 1; - } -} - -void RasterizerStorageGLES2::material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) { - Material *material = material_owner.getornull(p_material); - ERR_FAIL_COND(!material); - - RBMap::Element *E = material->instance_owners.find(p_instance); - ERR_FAIL_COND(!E); - - E->get()--; - - if (E->get() == 0) { - material->instance_owners.erase(E); - } -} - void RasterizerStorageGLES2::material_set_render_priority(RID p_material, int priority) { ERR_FAIL_COND(priority < RS::MATERIAL_RENDER_PRIORITY_MIN); ERR_FAIL_COND(priority > RS::MATERIAL_RENDER_PRIORITY_MAX); @@ -3233,53 +3207,6 @@ void RasterizerStorageGLES2::update_dirty_blend_shapes() { } } -//////// - -void RasterizerStorageGLES2::instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) { -} - -void RasterizerStorageGLES2::instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) { -} - -void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) { - Instantiable *inst = nullptr; - switch (p_instance->base_type) { - case RS::INSTANCE_MESH: { - inst = mesh_owner.getornull(p_base); - ERR_FAIL_COND(!inst); - } break; - case RS::INSTANCE_MULTIMESH: { - inst = multimesh_owner.getornull(p_base); - ERR_FAIL_COND(!inst); - } break; - default: { - ERR_FAIL(); - } - } - - inst->instance_list.add(&p_instance->dependency_item); -} - -void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) { - Instantiable *inst = nullptr; - - switch (p_instance->base_type) { - case RS::INSTANCE_MESH: { - inst = mesh_owner.getornull(p_base); - ERR_FAIL_COND(!inst); - } break; - case RS::INSTANCE_MULTIMESH: { - inst = multimesh_owner.getornull(p_base); - ERR_FAIL_COND(!inst); - } break; - default: { - ERR_FAIL(); - } - } - - inst->instance_list.remove(&p_instance->dependency_item); -} - /* RENDER TARGET */ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) { @@ -4084,24 +4011,6 @@ bool RasterizerStorageGLES2::free(RID p_rid) { g->material = RID(); } - for (RBMap::Element *E = m->instance_owners.front(); E; E = E->next()) { - RasterizerScene::InstanceBase *ins = E->key(); - - if (ins->material_override == p_rid) { - ins->material_override = RID(); - } - - if (ins->material_overlay == p_rid) { - ins->material_overlay = RID(); - } - - for (int i = 0; i < ins->materials.size(); i++) { - if (ins->materials[i] == p_rid) { - ins->materials.write[i] = RID(); - } - } - } - material_owner.free(p_rid); memdelete(m); diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index 6880bb1..a194ef9 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -172,23 +172,10 @@ public: ///////////////////////////////////////////////////////////////////////////////////////// struct Instantiable : public RID_Data { - SelfList::List instance_list; - _FORCE_INLINE_ void instance_change_notify(bool p_aabb, bool p_materials) { - SelfList *instances = instance_list.first(); - while (instances) { - instances->self()->base_changed(p_aabb, p_materials); - instances = instances->next(); - } } _FORCE_INLINE_ void instance_remove_deps() { - SelfList *instances = instance_list.first(); - - while (instances) { - instances->self()->base_removed(); - instances = instances->next(); - } } Instantiable() {} @@ -542,7 +529,6 @@ public: uint64_t last_pass; RBMap geometry_owners; - RBMap instance_owners; bool can_cast_shadow_cache; bool is_animated_cache; @@ -586,9 +572,6 @@ public: virtual bool material_uses_tangents(RID p_material); virtual bool material_uses_ensure_correct_normals(RID p_material); - virtual void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance); - virtual void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance); - virtual void material_set_render_priority(RID p_material, int priority); void update_dirty_materials(); @@ -810,14 +793,6 @@ public: void update_dirty_multimeshes(); - /* INSTANCE */ - - virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance); - virtual void instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance); - - virtual void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance); - virtual void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance); - /* RENDER TARGET */ struct RenderTarget : public RID_Data { diff --git a/servers/rendering/rasterizer.h b/servers/rendering/rasterizer.h index 5011530..a8f66f9 100644 --- a/servers/rendering/rasterizer.h +++ b/servers/rendering/rasterizer.h @@ -36,85 +36,6 @@ #include "core/containers/self_list.h" -class RasterizerScene { -public: - struct InstanceBase : RID_Data { - RS::InstanceType base_type; - RID base; - - RID skeleton; - RID material_override; - RID material_overlay; - - // This is the main transform to be drawn with .. - // This will either be the interpolated transform (when using fixed timestep interpolation) - // or the ONLY transform (when not using FTI). - Transform transform; - - // for interpolation we store the current transform (this physics tick) - // and the transform in the previous tick - Transform transform_curr; - Transform transform_prev; - - int depth_layer; - uint32_t layer_mask; - - //RID sampled_light; - - Vector materials; - Vector light_instances; - - PoolVector blend_values; - - //fit in 32 bits - bool mirror : 1; - bool receive_shadows : 1; - bool visible : 1; - bool redraw_if_visible : 1; - - bool on_interpolate_list : 1; - bool on_interpolate_transform_list : 1; - bool interpolated : 1; - TransformInterpolator::Method interpolation_method : 3; - - // For fixed timestep interpolation. - // Note 32 bits is plenty for checksum, no need for real_t - float transform_checksum_curr; - float transform_checksum_prev; - - float depth; //used for sorting - - SelfList dependency_item; - - virtual void base_removed() = 0; - virtual void base_changed(bool p_aabb, bool p_materials) = 0; - InstanceBase() : - dependency_item(this) { - base_type = RS::INSTANCE_NONE; - receive_shadows = true; - visible = true; - depth_layer = 0; - layer_mask = 1; - redraw_if_visible = false; - on_interpolate_list = false; - on_interpolate_transform_list = false; - interpolated = true; - interpolation_method = TransformInterpolator::INTERP_LERP; - transform_checksum_curr = 0.0; - transform_checksum_prev = 0.0; - } - }; - - virtual void render_scene(const Transform &p_cam_transform, const Projection &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count) = 0; - - virtual void set_scene_pass(uint64_t p_pass) = 0; - virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) = 0; - - virtual bool free(RID p_rid) = 0; - - virtual ~RasterizerScene() {} -}; - class RasterizerStorage { public: /* TEXTURE API */ @@ -208,9 +129,6 @@ public: virtual bool material_uses_tangents(RID p_material); virtual bool material_uses_ensure_correct_normals(RID p_material); - virtual void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) = 0; - virtual void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) = 0; - /* MESH API */ virtual RID mesh_create() = 0; @@ -332,12 +250,6 @@ private: void _multimesh_add_to_interpolation_lists(RID p_multimesh, MMInterpolator &r_mmi); public: - virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) = 0; - virtual void instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) = 0; - - virtual void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) = 0; - virtual void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) = 0; - /* RENDER TARGET */ enum RenderTargetFlags { diff --git a/servers/rendering/rendering_server_globals.cpp b/servers/rendering/rendering_server_globals.cpp index fe9792b..9d556c7 100644 --- a/servers/rendering/rendering_server_globals.cpp +++ b/servers/rendering/rendering_server_globals.cpp @@ -32,7 +32,6 @@ RasterizerStorage *RenderingServerGlobals::storage = nullptr; RasterizerCanvas *RenderingServerGlobals::canvas_render = nullptr; -RasterizerScene *RenderingServerGlobals::scene_render = nullptr; Rasterizer *RenderingServerGlobals::rasterizer = nullptr; RenderingServerCanvas *RenderingServerGlobals::canvas = nullptr; diff --git a/servers/rendering/rendering_server_globals.h b/servers/rendering/rendering_server_globals.h index 8b78589..16991f9 100644 --- a/servers/rendering/rendering_server_globals.h +++ b/servers/rendering/rendering_server_globals.h @@ -39,7 +39,6 @@ class RenderingServerGlobals { public: static RasterizerStorage *storage; static RasterizerCanvas *canvas_render; - static RasterizerScene *scene_render; static Rasterizer *rasterizer; static RenderingServerCanvas *canvas; diff --git a/servers/rendering/rendering_server_raster.cpp b/servers/rendering/rendering_server_raster.cpp index 94fe91e..86c6951 100644 --- a/servers/rendering/rendering_server_raster.cpp +++ b/servers/rendering/rendering_server_raster.cpp @@ -78,9 +78,6 @@ void RenderingServerRaster::free(RID p_rid) { if (RSG::viewport->free(p_rid)) { return; } - if (RSG::scene_render->free(p_rid)) { - return; - } ERR_FAIL_MSG("Invalid RID."); } diff --git a/servers/rendering/rendering_server_viewport.cpp b/servers/rendering/rendering_server_viewport.cpp index b03b798..68d721b 100644 --- a/servers/rendering/rendering_server_viewport.cpp +++ b/servers/rendering/rendering_server_viewport.cpp @@ -128,7 +128,6 @@ void RenderingServerViewport::draw_viewports() { RSG::storage->render_target_set_external_texture(vp->render_target, 0, 0); RSG::rasterizer->set_current_render_target(vp->render_target); - RSG::scene_render->set_debug_draw_mode(vp->debug_draw); RSG::storage->render_info_begin_capture(); // render standard mono camera @@ -153,7 +152,6 @@ void RenderingServerViewport::draw_viewports() { if (vp->update_mode == RS::VIEWPORT_UPDATE_ONCE) { vp->update_mode = RS::VIEWPORT_UPDATE_DISABLED; } - RSG::scene_render->set_debug_draw_mode(RS::VIEWPORT_DEBUG_DRAW_DISABLED); } }