Vector2.get_aspect() renamed to Vector2.aspect() to keep consistent method naming
This commit is contained in:
parent
00ec16e3f3
commit
6e88b1096a
6 changed files with 17 additions and 17 deletions
|
@ -154,7 +154,7 @@ struct Vector2 {
|
||||||
|
|
||||||
Vector2 floor() const;
|
Vector2 floor() const;
|
||||||
Vector2 snapped(const Vector2& p_by) 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); }
|
operator String() const { return String::num(x)+", "+String::num(y); }
|
||||||
|
|
|
@ -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,tangent);
|
||||||
VCALL_LOCALMEM0R(Vector2,floor);
|
VCALL_LOCALMEM0R(Vector2,floor);
|
||||||
VCALL_LOCALMEM1R(Vector2,snapped);
|
VCALL_LOCALMEM1R(Vector2,snapped);
|
||||||
VCALL_LOCALMEM0R(Vector2,get_aspect);
|
VCALL_LOCALMEM0R(Vector2,aspect);
|
||||||
VCALL_LOCALMEM1R(Vector2,dot);
|
VCALL_LOCALMEM1R(Vector2,dot);
|
||||||
VCALL_LOCALMEM1R(Vector2,slide);
|
VCALL_LOCALMEM1R(Vector2,slide);
|
||||||
VCALL_LOCALMEM1R(Vector2,reflect);
|
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,tangent,varray());
|
||||||
ADDFUNC0(VECTOR2,VECTOR2,Vector2,floor,varray());
|
ADDFUNC0(VECTOR2,VECTOR2,Vector2,floor,varray());
|
||||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,snapped,VECTOR2,"by",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,REAL,Vector2,dot,VECTOR2,"with",varray());
|
||||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,slide,VECTOR2,"vec",varray());
|
ADDFUNC1(VECTOR2,VECTOR2,Vector2,slide,VECTOR2,"vec",varray());
|
||||||
ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray());
|
ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray());
|
||||||
|
|
|
@ -373,7 +373,7 @@ Vector3 Camera::project_local_ray_normal(const Point2& p_pos) const {
|
||||||
ray=Vector3(0,0,-1);
|
ray=Vector3(0,0,-1);
|
||||||
} else {
|
} else {
|
||||||
CameraMatrix cm;
|
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;
|
float screen_w,screen_h;
|
||||||
cm.get_viewport_size(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();
|
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;
|
Vector2 pos = cpos / viewport_size;
|
||||||
float vsize,hsize;
|
float vsize,hsize;
|
||||||
if (keep_aspect==KEEP_WIDTH) {
|
if (keep_aspect==KEEP_WIDTH) {
|
||||||
vsize = size/viewport_size.get_aspect();
|
vsize = size/viewport_size.aspect();
|
||||||
hsize = size;
|
hsize = size;
|
||||||
} else {
|
} else {
|
||||||
hsize = size*viewport_size.get_aspect();
|
hsize = size*viewport_size.aspect();
|
||||||
vsize = size;
|
vsize = size;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -449,9 +449,9 @@ Point2 Camera::unproject_position(const Vector3& p_pos) const {
|
||||||
|
|
||||||
|
|
||||||
if (mode==PROJECTION_ORTHOGONAL)
|
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
|
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);
|
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;
|
CameraMatrix cm;
|
||||||
|
|
||||||
if (mode==PROJECTION_ORTHOGONAL)
|
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
|
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;
|
Size2 vp_size;
|
||||||
cm.get_viewport_size(vp_size.x,vp_size.y);
|
cm.get_viewport_size(vp_size.x,vp_size.y);
|
||||||
|
@ -628,9 +628,9 @@ Vector<Plane> Camera::get_frustum() const {
|
||||||
Size2 viewport_size = get_viewport()->get_visible_rect().size;
|
Size2 viewport_size = get_viewport()->get_visible_rect().size;
|
||||||
CameraMatrix cm;
|
CameraMatrix cm;
|
||||||
if (mode==PROJECTION_PERSPECTIVE)
|
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
|
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());
|
return cm.get_projection_planes(get_camera_transform());
|
||||||
|
|
||||||
|
|
|
@ -1138,8 +1138,8 @@ void SceneTree::_update_root_rect() {
|
||||||
Size2 viewport_size;
|
Size2 viewport_size;
|
||||||
Size2 screen_size;
|
Size2 screen_size;
|
||||||
|
|
||||||
float viewport_aspect = desired_res.get_aspect();
|
float viewport_aspect = desired_res.aspect();
|
||||||
float video_mode_aspect = video_mode.get_aspect();
|
float video_mode_aspect = video_mode.aspect();
|
||||||
|
|
||||||
if (stretch_aspect==STRETCH_ASPECT_IGNORE || ABS(viewport_aspect - video_mode_aspect)<CMP_EPSILON) {
|
if (stretch_aspect==STRETCH_ASPECT_IGNORE || ABS(viewport_aspect - video_mode_aspect)<CMP_EPSILON) {
|
||||||
//same aspect or ignore aspect
|
//same aspect or ignore aspect
|
||||||
|
|
|
@ -1652,7 +1652,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent& p_event) {
|
||||||
Vector2 minsize = canvas_item->edit_get_minimum_size();
|
Vector2 minsize = canvas_item->edit_get_minimum_size();
|
||||||
|
|
||||||
if (uniform) {
|
if (uniform) {
|
||||||
float aspect = local_rect.size.get_aspect();
|
float aspect = local_rect.size.aspect();
|
||||||
switch(drag) {
|
switch(drag) {
|
||||||
case DRAG_BOTTOM_LEFT:
|
case DRAG_BOTTOM_LEFT:
|
||||||
case DRAG_TOP_RIGHT: {
|
case DRAG_TOP_RIGHT: {
|
||||||
|
|
|
@ -468,7 +468,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3& p_pos) {
|
||||||
|
|
||||||
|
|
||||||
CameraMatrix cm;
|
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;
|
float screen_w,screen_h;
|
||||||
cm.get_viewport_size(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") );
|
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();
|
Size2 s = get_size();
|
||||||
|
|
||||||
Rect2 draw_rect;
|
Rect2 draw_rect;
|
||||||
|
|
Loading…
Reference in a new issue