diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 7896299c24a..a24c4266eec 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -154,7 +154,7 @@ struct Vector2 { Vector2 floor() const; Vector2 snapped(const Vector2& p_by) const; - real_t get_aspect() const { return width/height; } + real_t aspect() const { return width/height; } operator String() const { return String::num(x)+", "+String::num(y); } diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 0c8b40539d4..b20f8aafd1a 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -349,7 +349,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Vector2,tangent); VCALL_LOCALMEM0R(Vector2,floor); VCALL_LOCALMEM1R(Vector2,snapped); - VCALL_LOCALMEM0R(Vector2,get_aspect); + VCALL_LOCALMEM0R(Vector2,aspect); VCALL_LOCALMEM1R(Vector2,dot); VCALL_LOCALMEM1R(Vector2,slide); VCALL_LOCALMEM1R(Vector2,reflect); @@ -1457,7 +1457,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(VECTOR2,VECTOR2,Vector2,tangent,varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,floor,varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,snapped,VECTOR2,"by",varray()); - ADDFUNC0(VECTOR2,REAL,Vector2,get_aspect,varray()); + ADDFUNC0(VECTOR2,REAL,Vector2,aspect,varray()); ADDFUNC1(VECTOR2,REAL,Vector2,dot,VECTOR2,"with",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,slide,VECTOR2,"vec",varray()); ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray()); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 50ddafc3e44..84995428501 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -373,7 +373,7 @@ Vector3 Camera::project_local_ray_normal(const Point2& p_pos) const { ray=Vector3(0,0,-1); } else { CameraMatrix cm; - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); float screen_w,screen_h; cm.get_viewport_size(screen_w,screen_h); ray=Vector3( ((cpos.x/viewport_size.width)*2.0-1.0)*screen_w, ((1.0-(cpos.y/viewport_size.height))*2.0-1.0)*screen_h,-near).normalized(); @@ -410,10 +410,10 @@ Vector3 Camera::project_ray_origin(const Point2& p_pos) const { Vector2 pos = cpos / viewport_size; float vsize,hsize; if (keep_aspect==KEEP_WIDTH) { - vsize = size/viewport_size.get_aspect(); + vsize = size/viewport_size.aspect(); hsize = size; } else { - hsize = size*viewport_size.get_aspect(); + hsize = size*viewport_size.aspect(); vsize = size; } @@ -449,9 +449,9 @@ Point2 Camera::unproject_position(const Vector3& p_pos) const { if (mode==PROJECTION_ORTHOGONAL) - cm.set_orthogonal(size,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_orthogonal(size,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); else - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); Plane p(get_camera_transform().xform_inv(p_pos),1.0); @@ -479,9 +479,9 @@ Vector3 Camera::project_position(const Point2& p_point) const { CameraMatrix cm; if (mode==PROJECTION_ORTHOGONAL) - cm.set_orthogonal(size,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_orthogonal(size,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); else - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); Size2 vp_size; cm.get_viewport_size(vp_size.x,vp_size.y); @@ -628,9 +628,9 @@ Vector Camera::get_frustum() const { Size2 viewport_size = get_viewport()->get_visible_rect().size; CameraMatrix cm; if (mode==PROJECTION_PERSPECTIVE) - cm.set_perspective(fov,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_perspective(fov,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); else - cm.set_orthogonal(size,viewport_size.get_aspect(),near,far,keep_aspect==KEEP_WIDTH); + cm.set_orthogonal(size,viewport_size.aspect(),near,far,keep_aspect==KEEP_WIDTH); return cm.get_projection_planes(get_camera_transform()); diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index d233bf1a72f..75af716f65d 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -1138,8 +1138,8 @@ void SceneTree::_update_root_rect() { Size2 viewport_size; Size2 screen_size; - float viewport_aspect = desired_res.get_aspect(); - float video_mode_aspect = video_mode.get_aspect(); + float viewport_aspect = desired_res.aspect(); + float video_mode_aspect = video_mode.aspect(); if (stretch_aspect==STRETCH_ASPECT_IGNORE || ABS(viewport_aspect - video_mode_aspect)edit_get_minimum_size(); if (uniform) { - float aspect = local_rect.size.get_aspect(); + float aspect = local_rect.size.aspect(); switch(drag) { case DRAG_BOTTOM_LEFT: case DRAG_TOP_RIGHT: { diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 358404717cb..27200a5d5da 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -468,7 +468,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3& p_pos) { CameraMatrix cm; - cm.set_perspective(get_fov(),get_size().get_aspect(),get_znear(),get_zfar()); + cm.set_perspective(get_fov(),get_size().aspect(),get_znear(),get_zfar()); float screen_w,screen_h; cm.get_viewport_size(screen_w,screen_h); @@ -1898,7 +1898,7 @@ void SpatialEditorViewport::_draw() { Size2 ss = Size2( GlobalConfig::get_singleton()->get("display/width"), GlobalConfig::get_singleton()->get("display/height") ); - float aspect = ss.get_aspect(); + float aspect = ss.aspect(); Size2 s = get_size(); Rect2 draw_rect;