Expose GeometryInstance3D.custom_aabb property
This commit is contained in:
parent
1c5cfc4675
commit
5d51478d70
|
@ -16,13 +16,6 @@
|
||||||
Get the value of a shader parameter as set on this instance.
|
Get the value of a shader parameter as set on this instance.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_custom_aabb">
|
|
||||||
<return type="void" />
|
|
||||||
<param index="0" name="aabb" type="AABB" />
|
|
||||||
<description>
|
|
||||||
Overrides the bounding box of this node with a custom one. To remove it, set an [AABB] with all fields set to zero.
|
|
||||||
</description>
|
|
||||||
</method>
|
|
||||||
<method name="set_instance_shader_parameter">
|
<method name="set_instance_shader_parameter">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="name" type="StringName" />
|
<param index="0" name="name" type="StringName" />
|
||||||
|
@ -36,6 +29,9 @@
|
||||||
<member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance3D.ShadowCastingSetting" default="1">
|
<member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance3D.ShadowCastingSetting" default="1">
|
||||||
The selected shadow casting flag. See [enum ShadowCastingSetting] for possible values.
|
The selected shadow casting flag. See [enum ShadowCastingSetting] for possible values.
|
||||||
</member>
|
</member>
|
||||||
|
<member name="custom_aabb" type="AABB" setter="set_custom_aabb" getter="get_custom_aabb" default="AABB(0, 0, 0, 0, 0, 0)">
|
||||||
|
Overrides the bounding box of this node with a custom one. This can be used to avoid the expensive [AABB] recalculation that happens when a skeleton is used with a [MeshInstance3D] or to have fine control over the [MeshInstance3D]'s bounding box. To remove this, set value to an [AABB] with all fields set to zero.
|
||||||
|
</member>
|
||||||
<member name="extra_cull_margin" type="float" setter="set_extra_cull_margin" getter="get_extra_cull_margin" default="0.0">
|
<member name="extra_cull_margin" type="float" setter="set_extra_cull_margin" getter="get_extra_cull_margin" default="0.0">
|
||||||
The extra distance added to the GeometryInstance3D's bounding box ([AABB]) to increase its cull box.
|
The extra distance added to the GeometryInstance3D's bounding box ([AABB]) to increase its cull box.
|
||||||
</member>
|
</member>
|
||||||
|
|
|
@ -1559,7 +1559,7 @@
|
||||||
<param index="0" name="instance" type="RID" />
|
<param index="0" name="instance" type="RID" />
|
||||||
<param index="1" name="aabb" type="AABB" />
|
<param index="1" name="aabb" type="AABB" />
|
||||||
<description>
|
<description>
|
||||||
Sets a custom AABB to use when culling objects from the view frustum. Equivalent to [method GeometryInstance3D.set_custom_aabb].
|
Sets a custom AABB to use when culling objects from the view frustum. Equivalent to setting [member GeometryInstance3D.custom_aabb].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="instance_set_extra_visibility_margin">
|
<method name="instance_set_extra_visibility_margin">
|
||||||
|
|
|
@ -331,8 +331,16 @@ Variant GeometryInstance3D::get_instance_shader_parameter(const StringName &p_na
|
||||||
return RS::get_singleton()->instance_geometry_get_shader_parameter(get_instance(), p_name);
|
return RS::get_singleton()->instance_geometry_get_shader_parameter(get_instance(), p_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryInstance3D::set_custom_aabb(AABB aabb) {
|
void GeometryInstance3D::set_custom_aabb(AABB p_aabb) {
|
||||||
RS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb);
|
if (p_aabb == custom_aabb) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
custom_aabb = p_aabb;
|
||||||
|
RS::get_singleton()->instance_set_custom_aabb(get_instance(), custom_aabb);
|
||||||
|
}
|
||||||
|
|
||||||
|
AABB GeometryInstance3D::get_custom_aabb() const {
|
||||||
|
return custom_aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryInstance3D::set_lightmap_scale(LightmapScale p_scale) {
|
void GeometryInstance3D::set_lightmap_scale(LightmapScale p_scale) {
|
||||||
|
@ -442,6 +450,7 @@ void GeometryInstance3D::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("is_ignoring_occlusion_culling"), &GeometryInstance3D::is_ignoring_occlusion_culling);
|
ClassDB::bind_method(D_METHOD("is_ignoring_occlusion_culling"), &GeometryInstance3D::is_ignoring_occlusion_culling);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &GeometryInstance3D::set_custom_aabb);
|
ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &GeometryInstance3D::set_custom_aabb);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_custom_aabb"), &GeometryInstance3D::get_custom_aabb);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance3D::get_aabb);
|
ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance3D::get_aabb);
|
||||||
|
|
||||||
|
@ -451,6 +460,7 @@ void GeometryInstance3D::_bind_methods() {
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "transparency", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_transparency", "get_transparency");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "transparency", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_transparency", "get_transparency");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), "set_cast_shadows_setting", "get_cast_shadows_setting");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), "set_cast_shadows_setting", "get_cast_shadows_setting");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "extra_cull_margin", PROPERTY_HINT_RANGE, "0,16384,0.01,suffix:m"), "set_extra_cull_margin", "get_extra_cull_margin");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "extra_cull_margin", PROPERTY_HINT_RANGE, "0,16384,0.01,suffix:m"), "set_extra_cull_margin", "get_extra_cull_margin");
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, "suffix:m"), "set_custom_aabb", "get_custom_aabb");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lod_bias", PROPERTY_HINT_RANGE, "0.001,128,0.001"), "set_lod_bias", "get_lod_bias");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lod_bias", PROPERTY_HINT_RANGE, "0.001,128,0.001"), "set_lod_bias", "get_lod_bias");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ignore_occlusion_culling"), "set_ignore_occlusion_culling", "is_ignoring_occlusion_culling");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ignore_occlusion_culling"), "set_ignore_occlusion_culling", "is_ignoring_occlusion_culling");
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,7 @@ private:
|
||||||
mutable HashMap<StringName, StringName> instance_shader_parameter_property_remap;
|
mutable HashMap<StringName, StringName> instance_shader_parameter_property_remap;
|
||||||
|
|
||||||
float extra_cull_margin = 0.0;
|
float extra_cull_margin = 0.0;
|
||||||
|
AABB custom_aabb;
|
||||||
LightmapScale lightmap_scale = LIGHTMAP_SCALE_1X;
|
LightmapScale lightmap_scale = LIGHTMAP_SCALE_1X;
|
||||||
GIMode gi_mode = GI_MODE_STATIC;
|
GIMode gi_mode = GI_MODE_STATIC;
|
||||||
bool ignore_occlusion_culling = false;
|
bool ignore_occlusion_culling = false;
|
||||||
|
@ -177,7 +178,8 @@ public:
|
||||||
void set_instance_shader_parameter(const StringName &p_name, const Variant &p_value);
|
void set_instance_shader_parameter(const StringName &p_name, const Variant &p_value);
|
||||||
Variant get_instance_shader_parameter(const StringName &p_name) const;
|
Variant get_instance_shader_parameter(const StringName &p_name) const;
|
||||||
|
|
||||||
void set_custom_aabb(AABB aabb);
|
void set_custom_aabb(AABB p_aabb);
|
||||||
|
AABB get_custom_aabb() const;
|
||||||
|
|
||||||
void set_ignore_occlusion_culling(bool p_enabled);
|
void set_ignore_occlusion_culling(bool p_enabled);
|
||||||
bool is_ignoring_occlusion_culling();
|
bool is_ignoring_occlusion_culling();
|
||||||
|
|
Loading…
Reference in New Issue