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>
This commit is contained in:
parent
e93266b9ff
commit
a59819630d
55 changed files with 573 additions and 371 deletions
|
@ -75,9 +75,6 @@
|
|||
<member name="emission_energy" type="float" setter="set_emission_energy" getter="get_emission_energy" default="1.0">
|
||||
Energy multiplier for the emission texture. This will make the decal emit light at a higher or lower intensity, independently of the albedo color. See also [member modulate].
|
||||
</member>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
|
||||
Sets the size of the [AABB] used by the decal. The AABB goes from [code]-extents[/code] to [code]extents[/code].
|
||||
</member>
|
||||
<member name="lower_fade" type="float" setter="set_lower_fade" getter="get_lower_fade" default="0.3">
|
||||
Sets the curve over which the decal will fade as the surface gets further from the center of the [AABB]. Only positive values are valid (negative values will be clamped to [code]0.0[/code]). See also [member upper_fade].
|
||||
</member>
|
||||
|
@ -88,6 +85,9 @@
|
|||
Fades the Decal if the angle between the Decal's [AABB] and the target surface becomes too large. A value of [code]0[/code] projects the Decal regardless of angle, a value of [code]1[/code] limits the Decal to surfaces that are nearly perpendicular.
|
||||
[b]Note:[/b] Setting [member normal_fade] to a value greater than [code]0.0[/code] has a small performance cost due to the added normal angle computations.
|
||||
</member>
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
|
||||
Sets the size of the [AABB] used by the decal. The AABB goes from [code]-size/2[/code] to [code]size/2[/code].
|
||||
</member>
|
||||
<member name="texture_albedo" type="Texture2D" setter="set_texture" getter="get_texture">
|
||||
[Texture2D] with the base [Color] of the Decal. Either this or the [member texture_emission] must be set for the Decal to be visible. Use the alpha channel like a mask to smoothly blend the edges of the decal with the underlying object.
|
||||
[b]Note:[/b] Unlike [BaseMaterial3D] whose filter mode can be adjusted on a per-material basis, the filter mode for [Decal] textures is set globally with [member ProjectSettings.rendering/textures/decals/filter].
|
||||
|
|
|
@ -11,16 +11,16 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
|
||||
The size of the [FogVolume] when [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
|
||||
[b]Note:[/b] Thin fog volumes may appear to flicker when the camera moves or rotates. This can be alleviated by increasing [member ProjectSettings.rendering/environment/volumetric_fog/volume_depth] (at a performance cost) or by decreasing [member Environment.volumetric_fog_length] (at no performance cost, but at the cost of lower fog range). Alternatively, the [FogVolume] can be made thicker and use a lower density in the [member material].
|
||||
[b]Note:[/b] If [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_CONE] or [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], the cone/cylinder will be adjusted to fit within the extents. Non-uniform scaling of cone/cylinder shapes via the [member extents] property is not supported, but you can scale the [FogVolume] node instead.
|
||||
</member>
|
||||
<member name="material" type="Material" setter="set_material" getter="get_material">
|
||||
The [Material] used by the [FogVolume]. Can be either a built-in [FogMaterial] or a custom [ShaderMaterial].
|
||||
</member>
|
||||
<member name="shape" type="int" setter="set_shape" getter="get_shape" enum="RenderingServer.FogVolumeShape" default="3">
|
||||
The shape of the [FogVolume]. This can be set to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD].
|
||||
</member>
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
|
||||
The size of the [FogVolume] when [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
|
||||
[b]Note:[/b] Thin fog volumes may appear to flicker when the camera moves or rotates. This can be alleviated by increasing [member ProjectSettings.rendering/environment/volumetric_fog/volume_depth] (at a performance cost) or by decreasing [member Environment.volumetric_fog_length] (at no performance cost, but at the cost of lower fog range). Alternatively, the [FogVolume] can be made thicker and use a lower density in the [member material].
|
||||
[b]Note:[/b] If [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_CONE] or [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], the cone/cylinder will be adjusted to fit within the size. Non-uniform scaling of cone/cylinder shapes via the [member size] property is not supported, but you can scale the [FogVolume] node instead.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
|
||||
The attractor box's extents in 3D units.
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
|
||||
The attractor box's size in 3D units.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
|
||||
The extents of the vector field box in 3D units.
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
|
||||
The size of the vector field box in 3D units.
|
||||
</member>
|
||||
<member name="texture" type="Texture3D" setter="set_texture" getter="get_texture">
|
||||
The 3D texture to be used. Values are linearly interpolated between the texture's pixels.
|
||||
[b]Note:[/b] To get better performance, the 3D texture's resolution should reflect the [member extents] of the attractor. Since particle attraction is usually low-frequency data, the texture can be kept at a low resolution such as 64×64×64.
|
||||
[b]Note:[/b] To get better performance, the 3D texture's resolution should reflect the [member size] of the attractor. Since particle attraction is usually low-frequency data, the texture can be kept at a low resolution such as 64×64×64.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
|
||||
The collision box's extents in 3D units.
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
|
||||
The collision box's size in 3D units.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
|
||||
The collision heightmap's extents in 3D units. To improve heightmap quality, [member extents] should be set as small as possible while covering the parts of the scene you need.
|
||||
</member>
|
||||
<member name="follow_camera_enabled" type="bool" setter="set_follow_camera_enabled" getter="is_follow_camera_enabled" default="false">
|
||||
If [code]true[/code], the [GPUParticlesCollisionHeightField3D] will follow the current camera in global space. The [GPUParticlesCollisionHeightField3D] does not need to be a child of the [Camera3D] node for this to work.
|
||||
Following the camera has a performance cost, as it will force the heightmap to update whenever the camera moves. Consider lowering [member resolution] to improve performance if [member follow_camera_enabled] is [code]true[/code].
|
||||
|
@ -23,6 +20,9 @@
|
|||
<member name="resolution" type="int" setter="set_resolution" getter="get_resolution" enum="GPUParticlesCollisionHeightField3D.Resolution" default="2">
|
||||
Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If [member update_mode] is [constant UPDATE_MODE_ALWAYS], consider using the lowest resolution possible.
|
||||
</member>
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
|
||||
The collision heightmap's size in 3D units. To improve heightmap quality, [member size] should be set as small as possible while covering the parts of the scene you need.
|
||||
</member>
|
||||
<member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="GPUParticlesCollisionHeightField3D.UpdateMode" default="0">
|
||||
The update policy to use for the generated heightmap.
|
||||
</member>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<description>
|
||||
Baked signed distance field 3D particle attractor affecting [GPUParticles3D] nodes.
|
||||
Signed distance fields (SDF) allow for efficiently representing approximate collision shapes for convex and concave objects of any shape. This is more flexible than [GPUParticlesCollisionHeightField3D], but it requires a baking step.
|
||||
[b]Baking:[/b] The signed distance field texture can be baked by selecting the [GPUParticlesCollisionSDF3D] node in the editor, then clicking [b]Bake SDF[/b] at the top of the 3D viewport. Any [i]visible[/i] [MeshInstance3D]s touching the [member extents] will be taken into account for baking, regardless of their [member GeometryInstance3D.gi_mode].
|
||||
[b]Baking:[/b] The signed distance field texture can be baked by selecting the [GPUParticlesCollisionSDF3D] node in the editor, then clicking [b]Bake SDF[/b] at the top of the 3D viewport. Any [i]visible[/i] [MeshInstance3D]s within the [member size] will be taken into account for baking, regardless of their [member GeometryInstance3D.gi_mode].
|
||||
[b]Note:[/b] Baking a [GPUParticlesCollisionSDF3D]'s [member texture] is only possible within the editor, as there is no bake method exposed for use in exported projects. However, it's still possible to load pre-baked [Texture3D]s into its [member texture] property in an exported project.
|
||||
[b]Note:[/b] [member ParticleProcessMaterial.collision_mode] must be [constant ParticleProcessMaterial.COLLISION_RIGID] or [constant ParticleProcessMaterial.COLLISION_HIDE_ON_CONTACT] on the [GPUParticles3D]'s process material for collision to work.
|
||||
[b]Note:[/b] Particle collision only affects [GPUParticles3D], not [CPUParticles3D].
|
||||
|
@ -34,12 +34,12 @@
|
|||
<member name="bake_mask" type="int" setter="set_bake_mask" getter="get_bake_mask" default="4294967295">
|
||||
The visual layers to account for when baking the particle collision SDF. Only [MeshInstance3D]s whose [member VisualInstance3D.layers] match with this [member bake_mask] will be included in the generated particle collision SDF. By default, all objects are taken into account for the particle collision SDF baking.
|
||||
</member>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
|
||||
The collision SDF's extents in 3D units. To improve SDF quality, the [member extents] should be set as small as possible while covering the parts of the scene you need.
|
||||
</member>
|
||||
<member name="resolution" type="int" setter="set_resolution" getter="get_resolution" enum="GPUParticlesCollisionSDF3D.Resolution" default="2">
|
||||
The bake resolution to use for the signed distance field [member texture]. The texture must be baked again for changes to the [member resolution] property to be effective. Higher resolutions have a greater performance cost and take more time to bake. Higher resolutions also result in larger baked textures, leading to increased VRAM and storage space requirements. To improve performance and reduce bake times, use the lowest resolution possible for the object you're representing the collision of.
|
||||
</member>
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)">
|
||||
The collision SDF's size in 3D units. To improve SDF quality, the [member size] should be set as small as possible while covering the parts of the scene you need.
|
||||
</member>
|
||||
<member name="texture" type="Texture3D" setter="set_texture" getter="get_texture">
|
||||
The 3D texture representing the signed distance field.
|
||||
</member>
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
</tutorials>
|
||||
<members>
|
||||
<member name="ambient_color" type="Color" setter="set_ambient_color" getter="get_ambient_color" default="Color(0, 0, 0, 1)">
|
||||
The custom ambient color to use within the [ReflectionProbe]'s [member extents]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
|
||||
The custom ambient color to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
|
||||
</member>
|
||||
<member name="ambient_color_energy" type="float" setter="set_ambient_color_energy" getter="get_ambient_color_energy" default="1.0">
|
||||
The custom ambient color energy to use within the [ReflectionProbe]'s [member extents]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
|
||||
The custom ambient color energy to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR].
|
||||
</member>
|
||||
<member name="ambient_mode" type="int" setter="set_ambient_mode" getter="get_ambient_mode" enum="ReflectionProbe.AmbientMode" default="1">
|
||||
The ambient color to use within the [ReflectionProbe]'s [member extents]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s [member extents]).
|
||||
The ambient color to use within the [ReflectionProbe]'s [member size]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s [member size]).
|
||||
</member>
|
||||
<member name="box_projection" type="bool" setter="set_enable_box_projection" getter="is_box_projection_enabled" default="false">
|
||||
If [code]true[/code], enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location.
|
||||
|
@ -31,10 +31,6 @@
|
|||
<member name="enable_shadows" type="bool" setter="set_enable_shadows" getter="are_shadows_enabled" default="false">
|
||||
If [code]true[/code], computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the [constant UPDATE_ALWAYS] [member update_mode].
|
||||
</member>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(10, 10, 10)">
|
||||
The size of the reflection probe. The larger the extents, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the extents only as large as you need them.
|
||||
[b]Note:[/b] To better fit areas that are not aligned to the grid, you can rotate the [ReflectionProbe] node.
|
||||
</member>
|
||||
<member name="intensity" type="float" setter="set_intensity" getter="get_intensity" default="1.0">
|
||||
Defines the reflection intensity. Intensity modulates the strength of the reflection.
|
||||
</member>
|
||||
|
@ -43,7 +39,7 @@
|
|||
</member>
|
||||
<member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="0.0">
|
||||
The maximum distance away from the [ReflectionProbe] an object can be before it is culled. Decrease this to improve performance, especially when using the [constant UPDATE_ALWAYS] [member update_mode].
|
||||
[b]Note:[/b] The maximum reflection distance is always at least equal to the [member extents]. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's [member extents] are already large.
|
||||
[b]Note:[/b] The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's [member size] is already large.
|
||||
</member>
|
||||
<member name="mesh_lod_threshold" type="float" setter="set_mesh_lod_threshold" getter="get_mesh_lod_threshold" default="1.0">
|
||||
The automatic LOD bias to use for meshes rendered within the [ReflectionProbe] (this is analog to [member Viewport.mesh_lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member mesh_lod_threshold] to improve performance at the cost of geometry detail, especially when using the [constant UPDATE_ALWAYS] [member update_mode].
|
||||
|
@ -52,6 +48,10 @@
|
|||
<member name="origin_offset" type="Vector3" setter="set_origin_offset" getter="get_origin_offset" default="Vector3(0, 0, 0)">
|
||||
Sets the origin offset to be used when this [ReflectionProbe] is in [member box_projection] mode. This can be set to a non-zero value to ensure a reflection fits a rectangle-shaped room, while reducing the number of objects that "get in the way" of the reflection.
|
||||
</member>
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(20, 20, 20)">
|
||||
The size of the reflection probe. The larger the size, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the size only as large as you need it.
|
||||
[b]Note:[/b] To better fit areas that are not aligned to the grid, you can rotate the [ReflectionProbe] node.
|
||||
</member>
|
||||
<member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="ReflectionProbe.UpdateMode" default="0">
|
||||
Sets how frequently the [ReflectionProbe] is updated. Can be [constant UPDATE_ONCE] or [constant UPDATE_ALWAYS].
|
||||
</member>
|
||||
|
@ -64,13 +64,13 @@
|
|||
Update the probe every frame. This provides better results for fast-moving dynamic objects (such as cars). However, it has a significant performance cost. Due to the cost, it's recommended to only use one ReflectionProbe with [constant UPDATE_ALWAYS] at most per scene. For all other use cases, use [constant UPDATE_ONCE].
|
||||
</constant>
|
||||
<constant name="AMBIENT_DISABLED" value="0" enum="AmbientMode">
|
||||
Do not apply any ambient lighting inside the [ReflectionProbe]'s [member extents].
|
||||
Do not apply any ambient lighting inside the [ReflectionProbe]'s [member size].
|
||||
</constant>
|
||||
<constant name="AMBIENT_ENVIRONMENT" value="1" enum="AmbientMode">
|
||||
Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s [member extents].
|
||||
Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s [member size].
|
||||
</constant>
|
||||
<constant name="AMBIENT_COLOR" value="2" enum="AmbientMode">
|
||||
Apply custom ambient lighting inside the [ReflectionProbe]'s [member extents]. See [member ambient_color] and [member ambient_color_energy].
|
||||
Apply custom ambient lighting inside the [ReflectionProbe]'s [member size]. See [member ambient_color] and [member ambient_color_energy].
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -877,13 +877,6 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="decal_set_extents">
|
||||
<return type="void" />
|
||||
<param index="0" name="decal" type="RID" />
|
||||
<param index="1" name="extents" type="Vector3" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="decal_set_fade">
|
||||
<return type="void" />
|
||||
<param index="0" name="decal" type="RID" />
|
||||
|
@ -906,6 +899,13 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="decal_set_size">
|
||||
<return type="void" />
|
||||
<param index="0" name="decal" type="RID" />
|
||||
<param index="1" name="size" type="Vector3" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="decal_set_texture">
|
||||
<return type="void" />
|
||||
<param index="0" name="decal" type="RID" />
|
||||
|
@ -1218,14 +1218,6 @@
|
|||
Creates a new fog volume and allocates an RID.
|
||||
</description>
|
||||
</method>
|
||||
<method name="fog_volume_set_extents">
|
||||
<return type="void" />
|
||||
<param index="0" name="fog_volume" type="RID" />
|
||||
<param index="1" name="extents" type="Vector3" />
|
||||
<description>
|
||||
Sets the size of the fog volume when shape is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
|
||||
</description>
|
||||
</method>
|
||||
<method name="fog_volume_set_material">
|
||||
<return type="void" />
|
||||
<param index="0" name="fog_volume" type="RID" />
|
||||
|
@ -1242,6 +1234,14 @@
|
|||
Sets the shape of the fog volume to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD].
|
||||
</description>
|
||||
</method>
|
||||
<method name="fog_volume_set_size">
|
||||
<return type="void" />
|
||||
<param index="0" name="fog_volume" type="RID" />
|
||||
<param index="1" name="size" type="Vector3" />
|
||||
<description>
|
||||
Sets the size of the fog volume when shape is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
|
||||
</description>
|
||||
</method>
|
||||
<method name="force_draw">
|
||||
<return type="void" />
|
||||
<param index="0" name="swap_buffers" type="bool" default="true" />
|
||||
|
@ -2655,14 +2655,6 @@
|
|||
If [code]true[/code], computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to [member ReflectionProbe.enable_shadows].
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_extents">
|
||||
<return type="void" />
|
||||
<param index="0" name="probe" type="RID" />
|
||||
<param index="1" name="extents" type="Vector3" />
|
||||
<description>
|
||||
Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.extents].
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_intensity">
|
||||
<return type="void" />
|
||||
<param index="0" name="probe" type="RID" />
|
||||
|
@ -2701,6 +2693,14 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_size">
|
||||
<return type="void" />
|
||||
<param index="0" name="probe" type="RID" />
|
||||
<param index="1" name="size" type="Vector3" />
|
||||
<description>
|
||||
Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.size].
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_update_mode">
|
||||
<return type="void" />
|
||||
<param index="0" name="probe" type="RID" />
|
||||
|
@ -4091,10 +4091,10 @@
|
|||
[FogVolume] will be shaped like an ellipsoid (stretched sphere).
|
||||
</constant>
|
||||
<constant name="FOG_VOLUME_SHAPE_CONE" value="1" enum="FogVolumeShape">
|
||||
[FogVolume] will be shaped like a cone pointing upwards (in local coordinates). The cone's angle is set automatically to fill the extents. The cone will be adjusted to fit within the extents. Rotate the [FogVolume] node to reorient the cone. Non-uniform scaling via extents is not supported (scale the [FogVolume] node instead).
|
||||
[FogVolume] will be shaped like a cone pointing upwards (in local coordinates). The cone's angle is set automatically to fill the size. The cone will be adjusted to fit within the size. Rotate the [FogVolume] node to reorient the cone. Non-uniform scaling via size is not supported (scale the [FogVolume] node instead).
|
||||
</constant>
|
||||
<constant name="FOG_VOLUME_SHAPE_CYLINDER" value="2" enum="FogVolumeShape">
|
||||
[FogVolume] will be shaped like an upright cylinder (in local coordinates). Rotate the [FogVolume] node to reorient the cylinder. The cylinder will be adjusted to fit within the extents. Non-uniform scaling via extents is not supported (scale the [FogVolume] node instead).
|
||||
[FogVolume] will be shaped like an upright cylinder (in local coordinates). Rotate the [FogVolume] node to reorient the cylinder. The cylinder will be adjusted to fit within the size. Non-uniform scaling via size is not supported (scale the [FogVolume] node instead).
|
||||
</constant>
|
||||
<constant name="FOG_VOLUME_SHAPE_BOX" value="3" enum="FogVolumeShape">
|
||||
[FogVolume] will be shaped like a box.
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
<member name="data" type="VoxelGIData" setter="set_probe_data" getter="get_probe_data">
|
||||
The [VoxelGIData] resource that holds the data for this [VoxelGI].
|
||||
</member>
|
||||
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(10, 10, 10)">
|
||||
The size of the area covered by the [VoxelGI]. If you make the extents larger without increasing the subdivisions with [member subdiv], the size of each cell will increase and result in lower detailed lighting.
|
||||
[b]Note:[/b] Extents are clamped to 1.0 unit or more on each axis.
|
||||
<member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(20, 20, 20)">
|
||||
The size of the area covered by the [VoxelGI]. If you make the size larger without increasing the subdivisions with [member subdiv], the size of each cell will increase and result in lower detailed lighting.
|
||||
[b]Note:[/b] Size is clamped to 1.0 unit or more on each axis.
|
||||
</member>
|
||||
<member name="subdiv" type="int" setter="set_subdiv" getter="get_subdiv" enum="VoxelGI.Subdiv" default="1">
|
||||
Number of times to subdivide the grid that the [VoxelGI] operates on. A higher number results in finer detail and thus higher visual quality, while lower numbers result in better performance.
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
<method name="get_bounds" qualifiers="const">
|
||||
<return type="AABB" />
|
||||
<description>
|
||||
Returns the bounds of the baked voxel data as an [AABB], which should match [member VoxelGI.extents] after being baked (which only contains the size as a [Vector3]).
|
||||
[b]Note:[/b] If the extents were modified without baking the VoxelGI data, then the value of [method get_bounds] and [member VoxelGI.extents] will not match.
|
||||
Returns the bounds of the baked voxel data as an [AABB], which should match [member VoxelGI.size] after being baked (which only contains the size as a [Vector3]).
|
||||
[b]Note:[/b] If the size was modified without baking the VoxelGI data, then the value of [method get_bounds] and [member VoxelGI.size] will not match.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_data_cells" qualifiers="const">
|
||||
|
|
|
@ -49,7 +49,7 @@ void Fog::fog_volume_free(RID p_rid) {
|
|||
void Fog::fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) {
|
||||
}
|
||||
|
||||
void Fog::fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) {
|
||||
void Fog::fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) {
|
||||
}
|
||||
|
||||
void Fog::fog_volume_set_material(RID p_fog_volume, RID p_material) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
virtual void fog_volume_free(RID p_rid) override;
|
||||
|
||||
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) override;
|
||||
virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) override;
|
||||
virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) override;
|
||||
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) override;
|
||||
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const override;
|
||||
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const override;
|
||||
|
|
|
@ -403,7 +403,7 @@ void LightStorage::reflection_probe_set_ambient_energy(RID p_probe, float p_ener
|
|||
void LightStorage::reflection_probe_set_max_distance(RID p_probe, float p_distance) {
|
||||
}
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
void LightStorage::reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) {
|
||||
|
@ -436,7 +436,7 @@ uint32_t LightStorage::reflection_probe_get_cull_mask(RID p_probe) const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
Vector3 LightStorage::reflection_probe_get_extents(RID p_probe) const {
|
||||
Vector3 LightStorage::reflection_probe_get_size(RID p_probe) const {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ struct ReflectionProbe {
|
|||
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;
|
||||
|
@ -332,7 +332,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;
|
||||
|
@ -345,7 +345,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 bool reflection_probe_renders_shadows(RID p_probe) const override;
|
||||
|
|
|
@ -1503,7 +1503,7 @@ RID TextureStorage::decal_allocate() {
|
|||
void TextureStorage::decal_initialize(RID 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) {
|
||||
}
|
||||
|
||||
void TextureStorage::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) {
|
||||
|
|
|
@ -544,7 +544,7 @@ public:
|
|||
virtual void decal_initialize(RID p_rid) 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;
|
||||
|
|
|
@ -77,7 +77,7 @@ void GPUParticlesCollisionSDF3DEditorPlugin::_notification(int p_what) {
|
|||
|
||||
const Vector3i size = col_sdf->get_estimated_cell_size();
|
||||
|
||||
const Vector3 extents = col_sdf->get_extents();
|
||||
const Vector3 extents = col_sdf->get_size() / 2;
|
||||
|
||||
int data_size = 2;
|
||||
const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
|
||||
|
|
|
@ -1805,7 +1805,7 @@ void Camera3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
|
|||
} else {
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(0, 0, -1), Vector3(4096, 0, -1), s[0], s[1], ra, rb);
|
||||
float d = ra.x * 2.0;
|
||||
float d = ra.x * 2;
|
||||
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
@ -2099,7 +2099,7 @@ void OccluderInstance3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo,
|
|||
Ref<BoxOccluder3D> bo = o;
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
|
||||
float d = ra[p_id];
|
||||
float d = ra[p_id] * 2;
|
||||
if (snap_enabled) {
|
||||
d = Math::snapped(d, snap);
|
||||
}
|
||||
|
@ -2109,7 +2109,7 @@ void OccluderInstance3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo,
|
|||
}
|
||||
|
||||
Vector3 he = bo->get_size();
|
||||
he[p_id] = d * 2;
|
||||
he[p_id] = d;
|
||||
bo->set_size(he);
|
||||
}
|
||||
|
||||
|
@ -3184,7 +3184,7 @@ String GPUParticlesCollision3DGizmoPlugin::get_handle_name(const EditorNode3DGiz
|
|||
}
|
||||
|
||||
if (Object::cast_to<GPUParticlesCollisionBox3D>(cs) || Object::cast_to<GPUParticlesAttractorBox3D>(cs) || Object::cast_to<GPUParticlesAttractorVectorField3D>(cs) || Object::cast_to<GPUParticlesCollisionSDF3D>(cs) || Object::cast_to<GPUParticlesCollisionHeightField3D>(cs)) {
|
||||
return "Extents";
|
||||
return "Size";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -3198,7 +3198,7 @@ Variant GPUParticlesCollision3DGizmoPlugin::get_handle_value(const EditorNode3DG
|
|||
}
|
||||
|
||||
if (Object::cast_to<GPUParticlesCollisionBox3D>(cs) || Object::cast_to<GPUParticlesAttractorBox3D>(cs) || Object::cast_to<GPUParticlesAttractorVectorField3D>(cs) || Object::cast_to<GPUParticlesCollisionSDF3D>(cs) || Object::cast_to<GPUParticlesCollisionHeightField3D>(cs)) {
|
||||
return Vector3(p_gizmo->get_node_3d()->call("get_extents"));
|
||||
return Vector3(p_gizmo->get_node_3d()->call("get_size"));
|
||||
}
|
||||
|
||||
return Variant();
|
||||
|
@ -3235,7 +3235,7 @@ void GPUParticlesCollision3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_g
|
|||
axis[p_id] = 1.0;
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
|
||||
float d = ra[p_id];
|
||||
float d = ra[p_id] * 2;
|
||||
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
@ -3244,9 +3244,9 @@ void GPUParticlesCollision3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_g
|
|||
d = 0.001;
|
||||
}
|
||||
|
||||
Vector3 he = sn->call("get_extents");
|
||||
Vector3 he = sn->call("get_size");
|
||||
he[p_id] = d;
|
||||
sn->call("set_extents", he);
|
||||
sn->call("set_size", he);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3268,14 +3268,14 @@ void GPUParticlesCollision3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *
|
|||
|
||||
if (Object::cast_to<GPUParticlesCollisionBox3D>(sn) || Object::cast_to<GPUParticlesAttractorBox3D>(sn) || Object::cast_to<GPUParticlesAttractorVectorField3D>(sn) || Object::cast_to<GPUParticlesCollisionSDF3D>(sn) || Object::cast_to<GPUParticlesCollisionHeightField3D>(sn)) {
|
||||
if (p_cancel) {
|
||||
sn->call("set_extents", p_restore);
|
||||
sn->call("set_size", p_restore);
|
||||
return;
|
||||
}
|
||||
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
ur->create_action(TTR("Change Box Shape Extents"));
|
||||
ur->add_do_method(sn, "set_extents", sn->call("get_extents"));
|
||||
ur->add_undo_method(sn, "set_extents", p_restore);
|
||||
ur->create_action(TTR("Change Box Shape Size"));
|
||||
ur->add_do_method(sn, "set_size", sn->call("get_size"));
|
||||
ur->add_undo_method(sn, "set_size", p_restore);
|
||||
ur->commit_action();
|
||||
}
|
||||
}
|
||||
|
@ -3342,8 +3342,8 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
if (Object::cast_to<GPUParticlesCollisionBox3D>(cs) || Object::cast_to<GPUParticlesAttractorBox3D>(cs) || Object::cast_to<GPUParticlesAttractorVectorField3D>(cs) || Object::cast_to<GPUParticlesCollisionSDF3D>(cs) || Object::cast_to<GPUParticlesCollisionHeightField3D>(cs)) {
|
||||
Vector<Vector3> lines;
|
||||
AABB aabb;
|
||||
aabb.position = -cs->call("get_extents").operator Vector3();
|
||||
aabb.size = aabb.position * -2;
|
||||
aabb.size = cs->call("get_size").operator Vector3();
|
||||
aabb.position = aabb.size / -2;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
@ -3356,7 +3356,7 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Vector3 ax;
|
||||
ax[i] = cs->call("get_extents").operator Vector3()[i];
|
||||
ax[i] = cs->call("get_size").operator Vector3()[i] / 2;
|
||||
handles.push_back(ax);
|
||||
}
|
||||
|
||||
|
@ -3442,11 +3442,11 @@ int ReflectionProbeGizmoPlugin::get_priority() const {
|
|||
String ReflectionProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
switch (p_id) {
|
||||
case 0:
|
||||
return "Extents X";
|
||||
return "Size X";
|
||||
case 1:
|
||||
return "Extents Y";
|
||||
return "Size Y";
|
||||
case 2:
|
||||
return "Extents Z";
|
||||
return "Size Z";
|
||||
case 3:
|
||||
return "Origin X";
|
||||
case 4:
|
||||
|
@ -3460,7 +3460,7 @@ String ReflectionProbeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gi
|
|||
|
||||
Variant ReflectionProbeGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
ReflectionProbe *probe = Object::cast_to<ReflectionProbe>(p_gizmo->get_node_3d());
|
||||
return AABB(probe->get_extents(), probe->get_origin_offset());
|
||||
return AABB(probe->get_origin_offset(), probe->get_size());
|
||||
}
|
||||
|
||||
void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
|
||||
|
@ -3470,7 +3470,7 @@ void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, in
|
|||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
if (p_id < 3) {
|
||||
Vector3 extents = probe->get_extents();
|
||||
Vector3 size = probe->get_size();
|
||||
|
||||
Vector3 ray_from = p_camera->project_ray_origin(p_point);
|
||||
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
|
||||
|
@ -3482,7 +3482,7 @@ void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, in
|
|||
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 16384, sg[0], sg[1], ra, rb);
|
||||
float d = ra[p_id];
|
||||
float d = ra[p_id] * 2;
|
||||
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
@ -3491,8 +3491,8 @@ void ReflectionProbeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, in
|
|||
d = 0.001;
|
||||
}
|
||||
|
||||
extents[p_id] = d;
|
||||
probe->set_extents(extents);
|
||||
size[p_id] = d;
|
||||
probe->set_size(size);
|
||||
} else {
|
||||
p_id -= 3;
|
||||
|
||||
|
@ -3526,17 +3526,17 @@ void ReflectionProbeGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo,
|
|||
AABB restore = p_restore;
|
||||
|
||||
if (p_cancel) {
|
||||
probe->set_extents(restore.position);
|
||||
probe->set_origin_offset(restore.size);
|
||||
probe->set_origin_offset(restore.position);
|
||||
probe->set_size(restore.size);
|
||||
return;
|
||||
}
|
||||
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
ur->create_action(TTR("Change Probe Extents"));
|
||||
ur->add_do_method(probe, "set_extents", probe->get_extents());
|
||||
ur->create_action(TTR("Change Probe Size"));
|
||||
ur->add_do_method(probe, "set_size", probe->get_size());
|
||||
ur->add_do_method(probe, "set_origin_offset", probe->get_origin_offset());
|
||||
ur->add_undo_method(probe, "set_extents", restore.position);
|
||||
ur->add_undo_method(probe, "set_origin_offset", restore.size);
|
||||
ur->add_undo_method(probe, "set_size", restore.size);
|
||||
ur->add_undo_method(probe, "set_origin_offset", restore.position);
|
||||
ur->commit_action();
|
||||
}
|
||||
|
||||
|
@ -3547,11 +3547,11 @@ void ReflectionProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
|
||||
Vector<Vector3> lines;
|
||||
Vector<Vector3> internal_lines;
|
||||
Vector3 extents = probe->get_extents();
|
||||
Vector3 size = probe->get_size();
|
||||
|
||||
AABB aabb;
|
||||
aabb.position = -extents;
|
||||
aabb.size = extents * 2;
|
||||
aabb.position = -size / 2;
|
||||
aabb.size = size;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
@ -3593,7 +3593,7 @@ void ReflectionProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
|
||||
if (p_gizmo->is_selected()) {
|
||||
Ref<Material> solid_material = get_material("reflection_probe_solid_material", p_gizmo);
|
||||
p_gizmo->add_solid_box(solid_material, probe->get_extents() * 2.0);
|
||||
p_gizmo->add_solid_box(solid_material, probe->get_size());
|
||||
}
|
||||
|
||||
p_gizmo->add_unscaled_billboard(icon, 0.05);
|
||||
|
@ -3627,11 +3627,11 @@ int DecalGizmoPlugin::get_priority() const {
|
|||
String DecalGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
switch (p_id) {
|
||||
case 0:
|
||||
return "Extents X";
|
||||
return "Size X";
|
||||
case 1:
|
||||
return "Extents Y";
|
||||
return "Size Y";
|
||||
case 2:
|
||||
return "Extents Z";
|
||||
return "Size Z";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -3639,7 +3639,7 @@ String DecalGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p
|
|||
|
||||
Variant DecalGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
Decal *decal = Object::cast_to<Decal>(p_gizmo->get_node_3d());
|
||||
return decal->get_extents();
|
||||
return decal->get_size();
|
||||
}
|
||||
|
||||
void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
|
||||
|
@ -3648,7 +3648,7 @@ void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bo
|
|||
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
Vector3 extents = decal->get_extents();
|
||||
Vector3 size = decal->get_size();
|
||||
|
||||
Vector3 ray_from = p_camera->project_ray_origin(p_point);
|
||||
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
|
||||
|
@ -3660,7 +3660,7 @@ void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bo
|
|||
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 16384, sg[0], sg[1], ra, rb);
|
||||
float d = ra[p_id];
|
||||
float d = ra[p_id] * 2;
|
||||
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
@ -3669,8 +3669,8 @@ void DecalGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bo
|
|||
d = 0.001;
|
||||
}
|
||||
|
||||
extents[p_id] = d;
|
||||
decal->set_extents(extents);
|
||||
size[p_id] = d;
|
||||
decal->set_size(size);
|
||||
}
|
||||
|
||||
void DecalGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel) {
|
||||
|
@ -3679,14 +3679,14 @@ void DecalGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
|
|||
Vector3 restore = p_restore;
|
||||
|
||||
if (p_cancel) {
|
||||
decal->set_extents(restore);
|
||||
decal->set_size(restore);
|
||||
return;
|
||||
}
|
||||
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
ur->create_action(TTR("Change Decal Extents"));
|
||||
ur->add_do_method(decal, "set_extents", decal->get_extents());
|
||||
ur->add_undo_method(decal, "set_extents", restore);
|
||||
ur->create_action(TTR("Change Decal Size"));
|
||||
ur->add_do_method(decal, "set_size", decal->get_size());
|
||||
ur->add_undo_method(decal, "set_size", restore);
|
||||
ur->commit_action();
|
||||
}
|
||||
|
||||
|
@ -3696,11 +3696,11 @@ void DecalGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
p_gizmo->clear();
|
||||
|
||||
Vector<Vector3> lines;
|
||||
Vector3 extents = decal->get_extents();
|
||||
Vector3 size = decal->get_size();
|
||||
|
||||
AABB aabb;
|
||||
aabb.position = -extents;
|
||||
aabb.size = extents * 2;
|
||||
aabb.position = -size / 2;
|
||||
aabb.size = size;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
@ -3718,8 +3718,9 @@ void DecalGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
}
|
||||
}
|
||||
|
||||
lines.push_back(Vector3(0, extents.y, 0));
|
||||
lines.push_back(Vector3(0, extents.y * 1.2, 0));
|
||||
float half_size_y = size.y / 2;
|
||||
lines.push_back(Vector3(0, half_size_y, 0));
|
||||
lines.push_back(Vector3(0, half_size_y * 1.2, 0));
|
||||
|
||||
Vector<Vector3> handles;
|
||||
|
||||
|
@ -3767,11 +3768,11 @@ int VoxelGIGizmoPlugin::get_priority() const {
|
|||
String VoxelGIGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
switch (p_id) {
|
||||
case 0:
|
||||
return "Extents X";
|
||||
return "Size X";
|
||||
case 1:
|
||||
return "Extents Y";
|
||||
return "Size Y";
|
||||
case 2:
|
||||
return "Extents Z";
|
||||
return "Size Z";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -3779,7 +3780,7 @@ String VoxelGIGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int
|
|||
|
||||
Variant VoxelGIGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
VoxelGI *probe = Object::cast_to<VoxelGI>(p_gizmo->get_node_3d());
|
||||
return probe->get_extents();
|
||||
return probe->get_size();
|
||||
}
|
||||
|
||||
void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
|
||||
|
@ -3788,7 +3789,7 @@ void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
|
|||
Transform3D gt = probe->get_global_transform();
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
Vector3 extents = probe->get_extents();
|
||||
Vector3 size = probe->get_size();
|
||||
|
||||
Vector3 ray_from = p_camera->project_ray_origin(p_point);
|
||||
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
|
||||
|
@ -3800,7 +3801,7 @@ void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
|
|||
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 16384, sg[0], sg[1], ra, rb);
|
||||
float d = ra[p_id];
|
||||
float d = ra[p_id] * 2;
|
||||
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
@ -3809,8 +3810,8 @@ void VoxelGIGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
|
|||
d = 0.001;
|
||||
}
|
||||
|
||||
extents[p_id] = d;
|
||||
probe->set_extents(extents);
|
||||
size[p_id] = d;
|
||||
probe->set_size(size);
|
||||
}
|
||||
|
||||
void VoxelGIGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel) {
|
||||
|
@ -3819,14 +3820,14 @@ void VoxelGIGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_i
|
|||
Vector3 restore = p_restore;
|
||||
|
||||
if (p_cancel) {
|
||||
probe->set_extents(restore);
|
||||
probe->set_size(restore);
|
||||
return;
|
||||
}
|
||||
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
ur->create_action(TTR("Change Probe Extents"));
|
||||
ur->add_do_method(probe, "set_extents", probe->get_extents());
|
||||
ur->add_undo_method(probe, "set_extents", restore);
|
||||
ur->create_action(TTR("Change Probe Size"));
|
||||
ur->add_do_method(probe, "set_size", probe->get_size());
|
||||
ur->add_undo_method(probe, "set_size", restore);
|
||||
ur->commit_action();
|
||||
}
|
||||
|
||||
|
@ -3840,11 +3841,11 @@ void VoxelGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
p_gizmo->clear();
|
||||
|
||||
Vector<Vector3> lines;
|
||||
Vector3 extents = probe->get_extents();
|
||||
Vector3 size = probe->get_size();
|
||||
|
||||
static const int subdivs[VoxelGI::SUBDIV_MAX] = { 64, 128, 256, 512 };
|
||||
|
||||
AABB aabb = AABB(-extents, extents * 2);
|
||||
AABB aabb = AABB(-size / 2, size);
|
||||
int subdiv = subdivs[probe->get_subdiv()];
|
||||
float cell_size = aabb.get_longest_axis_size() / subdiv;
|
||||
|
||||
|
@ -4363,7 +4364,7 @@ void CollisionShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
|
|||
Ref<BoxShape3D> bs = s;
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
|
||||
float d = ra[p_id];
|
||||
float d = ra[p_id] * 2;
|
||||
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
@ -4373,7 +4374,7 @@ void CollisionShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
|
|||
}
|
||||
|
||||
Vector3 he = bs->get_size();
|
||||
he[p_id] = d * 2;
|
||||
he[p_id] = d;
|
||||
bs->set_size(he);
|
||||
}
|
||||
|
||||
|
@ -5902,11 +5903,11 @@ int FogVolumeGizmoPlugin::get_priority() const {
|
|||
}
|
||||
|
||||
String FogVolumeGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
return "Extents";
|
||||
return "Size";
|
||||
}
|
||||
|
||||
Variant FogVolumeGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
|
||||
return Vector3(p_gizmo->get_node_3d()->call("get_extents"));
|
||||
return Vector3(p_gizmo->get_node_3d()->call("get_size"));
|
||||
}
|
||||
|
||||
void FogVolumeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
|
||||
|
@ -5924,7 +5925,7 @@ void FogVolumeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id
|
|||
axis[p_id] = 1.0;
|
||||
Vector3 ra, rb;
|
||||
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
|
||||
float d = ra[p_id];
|
||||
float d = ra[p_id] * 2;
|
||||
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
@ -5933,23 +5934,23 @@ void FogVolumeGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id
|
|||
d = 0.001;
|
||||
}
|
||||
|
||||
Vector3 he = sn->call("get_extents");
|
||||
Vector3 he = sn->call("get_size");
|
||||
he[p_id] = d;
|
||||
sn->call("set_extents", he);
|
||||
sn->call("set_size", he);
|
||||
}
|
||||
|
||||
void FogVolumeGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel) {
|
||||
Node3D *sn = p_gizmo->get_node_3d();
|
||||
|
||||
if (p_cancel) {
|
||||
sn->call("set_extents", p_restore);
|
||||
sn->call("set_size", p_restore);
|
||||
return;
|
||||
}
|
||||
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
ur->create_action(TTR("Change Fog Volume Extents"));
|
||||
ur->add_do_method(sn, "set_extents", sn->call("get_extents"));
|
||||
ur->add_undo_method(sn, "set_extents", p_restore);
|
||||
ur->create_action(TTR("Change Fog Volume Size"));
|
||||
ur->add_do_method(sn, "set_size", sn->call("get_size"));
|
||||
ur->add_undo_method(sn, "set_size", p_restore);
|
||||
ur->commit_action();
|
||||
}
|
||||
|
||||
|
@ -5968,8 +5969,8 @@ void FogVolumeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
|
||||
Vector<Vector3> lines;
|
||||
AABB aabb;
|
||||
aabb.position = -cs->call("get_extents").operator Vector3();
|
||||
aabb.size = aabb.position * -2;
|
||||
aabb.size = cs->call("get_size").operator Vector3();
|
||||
aabb.position = aabb.size / -2;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Vector3 a, b;
|
||||
|
@ -5982,7 +5983,7 @@ void FogVolumeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Vector3 ax;
|
||||
ax[i] = cs->call("get_extents").operator Vector3()[i];
|
||||
ax[i] = cs->call("get_size").operator Vector3()[i] / 2;
|
||||
handles.push_back(ax);
|
||||
}
|
||||
|
||||
|
|
|
@ -5647,7 +5647,7 @@ VisualShaderEditor::VisualShaderEditor() {
|
|||
add_options.push_back(AddOption("WorldPosition", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "world_position", "WORLD_POSITION"), { "world_position" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
|
||||
add_options.push_back(AddOption("ObjectPosition", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "object_position", "OBJECT_POSITION"), { "object_position" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
|
||||
add_options.push_back(AddOption("UVW", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "uvw", "UVW"), { "uvw" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
|
||||
add_options.push_back(AddOption("Extents", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "extents", "EXTENTS"), { "extents" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
|
||||
add_options.push_back(AddOption("Size", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "size", "SIZE"), { "size" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FOG, Shader::MODE_FOG));
|
||||
add_options.push_back(AddOption("SDF", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "sdf", "SDF"), { "sdf" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FOG, Shader::MODE_FOG));
|
||||
add_options.push_back(AddOption("Time", "Input/Fog", "VisualShaderNodeInput", vformat(input_param_for_fog_shader_mode, "time", "TIME"), { "time" }, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FOG, Shader::MODE_FOG));
|
||||
|
||||
|
|
|
@ -101,12 +101,12 @@ void VoxelGIEditorPlugin::_notification(int p_what) {
|
|||
// Set information tooltip on the Bake button. This information is useful
|
||||
// to optimize performance (video RAM size) and reduce light leaking (individual cell size).
|
||||
|
||||
const Vector3i size = voxel_gi->get_estimated_cell_size();
|
||||
const Vector3i cell_size = voxel_gi->get_estimated_cell_size();
|
||||
|
||||
const Vector3 extents = voxel_gi->get_extents();
|
||||
const Vector3 half_size = voxel_gi->get_size() / 2;
|
||||
|
||||
const int data_size = 4;
|
||||
const double size_mb = size.x * size.y * size.z * data_size / (1024.0 * 1024.0);
|
||||
const double size_mb = cell_size.x * cell_size.y * cell_size.z * data_size / (1024.0 * 1024.0);
|
||||
// Add a qualitative measurement to help the user assess whether a VoxelGI node is using a lot of VRAM.
|
||||
String size_quality;
|
||||
if (size_mb < 16.0) {
|
||||
|
@ -118,8 +118,8 @@ void VoxelGIEditorPlugin::_notification(int p_what) {
|
|||
}
|
||||
|
||||
String text;
|
||||
text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), size.x, size.y, size.z)) + "\n";
|
||||
text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), extents.x / size.x, extents.y / size.y, extents.z / size.z)) + "\n";
|
||||
text += vformat(TTR("Subdivisions: %s"), vformat(String::utf8("%d × %d × %d"), cell_size.x, cell_size.y, cell_size.z)) + "\n";
|
||||
text += vformat(TTR("Cell size: %s"), vformat(String::utf8("%.3f × %.3f × %.3f"), half_size.x / cell_size.x, half_size.y / cell_size.y, half_size.z / cell_size.z)) + "\n";
|
||||
text += vformat(TTR("Video RAM size: %s MB (%s)"), String::num(size_mb, 2), size_quality);
|
||||
|
||||
// Only update the tooltip when needed to avoid constant redrawing.
|
||||
|
|
|
@ -30,14 +30,14 @@
|
|||
|
||||
#include "decal.h"
|
||||
|
||||
void Decal::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
RS::get_singleton()->decal_set_extents(decal, p_extents);
|
||||
void Decal::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
RS::get_singleton()->decal_set_size(decal, p_size);
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 Decal::get_extents() const {
|
||||
return extents;
|
||||
Vector3 Decal::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void Decal::set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture) {
|
||||
|
@ -147,8 +147,8 @@ uint32_t Decal::get_cull_mask() const {
|
|||
|
||||
AABB Decal::get_aabb() const {
|
||||
AABB aabb;
|
||||
aabb.position = -extents;
|
||||
aabb.size = extents * 2.0;
|
||||
aabb.position = -size / 2;
|
||||
aabb.size = size;
|
||||
return aabb;
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,8 @@ PackedStringArray Decal::get_configuration_warnings() const {
|
|||
}
|
||||
|
||||
void Decal::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &Decal::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &Decal::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &Decal::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &Decal::get_size);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_texture", "type", "texture"), &Decal::set_texture);
|
||||
ClassDB::bind_method(D_METHOD("get_texture", "type"), &Decal::get_texture);
|
||||
|
@ -217,7 +217,7 @@ void Decal::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_cull_mask", "mask"), &Decal::set_cull_mask);
|
||||
ClassDB::bind_method(D_METHOD("get_cull_mask"), &Decal::get_cull_mask);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,suffix:m"), "set_size", "get_size");
|
||||
|
||||
ADD_GROUP("Textures", "texture_");
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "texture_albedo", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_ALBEDO);
|
||||
|
@ -252,6 +252,24 @@ void Decal::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(TEXTURE_MAX);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool Decal::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Decal::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
Decal::Decal() {
|
||||
decal = RenderingServer::get_singleton()->decal_create();
|
||||
RS::get_singleton()->instance_set_base(get_instance(), decal);
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
private:
|
||||
RID decal;
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
Ref<Texture2D> textures[TEXTURE_MAX];
|
||||
real_t emission_energy = 1.0;
|
||||
real_t albedo_mix = 1.0;
|
||||
|
@ -63,12 +63,16 @@ private:
|
|||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
virtual PackedStringArray get_configuration_warnings() const override;
|
||||
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
void set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture);
|
||||
Ref<Texture2D> get_texture(DecalTexture p_type) const;
|
||||
|
|
|
@ -34,36 +34,54 @@
|
|||
///////////////////////////
|
||||
|
||||
void FogVolume::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &FogVolume::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &FogVolume::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &FogVolume::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &FogVolume::get_size);
|
||||
ClassDB::bind_method(D_METHOD("set_shape", "shape"), &FogVolume::set_shape);
|
||||
ClassDB::bind_method(D_METHOD("get_shape"), &FogVolume::get_shape);
|
||||
ClassDB::bind_method(D_METHOD("set_material", "material"), &FogVolume::set_material);
|
||||
ClassDB::bind_method(D_METHOD("get_material"), &FogVolume::get_material);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "shape", PROPERTY_HINT_ENUM, "Ellipsoid (Local),Cone (Local),Cylinder (Local),Box (Local),World (Global)"), "set_shape", "get_shape");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "FogMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
}
|
||||
|
||||
void FogVolume::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "extents" && shape == RS::FOG_VOLUME_SHAPE_WORLD) {
|
||||
if (p_property.name == "size" && shape == RS::FOG_VOLUME_SHAPE_WORLD) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void FogVolume::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
extents.x = MAX(0.0, extents.x);
|
||||
extents.y = MAX(0.0, extents.y);
|
||||
extents.z = MAX(0.0, extents.z);
|
||||
RS::get_singleton()->fog_volume_set_extents(_get_volume(), extents);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool FogVolume::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FogVolume::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void FogVolume::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
size.x = MAX(0.0, size.x);
|
||||
size.y = MAX(0.0, size.y);
|
||||
size.z = MAX(0.0, size.z);
|
||||
RS::get_singleton()->fog_volume_set_size(_get_volume(), size);
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 FogVolume::get_extents() const {
|
||||
return extents;
|
||||
Vector3 FogVolume::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void FogVolume::set_shape(RS::FogVolumeShape p_type) {
|
||||
|
@ -94,7 +112,7 @@ Ref<Material> FogVolume::get_material() const {
|
|||
|
||||
AABB FogVolume::get_aabb() const {
|
||||
if (shape != RS::FOG_VOLUME_SHAPE_WORLD) {
|
||||
return AABB(-extents, extents * 2);
|
||||
return AABB(-size / 2, size);
|
||||
}
|
||||
return AABB();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
class FogVolume : public VisualInstance3D {
|
||||
GDCLASS(FogVolume, VisualInstance3D);
|
||||
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
Ref<Material> material;
|
||||
RS::FogVolumeShape shape = RS::FOG_VOLUME_SHAPE_BOX;
|
||||
|
||||
|
@ -50,10 +50,14 @@ protected:
|
|||
_FORCE_INLINE_ RID _get_volume() { return volume; }
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
void set_shape(RS::FogVolumeShape p_type);
|
||||
RS::FogVolumeShape get_shape() const;
|
||||
|
|
|
@ -95,24 +95,42 @@ GPUParticlesCollisionSphere3D::~GPUParticlesCollisionSphere3D() {
|
|||
///////////////////////////
|
||||
|
||||
void GPUParticlesCollisionBox3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesCollisionBox3D::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesCollisionBox3D::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesCollisionBox3D::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesCollisionBox3D::get_size);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
|
||||
}
|
||||
|
||||
void GPUParticlesCollisionBox3D::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool GPUParticlesCollisionBox3D::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GPUParticlesCollisionBox3D::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void GPUParticlesCollisionBox3D::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 GPUParticlesCollisionBox3D::get_extents() const {
|
||||
return extents;
|
||||
Vector3 GPUParticlesCollisionBox3D::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
AABB GPUParticlesCollisionBox3D::get_aabb() const {
|
||||
return AABB(-extents, extents * 2);
|
||||
return AABB(-size / 2, size);
|
||||
}
|
||||
|
||||
GPUParticlesCollisionBox3D::GPUParticlesCollisionBox3D() :
|
||||
|
@ -359,7 +377,7 @@ Vector3i GPUParticlesCollisionSDF3D::get_estimated_cell_size() const {
|
|||
static const int subdivs[RESOLUTION_MAX] = { 16, 32, 64, 128, 256, 512 };
|
||||
int subdiv = subdivs[get_resolution()];
|
||||
|
||||
AABB aabb(-extents, extents * 2);
|
||||
AABB aabb(-size / 2, size);
|
||||
|
||||
float cell_size = aabb.get_longest_axis_size() / float(subdiv);
|
||||
|
||||
|
@ -374,7 +392,7 @@ Ref<Image> GPUParticlesCollisionSDF3D::bake() {
|
|||
static const int subdivs[RESOLUTION_MAX] = { 16, 32, 64, 128, 256, 512 };
|
||||
int subdiv = subdivs[get_resolution()];
|
||||
|
||||
AABB aabb(-extents, extents * 2);
|
||||
AABB aabb(-size / 2, size);
|
||||
|
||||
float cell_size = aabb.get_longest_axis_size() / float(subdiv);
|
||||
|
||||
|
@ -515,8 +533,8 @@ PackedStringArray GPUParticlesCollisionSDF3D::get_configuration_warnings() const
|
|||
}
|
||||
|
||||
void GPUParticlesCollisionSDF3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesCollisionSDF3D::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesCollisionSDF3D::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesCollisionSDF3D::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesCollisionSDF3D::get_size);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_resolution", "resolution"), &GPUParticlesCollisionSDF3D::set_resolution);
|
||||
ClassDB::bind_method(D_METHOD("get_resolution"), &GPUParticlesCollisionSDF3D::get_resolution);
|
||||
|
@ -532,7 +550,7 @@ void GPUParticlesCollisionSDF3D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_bake_mask_value", "layer_number", "value"), &GPUParticlesCollisionSDF3D::set_bake_mask_value);
|
||||
ClassDB::bind_method(D_METHOD("get_bake_mask_value", "layer_number"), &GPUParticlesCollisionSDF3D::get_bake_mask_value);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "resolution", PROPERTY_HINT_ENUM, "16,32,64,128,256,512"), "set_resolution", "get_resolution");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "thickness", PROPERTY_HINT_RANGE, "0.0,2.0,0.01,suffix:m"), "set_thickness", "get_thickness");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_bake_mask", "get_bake_mask");
|
||||
|
@ -547,6 +565,24 @@ void GPUParticlesCollisionSDF3D::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(RESOLUTION_MAX);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool GPUParticlesCollisionSDF3D::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GPUParticlesCollisionSDF3D::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void GPUParticlesCollisionSDF3D::set_thickness(float p_thickness) {
|
||||
thickness = p_thickness;
|
||||
}
|
||||
|
@ -555,14 +591,14 @@ float GPUParticlesCollisionSDF3D::get_thickness() const {
|
|||
return thickness;
|
||||
}
|
||||
|
||||
void GPUParticlesCollisionSDF3D::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
|
||||
void GPUParticlesCollisionSDF3D::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 GPUParticlesCollisionSDF3D::get_extents() const {
|
||||
return extents;
|
||||
Vector3 GPUParticlesCollisionSDF3D::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void GPUParticlesCollisionSDF3D::set_resolution(Resolution p_resolution) {
|
||||
|
@ -610,7 +646,7 @@ Ref<Texture3D> GPUParticlesCollisionSDF3D::get_texture() const {
|
|||
}
|
||||
|
||||
AABB GPUParticlesCollisionSDF3D::get_aabb() const {
|
||||
return AABB(-extents, extents * 2);
|
||||
return AABB(-size / 2, size);
|
||||
}
|
||||
|
||||
GPUParticlesCollisionSDF3D::BakeBeginFunc GPUParticlesCollisionSDF3D::bake_begin_function = nullptr;
|
||||
|
@ -675,8 +711,8 @@ void GPUParticlesCollisionHeightField3D::_notification(int p_what) {
|
|||
}
|
||||
|
||||
void GPUParticlesCollisionHeightField3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesCollisionHeightField3D::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesCollisionHeightField3D::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesCollisionHeightField3D::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesCollisionHeightField3D::get_size);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_resolution", "resolution"), &GPUParticlesCollisionHeightField3D::set_resolution);
|
||||
ClassDB::bind_method(D_METHOD("get_resolution"), &GPUParticlesCollisionHeightField3D::get_resolution);
|
||||
|
@ -687,7 +723,7 @@ void GPUParticlesCollisionHeightField3D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_follow_camera_enabled", "enabled"), &GPUParticlesCollisionHeightField3D::set_follow_camera_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_follow_camera_enabled"), &GPUParticlesCollisionHeightField3D::is_follow_camera_enabled);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "resolution", PROPERTY_HINT_ENUM, "256 (Fastest),512 (Fast),1024 (Average),2048 (Slow),4096 (Slower),8192 (Slowest)"), "set_resolution", "get_resolution");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "When Moved (Fast),Always (Slow)"), "set_update_mode", "get_update_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "follow_camera_enabled"), "set_follow_camera_enabled", "is_follow_camera_enabled");
|
||||
|
@ -704,15 +740,33 @@ void GPUParticlesCollisionHeightField3D::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(UPDATE_MODE_ALWAYS);
|
||||
}
|
||||
|
||||
void GPUParticlesCollisionHeightField3D::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool GPUParticlesCollisionHeightField3D::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GPUParticlesCollisionHeightField3D::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void GPUParticlesCollisionHeightField3D::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
|
||||
update_gizmos();
|
||||
RS::get_singleton()->particles_collision_height_field_update(_get_collision());
|
||||
}
|
||||
|
||||
Vector3 GPUParticlesCollisionHeightField3D::get_extents() const {
|
||||
return extents;
|
||||
Vector3 GPUParticlesCollisionHeightField3D::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void GPUParticlesCollisionHeightField3D::set_resolution(Resolution p_resolution) {
|
||||
|
@ -745,7 +799,7 @@ bool GPUParticlesCollisionHeightField3D::is_follow_camera_enabled() const {
|
|||
}
|
||||
|
||||
AABB GPUParticlesCollisionHeightField3D::get_aabb() const {
|
||||
return AABB(-extents, extents * 2);
|
||||
return AABB(-size / 2, size);
|
||||
}
|
||||
|
||||
GPUParticlesCollisionHeightField3D::GPUParticlesCollisionHeightField3D() :
|
||||
|
@ -857,24 +911,42 @@ GPUParticlesAttractorSphere3D::~GPUParticlesAttractorSphere3D() {
|
|||
///////////////////////////
|
||||
|
||||
void GPUParticlesAttractorBox3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesAttractorBox3D::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesAttractorBox3D::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesAttractorBox3D::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesAttractorBox3D::get_size);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
|
||||
}
|
||||
|
||||
void GPUParticlesAttractorBox3D::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool GPUParticlesAttractorBox3D::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GPUParticlesAttractorBox3D::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void GPUParticlesAttractorBox3D::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 GPUParticlesAttractorBox3D::get_extents() const {
|
||||
return extents;
|
||||
Vector3 GPUParticlesAttractorBox3D::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
AABB GPUParticlesAttractorBox3D::get_aabb() const {
|
||||
return AABB(-extents, extents * 2);
|
||||
return AABB(-size / 2, size);
|
||||
}
|
||||
|
||||
GPUParticlesAttractorBox3D::GPUParticlesAttractorBox3D() :
|
||||
|
@ -887,24 +959,42 @@ GPUParticlesAttractorBox3D::~GPUParticlesAttractorBox3D() {
|
|||
///////////////////////////
|
||||
|
||||
void GPUParticlesAttractorVectorField3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GPUParticlesAttractorVectorField3D::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &GPUParticlesAttractorVectorField3D::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesAttractorVectorField3D::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &GPUParticlesAttractorVectorField3D::get_size);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &GPUParticlesAttractorVectorField3D::set_texture);
|
||||
ClassDB::bind_method(D_METHOD("get_texture"), &GPUParticlesAttractorVectorField3D::get_texture);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater,suffix:m"), "set_size", "get_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture3D"), "set_texture", "get_texture");
|
||||
}
|
||||
|
||||
void GPUParticlesAttractorVectorField3D::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), extents);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool GPUParticlesAttractorVectorField3D::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GPUParticlesAttractorVectorField3D::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void GPUParticlesAttractorVectorField3D::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
RS::get_singleton()->particles_collision_set_box_extents(_get_collision(), size / 2);
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 GPUParticlesAttractorVectorField3D::get_extents() const {
|
||||
return extents;
|
||||
Vector3 GPUParticlesAttractorVectorField3D::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void GPUParticlesAttractorVectorField3D::set_texture(const Ref<Texture3D> &p_texture) {
|
||||
|
@ -918,7 +1008,7 @@ Ref<Texture3D> GPUParticlesAttractorVectorField3D::get_texture() const {
|
|||
}
|
||||
|
||||
AABB GPUParticlesAttractorVectorField3D::get_aabb() const {
|
||||
return AABB(-extents, extents * 2);
|
||||
return AABB(-size / 2, size);
|
||||
}
|
||||
|
||||
GPUParticlesAttractorVectorField3D::GPUParticlesAttractorVectorField3D() :
|
||||
|
|
|
@ -74,14 +74,18 @@ public:
|
|||
class GPUParticlesCollisionBox3D : public GPUParticlesCollision3D {
|
||||
GDCLASS(GPUParticlesCollisionBox3D, GPUParticlesCollision3D);
|
||||
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
|
||||
|
@ -108,7 +112,7 @@ public:
|
|||
typedef void (*BakeEndFunc)();
|
||||
|
||||
private:
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
Resolution resolution = RESOLUTION_64;
|
||||
uint32_t bake_mask = 0xFFFFFFFF;
|
||||
Ref<Texture3D> texture;
|
||||
|
@ -160,6 +164,10 @@ private:
|
|||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
virtual PackedStringArray get_configuration_warnings() const override;
|
||||
|
@ -167,8 +175,8 @@ public:
|
|||
void set_thickness(float p_thickness);
|
||||
float get_thickness() const;
|
||||
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
void set_resolution(Resolution p_resolution);
|
||||
Resolution get_resolution() const;
|
||||
|
@ -217,7 +225,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
Resolution resolution = RESOLUTION_1024;
|
||||
bool follow_camera_mode = false;
|
||||
|
||||
|
@ -226,10 +234,14 @@ private:
|
|||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
void set_resolution(Resolution p_resolution);
|
||||
Resolution get_resolution() const;
|
||||
|
@ -301,14 +313,18 @@ public:
|
|||
class GPUParticlesAttractorBox3D : public GPUParticlesAttractor3D {
|
||||
GDCLASS(GPUParticlesAttractorBox3D, GPUParticlesAttractor3D);
|
||||
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
|
||||
|
@ -319,15 +335,19 @@ public:
|
|||
class GPUParticlesAttractorVectorField3D : public GPUParticlesAttractor3D {
|
||||
GDCLASS(GPUParticlesAttractorVectorField3D, GPUParticlesAttractor3D);
|
||||
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
Ref<Texture3D> texture;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
void set_texture(const Ref<Texture3D> &p_texture);
|
||||
Ref<Texture3D> get_texture() const;
|
||||
|
|
|
@ -85,38 +85,40 @@ float ReflectionProbe::get_mesh_lod_threshold() const {
|
|||
return mesh_lod_threshold;
|
||||
}
|
||||
|
||||
void ReflectionProbe::set_extents(const Vector3 &p_extents) {
|
||||
extents = p_extents;
|
||||
void ReflectionProbe::set_size(const Vector3 &p_size) {
|
||||
size = p_size;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (extents[i] < 0.01) {
|
||||
extents[i] = 0.01;
|
||||
float half_size = size[i] / 2;
|
||||
if (half_size < 0.01) {
|
||||
half_size = 0.01;
|
||||
}
|
||||
|
||||
if (extents[i] - 0.01 < ABS(origin_offset[i])) {
|
||||
origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
|
||||
if (half_size - 0.01 < ABS(origin_offset[i])) {
|
||||
origin_offset[i] = SIGN(origin_offset[i]) * (half_size - 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
RS::get_singleton()->reflection_probe_set_extents(probe, extents);
|
||||
RS::get_singleton()->reflection_probe_set_size(probe, size);
|
||||
RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
|
||||
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 ReflectionProbe::get_extents() const {
|
||||
return extents;
|
||||
Vector3 ReflectionProbe::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) {
|
||||
origin_offset = p_extents;
|
||||
void ReflectionProbe::set_origin_offset(const Vector3 &p_offset) {
|
||||
origin_offset = p_offset;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (extents[i] - 0.01 < ABS(origin_offset[i])) {
|
||||
origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
|
||||
float half_size = size[i] / 2;
|
||||
if (half_size - 0.01 < ABS(origin_offset[i])) {
|
||||
origin_offset[i] = SIGN(origin_offset[i]) * (half_size - 0.01);
|
||||
}
|
||||
}
|
||||
RS::get_singleton()->reflection_probe_set_extents(probe, extents);
|
||||
RS::get_singleton()->reflection_probe_set_size(probe, size);
|
||||
RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
|
||||
|
||||
update_gizmos();
|
||||
|
@ -174,7 +176,7 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const {
|
|||
AABB ReflectionProbe::get_aabb() const {
|
||||
AABB aabb;
|
||||
aabb.position = -origin_offset;
|
||||
aabb.size = origin_offset + extents;
|
||||
aabb.size = origin_offset + size / 2;
|
||||
return aabb;
|
||||
}
|
||||
|
||||
|
@ -205,8 +207,8 @@ void ReflectionProbe::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_mesh_lod_threshold", "ratio"), &ReflectionProbe::set_mesh_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("get_mesh_lod_threshold"), &ReflectionProbe::get_mesh_lod_threshold);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &ReflectionProbe::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &ReflectionProbe::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &ReflectionProbe::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &ReflectionProbe::get_size);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_origin_offset", "origin_offset"), &ReflectionProbe::set_origin_offset);
|
||||
ClassDB::bind_method(D_METHOD("get_origin_offset"), &ReflectionProbe::get_origin_offset);
|
||||
|
@ -229,7 +231,7 @@ void ReflectionProbe::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "Once (Fast),Always (Slow)"), "set_update_mode", "get_update_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "intensity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_intensity", "get_intensity");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_distance", PROPERTY_HINT_RANGE, "0,16384,0.1,or_greater,exp,suffix:m"), "set_max_distance", "get_max_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_NONE, "suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_NONE, "suffix:m"), "set_size", "get_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "origin_offset", PROPERTY_HINT_NONE, "suffix:m"), "set_origin_offset", "get_origin_offset");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "box_projection"), "set_enable_box_projection", "is_box_projection_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_as_interior", "is_set_as_interior");
|
||||
|
@ -250,6 +252,24 @@ void ReflectionProbe::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(AMBIENT_COLOR);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool ReflectionProbe::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReflectionProbe::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
ReflectionProbe::ReflectionProbe() {
|
||||
probe = RenderingServer::get_singleton()->reflection_probe_create();
|
||||
RS::get_singleton()->instance_set_base(get_instance(), probe);
|
||||
|
|
|
@ -52,7 +52,7 @@ private:
|
|||
RID probe;
|
||||
float intensity = 1.0;
|
||||
float max_distance = 0.0;
|
||||
Vector3 extents = Vector3(10, 10, 10);
|
||||
Vector3 size = Vector3(20, 20, 20);
|
||||
Vector3 origin_offset = Vector3(0, 0, 0);
|
||||
bool box_projection = false;
|
||||
bool enable_shadows = false;
|
||||
|
@ -68,6 +68,10 @@ private:
|
|||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
void set_intensity(float p_intensity);
|
||||
|
@ -91,10 +95,10 @@ public:
|
|||
void set_mesh_lod_threshold(float p_pixels);
|
||||
float get_mesh_lod_threshold() const;
|
||||
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
void set_origin_offset(const Vector3 &p_extents);
|
||||
void set_origin_offset(const Vector3 &p_offset);
|
||||
Vector3 get_origin_offset() const;
|
||||
|
||||
void set_as_interior(bool p_enable);
|
||||
|
|
|
@ -237,6 +237,24 @@ void VoxelGIData::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior");
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool VoxelGI::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
set_size((Vector3)p_value * 2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VoxelGI::_get(const StringName &p_name, Variant &r_property) const {
|
||||
if (p_name == "extents") { // Compatibility with Godot 3.x.
|
||||
r_property = size / 2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
VoxelGIData::VoxelGIData() {
|
||||
probe = RS::get_singleton()->voxel_gi_create();
|
||||
}
|
||||
|
@ -273,14 +291,14 @@ VoxelGI::Subdiv VoxelGI::get_subdiv() const {
|
|||
return subdiv;
|
||||
}
|
||||
|
||||
void VoxelGI::set_extents(const Vector3 &p_extents) {
|
||||
// Prevent very small extents as these break baking if other extents are set very high.
|
||||
extents = Vector3(MAX(1.0, p_extents.x), MAX(1.0, p_extents.y), MAX(1.0, p_extents.z));
|
||||
void VoxelGI::set_size(const Vector3 &p_size) {
|
||||
// Prevent very small size dimensions as these breaks baking if other size dimensions are set very high.
|
||||
size = Vector3(MAX(1.0, p_size.x), MAX(1.0, p_size.y), MAX(1.0, p_size.z));
|
||||
update_gizmos();
|
||||
}
|
||||
|
||||
Vector3 VoxelGI::get_extents() const {
|
||||
return extents;
|
||||
Vector3 VoxelGI::get_size() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void VoxelGI::set_camera_attributes(const Ref<CameraAttributes> &p_camera_attributes) {
|
||||
|
@ -300,7 +318,7 @@ void VoxelGI::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
|
|||
|
||||
Transform3D xf = get_global_transform().affine_inverse() * mi->get_global_transform();
|
||||
|
||||
if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
|
||||
if (AABB(-size / 2, size).intersects(xf.xform(aabb))) {
|
||||
PlotMesh pm;
|
||||
pm.local_xform = xf;
|
||||
pm.mesh = mesh;
|
||||
|
@ -328,7 +346,7 @@ void VoxelGI::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
|
|||
|
||||
Transform3D xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
|
||||
|
||||
if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
|
||||
if (AABB(-size / 2, size).intersects(xf.xform(aabb))) {
|
||||
PlotMesh pm;
|
||||
pm.local_xform = xf;
|
||||
pm.mesh = mesh;
|
||||
|
@ -352,7 +370,7 @@ Vector3i VoxelGI::get_estimated_cell_size() const {
|
|||
static const int subdiv_value[SUBDIV_MAX] = { 6, 7, 8, 9 };
|
||||
int cell_subdiv = subdiv_value[subdiv];
|
||||
int axis_cell_size[3];
|
||||
AABB bounds = AABB(-extents, extents * 2.0);
|
||||
AABB bounds = AABB(-size / 2, size);
|
||||
int longest_axis = bounds.get_longest_axis_index();
|
||||
axis_cell_size[longest_axis] = 1 << cell_subdiv;
|
||||
|
||||
|
@ -390,7 +408,7 @@ void VoxelGI::bake(Node *p_from_node, bool p_create_visual_debug) {
|
|||
|
||||
Voxelizer baker;
|
||||
|
||||
baker.begin_bake(subdiv_value[subdiv], AABB(-extents, extents * 2.0), exposure_normalization);
|
||||
baker.begin_bake(subdiv_value[subdiv], AABB(-size / 2, size), exposure_normalization);
|
||||
|
||||
List<PlotMesh> mesh_list;
|
||||
|
||||
|
@ -448,7 +466,7 @@ void VoxelGI::bake(Node *p_from_node, bool p_create_visual_debug) {
|
|||
|
||||
RS::get_singleton()->voxel_gi_set_baked_exposure_normalization(probe_data_new->get_rid(), exposure_normalization);
|
||||
|
||||
probe_data_new->allocate(baker.get_to_cell_space_xform(), AABB(-extents, extents * 2.0), baker.get_voxel_gi_octree_size(), baker.get_voxel_gi_octree_cells(), baker.get_voxel_gi_data_cells(), df, baker.get_voxel_gi_level_cell_count());
|
||||
probe_data_new->allocate(baker.get_to_cell_space_xform(), AABB(-size / 2, size), baker.get_voxel_gi_octree_size(), baker.get_voxel_gi_octree_cells(), baker.get_voxel_gi_data_cells(), df, baker.get_voxel_gi_level_cell_count());
|
||||
|
||||
set_probe_data(probe_data_new);
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
@ -468,7 +486,7 @@ void VoxelGI::_debug_bake() {
|
|||
}
|
||||
|
||||
AABB VoxelGI::get_aabb() const {
|
||||
return AABB(-extents, extents * 2);
|
||||
return AABB(-size / 2, size);
|
||||
}
|
||||
|
||||
PackedStringArray VoxelGI::get_configuration_warnings() const {
|
||||
|
@ -489,8 +507,8 @@ void VoxelGI::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_subdiv", "subdiv"), &VoxelGI::set_subdiv);
|
||||
ClassDB::bind_method(D_METHOD("get_subdiv"), &VoxelGI::get_subdiv);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &VoxelGI::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &VoxelGI::get_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_size", "size"), &VoxelGI::set_size);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &VoxelGI::get_size);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_camera_attributes", "camera_attributes"), &VoxelGI::set_camera_attributes);
|
||||
ClassDB::bind_method(D_METHOD("get_camera_attributes"), &VoxelGI::get_camera_attributes);
|
||||
|
@ -500,7 +518,7 @@ void VoxelGI::_bind_methods() {
|
|||
ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdiv", PROPERTY_HINT_ENUM, "64,128,256,512"), "set_subdiv", "get_subdiv");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_NONE, "suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size", PROPERTY_HINT_NONE, "suffix:m"), "set_size", "get_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_attributes", PROPERTY_HINT_RESOURCE_TYPE, "CameraAttributesPractical,CameraAttributesPhysical"), "set_camera_attributes", "get_camera_attributes");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "VoxelGIData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_probe_data", "get_probe_data");
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ private:
|
|||
RID voxel_gi;
|
||||
|
||||
Subdiv subdiv = SUBDIV_128;
|
||||
Vector3 extents = Vector3(10, 10, 10);
|
||||
Vector3 size = Vector3(20, 20, 20);
|
||||
Ref<CameraAttributes> camera_attributes;
|
||||
|
||||
struct PlotMesh {
|
||||
|
@ -133,6 +133,10 @@ private:
|
|||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_property) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
public:
|
||||
static BakeBeginFunc bake_begin_function;
|
||||
|
@ -145,8 +149,8 @@ public:
|
|||
void set_subdiv(Subdiv p_subdiv);
|
||||
Subdiv get_subdiv() const;
|
||||
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
void set_size(const Vector3 &p_size);
|
||||
Vector3 get_size() const;
|
||||
|
||||
void set_camera_attributes(const Ref<CameraAttributes> &p_camera_attributes);
|
||||
Ref<CameraAttributes> get_camera_attributes() const;
|
||||
|
|
|
@ -159,7 +159,7 @@ uniform sampler3D density_texture: hint_default_white;
|
|||
void fog() {
|
||||
DENSITY = density * clamp(exp2(-height_falloff * (WORLD_POSITION.y - OBJECT_POSITION.y)), 0.0, 1.0);
|
||||
DENSITY *= texture(density_texture, UVW).r;
|
||||
DENSITY *= pow(clamp(-SDF / min(min(EXTENTS.x, EXTENTS.y), EXTENTS.z), 0.0, 1.0), edge_fade);
|
||||
DENSITY *= pow(clamp(-2.0 * SDF / min(min(SIZE.x, SIZE.y), SIZE.z), 0.0, 1.0), edge_fade);
|
||||
ALBEDO = albedo.rgb;
|
||||
EMISSION = emission.rgb;
|
||||
}
|
||||
|
|
|
@ -2936,7 +2936,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
|
|||
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "world_position", "WORLD_POSITION" },
|
||||
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "object_position", "OBJECT_POSITION" },
|
||||
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "uvw", "UVW" },
|
||||
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "extents", "EXTENTS" },
|
||||
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_VECTOR_3D, "size", "SIZE" },
|
||||
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_SCALAR, "sdf", "SDF" },
|
||||
{ Shader::MODE_FOG, VisualShader::TYPE_FOG, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" },
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual void fog_volume_free(RID p_rid) override {}
|
||||
|
||||
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) override {}
|
||||
virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) override {}
|
||||
virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) override {}
|
||||
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) override {}
|
||||
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const override { return AABB(); }
|
||||
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const override { return RS::FOG_VOLUME_SHAPE_BOX; }
|
||||
|
|
|
@ -101,7 +101,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 {}
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
virtual AABB reflection_probe_get_aabb(RID p_probe) const override { return AABB(); }
|
||||
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const override { return RenderingServer::REFLECTION_PROBE_UPDATE_ONCE; }
|
||||
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const override { return 0; }
|
||||
virtual Vector3 reflection_probe_get_extents(RID p_probe) const override { return Vector3(); }
|
||||
virtual Vector3 reflection_probe_get_size(RID p_probe) const override { return Vector3(); }
|
||||
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const override { return Vector3(); }
|
||||
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const override { return 0.0; }
|
||||
virtual bool reflection_probe_renders_shadows(RID p_probe) const override { return false; }
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
virtual void decal_initialize(RID p_rid) 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 {}
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual void fog_volume_free(RID p_rid) = 0;
|
||||
|
||||
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) = 0;
|
||||
virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) = 0;
|
||||
virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) = 0;
|
||||
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) = 0;
|
||||
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const = 0;
|
||||
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const = 0;
|
||||
|
|
|
@ -330,7 +330,7 @@ public:
|
|||
render_element_count++;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void add_box(BoxType p_box_type, const Transform3D &p_transform, const Vector3 &p_half_extents) {
|
||||
_FORCE_INLINE_ void add_box(BoxType p_box_type, const Transform3D &p_transform, const Vector3 &p_half_size) {
|
||||
if (p_box_type == BOX_TYPE_DECAL && cluster_count_by_type[ELEMENT_TYPE_DECAL] == max_elements_by_type) {
|
||||
return; // Max number elements reached.
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ public:
|
|||
Transform3D xform = view_xform * p_transform;
|
||||
|
||||
// Extract scale and scale the matrix by it, makes things simpler.
|
||||
Vector3 scale = p_half_extents;
|
||||
Vector3 scale = p_half_size;
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
float s = xform.basis.rows[i].length();
|
||||
scale[i] *= s;
|
||||
|
|
|
@ -82,11 +82,11 @@ void Fog::fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) {
|
|||
fog_volume->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
|
||||
}
|
||||
|
||||
void Fog::fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) {
|
||||
void Fog::fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) {
|
||||
FogVolume *fog_volume = fog_volume_owner.get_or_null(p_fog_volume);
|
||||
ERR_FAIL_COND(!fog_volume);
|
||||
|
||||
fog_volume->extents = p_extents;
|
||||
fog_volume->size = p_size;
|
||||
fog_volume->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
|
||||
}
|
||||
|
||||
|
@ -120,8 +120,8 @@ AABB Fog::fog_volume_get_aabb(RID p_fog_volume) const {
|
|||
case RS::FOG_VOLUME_SHAPE_CYLINDER:
|
||||
case RS::FOG_VOLUME_SHAPE_BOX: {
|
||||
AABB aabb;
|
||||
aabb.position = -fog_volume->extents;
|
||||
aabb.size = fog_volume->extents * 2;
|
||||
aabb.position = -fog_volume->size / 2;
|
||||
aabb.size = fog_volume->size;
|
||||
return aabb;
|
||||
}
|
||||
default: {
|
||||
|
@ -131,10 +131,10 @@ AABB Fog::fog_volume_get_aabb(RID p_fog_volume) const {
|
|||
}
|
||||
}
|
||||
|
||||
Vector3 Fog::fog_volume_get_extents(RID p_fog_volume) const {
|
||||
Vector3 Fog::fog_volume_get_size(RID p_fog_volume) const {
|
||||
const FogVolume *fog_volume = fog_volume_owner.get_or_null(p_fog_volume);
|
||||
ERR_FAIL_COND_V(!fog_volume, Vector3());
|
||||
return fog_volume->extents;
|
||||
return fog_volume->size;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -210,7 +210,7 @@ void Fog::init_fog_shader(uint32_t p_max_directional_lights, int p_roughness_lay
|
|||
actions.renames["WORLD_POSITION"] = "world.xyz";
|
||||
actions.renames["OBJECT_POSITION"] = "params.position";
|
||||
actions.renames["UVW"] = "uvw";
|
||||
actions.renames["EXTENTS"] = "params.extents";
|
||||
actions.renames["SIZE"] = "params.size";
|
||||
actions.renames["ALBEDO"] = "albedo";
|
||||
actions.renames["DENSITY"] = "density";
|
||||
actions.renames["EMISSION"] = "emission";
|
||||
|
@ -643,7 +643,7 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P
|
|||
|
||||
Vector3 position = fog_volume_instance->transform.get_origin();
|
||||
RS::FogVolumeShape volume_type = RendererRD::Fog::get_singleton()->fog_volume_get_shape(fog_volume);
|
||||
Vector3 extents = RendererRD::Fog::get_singleton()->fog_volume_get_extents(fog_volume);
|
||||
Vector3 extents = RendererRD::Fog::get_singleton()->fog_volume_get_size(fog_volume) / 2;
|
||||
|
||||
if (volume_type != RS::FOG_VOLUME_SHAPE_WORLD) {
|
||||
// Local fog volume.
|
||||
|
@ -683,9 +683,9 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P
|
|||
push_constant.position[0] = position.x;
|
||||
push_constant.position[1] = position.y;
|
||||
push_constant.position[2] = position.z;
|
||||
push_constant.extents[0] = extents.x;
|
||||
push_constant.extents[1] = extents.y;
|
||||
push_constant.extents[2] = extents.z;
|
||||
push_constant.size[0] = extents.x * 2;
|
||||
push_constant.size[1] = extents.y * 2;
|
||||
push_constant.size[2] = extents.z * 2;
|
||||
push_constant.corner[0] = min.x;
|
||||
push_constant.corner[1] = min.y;
|
||||
push_constant.corner[2] = min.z;
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
|
||||
struct FogVolume {
|
||||
RID material;
|
||||
Vector3 extents = Vector3(1, 1, 1);
|
||||
Vector3 size = Vector3(2, 2, 2);
|
||||
|
||||
RS::FogVolumeShape shape = RS::FOG_VOLUME_SHAPE_BOX;
|
||||
|
||||
|
@ -83,7 +83,7 @@ private:
|
|||
float position[3];
|
||||
float pad;
|
||||
|
||||
float extents[3];
|
||||
float size[3];
|
||||
float pad2;
|
||||
|
||||
int32_t corner[3];
|
||||
|
@ -239,12 +239,12 @@ public:
|
|||
Dependency *fog_volume_get_dependency(RID p_fog_volume) const;
|
||||
|
||||
virtual void fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) override;
|
||||
virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) override;
|
||||
virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) override;
|
||||
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) override;
|
||||
virtual RS::FogVolumeShape fog_volume_get_shape(RID p_fog_volume) const override;
|
||||
RID fog_volume_get_material(RID p_fog_volume) const;
|
||||
virtual AABB fog_volume_get_aabb(RID p_fog_volume) const override;
|
||||
Vector3 fog_volume_get_extents(RID p_fog_volume) const;
|
||||
Vector3 fog_volume_get_size(RID p_fog_volume) const;
|
||||
|
||||
/* FOG VOLUMES INSTANCE */
|
||||
|
||||
|
|
|
@ -1232,9 +1232,9 @@ void RenderForwardClustered::_update_volumetric_fog(Ref<RenderSceneBuffersRD> p_
|
|||
|
||||
/* Lighting */
|
||||
|
||||
void RenderForwardClustered::setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_extents) {
|
||||
void RenderForwardClustered::setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_size) {
|
||||
if (current_cluster_builder != nullptr) {
|
||||
current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_REFLECTION_PROBE, p_transform, p_half_extents);
|
||||
current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_REFLECTION_PROBE, p_transform, p_half_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1244,9 +1244,9 @@ void RenderForwardClustered::setup_added_light(const RS::LightType p_type, const
|
|||
}
|
||||
}
|
||||
|
||||
void RenderForwardClustered::setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_extents) {
|
||||
void RenderForwardClustered::setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_size) {
|
||||
if (current_cluster_builder != nullptr) {
|
||||
current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_DECAL, p_transform, p_half_extents);
|
||||
current_cluster_builder->add_box(ClusterBuilderRD::BOX_TYPE_DECAL, p_transform, p_half_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2617,8 +2617,8 @@ void RenderForwardClustered::_render_sdfgi(Ref<RenderSceneBuffersRD> p_render_bu
|
|||
render_list[RENDER_LIST_SECONDARY].sort_by_key();
|
||||
_fill_instance_data(RENDER_LIST_SECONDARY);
|
||||
|
||||
Vector3 half_extents = p_bounds.size * 0.5;
|
||||
Vector3 center = p_bounds.position + half_extents;
|
||||
Vector3 half_size = p_bounds.size * 0.5;
|
||||
Vector3 center = p_bounds.position + half_size;
|
||||
|
||||
Vector<RID> sbs = {
|
||||
p_albedo_texture,
|
||||
|
@ -2646,16 +2646,16 @@ void RenderForwardClustered::_render_sdfgi(Ref<RenderSceneBuffersRD> p_render_bu
|
|||
fb_size.x = p_size[right_axis];
|
||||
fb_size.y = p_size[up_axis];
|
||||
|
||||
scene_data.cam_transform.origin = center + axis * half_extents;
|
||||
scene_data.cam_transform.origin = center + axis * half_size;
|
||||
scene_data.cam_transform.basis.set_column(0, right);
|
||||
scene_data.cam_transform.basis.set_column(1, up);
|
||||
scene_data.cam_transform.basis.set_column(2, axis);
|
||||
|
||||
//print_line("pass: " + itos(i) + " xform " + scene_data.cam_transform);
|
||||
|
||||
float h_size = half_extents[right_axis];
|
||||
float v_size = half_extents[up_axis];
|
||||
float d_size = half_extents[i] * 2.0;
|
||||
float h_size = half_size[right_axis];
|
||||
float v_size = half_size[up_axis];
|
||||
float d_size = half_size[i] * 2.0;
|
||||
scene_data.cam_projection.set_orthogonal(-h_size, h_size, -v_size, v_size, 0, d_size);
|
||||
//print_line("pass: " + itos(i) + " cam hsize: " + rtos(h_size) + " vsize: " + rtos(v_size) + " dsize " + rtos(d_size));
|
||||
|
||||
|
|
|
@ -640,9 +640,9 @@ public:
|
|||
RendererRD::SSEffects *get_ss_effects() { return ss_effects; }
|
||||
|
||||
/* callback from updating our lighting UBOs, used to populate cluster builder */
|
||||
virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_extents) override;
|
||||
virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_size) override;
|
||||
virtual void setup_added_light(const RS::LightType p_type, const Transform3D &p_transform, float p_radius, float p_spot_aperture) override;
|
||||
virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_extents) override;
|
||||
virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_size) override;
|
||||
|
||||
virtual void base_uniforms_changed() override;
|
||||
_FORCE_INLINE_ virtual void update_uniform_sets() override {
|
||||
|
|
|
@ -204,9 +204,9 @@ public:
|
|||
|
||||
/* LIGHTING */
|
||||
|
||||
virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_extents){};
|
||||
virtual void setup_added_reflection_probe(const Transform3D &p_transform, const Vector3 &p_half_size){};
|
||||
virtual void setup_added_light(const RS::LightType p_type, const Transform3D &p_transform, float p_radius, float p_spot_aperture){};
|
||||
virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_extents){};
|
||||
virtual void setup_added_decal(const Transform3D &p_transform, const Vector3 &p_half_size){};
|
||||
|
||||
/* GI */
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ layout(push_constant, std430) uniform Params {
|
|||
vec3 position;
|
||||
float pad;
|
||||
|
||||
vec3 extents;
|
||||
vec3 size;
|
||||
float pad2;
|
||||
|
||||
ivec3 corner;
|
||||
|
@ -184,36 +184,37 @@ void main() {
|
|||
vec4 local_pos = params.transform * world;
|
||||
local_pos.xyz /= local_pos.w;
|
||||
|
||||
vec3 half_size = params.size / 2.0;
|
||||
float sdf = -1.0;
|
||||
if (params.shape == 0) {
|
||||
// Ellipsoid
|
||||
// https://www.shadertoy.com/view/tdS3DG
|
||||
float k0 = length(local_pos.xyz / params.extents);
|
||||
float k1 = length(local_pos.xyz / (params.extents * params.extents));
|
||||
float k0 = length(local_pos.xyz / half_size);
|
||||
float k1 = length(local_pos.xyz / (half_size * half_size));
|
||||
sdf = k0 * (k0 - 1.0) / k1;
|
||||
} else if (params.shape == 1) {
|
||||
// Cone
|
||||
// https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
|
||||
// Compute the cone angle automatically to fit within the volume's extents.
|
||||
float inv_height = 1.0 / max(0.001, params.extents.y);
|
||||
float radius = 1.0 / max(0.001, (min(params.extents.x, params.extents.z) * 0.5));
|
||||
// Compute the cone angle automatically to fit within the volume's size.
|
||||
float inv_height = 1.0 / max(0.001, half_size.y);
|
||||
float radius = 1.0 / max(0.001, (min(half_size.x, half_size.z) * 0.5));
|
||||
float hypotenuse = sqrt(radius * radius + inv_height * inv_height);
|
||||
float rsin = radius / hypotenuse;
|
||||
float rcos = inv_height / hypotenuse;
|
||||
vec2 c = vec2(rsin, rcos);
|
||||
|
||||
float q = length(local_pos.xz);
|
||||
sdf = max(dot(c, vec2(q, local_pos.y - params.extents.y)), -params.extents.y - local_pos.y);
|
||||
sdf = max(dot(c, vec2(q, local_pos.y - half_size.y)), -half_size.y - local_pos.y);
|
||||
} else if (params.shape == 2) {
|
||||
// Cylinder
|
||||
// https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
vec2 d = abs(vec2(length(local_pos.xz), local_pos.y)) - vec2(min(params.extents.x, params.extents.z), params.extents.y);
|
||||
vec2 d = abs(vec2(length(local_pos.xz), local_pos.y)) - vec2(min(half_size.x, half_size.z), half_size.y);
|
||||
sdf = min(max(d.x, d.y), 0.0) + length(max(d, 0.0));
|
||||
} else if (params.shape == 3) {
|
||||
// Box
|
||||
// https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
vec3 q = abs(local_pos.xyz) - params.extents;
|
||||
vec3 q = abs(local_pos.xyz) - half_size;
|
||||
sdf = length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
|
||||
}
|
||||
|
||||
|
@ -222,7 +223,7 @@ void main() {
|
|||
#ifndef SDF_USED
|
||||
cull_mask = 1.0 - smoothstep(-0.1, 0.0, sdf);
|
||||
#endif
|
||||
uvw = clamp((local_pos.xyz + params.extents) / (2.0 * params.extents), 0.0, 1.0);
|
||||
uvw = clamp((local_pos.xyz + half_size) / params.size, 0.0, 1.0);
|
||||
}
|
||||
|
||||
if (cull_mask > 0.0) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -3394,13 +3394,13 @@ bool RendererSceneCull::_render_reflection_probe_step(Instance *p_instance, int
|
|||
Vector3(0, -1, 0)
|
||||
};
|
||||
|
||||
Vector3 extents = RSG::light_storage->reflection_probe_get_extents(p_instance->base);
|
||||
Vector3 probe_size = RSG::light_storage->reflection_probe_get_size(p_instance->base);
|
||||
Vector3 origin_offset = RSG::light_storage->reflection_probe_get_origin_offset(p_instance->base);
|
||||
float max_distance = RSG::light_storage->reflection_probe_get_origin_max_distance(p_instance->base);
|
||||
float size = RSG::light_storage->reflection_atlas_get_size(scenario->reflection_atlas);
|
||||
float mesh_lod_threshold = RSG::light_storage->reflection_probe_get_mesh_lod_threshold(p_instance->base) / size;
|
||||
float atlas_size = RSG::light_storage->reflection_atlas_get_size(scenario->reflection_atlas);
|
||||
float mesh_lod_threshold = RSG::light_storage->reflection_probe_get_mesh_lod_threshold(p_instance->base) / atlas_size;
|
||||
|
||||
Vector3 edge = view_normals[p_step] * extents;
|
||||
Vector3 edge = view_normals[p_step] * probe_size / 2;
|
||||
float distance = ABS(view_normals[p_step].dot(edge) - view_normals[p_step].dot(origin_offset)); //distance from origin offset to actual view distance limit
|
||||
|
||||
max_distance = MAX(max_distance, distance);
|
||||
|
|
|
@ -387,7 +387,7 @@ public:
|
|||
FUNC2(reflection_probe_set_ambient_energy, RID, float)
|
||||
FUNC2(reflection_probe_set_ambient_mode, RID, ReflectionProbeAmbientMode)
|
||||
FUNC2(reflection_probe_set_max_distance, RID, float)
|
||||
FUNC2(reflection_probe_set_extents, RID, const Vector3 &)
|
||||
FUNC2(reflection_probe_set_size, RID, const Vector3 &)
|
||||
FUNC2(reflection_probe_set_origin_offset, RID, const Vector3 &)
|
||||
FUNC2(reflection_probe_set_as_interior, RID, bool)
|
||||
FUNC2(reflection_probe_set_enable_box_projection, RID, bool)
|
||||
|
@ -428,7 +428,7 @@ public:
|
|||
|
||||
FUNCRIDSPLIT(decal)
|
||||
|
||||
FUNC2(decal_set_extents, RID, const Vector3 &)
|
||||
FUNC2(decal_set_size, RID, const Vector3 &)
|
||||
FUNC3(decal_set_texture, RID, DecalTexture, RID)
|
||||
FUNC2(decal_set_emission_energy, RID, float)
|
||||
FUNC2(decal_set_albedo_mix, RID, float)
|
||||
|
@ -540,7 +540,7 @@ public:
|
|||
FUNCRIDSPLIT(fog_volume)
|
||||
|
||||
FUNC2(fog_volume_set_shape, RID, FogVolumeShape)
|
||||
FUNC2(fog_volume_set_extents, RID, const Vector3 &)
|
||||
FUNC2(fog_volume_set_size, RID, const Vector3 &)
|
||||
FUNC2(fog_volume_set_material, RID, RID)
|
||||
|
||||
/* VISIBILITY_NOTIFIER */
|
||||
|
|
|
@ -464,7 +464,7 @@ ShaderTypes::ShaderTypes() {
|
|||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["WORLD_POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
|
||||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["OBJECT_POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
|
||||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["UVW"] = constt(ShaderLanguage::TYPE_VEC3);
|
||||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["EXTENTS"] = constt(ShaderLanguage::TYPE_VEC3);
|
||||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["SIZE"] = constt(ShaderLanguage::TYPE_VEC3);
|
||||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["SDF"] = constt(ShaderLanguage::TYPE_FLOAT);
|
||||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["ALBEDO"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[RS::SHADER_FOG].functions["fog"].built_ins["DENSITY"] = ShaderLanguage::TYPE_FLOAT;
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) = 0;
|
||||
virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) = 0;
|
||||
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) = 0;
|
||||
virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) = 0;
|
||||
virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) = 0;
|
||||
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) = 0;
|
||||
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) = 0;
|
||||
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
|
||||
|
@ -121,7 +121,7 @@ public:
|
|||
virtual AABB reflection_probe_get_aabb(RID p_probe) const = 0;
|
||||
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const = 0;
|
||||
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const = 0;
|
||||
virtual Vector3 reflection_probe_get_extents(RID p_probe) const = 0;
|
||||
virtual Vector3 reflection_probe_get_size(RID p_probe) const = 0;
|
||||
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const = 0;
|
||||
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const = 0;
|
||||
virtual bool reflection_probe_renders_shadows(RID p_probe) const = 0;
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
virtual void decal_initialize(RID p_rid) = 0;
|
||||
virtual void decal_free(RID p_rid) = 0;
|
||||
|
||||
virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) = 0;
|
||||
virtual void decal_set_size(RID p_decal, const Vector3 &p_size) = 0;
|
||||
virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) = 0;
|
||||
virtual void decal_set_emission_energy(RID p_decal, float p_energy) = 0;
|
||||
virtual void decal_set_albedo_mix(RID p_decal, float p_mix) = 0;
|
||||
|
|
|
@ -1968,7 +1968,7 @@ void RenderingServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("reflection_probe_set_ambient_color", "probe", "color"), &RenderingServer::reflection_probe_set_ambient_color);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_ambient_energy", "probe", "energy"), &RenderingServer::reflection_probe_set_ambient_energy);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_max_distance", "probe", "distance"), &RenderingServer::reflection_probe_set_max_distance);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_extents", "probe", "extents"), &RenderingServer::reflection_probe_set_extents);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_size", "probe", "size"), &RenderingServer::reflection_probe_set_size);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_origin_offset", "probe", "offset"), &RenderingServer::reflection_probe_set_origin_offset);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_as_interior", "probe", "enable"), &RenderingServer::reflection_probe_set_as_interior);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_box_projection", "probe", "enable"), &RenderingServer::reflection_probe_set_enable_box_projection);
|
||||
|
@ -1987,7 +1987,7 @@ void RenderingServer::_bind_methods() {
|
|||
/* DECAL */
|
||||
|
||||
ClassDB::bind_method(D_METHOD("decal_create"), &RenderingServer::decal_create);
|
||||
ClassDB::bind_method(D_METHOD("decal_set_extents", "decal", "extents"), &RenderingServer::decal_set_extents);
|
||||
ClassDB::bind_method(D_METHOD("decal_set_size", "decal", "size"), &RenderingServer::decal_set_size);
|
||||
ClassDB::bind_method(D_METHOD("decal_set_texture", "decal", "type", "texture"), &RenderingServer::decal_set_texture);
|
||||
ClassDB::bind_method(D_METHOD("decal_set_emission_energy", "decal", "energy"), &RenderingServer::decal_set_emission_energy);
|
||||
ClassDB::bind_method(D_METHOD("decal_set_albedo_mix", "decal", "albedo_mix"), &RenderingServer::decal_set_albedo_mix);
|
||||
|
@ -2147,7 +2147,7 @@ void RenderingServer::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("fog_volume_create"), &RenderingServer::fog_volume_create);
|
||||
ClassDB::bind_method(D_METHOD("fog_volume_set_shape", "fog_volume", "shape"), &RenderingServer::fog_volume_set_shape);
|
||||
ClassDB::bind_method(D_METHOD("fog_volume_set_extents", "fog_volume", "extents"), &RenderingServer::fog_volume_set_extents);
|
||||
ClassDB::bind_method(D_METHOD("fog_volume_set_size", "fog_volume", "size"), &RenderingServer::fog_volume_set_size);
|
||||
ClassDB::bind_method(D_METHOD("fog_volume_set_material", "fog_volume", "material"), &RenderingServer::fog_volume_set_material);
|
||||
|
||||
BIND_ENUM_CONSTANT(FOG_VOLUME_SHAPE_ELLIPSOID);
|
||||
|
|
|
@ -541,7 +541,7 @@ public:
|
|||
virtual void reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) = 0;
|
||||
virtual void reflection_probe_set_ambient_energy(RID p_probe, float p_energy) = 0;
|
||||
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) = 0;
|
||||
virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) = 0;
|
||||
virtual void reflection_probe_set_size(RID p_probe, const Vector3 &p_size) = 0;
|
||||
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) = 0;
|
||||
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) = 0;
|
||||
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
|
||||
|
@ -561,7 +561,7 @@ public:
|
|||
};
|
||||
|
||||
virtual RID decal_create() = 0;
|
||||
virtual void decal_set_extents(RID p_decal, const Vector3 &p_extents) = 0;
|
||||
virtual void decal_set_size(RID p_decal, const Vector3 &p_size) = 0;
|
||||
virtual void decal_set_texture(RID p_decal, DecalTexture p_type, RID p_texture) = 0;
|
||||
virtual void decal_set_emission_energy(RID p_decal, float p_energy) = 0;
|
||||
virtual void decal_set_albedo_mix(RID p_decal, float p_mix) = 0;
|
||||
|
@ -750,7 +750,7 @@ public:
|
|||
};
|
||||
|
||||
virtual void fog_volume_set_shape(RID p_fog_volume, FogVolumeShape p_shape) = 0;
|
||||
virtual void fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) = 0;
|
||||
virtual void fog_volume_set_size(RID p_fog_volume, const Vector3 &p_size) = 0;
|
||||
virtual void fog_volume_set_material(RID p_fog_volume, RID p_material) = 0;
|
||||
|
||||
/* VISIBILITY NOTIFIER API */
|
||||
|
|
Loading…
Reference in a new issue