diff options
author | Marius Hanl <mariushanl@web.de> | 2022-07-12 08:43:01 +0100 |
---|---|---|
committer | Marius Hanl <mariushanl@web.de> | 2023-01-31 20:04:11 +0100 |
commit | a59819630dcdb6dc9680b273d8a77267ea660e96 (patch) | |
tree | 27b8fc4d8711e98ee1038e3cd5a2ef659c01f1ca /servers/rendering/renderer_rd/storage_rd | |
parent | e93266b9ff359c98e9f8e2a550e16ad77490fc4d (diff) |
Replace Extents with Size in VoxelGI, ReflectionProbe, FogVolume, Decal and GPUParticles*3D
- Extents are replaced by Size (Size is Extents * 2)
- The UI text displays 'Size'
- Snapping is adjusted to work with Size
- _set and _get handle extents for compatibility
Co-authored-by: ator-dev <dominic.codedeveloper@gmail.com>
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd')
4 files changed, 19 insertions, 19 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp index 33e35a7a64..96bed459a0 100644 --- a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp @@ -1064,14 +1064,14 @@ void LightStorage::reflection_probe_set_max_distance(RID p_probe, float p_distan reflection_probe->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_REFLECTION_PROBE); } -void LightStorage::reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) { +void LightStorage::reflection_probe_set_size(RID p_probe, const Vector3 &p_size) { ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_probe); ERR_FAIL_COND(!reflection_probe); - if (reflection_probe->extents == p_extents) { + if (reflection_probe->size == p_size) { return; } - reflection_probe->extents = p_extents; + reflection_probe->size = p_size; reflection_probe->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_REFLECTION_PROBE); } @@ -1143,8 +1143,8 @@ AABB LightStorage::reflection_probe_get_aabb(RID p_probe) const { ERR_FAIL_COND_V(!reflection_probe, AABB()); AABB aabb; - aabb.position = -reflection_probe->extents; - aabb.size = reflection_probe->extents * 2.0; + aabb.position = -reflection_probe->size / 2; + aabb.size = reflection_probe->size; return aabb; } @@ -1163,11 +1163,11 @@ uint32_t LightStorage::reflection_probe_get_cull_mask(RID p_probe) const { return reflection_probe->cull_mask; } -Vector3 LightStorage::reflection_probe_get_extents(RID p_probe) const { +Vector3 LightStorage::reflection_probe_get_size(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_probe); ERR_FAIL_COND_V(!reflection_probe, Vector3()); - return reflection_probe->extents; + return reflection_probe->size; } Vector3 LightStorage::reflection_probe_get_origin_offset(RID p_probe) const { @@ -1668,7 +1668,7 @@ void LightStorage::update_reflection_probe_buffer(RenderDataRD *p_render_data, c ReflectionData &reflection_ubo = reflections[i]; - Vector3 extents = probe->extents; + Vector3 extents = probe->size / 2; rpi->cull_mask = probe->cull_mask; diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.h b/servers/rendering/renderer_rd/storage_rd/light_storage.h index d359219128..68f439ddef 100644 --- a/servers/rendering/renderer_rd/storage_rd/light_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/light_storage.h @@ -226,7 +226,7 @@ private: Color ambient_color; float ambient_color_energy = 1.0; float max_distance = 0; - Vector3 extents = Vector3(10, 10, 10); + Vector3 size = Vector3(20, 20, 20); Vector3 origin_offset; bool interior = false; bool box_projection = false; @@ -791,7 +791,7 @@ public: virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) override; virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) override; virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) override; - virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) override; + virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) override; virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) override; virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) override; virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) override; @@ -805,7 +805,7 @@ public: virtual AABB reflection_probe_get_aabb(RID p_probe) const override; virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const override; virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const override; - virtual Vector3 reflection_probe_get_extents(RID p_probe) const override; + virtual Vector3 reflection_probe_get_size(RID p_probe) const override; virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const override; virtual float reflection_probe_get_origin_max_distance(RID p_probe) const override; virtual float reflection_probe_get_mesh_lod_threshold(RID p_probe) const override; diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp index 2eaa7824fb..5d845ce510 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp @@ -1853,10 +1853,10 @@ void TextureStorage::decal_free(RID p_rid) { decal_owner.free(p_rid); } -void TextureStorage::decal_set_extents(RID p_decal, const Vector3 &p_extents) { +void TextureStorage::decal_set_size(RID p_decal, const Vector3 &p_size) { Decal *decal = decal_owner.get_or_null(p_decal); ERR_FAIL_COND(!decal); - decal->extents = p_extents; + decal->size = p_size; decal->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB); } @@ -1949,7 +1949,7 @@ AABB TextureStorage::decal_get_aabb(RID p_decal) const { Decal *decal = decal_owner.get_or_null(p_decal); ERR_FAIL_COND_V(!decal, AABB()); - return AABB(-decal->extents, decal->extents * 2.0); + return AABB(-decal->size / 2, decal->size); } Dependency *TextureStorage::decal_get_dependency(RID p_decal) { @@ -2312,7 +2312,7 @@ void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const DecalData &dd = decals[i]; - Vector3 decal_extents = decal->extents; + Vector3 decal_extents = decal->size / 2; Transform3D scale_xform; scale_xform.basis.scale(decal_extents); diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.h b/servers/rendering/renderer_rd/storage_rd/texture_storage.h index ea0df0b459..aeab3bf3cb 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.h +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.h @@ -235,7 +235,7 @@ private: } decal_atlas; struct Decal { - Vector3 extents = Vector3(1, 1, 1); + Vector3 size = Vector3(2, 2, 2); RID textures[RS::DECAL_TEXTURE_MAX]; float emission_energy = 1.0; float albedo_mix = 1.0; @@ -561,7 +561,7 @@ public: virtual void decal_initialize(RID p_decal) override; virtual void decal_free(RID p_rid) override; - virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) override; + virtual void decal_set_size(RID p_decal, const Vector3 &p_size) override; virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override; virtual void decal_set_emission_energy(RID p_decal, float p_energy) override; virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override; @@ -577,9 +577,9 @@ public: virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override; virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override; - _FORCE_INLINE_ Vector3 decal_get_extents(RID p_decal) { + _FORCE_INLINE_ Vector3 decal_get_size(RID p_decal) { const Decal *decal = decal_owner.get_or_null(p_decal); - return decal->extents; + return decal->size; } _FORCE_INLINE_ RID decal_get_texture(RID p_decal, RS::DecalTexture p_texture) { |