diff options
author | Spartan322 <Megacake1234@gmail.com> | 2024-11-19 11:38:29 -0500 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2024-11-19 11:39:37 -0500 |
commit | cfc378b251e4330c6b6be949d4c054f9bae48159 (patch) | |
tree | 148a5511d3c1d723b2f2f364c832c2ba6f267fcc /servers | |
parent | 9767837a7ec40697788765e581131cb2cf172567 (diff) | |
parent | fd4c29a189e53a1e085df5b9b9a05cac9351b3ef (diff) | |
download | redot-engine-cfc378b251e4330c6b6be949d4c054f9bae48159.tar.gz |
Merge commit godotengine/godot@fd4c29a189e53a1e085df5b9b9a05cac9351b3ef
Diffstat (limited to 'servers')
14 files changed, 44 insertions, 16 deletions
diff --git a/servers/rendering/dummy/storage/mesh_storage.h b/servers/rendering/dummy/storage/mesh_storage.h index 37959ffb7f..91fcaf437c 100644 --- a/servers/rendering/dummy/storage/mesh_storage.h +++ b/servers/rendering/dummy/storage/mesh_storage.h @@ -172,6 +172,7 @@ public: virtual Color _multimesh_instance_get_color(RID p_multimesh, int p_index) const override { return Color(); } virtual Color _multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const override { return Color(); } virtual void _multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) override; + virtual RID _multimesh_get_buffer_rd_rid(RID p_multimesh) const override { return RID(); } virtual Vector<float> _multimesh_get_buffer(RID p_multimesh) const override; virtual void _multimesh_set_visible_instances(RID p_multimesh, int p_visible) override {} diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index 51f7d21cfc..e145100f21 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -280,6 +280,19 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2 ci->children_order_dirty = false; } + if (ci->use_parent_material && p_material_owner) { + ci->material_owner = p_material_owner; + } else { + p_material_owner = ci; + ci->material_owner = nullptr; + } + + Color modulate = ci->modulate * p_modulate; + + if (modulate.a < 0.007) { + return; + } + Rect2 rect = ci->get_rect(); if (ci->visibility_notifier) { @@ -348,19 +361,6 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2 } global_rect.position += p_clip_rect.position; - if (ci->use_parent_material && p_material_owner) { - ci->material_owner = p_material_owner; - } else { - p_material_owner = ci; - ci->material_owner = nullptr; - } - - Color modulate(ci->modulate.r * p_modulate.r, ci->modulate.g * p_modulate.g, ci->modulate.b * p_modulate.b, ci->modulate.a * p_modulate.a); - - if (modulate.a < 0.007) { - return; - } - int child_item_count = ci->child_items.size(); Item **child_items = ci->child_items.ptrw(); diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h index 379536b82c..7fbe95548b 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h @@ -275,7 +275,7 @@ public: _FORCE_INLINE_ bool uses_shared_shadow_material() const { bool backface_culling = cull_mode == CULL_BACK; - return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_position && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && backface_culling && !uses_point_size && !uses_world_coordinates; + return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_position && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && backface_culling && !uses_point_size && !uses_world_coordinates && !wireframe; } virtual void set_code(const String &p_Code); diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index 79fe54277a..d7e4d31e43 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -2066,6 +2066,10 @@ void RenderForwardMobile::_fill_render_list(RenderListType p_render_list, const surf = surf->next; } } + + if (p_render_list == RENDER_LIST_OPAQUE && lightmap_captures_used) { + RD::get_singleton()->buffer_update(scene_state.lightmap_capture_buffer, 0, sizeof(LightmapCaptureData) * lightmap_captures_used, scene_state.lightmap_captures); + } } void RenderForwardMobile::_setup_environment(const RenderDataRD *p_render_data, bool p_no_fog, const Size2i &p_screen_size, const Color &p_default_bg_color, bool p_opaque_render_buffers, bool p_pancake_shadows, int p_index) { diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h index 6b40ae5198..ea9ee07226 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h @@ -245,7 +245,7 @@ public: } _FORCE_INLINE_ bool uses_shared_shadow_material() const { - return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && !uses_world_coordinates; + return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && !uses_world_coordinates && !wireframe; } virtual void set_code(const String &p_Code); diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp index 4ada0803f3..5b01f11abf 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp @@ -1999,6 +1999,12 @@ void MeshStorage::_multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_ } } +RID MeshStorage::_multimesh_get_buffer_rd_rid(RID p_multimesh) const { + MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh); + ERR_FAIL_NULL_V(multimesh, RID()); + return multimesh->buffer; +} + Vector<float> MeshStorage::_multimesh_get_buffer(RID p_multimesh) const { MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh); ERR_FAIL_NULL_V(multimesh, Vector<float>()); diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h index e70b7568e0..584583eb6d 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h @@ -653,6 +653,7 @@ public: virtual Color _multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const override; virtual void _multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) override; + virtual RID _multimesh_get_buffer_rd_rid(RID p_multimesh) const override; virtual Vector<float> _multimesh_get_buffer(RID p_multimesh) const override; virtual void _multimesh_set_visible_instances(RID p_multimesh, int p_visible) override; diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 2e4e29d174..30f5e788bf 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -3019,7 +3019,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul cull_data.cull->lock.lock(); RSG::particles_storage->particles_request_process(idata.base_rid); cull_data.cull->lock.unlock(); - RSG::particles_storage->particles_set_view_axis(idata.base_rid, -cull_data.cam_transform.basis.get_column(2).normalized(), cull_data.cam_transform.basis.get_column(1).normalized()); + + RS::get_singleton()->call_on_render_thread(callable_mp_static(&RendererSceneCull::_scene_particles_set_view_axis).bind(idata.base_rid, -cull_data.cam_transform.basis.get_column(2).normalized(), cull_data.cam_transform.basis.get_column(1).normalized())); //particles visible? request redraw RenderingServerDefault::redraw_request(); } @@ -3194,6 +3195,10 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul } } +void RendererSceneCull::_scene_particles_set_view_axis(RID p_particles, const Vector3 &p_axis, const Vector3 &p_up_axis) { + RSG::particles_storage->particles_set_view_axis(p_particles, p_axis, p_up_axis); +} + void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_camera_data, const Ref<RenderSceneBuffers> &p_render_buffers, RID p_environment, RID p_force_camera_attributes, RID p_compositor, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, bool p_using_shadows, RenderingMethod::RenderInfo *r_render_info) { Instance *render_reflection_probe = instance_owner.get_or_null(p_reflection_probe); //if null, not rendering to it diff --git a/servers/rendering/renderer_scene_cull.h b/servers/rendering/renderer_scene_cull.h index 36cf5cb4c3..e58500c7b0 100644 --- a/servers/rendering/renderer_scene_cull.h +++ b/servers/rendering/renderer_scene_cull.h @@ -1186,9 +1186,11 @@ public: void _scene_cull_threaded(uint32_t p_thread, CullData *cull_data); void _scene_cull(CullData &cull_data, InstanceCullResult &cull_result, uint64_t p_from, uint64_t p_to); + static void _scene_particles_set_view_axis(RID p_particles, const Vector3 &p_axis, const Vector3 &p_up_axis); _FORCE_INLINE_ bool _visibility_parent_check(const CullData &p_cull_data, const InstanceData &p_instance_data); bool _render_reflection_probe_step(Instance *p_instance, int p_step); + void _render_scene(const RendererSceneRender::CameraData *p_camera_data, const Ref<RenderSceneBuffers> &p_render_buffers, RID p_environment, RID p_force_camera_attributes, RID p_compositor, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, bool p_using_shadows = true, RenderInfo *r_render_info = nullptr); void render_empty_scene(const Ref<RenderSceneBuffers> &p_render_buffers, RID p_scenario, RID p_shadow_atlas); diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index 8c9942ad76..ff5f908984 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -405,6 +405,7 @@ public: FUNC2RC(Color, multimesh_instance_get_custom_data, RID, int) FUNC2(multimesh_set_buffer, RID, const Vector<float> &) + FUNC1RC(RID, multimesh_get_buffer_rd_rid, RID) FUNC1RC(Vector<float>, multimesh_get_buffer, RID) FUNC3(multimesh_set_buffer_interpolated, RID, const Vector<float> &, const Vector<float> &) diff --git a/servers/rendering/storage/mesh_storage.cpp b/servers/rendering/storage/mesh_storage.cpp index 0f8c586c5a..b0136fb1f2 100644 --- a/servers/rendering/storage/mesh_storage.cpp +++ b/servers/rendering/storage/mesh_storage.cpp @@ -225,6 +225,10 @@ void RendererMeshStorage::multimesh_set_buffer(RID p_multimesh, const Vector<flo _multimesh_set_buffer(p_multimesh, p_buffer); } +RID RendererMeshStorage::multimesh_get_buffer_rd_rid(RID p_multimesh) const { + return _multimesh_get_buffer_rd_rid(p_multimesh); +} + Vector<float> RendererMeshStorage::multimesh_get_buffer(RID p_multimesh) const { return _multimesh_get_buffer(p_multimesh); } diff --git a/servers/rendering/storage/mesh_storage.h b/servers/rendering/storage/mesh_storage.h index 8f9ca40f61..5ea235c904 100644 --- a/servers/rendering/storage/mesh_storage.h +++ b/servers/rendering/storage/mesh_storage.h @@ -143,6 +143,7 @@ public: virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const; virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer); + virtual RID multimesh_get_buffer_rd_rid(RID p_multimesh) const; virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const; virtual void multimesh_set_buffer_interpolated(RID p_multimesh, const Vector<float> &p_buffer, const Vector<float> &p_buffer_prev); @@ -180,6 +181,7 @@ public: virtual Color _multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0; virtual void _multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) = 0; + virtual RID _multimesh_get_buffer_rd_rid(RID p_multimesh) const = 0; virtual Vector<float> _multimesh_get_buffer(RID p_multimesh) const = 0; virtual void _multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0; diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 725ef4d637..2460c56a2b 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -2454,6 +2454,7 @@ void RenderingServer::_bind_methods() { ClassDB::bind_method(D_METHOD("multimesh_set_visible_instances", "multimesh", "visible"), &RenderingServer::multimesh_set_visible_instances); ClassDB::bind_method(D_METHOD("multimesh_get_visible_instances", "multimesh"), &RenderingServer::multimesh_get_visible_instances); ClassDB::bind_method(D_METHOD("multimesh_set_buffer", "multimesh", "buffer"), &RenderingServer::multimesh_set_buffer); + ClassDB::bind_method(D_METHOD("multimesh_get_buffer_rd_rid", "multimesh"), &RenderingServer::multimesh_get_buffer_rd_rid); ClassDB::bind_method(D_METHOD("multimesh_get_buffer", "multimesh"), &RenderingServer::multimesh_get_buffer); ClassDB::bind_method(D_METHOD("multimesh_set_buffer_interpolated", "multimesh", "buffer", "buffer_previous"), &RenderingServer::multimesh_set_buffer_interpolated); diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 9e72c3c2e1..d47cb0b63c 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -477,6 +477,7 @@ public: virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0; virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) = 0; + virtual RID multimesh_get_buffer_rd_rid(RID p_multimesh) const = 0; virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const = 0; // Interpolation. |