Exposed custom AABB setter on GeometryInstance

This commit is contained in:
Marc Gilleron 2019-01-31 17:54:00 +01:00
parent c21ca98e4c
commit 5b378f408c
3 changed files with 18 additions and 0 deletions

View File

@ -11,6 +11,15 @@
<demos> <demos>
</demos> </demos>
<methods> <methods>
<method name="set_custom_aabb">
<return type="void">
</return>
<argument index="0" name="aabb" type="AABB">
</argument>
<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>
</methods> </methods>
<members> <members>
<member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance.ShadowCastingSetting"> <member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance.ShadowCastingSetting">

View File

@ -263,6 +263,11 @@ float GeometryInstance::get_extra_cull_margin() const {
return extra_cull_margin; return extra_cull_margin;
} }
void GeometryInstance::set_custom_aabb(AABB aabb) {
VS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb);
}
void GeometryInstance::_bind_methods() { void GeometryInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance::set_material_override); ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance::set_material_override);
@ -289,6 +294,8 @@ void GeometryInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_extra_cull_margin", "margin"), &GeometryInstance::set_extra_cull_margin); ClassDB::bind_method(D_METHOD("set_extra_cull_margin", "margin"), &GeometryInstance::set_extra_cull_margin);
ClassDB::bind_method(D_METHOD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin); ClassDB::bind_method(D_METHOD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin);
ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &GeometryInstance::set_custom_aabb);
ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance::get_aabb); ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance::get_aabb);
ADD_GROUP("Geometry", ""); ADD_GROUP("Geometry", "");

View File

@ -137,6 +137,8 @@ public:
void set_extra_cull_margin(float p_margin); void set_extra_cull_margin(float p_margin);
float get_extra_cull_margin() const; float get_extra_cull_margin() const;
void set_custom_aabb(AABB aabb);
GeometryInstance(); GeometryInstance();
}; };