Fix GIProbe light visibility
- Fix https://github.com/godotengine/godot/issues/10535
This commit is contained in:
parent
b204683640
commit
4501a30ce9
2 changed files with 8 additions and 3 deletions
|
@ -2348,7 +2348,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
|
||||||
RID rid = E->key();
|
RID rid = E->key();
|
||||||
const InstanceGIProbeData::LightCache &lc = E->get();
|
const InstanceGIProbeData::LightCache &lc = E->get();
|
||||||
|
|
||||||
if (!probe_data->dynamic.light_cache_changes.has(rid) || !(probe_data->dynamic.light_cache_changes[rid] == lc)) {
|
if ((!probe_data->dynamic.light_cache_changes.has(rid) || !(probe_data->dynamic.light_cache_changes[rid] == lc)) && lc.visible) {
|
||||||
//erase light data
|
//erase light data
|
||||||
|
|
||||||
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, -1);
|
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, -1);
|
||||||
|
@ -2361,7 +2361,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
|
||||||
RID rid = E->key();
|
RID rid = E->key();
|
||||||
const InstanceGIProbeData::LightCache &lc = E->get();
|
const InstanceGIProbeData::LightCache &lc = E->get();
|
||||||
|
|
||||||
if (!probe_data->dynamic.light_cache.has(rid) || !(probe_data->dynamic.light_cache[rid] == lc)) {
|
if ((!probe_data->dynamic.light_cache.has(rid) || !(probe_data->dynamic.light_cache[rid] == lc)) && lc.visible) {
|
||||||
//add light data
|
//add light data
|
||||||
|
|
||||||
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, 1);
|
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, 1);
|
||||||
|
@ -2568,6 +2568,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
||||||
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
|
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
|
||||||
lc.spot_attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
|
lc.spot_attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
|
||||||
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
||||||
|
lc.visible = E->get()->visible;
|
||||||
|
|
||||||
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
|
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
|
||||||
all_equal = false;
|
all_equal = false;
|
||||||
|
@ -2587,6 +2588,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
||||||
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
|
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
|
||||||
lc.spot_attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
|
lc.spot_attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
|
||||||
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
||||||
|
lc.visible = E->get()->visible;
|
||||||
|
|
||||||
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
|
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
|
||||||
all_equal = false;
|
all_equal = false;
|
||||||
|
|
|
@ -359,6 +359,7 @@ public:
|
||||||
float attenuation;
|
float attenuation;
|
||||||
float spot_angle;
|
float spot_angle;
|
||||||
float spot_attenuation;
|
float spot_attenuation;
|
||||||
|
bool visible;
|
||||||
|
|
||||||
bool operator==(const LightCache &p_cache) {
|
bool operator==(const LightCache &p_cache) {
|
||||||
|
|
||||||
|
@ -369,7 +370,8 @@ public:
|
||||||
radius == p_cache.radius &&
|
radius == p_cache.radius &&
|
||||||
attenuation == p_cache.attenuation &&
|
attenuation == p_cache.attenuation &&
|
||||||
spot_angle == p_cache.spot_angle &&
|
spot_angle == p_cache.spot_angle &&
|
||||||
spot_attenuation == p_cache.spot_attenuation);
|
spot_attenuation == p_cache.spot_attenuation &&
|
||||||
|
visible == p_cache.visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
LightCache() {
|
LightCache() {
|
||||||
|
@ -380,6 +382,7 @@ public:
|
||||||
attenuation = 1.0;
|
attenuation = 1.0;
|
||||||
spot_angle = 1.0;
|
spot_angle = 1.0;
|
||||||
spot_attenuation = 1.0;
|
spot_attenuation = 1.0;
|
||||||
|
visible = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue