diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/area.cpp | 6 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 4 | ||||
-rw-r--r-- | scene/3d/light.cpp | 6 | ||||
-rw-r--r-- | scene/3d/light.h | 2 | ||||
-rw-r--r-- | scene/3d/navigation_mesh.cpp | 230 | ||||
-rw-r--r-- | scene/3d/navigation_mesh.h | 81 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 5 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 11 |
8 files changed, 337 insertions, 8 deletions
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 217cb71230..266bc5e381 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -729,6 +729,12 @@ void Area::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "reverb_bus_name", PROPERTY_HINT_ENUM, ""), "set_reverb_bus", "get_reverb_bus"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_amount", "get_reverb_amount"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "reverb_bus_uniformity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_reverb_uniformity", "get_reverb_uniformity"); + + BIND_ENUM_CONSTANT(SPACE_OVERRIDE_DISABLED); + BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE); + BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE_REPLACE); + BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE); + BIND_ENUM_CONSTANT(SPACE_OVERRIDE_REPLACE_COMBINE); } Area::Area() diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index 966dd88a2c..147d3bf115 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -184,7 +184,7 @@ int ARVRController::get_joystick_id() const { int ARVRController::is_button_pressed(int p_button) const { int joy_id = get_joystick_id(); - if (joy_id == 0) { + if (joy_id == -1) { return false; }; @@ -193,7 +193,7 @@ int ARVRController::is_button_pressed(int p_button) const { float ARVRController::get_joystick_axis(int p_axis) const { int joy_id = get_joystick_id(); - if (joy_id == 0) { + if (joy_id == -1) { return 0.0; }; diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 096f787873..7402e664d9 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -405,6 +405,12 @@ void OmniLight::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_attenuation", PROPERTY_HINT_EXP_EASING), "set_param", "get_param", PARAM_ATTENUATION); ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_mode", PROPERTY_HINT_ENUM, "Dual Paraboloid,Cube"), "set_shadow_mode", "get_shadow_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_detail", PROPERTY_HINT_ENUM, "Vertical,Horizontal"), "set_shadow_detail", "get_shadow_detail"); + + BIND_ENUM_CONSTANT(SHADOW_DUAL_PARABOLOID); + BIND_ENUM_CONSTANT(SHADOW_CUBE); + + BIND_ENUM_CONSTANT(SHADOW_DETAIL_VERTICAL); + BIND_ENUM_CONSTANT(SHADOW_DETAIL_HORIZONTAL); } OmniLight::OmniLight() diff --git a/scene/3d/light.h b/scene/3d/light.h index 6aa0220265..2f3ac8a5e7 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -150,7 +150,7 @@ public: void set_shadow_mode(ShadowMode p_mode); ShadowMode get_shadow_mode() const; - void set_shadow_depth_range(ShadowDepthRange p_mode); + void set_shadow_depth_range(ShadowDepthRange p_range); ShadowDepthRange get_shadow_depth_range() const; void set_blend_splits(bool p_enable); diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 7a55f956e0..40750cdfe8 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -63,6 +63,143 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) { } } +void NavigationMesh::set_sample_partition_type(int p_value) { + ERR_FAIL_COND(p_value >= SAMPLE_PARTITION_MAX); + partition_type = static_cast<SamplePartitionType>(p_value); +} + +int NavigationMesh::get_sample_partition_type() const { + return static_cast<int>(partition_type); +} + +void NavigationMesh::set_cell_size(float p_value) { + cell_size = p_value; +} + +float NavigationMesh::get_cell_size() const { + return cell_size; +} + +void NavigationMesh::set_cell_height(float p_value) { + cell_height = p_value; +} + +float NavigationMesh::get_cell_height() const { + return cell_height; +} + +void NavigationMesh::set_agent_height(float p_value) { + agent_height = p_value; +} + +float NavigationMesh::get_agent_height() const { + return agent_height; +} + +void NavigationMesh::set_agent_radius(float p_value) { + agent_radius = p_value; +} + +float NavigationMesh::get_agent_radius() { + return agent_radius; +} + +void NavigationMesh::set_agent_max_climb(float p_value) { + agent_max_climb = p_value; +} + +float NavigationMesh::get_agent_max_climb() const { + return agent_max_climb; +} + +void NavigationMesh::set_agent_max_slope(float p_value) { + agent_max_slope = p_value; +} + +float NavigationMesh::get_agent_max_slope() const { + return agent_max_slope; +} + +void NavigationMesh::set_region_min_size(float p_value) { + region_min_size = p_value; +} + +float NavigationMesh::get_region_min_size() const { + return region_min_size; +} + +void NavigationMesh::set_region_merge_size(float p_value) { + region_merge_size = p_value; +} + +float NavigationMesh::get_region_merge_size() const { + return region_merge_size; +} + +void NavigationMesh::set_edge_max_length(float p_value) { + edge_max_length = p_value; +} + +float NavigationMesh::get_edge_max_length() const { + return edge_max_length; +} + +void NavigationMesh::set_edge_max_error(float p_value) { + edge_max_error = p_value; +} + +float NavigationMesh::get_edge_max_error() const { + return edge_max_error; +} + +void NavigationMesh::set_verts_per_poly(float p_value) { + verts_per_poly = p_value; +} + +float NavigationMesh::get_verts_per_poly() const { + return verts_per_poly; +} + +void NavigationMesh::set_detail_sample_distance(float p_value) { + detail_sample_distance = p_value; +} + +float NavigationMesh::get_detail_sample_distance() const { + return detail_sample_distance; +} + +void NavigationMesh::set_detail_sample_max_error(float p_value) { + detail_sample_max_error = p_value; +} + +float NavigationMesh::get_detail_sample_max_error() const { + return detail_sample_max_error; +} + +void NavigationMesh::set_filter_low_hanging_obstacles(bool p_value) { + filter_low_hanging_obstacles = p_value; +} + +bool NavigationMesh::get_filter_low_hanging_obstacles() const { + return filter_low_hanging_obstacles; +} + +void NavigationMesh::set_filter_ledge_spans(bool p_value) { + filter_ledge_spans = p_value; +} + +bool NavigationMesh::get_filter_ledge_spans() const { + return filter_ledge_spans; +} + +void NavigationMesh::set_filter_walkable_low_height_spans(bool p_value) { + filter_walkable_low_height_spans = p_value; +} + +bool NavigationMesh::get_filter_walkable_low_height_spans() const { + return filter_walkable_low_height_spans; +} + void NavigationMesh::set_vertices(const PoolVector<Vector3> &p_vertices) { vertices = p_vertices; @@ -199,6 +336,56 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() { } void NavigationMesh::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_sample_partition_type", "sample_partition_type"), &NavigationMesh::set_sample_partition_type); + ClassDB::bind_method(D_METHOD("get_sample_partition_type"), &NavigationMesh::get_sample_partition_type); + + ClassDB::bind_method(D_METHOD("set_cell_size", "cell_size"), &NavigationMesh::set_cell_size); + ClassDB::bind_method(D_METHOD("get_cell_size"), &NavigationMesh::get_cell_size); + + ClassDB::bind_method(D_METHOD("set_cell_height", "cell_height"), &NavigationMesh::set_cell_height); + ClassDB::bind_method(D_METHOD("get_cell_height"), &NavigationMesh::get_cell_height); + + ClassDB::bind_method(D_METHOD("set_agent_height", "agent_height"), &NavigationMesh::set_agent_height); + ClassDB::bind_method(D_METHOD("get_agent_height"), &NavigationMesh::get_agent_height); + + ClassDB::bind_method(D_METHOD("set_agent_radius", "agent_radius"), &NavigationMesh::set_agent_radius); + ClassDB::bind_method(D_METHOD("get_agent_radius"), &NavigationMesh::get_agent_radius); + + ClassDB::bind_method(D_METHOD("set_agent_max_climb", "agent_max_climb"), &NavigationMesh::set_agent_max_climb); + ClassDB::bind_method(D_METHOD("get_agent_max_climb"), &NavigationMesh::get_agent_max_climb); + + ClassDB::bind_method(D_METHOD("set_agent_max_slope", "agent_max_slope"), &NavigationMesh::set_agent_max_slope); + ClassDB::bind_method(D_METHOD("get_agent_max_slope"), &NavigationMesh::get_agent_max_slope); + + ClassDB::bind_method(D_METHOD("set_region_min_size", "region_min_size"), &NavigationMesh::set_region_min_size); + ClassDB::bind_method(D_METHOD("get_region_min_size"), &NavigationMesh::get_region_min_size); + + ClassDB::bind_method(D_METHOD("set_region_merge_size", "region_merge_size"), &NavigationMesh::set_region_merge_size); + ClassDB::bind_method(D_METHOD("get_region_merge_size"), &NavigationMesh::get_region_merge_size); + + ClassDB::bind_method(D_METHOD("set_edge_max_length", "edge_max_length"), &NavigationMesh::set_edge_max_length); + ClassDB::bind_method(D_METHOD("get_edge_max_length"), &NavigationMesh::get_edge_max_length); + + ClassDB::bind_method(D_METHOD("set_edge_max_error", "edge_max_error"), &NavigationMesh::set_edge_max_error); + ClassDB::bind_method(D_METHOD("get_edge_max_error"), &NavigationMesh::get_edge_max_error); + + ClassDB::bind_method(D_METHOD("set_verts_per_poly", "verts_per_poly"), &NavigationMesh::set_verts_per_poly); + ClassDB::bind_method(D_METHOD("get_verts_per_poly"), &NavigationMesh::get_verts_per_poly); + + ClassDB::bind_method(D_METHOD("set_detail_sample_distance", "detail_sample_dist"), &NavigationMesh::set_detail_sample_distance); + ClassDB::bind_method(D_METHOD("get_detail_sample_distance"), &NavigationMesh::get_detail_sample_distance); + + ClassDB::bind_method(D_METHOD("set_detail_sample_max_error", "detail_sample_max_error"), &NavigationMesh::set_detail_sample_max_error); + ClassDB::bind_method(D_METHOD("get_detail_sample_max_error"), &NavigationMesh::get_detail_sample_max_error); + + ClassDB::bind_method(D_METHOD("set_filter_low_hanging_obstacles", "filter_low_hanging_obstacles"), &NavigationMesh::set_filter_low_hanging_obstacles); + ClassDB::bind_method(D_METHOD("get_filter_low_hanging_obstacles"), &NavigationMesh::get_filter_low_hanging_obstacles); + + ClassDB::bind_method(D_METHOD("set_filter_ledge_spans", "filter_ledge_spans"), &NavigationMesh::set_filter_ledge_spans); + ClassDB::bind_method(D_METHOD("get_filter_ledge_spans"), &NavigationMesh::get_filter_ledge_spans); + + ClassDB::bind_method(D_METHOD("set_filter_walkable_low_height_spans", "filter_walkable_low_height_spans"), &NavigationMesh::set_filter_walkable_low_height_spans); + ClassDB::bind_method(D_METHOD("get_filter_walkable_low_height_spans"), &NavigationMesh::get_filter_walkable_low_height_spans); ClassDB::bind_method(D_METHOD("set_vertices", "vertices"), &NavigationMesh::set_vertices); ClassDB::bind_method(D_METHOD("get_vertices"), &NavigationMesh::get_vertices); @@ -213,11 +400,54 @@ void NavigationMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_polygons", "polygons"), &NavigationMesh::_set_polygons); ClassDB::bind_method(D_METHOD("_get_polygons"), &NavigationMesh::_get_polygons); + BIND_CONSTANT(SAMPLE_PARTITION_WATERSHED); + BIND_CONSTANT(SAMPLE_PARTITION_MONOTONE); + BIND_CONSTANT(SAMPLE_PARTITION_LAYERS); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_vertices", "get_vertices"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_polygons", "_get_polygons"); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type/sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type"); + + ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/size", PROPERTY_HINT_RANGE, "0.1,1.0,0.01"), "set_cell_size", "get_cell_size"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/height", PROPERTY_HINT_RANGE, "0.1,1.0,0.01"), "set_cell_height", "get_cell_height"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/height", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_height", "get_agent_height"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/radius", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_radius", "get_agent_radius"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_climb", PROPERTY_HINT_RANGE, "0.1,5.0,0.01"), "set_agent_max_climb", "get_agent_max_climb"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_slope", PROPERTY_HINT_RANGE, "0.0,90.0,0.1"), "set_agent_max_slope", "get_agent_max_slope"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01"), "set_region_min_size", "get_region_min_size"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01"), "set_region_merge_size", "get_region_merge_size"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01"), "set_edge_max_length", "get_edge_max_length"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01"), "set_edge_max_error", "get_edge_max_error"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0"), "set_verts_per_poly", "get_verts_per_poly"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.0,16.0,0.01"), "set_detail_sample_distance", "get_detail_sample_distance"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01"), "set_detail_sample_max_error", "get_detail_sample_max_error"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/ledge_spans"), "set_filter_ledge_spans", "get_filter_ledge_spans"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/filter_walkable_low_height_spans"), "set_filter_walkable_low_height_spans", "get_filter_walkable_low_height_spans"); } NavigationMesh::NavigationMesh() { + cell_size = 0.3f; + cell_height = 0.2f; + agent_height = 2.0f; + agent_radius = 0.6f; + agent_max_climb = 0.9f; + agent_max_slope = 45.0f; + region_min_size = 8.0f; + region_merge_size = 20.0f; + edge_max_length = 12.0f; + edge_max_error = 1.3f; + verts_per_poly = 6.0f; + detail_sample_distance = 6.0f; + detail_sample_max_error = 1.0f; + + partition_type = SAMPLE_PARTITION_WATERSHED; + + filter_low_hanging_obstacles = false; + filter_ledge_spans = false; + filter_walkable_low_height_spans = false; } void NavigationMeshInstance::set_enabled(bool p_enabled) { diff --git a/scene/3d/navigation_mesh.h b/scene/3d/navigation_mesh.h index 36fe3ee34b..dd5ed79500 100644 --- a/scene/3d/navigation_mesh.h +++ b/scene/3d/navigation_mesh.h @@ -61,6 +61,87 @@ protected: Array _get_polygons() const; public: + enum SamplePartitionType { + SAMPLE_PARTITION_WATERSHED = 0, + SAMPLE_PARTITION_MONOTONE, + SAMPLE_PARTITION_LAYERS, + SAMPLE_PARTITION_MAX + }; + +protected: + float cell_size; + float cell_height; + float agent_height; + float agent_radius; + float agent_max_climb; + float agent_max_slope; + float region_min_size; + float region_merge_size; + float edge_max_length; + float edge_max_error; + float verts_per_poly; + float detail_sample_distance; + float detail_sample_max_error; + + SamplePartitionType partition_type; + + bool filter_low_hanging_obstacles; + bool filter_ledge_spans; + bool filter_walkable_low_height_spans; + +public: + // Recast settings + void set_sample_partition_type(int p_value); + int get_sample_partition_type() const; + + void set_cell_size(float p_value); + float get_cell_size() const; + + void set_cell_height(float p_value); + float get_cell_height() const; + + void set_agent_height(float p_value); + float get_agent_height() const; + + void set_agent_radius(float p_value); + float get_agent_radius(); + + void set_agent_max_climb(float p_value); + float get_agent_max_climb() const; + + void set_agent_max_slope(float p_value); + float get_agent_max_slope() const; + + void set_region_min_size(float p_value); + float get_region_min_size() const; + + void set_region_merge_size(float p_value); + float get_region_merge_size() const; + + void set_edge_max_length(float p_value); + float get_edge_max_length() const; + + void set_edge_max_error(float p_value); + float get_edge_max_error() const; + + void set_verts_per_poly(float p_value); + float get_verts_per_poly() const; + + void set_detail_sample_distance(float p_value); + float get_detail_sample_distance() const; + + void set_detail_sample_max_error(float p_value); + float get_detail_sample_max_error() const; + + void set_filter_low_hanging_obstacles(bool p_value); + bool get_filter_low_hanging_obstacles() const; + + void set_filter_ledge_spans(bool p_value); + bool get_filter_ledge_spans() const; + + void set_filter_walkable_low_height_spans(bool p_value); + bool get_filter_walkable_low_height_spans() const; + void create_from_mesh(const Ref<Mesh> &p_mesh); void set_vertices(const PoolVector<Vector3> &p_vertices); diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 7525eb5069..6551deabf2 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -874,6 +874,11 @@ void RigidBody::_bind_methods() { BIND_ENUM_CONSTANT(MODE_KINEMATIC); BIND_ENUM_CONSTANT(MODE_RIGID); BIND_ENUM_CONSTANT(MODE_CHARACTER); + + BIND_ENUM_CONSTANT(AXIS_LOCK_DISABLED); + BIND_ENUM_CONSTANT(AXIS_LOCK_X); + BIND_ENUM_CONSTANT(AXIS_LOCK_Y); + BIND_ENUM_CONSTANT(AXIS_LOCK_Z); } RigidBody::RigidBody() diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 0464a82f65..fa35d982eb 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -288,12 +288,13 @@ void GeometryInstance::_bind_methods() { //ADD_SIGNAL( MethodInfo("visibility_changed")); - BIND_CONSTANT(FLAG_MAX); + BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_OFF); + BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_ON); + BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED); + BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY); - BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF); - BIND_CONSTANT(SHADOW_CASTING_SETTING_ON); - BIND_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED); - BIND_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY); + BIND_ENUM_CONSTANT(FLAG_USE_BAKED_LIGHT); + BIND_ENUM_CONSTANT(FLAG_MAX); } GeometryInstance::GeometryInstance() { |