You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Rewrote large part of rendering, omni and spot shadows now work.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user