mirror of
https://github.com/godotengine/godot
synced 2024-09-05 17:09:44 +00:00
Merge pull request #25670 from aqnuep/bake_mode_affect_gi_prove
Disable GI probe capturing lights with bake mode disabled
This commit is contained in:
commit
dd2cd06165
|
@ -2003,6 +2003,17 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="light_set_use_gi">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="light" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="enabled" type="bool">
|
||||
</argument>
|
||||
<description>
|
||||
Sets whether GI probes capture light information from this light.
|
||||
</description>
|
||||
</method>
|
||||
<method name="light_set_color">
|
||||
<return type="void">
|
||||
</return>
|
||||
|
|
|
@ -484,6 +484,7 @@ public:
|
|||
void light_set_negative(RID p_light, bool p_enable) {}
|
||||
void light_set_cull_mask(RID p_light, uint32_t p_mask) {}
|
||||
void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {}
|
||||
void light_set_use_gi(RID p_light, bool p_enabled) {}
|
||||
|
||||
void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {}
|
||||
void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {}
|
||||
|
@ -503,6 +504,7 @@ public:
|
|||
AABB light_get_aabb(RID p_light) const { return AABB(); }
|
||||
float light_get_param(RID p_light, VS::LightParam p_param) { return 0.0; }
|
||||
Color light_get_color(RID p_light) { return Color(); }
|
||||
bool light_get_use_gi(RID p_light) { return false; }
|
||||
uint64_t light_get_version(RID p_light) const { return 0; }
|
||||
|
||||
/* PROBE API */
|
||||
|
|
|
@ -3712,6 +3712,7 @@ RID RasterizerStorageGLES2::light_create(VS::LightType p_type) {
|
|||
light->directional_blend_splits = false;
|
||||
light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
|
||||
light->reverse_cull = false;
|
||||
light->use_gi = true;
|
||||
light->version = 0;
|
||||
|
||||
return light_owner.make_rid(light);
|
||||
|
@ -3799,6 +3800,16 @@ void RasterizerStorageGLES2::light_set_reverse_cull_face_mode(RID p_light, bool
|
|||
light->instance_change_notify(true, false);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::light_set_use_gi(RID p_light, bool p_enabled) {
|
||||
Light *light = light_owner.getornull(p_light);
|
||||
ERR_FAIL_COND(!light);
|
||||
|
||||
light->use_gi = p_enabled;
|
||||
|
||||
light->version++;
|
||||
light->instance_change_notify(true, false);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
|
||||
Light *light = light_owner.getornull(p_light);
|
||||
ERR_FAIL_COND(!light);
|
||||
|
@ -3894,6 +3905,13 @@ Color RasterizerStorageGLES2::light_get_color(RID p_light) {
|
|||
return light->color;
|
||||
}
|
||||
|
||||
bool RasterizerStorageGLES2::light_get_use_gi(RID p_light) {
|
||||
Light *light = light_owner.getornull(p_light);
|
||||
ERR_FAIL_COND_V(!light, false);
|
||||
|
||||
return light->use_gi;
|
||||
}
|
||||
|
||||
bool RasterizerStorageGLES2::light_has_shadow(RID p_light) const {
|
||||
Light *light = light_owner.getornull(p_light);
|
||||
ERR_FAIL_COND_V(!light, false);
|
||||
|
|
|
@ -910,6 +910,7 @@ public:
|
|||
bool shadow;
|
||||
bool negative;
|
||||
bool reverse_cull;
|
||||
bool use_gi;
|
||||
|
||||
uint32_t cull_mask;
|
||||
|
||||
|
@ -936,6 +937,7 @@ public:
|
|||
virtual void light_set_negative(RID p_light, bool p_enable);
|
||||
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
|
||||
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
|
||||
virtual void light_set_use_gi(RID p_light, bool p_enabled);
|
||||
|
||||
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
|
||||
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
|
||||
|
@ -955,6 +957,7 @@ public:
|
|||
virtual VS::LightType light_get_type(RID p_light) const;
|
||||
virtual float light_get_param(RID p_light, VS::LightParam p_param);
|
||||
virtual Color light_get_color(RID p_light);
|
||||
virtual bool light_get_use_gi(RID p_light);
|
||||
|
||||
virtual AABB light_get_aabb(RID p_light) const;
|
||||
virtual uint64_t light_get_version(RID p_light) const;
|
||||
|
|
|
@ -5219,6 +5219,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
|
|||
light->directional_blend_splits = false;
|
||||
light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
|
||||
light->reverse_cull = false;
|
||||
light->use_gi = true;
|
||||
light->version = 0;
|
||||
|
||||
return light_owner.make_rid(light);
|
||||
|
@ -5310,6 +5311,15 @@ void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool
|
|||
light->instance_change_notify(true, false);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES3::light_set_use_gi(RID p_light, bool p_enabled) {
|
||||
Light *light = light_owner.getornull(p_light);
|
||||
ERR_FAIL_COND(!light);
|
||||
|
||||
light->use_gi = p_enabled;
|
||||
|
||||
light->version++;
|
||||
light->instance_change_notify(true, false);
|
||||
}
|
||||
void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
|
||||
|
||||
Light *light = light_owner.getornull(p_light);
|
||||
|
@ -5415,6 +5425,13 @@ Color RasterizerStorageGLES3::light_get_color(RID p_light) {
|
|||
return light->color;
|
||||
}
|
||||
|
||||
bool RasterizerStorageGLES3::light_get_use_gi(RID p_light) {
|
||||
Light *light = light_owner.getornull(p_light);
|
||||
ERR_FAIL_COND_V(!light, false);
|
||||
|
||||
return light->use_gi;
|
||||
}
|
||||
|
||||
bool RasterizerStorageGLES3::light_has_shadow(RID p_light) const {
|
||||
|
||||
const Light *light = light_owner.getornull(p_light);
|
||||
|
|
|
@ -930,6 +930,7 @@ public:
|
|||
bool shadow;
|
||||
bool negative;
|
||||
bool reverse_cull;
|
||||
bool use_gi;
|
||||
uint32_t cull_mask;
|
||||
VS::LightOmniShadowMode omni_shadow_mode;
|
||||
VS::LightOmniShadowDetail omni_shadow_detail;
|
||||
|
@ -951,6 +952,7 @@ public:
|
|||
virtual void light_set_negative(RID p_light, bool p_enable);
|
||||
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
|
||||
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
|
||||
virtual void light_set_use_gi(RID p_light, bool p_enabled);
|
||||
|
||||
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
|
||||
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
|
||||
|
@ -970,6 +972,7 @@ public:
|
|||
virtual VS::LightType light_get_type(RID p_light) const;
|
||||
virtual float light_get_param(RID p_light, VS::LightParam p_param);
|
||||
virtual Color light_get_color(RID p_light);
|
||||
virtual bool light_get_use_gi(RID p_light);
|
||||
|
||||
virtual AABB light_get_aabb(RID p_light) const;
|
||||
virtual uint64_t light_get_version(RID p_light) const;
|
||||
|
|
|
@ -152,6 +152,7 @@ PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const {
|
|||
|
||||
void Light::set_bake_mode(BakeMode p_mode) {
|
||||
bake_mode = p_mode;
|
||||
VS::get_singleton()->light_set_use_gi(light, p_mode != BAKE_DISABLED);
|
||||
}
|
||||
|
||||
Light::BakeMode Light::get_bake_mode() const {
|
||||
|
|
|
@ -373,6 +373,7 @@ public:
|
|||
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
|
||||
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
|
||||
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
|
||||
virtual void light_set_use_gi(RID p_light, bool p_enable) = 0;
|
||||
|
||||
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) = 0;
|
||||
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) = 0;
|
||||
|
@ -392,6 +393,7 @@ public:
|
|||
virtual AABB light_get_aabb(RID p_light) const = 0;
|
||||
virtual float light_get_param(RID p_light, VS::LightParam p_param) = 0;
|
||||
virtual Color light_get_color(RID p_light) = 0;
|
||||
virtual bool light_get_use_gi(RID p_light) = 0;
|
||||
virtual uint64_t light_get_version(RID p_light) const = 0;
|
||||
|
||||
/* PROBE API */
|
||||
|
|
|
@ -312,6 +312,7 @@ public:
|
|||
BIND2(light_set_negative, RID, bool)
|
||||
BIND2(light_set_cull_mask, RID, uint32_t)
|
||||
BIND2(light_set_reverse_cull_face_mode, RID, bool)
|
||||
BIND2(light_set_use_gi, RID, bool)
|
||||
|
||||
BIND2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
|
||||
BIND2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
|
||||
|
|
|
@ -3117,6 +3117,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
|||
|
||||
for (List<Instance *>::Element *E = p_gi_probe->scenario->directional_lights.front(); E; E = E->next()) {
|
||||
|
||||
if (!VSG::storage->light_get_use_gi(E->get()->base))
|
||||
continue;
|
||||
|
||||
InstanceGIProbeData::LightCache lc;
|
||||
lc.type = VSG::storage->light_get_type(E->get()->base);
|
||||
lc.color = VSG::storage->light_get_color(E->get()->base);
|
||||
|
@ -3137,6 +3140,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
|||
|
||||
for (Set<Instance *>::Element *E = probe_data->lights.front(); E; E = E->next()) {
|
||||
|
||||
if (!VSG::storage->light_get_use_gi(E->get()->base))
|
||||
continue;
|
||||
|
||||
InstanceGIProbeData::LightCache lc;
|
||||
lc.type = VSG::storage->light_get_type(E->get()->base);
|
||||
lc.color = VSG::storage->light_get_color(E->get()->base);
|
||||
|
|
|
@ -248,6 +248,7 @@ public:
|
|||
FUNC2(light_set_negative, RID, bool)
|
||||
FUNC2(light_set_cull_mask, RID, uint32_t)
|
||||
FUNC2(light_set_reverse_cull_face_mode, RID, bool)
|
||||
FUNC2(light_set_use_gi, RID, bool)
|
||||
|
||||
FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
|
||||
FUNC2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
|
||||
|
|
|
@ -1780,6 +1780,7 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("light_set_negative", "light", "enable"), &VisualServer::light_set_negative);
|
||||
ClassDB::bind_method(D_METHOD("light_set_cull_mask", "light", "mask"), &VisualServer::light_set_cull_mask);
|
||||
ClassDB::bind_method(D_METHOD("light_set_reverse_cull_face_mode", "light", "enabled"), &VisualServer::light_set_reverse_cull_face_mode);
|
||||
ClassDB::bind_method(D_METHOD("light_set_use_gi", "light", "enabled"), &VisualServer::light_set_use_gi);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("light_omni_set_shadow_mode", "light", "mode"), &VisualServer::light_omni_set_shadow_mode);
|
||||
ClassDB::bind_method(D_METHOD("light_omni_set_shadow_detail", "light", "detail"), &VisualServer::light_omni_set_shadow_detail);
|
||||
|
|
|
@ -435,6 +435,7 @@ public:
|
|||
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
|
||||
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
|
||||
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
|
||||
virtual void light_set_use_gi(RID p_light, bool p_enable) = 0;
|
||||
|
||||
// omni light
|
||||
enum LightOmniShadowMode {
|
||||
|
|
Loading…
Reference in a new issue