diff options
author | jfons <joan.fonssanchez@gmail.com> | 2021-05-09 18:23:20 +0200 |
---|---|---|
committer | jfons <joan.fonssanchez@gmail.com> | 2021-06-14 12:17:11 +0200 |
commit | 3a53ae5d9fe3d8b3dcc686c6a32510e0fe53b19e (patch) | |
tree | f4201a9212a4d10309af2067899d0935ee86cd5f /doc/classes | |
parent | 12e0f10c74e9619262f1edcfdc1840432ada0565 (diff) |
Implement visibility range and dependencies.
This commit adds the following properties to GeometryInstance3D: `visibility_range_begin`,
`visibility_range_begin_margin`, `visibility_range_end`, `visibility_range_end_margin`.
Together they define a range in which the GeometryInstance3D will be visible from the camera,
taking hysteresis into account for state changes. A begin or end value of 0 will be ignored,
so the visibility range can be open-ended in both directions.
This commit also adds the `visibility_parent` property to 'Node3D'.
Which defines the visibility parents of the node and its subtree (until
another parent is defined).
Visual instances with a visibility parent will only be visible when the parent, and all of its
ancestors recursively, are hidden because they are closer to the camera than their respective
`visibility_range_begin` thresholds.
Combining visibility ranges and visibility parents users can set-up a quick HLOD system
that shows high detail meshes when close (i.e buildings, trees) and merged low detail meshes
for far away groups (i.e. cities, woods).
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/GeometryInstance3D.xml | 26 | ||||
-rw-r--r-- | doc/classes/Node3D.xml | 3 | ||||
-rw-r--r-- | doc/classes/RenderingServer.xml | 54 |
3 files changed, 41 insertions, 42 deletions
diff --git a/doc/classes/GeometryInstance3D.xml b/doc/classes/GeometryInstance3D.xml index b2c3bfc3ed..667ca2dacf 100644 --- a/doc/classes/GeometryInstance3D.xml +++ b/doc/classes/GeometryInstance3D.xml @@ -52,25 +52,21 @@ </member> <member name="lod_bias" type="float" setter="set_lod_bias" getter="get_lod_bias" default="1.0"> </member> - <member name="lod_max_distance" type="float" setter="set_lod_max_distance" getter="get_lod_max_distance" default="0.0"> - The GeometryInstance3D's max LOD distance. - [b]Note:[/b] This property currently has no effect. + <member name="material_override" type="Material" setter="set_material_override" getter="get_material_override"> + The material override for the whole geometry. + If a material is assigned to this property, it will be used instead of any material set in any material slot of the mesh. </member> - <member name="lod_max_hysteresis" type="float" setter="set_lod_max_hysteresis" getter="get_lod_max_hysteresis" default="0.0"> - The GeometryInstance3D's max LOD margin. - [b]Note:[/b] This property currently has no effect. + <member name="visibility_range_begin" type="float" setter="set_visibility_range_begin" getter="get_visibility_range_begin" default="0.0"> + Starting distance from which the GeometryInstance3D will be visible, taking [member visibility_range_begin_margin] into account as well. The default value of 0 is used to disable the range check. </member> - <member name="lod_min_distance" type="float" setter="set_lod_min_distance" getter="get_lod_min_distance" default="0.0"> - The GeometryInstance3D's min LOD distance. - [b]Note:[/b] This property currently has no effect. + <member name="visibility_range_begin_margin" type="float" setter="set_visibility_range_begin_margin" getter="get_visibility_range_begin_margin" default="0.0"> + Margin for the [member visibility_range_begin] threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the [member visibility_range_begin] threshold by this amount. </member> - <member name="lod_min_hysteresis" type="float" setter="set_lod_min_hysteresis" getter="get_lod_min_hysteresis" default="0.0"> - The GeometryInstance3D's min LOD margin. - [b]Note:[/b] This property currently has no effect. + <member name="visibility_range_end" type="float" setter="set_visibility_range_end" getter="get_visibility_range_end" default="0.0"> + Distance from which the GeometryInstance3D will be hidden, taking [member visibility_range_end_margin] into account as well. The default value of 0 is used to disable the range check.. </member> - <member name="material_override" type="Material" setter="set_material_override" getter="get_material_override"> - The material override for the whole geometry. - If a material is assigned to this property, it will be used instead of any material set in any material slot of the mesh. + <member name="visibility_range_end_margin" type="float" setter="set_visibility_range_end_margin" getter="get_visibility_range_end_margin" default="0.0"> + Margin for the [member visibility_range_end] threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the [member visibility_range_end] threshold by this amount. </member> </members> <constants> diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml index a6237708c6..ed1899ca74 100644 --- a/doc/classes/Node3D.xml +++ b/doc/classes/Node3D.xml @@ -310,6 +310,9 @@ <member name="transform" type="Transform3D" setter="set_transform" getter="get_transform" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )"> Local space [Transform3D] of this node, with respect to the parent node. </member> + <member name="visibility_parent" type="NodePath" setter="set_visibility_parent" getter="get_visibility_parent" default="NodePath("")"> + Defines the visibility range parent for this node and its subtree. The visibility parent must be a GeometryInstance3D. Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependant instances will not take the hidden node or its ancestors into account. + </member> <member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true"> If [code]true[/code], this node is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]). </member> diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index ba19176788..9b9644093f 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -1175,17 +1175,6 @@ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> - <method name="instance_geometry_set_as_instance_lod"> - <return type="void"> - </return> - <argument index="0" name="instance" type="RID"> - </argument> - <argument index="1" name="as_lod_of_instance" type="RID"> - </argument> - <description> - Not implemented in Godot 3.x. - </description> - </method> <method name="instance_geometry_set_cast_shadows_setting"> <return type="void"> </return> @@ -1197,45 +1186,45 @@ Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance3D.cast_shadow]. </description> </method> - <method name="instance_geometry_set_draw_range"> + <method name="instance_geometry_set_flag"> <return type="void"> </return> <argument index="0" name="instance" type="RID"> </argument> - <argument index="1" name="min" type="float"> - </argument> - <argument index="2" name="max" type="float"> - </argument> - <argument index="3" name="min_margin" type="float"> + <argument index="1" name="flag" type="int" enum="RenderingServer.InstanceFlags"> </argument> - <argument index="4" name="max_margin" type="float"> + <argument index="2" name="enabled" type="bool"> </argument> <description> - Not implemented in Godot 3.x. + Sets the flag for a given [enum InstanceFlags]. See [enum InstanceFlags] for more details. </description> </method> - <method name="instance_geometry_set_flag"> + <method name="instance_geometry_set_material_override"> <return type="void"> </return> <argument index="0" name="instance" type="RID"> </argument> - <argument index="1" name="flag" type="int" enum="RenderingServer.InstanceFlags"> - </argument> - <argument index="2" name="enabled" type="bool"> + <argument index="1" name="material" type="RID"> </argument> <description> - Sets the flag for a given [enum InstanceFlags]. See [enum InstanceFlags] for more details. + Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance3D.material_override]. </description> </method> - <method name="instance_geometry_set_material_override"> + <method name="instance_geometry_set_visibility_range"> <return type="void"> </return> <argument index="0" name="instance" type="RID"> </argument> - <argument index="1" name="material" type="RID"> + <argument index="1" name="min" type="float"> + </argument> + <argument index="2" name="max" type="float"> + </argument> + <argument index="3" name="min_margin" type="float"> + </argument> + <argument index="4" name="max_margin" type="float"> </argument> <description> - Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance3D.material_override]. + Sets the visibility range values for the given geometry instance. Equivalent to [member GeometryInstance3D.visibility_range_begin] and related properties. </description> </method> <method name="instance_set_base"> @@ -1341,6 +1330,17 @@ Sets the world space transform of the instance. Equivalent to [member Node3D.transform]. </description> </method> + <method name="instance_set_visibility_parent"> + <return type="void"> + </return> + <argument index="0" name="instance" type="RID"> + </argument> + <argument index="1" name="parent" type="RID"> + </argument> + <description> + Sets the visibility parent for the given instance. Equivalent to [member Node3D.visibility_parent]. + </description> + </method> <method name="instance_set_visible"> <return type="void"> </return> |