diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-09-06 22:51:27 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-11 12:01:18 +0100 |
commit | 920db604d26e2e82b6289807ad8a0607b310eef6 (patch) | |
tree | eedd704c8df67b4f7931bd2f955a8ce6834ac3dd /servers/visual/visual_server_scene.cpp | |
parent | 1d871f6226c2a82415291d58f7e91be60e94f203 (diff) |
Rewrote large part of rendering, omni and spot shadows now work.
Diffstat (limited to 'servers/visual/visual_server_scene.cpp')
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 59 |
1 files changed, 8 insertions, 51 deletions
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index ae95fe386d..d060043b40 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -268,7 +268,6 @@ RID VisualServerScene::scenario_create() { VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 1, 4); VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 2, 4); VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 3, 8); - scenario->reflection_atlas = VSG::scene_render->reflection_atlas_create(); return scenario_rid; } @@ -294,14 +293,6 @@ void VisualServerScene::scenario_set_fallback_environment(RID p_scenario, RID p_ scenario->fallback_environment = p_environment; } -void VisualServerScene::scenario_set_reflection_atlas_size(RID p_scenario, int p_size, int p_subdiv) { - - Scenario *scenario = scenario_owner.getornull(p_scenario); - ERR_FAIL_COND(!scenario); - VSG::scene_render->reflection_atlas_set_size(scenario->reflection_atlas, p_size); - VSG::scene_render->reflection_atlas_set_subdivision(scenario->reflection_atlas, p_subdiv); -} - /* INSTANCING API */ void VisualServerScene::_instance_queue_update(Instance *p_instance, bool p_update_aabb, bool p_update_dependencies) { @@ -360,11 +351,6 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) { instance->octree_id = 0; } - if (instance->custom_data) { - VSG::scene_render->instance_free_custom_data(instance); - instance->custom_data = nullptr; - } - switch (instance->base_type) { case VS::INSTANCE_LIGHT: { @@ -494,8 +480,6 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) { //forcefully update the dependency now, so if for some reason it gets removed, we can immediately clear it VSG::storage->base_update_dependency(p_base, instance); - - VSG::scene_render->instance_create_custom_data(instance); } _instance_queue_update(instance, true, true); @@ -527,8 +511,6 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario) { } break; case VS::INSTANCE_REFLECTION_PROBE: { - InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(instance->base_data); - VSG::scene_render->reflection_probe_release_atlas_index(reflection_probe->instance); } break; case VS::INSTANCE_GI_PROBE: { @@ -710,10 +692,6 @@ void VisualServerScene::instance_set_use_lightmap(RID p_instance, RID p_lightmap lightmap_capture->users.insert(instance); instance->lightmap = p_lightmap; } - - if (instance->custom_data) { - VSG::scene_render->instance_custom_data_update_lightmap(instance); - } } void VisualServerScene::instance_set_custom_aabb(RID p_instance, AABB p_aabb) { @@ -943,10 +921,6 @@ void VisualServerScene::_update_instance(Instance *p_instance) { p_instance->transformed_aabb = new_aabb; - if (p_instance->custom_data) { - VSG::scene_render->instance_custom_data_update_transform(p_instance); - } - if (!p_instance->scenario) { return; @@ -1614,12 +1588,12 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons //using this one ensures that raster deferred will have it static const Vector3 view_normals[6] = { - Vector3(-1, 0, 0), Vector3(+1, 0, 0), + Vector3(-1, 0, 0), Vector3(0, -1, 0), Vector3(0, +1, 0), - Vector3(0, 0, -1), - Vector3(0, 0, +1) + Vector3(0, 0, +1), + Vector3(0, 0, -1) }; static const Vector3 view_up[6] = { Vector3(0, -1, 0), @@ -1920,10 +1894,8 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca reflection_probe->reflection_dirty = false; } - if (VSG::scene_render->reflection_probe_instance_has_reflection(reflection_probe->instance)) { - reflection_probe_instance_cull_result[reflection_probe_cull_count] = reflection_probe->instance; - reflection_probe_cull_count++; - } + reflection_probe_instance_cull_result[reflection_probe_cull_count] = reflection_probe->instance; + reflection_probe_cull_count++; } } } @@ -1970,10 +1942,6 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca } geom->lighting_dirty = false; - - if (ins->custom_data) { - VSG::scene_render->instance_custom_data_update_lights(ins); - } } if (geom->reflection_dirty) { @@ -1989,10 +1957,6 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca } geom->reflection_dirty = false; - - if (ins->custom_data) { - VSG::scene_render->instance_custom_data_update_reflection_probes(ins); - } } if (geom->gi_probes_dirty) { @@ -2008,10 +1972,6 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca } geom->gi_probes_dirty = false; - - if (ins->custom_data) { - VSG::scene_render->instance_custom_data_update_gi_probes(ins); - } } ins->depth = near_plane.distance_to(ins->transform.origin); @@ -2188,7 +2148,7 @@ void VisualServerScene::_render_scene(RID p_render_buffers, const Transform p_ca /* PROCESS GEOMETRY AND DRAW SCENE */ - VSG::scene_render->render_scene(p_render_buffers, p_cam_transform, p_cam_projection, p_cam_orthogonal, (RasterizerScene::InstanceBase **)instance_cull_result, instance_cull_count, light_instance_cull_result, light_cull_count + directional_light_count, reflection_probe_instance_cull_result, reflection_probe_cull_count, environment, p_shadow_atlas, scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass); + VSG::scene_render->render_scene(p_render_buffers, p_cam_transform, p_cam_projection, p_cam_orthogonal, (RasterizerScene::InstanceBase **)instance_cull_result, instance_cull_count, light_instance_cull_result, light_cull_count + directional_light_count, reflection_probe_instance_cull_result, reflection_probe_cull_count, environment, p_shadow_atlas, p_reflection_probe, p_reflection_probe_pass); } void VisualServerScene::render_empty_scene(RID p_render_buffers, RID p_scenario, RID p_shadow_atlas) { @@ -2202,7 +2162,7 @@ void VisualServerScene::render_empty_scene(RID p_render_buffers, RID p_scenario, environment = scenario->environment; else environment = scenario->fallback_environment; - VSG::scene_render->render_scene(p_render_buffers, Transform(), CameraMatrix(), true, NULL, 0, NULL, 0, NULL, 0, environment, p_shadow_atlas, scenario->reflection_atlas, RID(), 0); + VSG::scene_render->render_scene(p_render_buffers, Transform(), CameraMatrix(), true, NULL, 0, NULL, 0, NULL, 0, environment, p_shadow_atlas, RID(), 0); #endif } @@ -2216,9 +2176,7 @@ bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int if (p_step == 0) { - if (!VSG::scene_render->reflection_probe_instance_begin_render(reflection_probe->instance, scenario->reflection_atlas)) { - return true; //sorry, all full :( - } + VSG::scene_render->reflection_probe_instance_begin_render(reflection_probe->instance); } if (p_step >= 0 && p_step < 6) { @@ -3507,7 +3465,6 @@ bool VisualServerScene::free(RID p_rid) { instance_set_scenario(scenario->instances.first()->self()->self, RID()); } VSG::scene_render->free(scenario->reflection_probe_shadow_atlas); - VSG::scene_render->free(scenario->reflection_atlas); scenario_owner.free(p_rid); memdelete(scenario); |