diff options
Diffstat (limited to 'scene/resources/world.cpp')
-rw-r--r-- | scene/resources/world.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index 1099852098..a7e519479f 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -262,6 +262,7 @@ RID World::get_space() const { return space; } + RID World::get_scenario() const { return scenario; @@ -305,6 +306,20 @@ Ref<Environment> World::get_fallback_environment() const { return fallback_environment; } +void World::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { + + camera_effects = p_camera_effects; + if (camera_effects.is_valid()) + VS::get_singleton()->scenario_set_camera_effects(scenario, camera_effects->get_rid()); + else + VS::get_singleton()->scenario_set_camera_effects(scenario, RID()); +} + +Ref<CameraEffects> World::get_camera_effects() const { + + return camera_effects; +} + PhysicsDirectSpaceState *World::get_direct_space_state() { return PhysicsServer::get_singleton()->space_get_direct_state(space); @@ -325,9 +340,12 @@ void World::_bind_methods() { ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment); ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment); ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment); + ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World::set_camera_effects); + ClassDB::bind_method(D_METHOD("get_camera_effects"), &World::get_camera_effects); ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects"); ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); @@ -342,9 +360,9 @@ World::World() { PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_GRAVITY, GLOBAL_DEF("physics/3d/default_gravity", 9.8)); PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF("physics/3d/default_gravity_vector", Vector3(0, -1, 0))); PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF("physics/3d/default_linear_damp", 0.1)); - ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_linear_damp", PropertyInfo(Variant::REAL, "physics/3d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); + ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_linear_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/3d/default_angular_damp", 0.1)); - ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::REAL, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); + ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); #ifdef _3D_DISABLED indexer = NULL; |