From ecf8ae5bcf5d355f79bf3e84e19331f598b19622 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Wed, 16 Dec 2020 12:40:42 +0000 Subject: Rename Camera3D near and far getters and setters Renames: - get_znear() -> get_near() - set_znear() -> set_near() - get_zfar() -> get_far() - set_zfar() -> set_far() --- scene/3d/camera_3d.cpp | 24 ++++++++++++------------ scene/3d/camera_3d.h | 8 ++++---- scene/3d/xr_nodes.cpp | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'scene/3d') diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 178c5c8ff8..2e47f9f4a3 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -476,13 +476,13 @@ void Camera3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_fov"), &Camera3D::get_fov); ClassDB::bind_method(D_METHOD("get_frustum_offset"), &Camera3D::get_frustum_offset); ClassDB::bind_method(D_METHOD("get_size"), &Camera3D::get_size); - ClassDB::bind_method(D_METHOD("get_zfar"), &Camera3D::get_zfar); - ClassDB::bind_method(D_METHOD("get_znear"), &Camera3D::get_znear); + ClassDB::bind_method(D_METHOD("get_far"), &Camera3D::get_far); + ClassDB::bind_method(D_METHOD("get_near"), &Camera3D::get_near); ClassDB::bind_method(D_METHOD("set_fov"), &Camera3D::set_fov); ClassDB::bind_method(D_METHOD("set_frustum_offset"), &Camera3D::set_frustum_offset); ClassDB::bind_method(D_METHOD("set_size"), &Camera3D::set_size); - ClassDB::bind_method(D_METHOD("set_zfar"), &Camera3D::set_zfar); - ClassDB::bind_method(D_METHOD("set_znear"), &Camera3D::set_znear); + ClassDB::bind_method(D_METHOD("set_far"), &Camera3D::set_far); + ClassDB::bind_method(D_METHOD("set_near"), &Camera3D::set_near); ClassDB::bind_method(D_METHOD("get_projection"), &Camera3D::get_projection); ClassDB::bind_method(D_METHOD("set_projection"), &Camera3D::set_projection); ClassDB::bind_method(D_METHOD("set_h_offset", "ofs"), &Camera3D::set_h_offset); @@ -519,8 +519,8 @@ void Camera3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fov", PROPERTY_HINT_RANGE, "1,179,0.1"), "set_fov", "get_fov"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size", PROPERTY_HINT_RANGE, "0.1,16384,0.01"), "set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "frustum_offset"), "set_frustum_offset", "get_frustum_offset"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "near", PROPERTY_HINT_EXP_RANGE, "0.001,10,0.001,or_greater"), "set_znear", "get_znear"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "far", PROPERTY_HINT_EXP_RANGE, "0.01,4000,0.01,or_greater"), "set_zfar", "get_zfar"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "near", PROPERTY_HINT_EXP_RANGE, "0.001,10,0.001,or_greater"), "set_near", "get_near"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "far", PROPERTY_HINT_EXP_RANGE, "0.01,4000,0.01,or_greater"), "set_far", "get_far"); BIND_ENUM_CONSTANT(PROJECTION_PERSPECTIVE); BIND_ENUM_CONSTANT(PROJECTION_ORTHOGONAL); @@ -542,7 +542,7 @@ float Camera3D::get_size() const { return size; } -float Camera3D::get_znear() const { +float Camera3D::get_near() const { return near; } @@ -550,7 +550,7 @@ Vector2 Camera3D::get_frustum_offset() const { return frustum_offset; } -float Camera3D::get_zfar() const { +float Camera3D::get_far() const { return far; } @@ -572,8 +572,8 @@ void Camera3D::set_size(float p_size) { _change_notify("size"); } -void Camera3D::set_znear(float p_znear) { - near = p_znear; +void Camera3D::set_near(float p_near) { + near = p_near; _update_camera_mode(); } @@ -582,8 +582,8 @@ void Camera3D::set_frustum_offset(Vector2 p_offset) { _update_camera_mode(); } -void Camera3D::set_zfar(float p_zfar) { - far = p_zfar; +void Camera3D::set_far(float p_far) { + far = p_far; _update_camera_mode(); } diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h index 04cec92b14..8b99f78370 100644 --- a/scene/3d/camera_3d.h +++ b/scene/3d/camera_3d.h @@ -121,16 +121,16 @@ public: float get_fov() const; float get_size() const; - float get_zfar() const; - float get_znear() const; + float get_far() const; + float get_near() const; Vector2 get_frustum_offset() const; Projection get_projection() const; void set_fov(float p_fov); void set_size(float p_size); - void set_zfar(float p_zfar); - void set_znear(float p_znear); + void set_far(float p_far); + void set_near(float p_near); void set_frustum_offset(Vector2 p_offset); virtual Transform get_camera_transform() const; diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp index 763461880f..a7b3a830e0 100644 --- a/scene/3d/xr_nodes.cpp +++ b/scene/3d/xr_nodes.cpp @@ -91,9 +91,9 @@ Vector3 XRCamera3D::project_local_ray_normal(const Point2 &p_pos) const { Vector2 cpos = get_viewport()->get_camera_coords(p_pos); Vector3 ray; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); Vector2 screen_he = cm.get_viewport_half_extents(); - ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -get_znear()).normalized(); + ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -get_near()).normalized(); return ray; }; @@ -113,7 +113,7 @@ Point2 XRCamera3D::unproject_position(const Vector3 &p_pos) const { Size2 viewport_size = get_viewport()->get_visible_rect().size; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); Plane p(get_camera_transform().xform_inv(p_pos), 1.0); @@ -142,7 +142,7 @@ Vector3 XRCamera3D::project_position(const Point2 &p_point, float p_z_depth) con Size2 viewport_size = get_viewport()->get_visible_rect().size; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); Vector2 vp_he = cm.get_viewport_half_extents(); @@ -170,7 +170,7 @@ Vector XRCamera3D::get_frustum() const { ERR_FAIL_COND_V(!is_inside_world(), Vector()); Size2 viewport_size = get_viewport()->get_visible_rect().size; - CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_near(), get_far()); return cm.get_projection_planes(get_camera_transform()); }; -- cgit v1.2.3