summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2022-05-03 07:50:35 -0500
committerAaron Franke <arnfranke@yahoo.com>2022-05-03 09:37:47 -0500
commitfa7a7795f09688b1c71ddad40243e46909989054 (patch)
tree754a5bec7014bfb82114e69cc55555753803f1c8 /editor
parentd5d86cb26e65b89a00b644de6eef510d8ca06797 (diff)
Rename Basis get_axis to get_column, remove redundant methods
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp6
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp26
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp64
-rw-r--r--editor/plugins/path_3d_editor_plugin.cpp6
-rw-r--r--editor/plugins/polygon_3d_editor_plugin.cpp2
5 files changed, 52 insertions, 52 deletions
diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp
index 850c673c12..b54fa41e88 100644
--- a/editor/plugins/multimesh_editor_plugin.cpp
+++ b/editor/plugins/multimesh_editor_plugin.cpp
@@ -200,9 +200,9 @@ void MultiMeshEditor::_populate() {
Basis post_xform;
- post_xform.rotate(xform.basis.get_axis(1), -Math::random(-_rotate_random, _rotate_random) * Math_PI);
- post_xform.rotate(xform.basis.get_axis(2), -Math::random(-_tilt_random, _tilt_random) * Math_PI);
- post_xform.rotate(xform.basis.get_axis(0), -Math::random(-_tilt_random, _tilt_random) * Math_PI);
+ post_xform.rotate(xform.basis.get_column(1), -Math::random(-_rotate_random, _rotate_random) * Math_PI);
+ post_xform.rotate(xform.basis.get_column(2), -Math::random(-_tilt_random, _tilt_random) * Math_PI);
+ post_xform.rotate(xform.basis.get_column(0), -Math::random(-_tilt_random, _tilt_random) * Math_PI);
xform.basis = post_xform * xform.basis;
//xform.basis.orthonormalize();
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 47c8c66c57..6829e25ef3 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -589,7 +589,7 @@ void EditorNode3DGizmo::handles_intersect_ray(Camera3D *p_camera, const Vector2
Transform3D camera_xform = p_camera->get_global_transform();
Transform3D t = spatial_node->get_global_transform();
if (billboard_handle) {
- t.set_look_at(t.origin, t.origin - camera_xform.basis.get_axis(2), camera_xform.basis.get_axis(1));
+ t.set_look_at(t.origin, t.origin - camera_xform.basis.get_column(2), camera_xform.basis.get_column(1));
}
float min_d = 1e20;
@@ -665,7 +665,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
Transform3D orig_camera_transform = p_camera->get_camera_transform();
if (!orig_camera_transform.origin.is_equal_approx(t.origin) &&
- ABS(orig_camera_transform.basis.get_axis(Vector3::AXIS_Z).dot(Vector3(0, 1, 0))) < 0.99) {
+ ABS(orig_camera_transform.basis.get_column(Vector3::AXIS_Z).dot(Vector3(0, 1, 0))) < 0.99) {
p_camera->look_at(t.origin);
}
@@ -689,13 +689,13 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
}
if (collision_segments.size()) {
- Plane camp(-p_camera->get_transform().basis.get_axis(2).normalized(), p_camera->get_transform().origin);
+ Plane camp(-p_camera->get_transform().basis.get_column(2).normalized(), p_camera->get_transform().origin);
int vc = collision_segments.size();
const Vector3 *vptr = collision_segments.ptr();
Transform3D t = spatial_node->get_global_transform();
if (billboard_handle) {
- t.set_look_at(t.origin, t.origin - p_camera->get_transform().basis.get_axis(2), p_camera->get_transform().basis.get_axis(1));
+ t.set_look_at(t.origin, t.origin - p_camera->get_transform().basis.get_column(2), p_camera->get_transform().basis.get_column(1));
}
Vector3 cp;
@@ -742,7 +742,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
Transform3D gt = spatial_node->get_global_transform();
if (billboard_handle) {
- gt.set_look_at(gt.origin, gt.origin - p_camera->get_transform().basis.get_axis(2), p_camera->get_transform().basis.get_axis(1));
+ gt.set_look_at(gt.origin, gt.origin - p_camera->get_transform().basis.get_column(2), p_camera->get_transform().basis.get_column(1));
}
Transform3D ai = gt.affine_inverse();
@@ -1319,7 +1319,7 @@ void Light3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id,
light->set_param(Light3D::PARAM_RANGE, d);
} else if (Object::cast_to<OmniLight3D>(light)) {
- Plane cp = Plane(p_camera->get_transform().basis.get_axis(2), gt.origin);
+ Plane cp = Plane(p_camera->get_transform().basis.get_column(2), gt.origin);
Vector3 inters;
if (cp.intersects_ray(ray_from, ray_dir, &inters)) {
@@ -4832,7 +4832,7 @@ Basis JointGizmosDrawer::look_body(const Transform3D &p_joint_transform, const T
v_y.normalize();
Basis base;
- base.set(v_x, v_y, v_z);
+ base.set_columns(v_x, v_y, v_z);
// Absorb current joint transform
base = p_joint_transform.basis.inverse() * base;
@@ -4857,7 +4857,7 @@ Basis JointGizmosDrawer::look_body_toward_x(const Transform3D &p_joint_transform
const Vector3 &p_eye(p_joint_transform.origin);
const Vector3 &p_target(p_body_transform.origin);
- const Vector3 p_front(p_joint_transform.basis.get_axis(0));
+ const Vector3 p_front(p_joint_transform.basis.get_column(0));
Vector3 v_x, v_y, v_z;
@@ -4876,7 +4876,7 @@ Basis JointGizmosDrawer::look_body_toward_x(const Transform3D &p_joint_transform
v_x.normalize();
Basis base;
- base.set(v_x, v_y, v_z);
+ base.set_columns(v_x, v_y, v_z);
// Absorb current joint transform
base = p_joint_transform.basis.inverse() * base;
@@ -4888,7 +4888,7 @@ Basis JointGizmosDrawer::look_body_toward_y(const Transform3D &p_joint_transform
const Vector3 &p_eye(p_joint_transform.origin);
const Vector3 &p_target(p_body_transform.origin);
- const Vector3 p_up(p_joint_transform.basis.get_axis(1));
+ const Vector3 p_up(p_joint_transform.basis.get_column(1));
Vector3 v_x, v_y, v_z;
@@ -4907,7 +4907,7 @@ Basis JointGizmosDrawer::look_body_toward_y(const Transform3D &p_joint_transform
v_y.normalize();
Basis base;
- base.set(v_x, v_y, v_z);
+ base.set_columns(v_x, v_y, v_z);
// Absorb current joint transform
base = p_joint_transform.basis.inverse() * base;
@@ -4919,7 +4919,7 @@ Basis JointGizmosDrawer::look_body_toward_z(const Transform3D &p_joint_transform
const Vector3 &p_eye(p_joint_transform.origin);
const Vector3 &p_target(p_body_transform.origin);
- const Vector3 p_lateral(p_joint_transform.basis.get_axis(2));
+ const Vector3 p_lateral(p_joint_transform.basis.get_column(2));
Vector3 v_x, v_y, v_z;
@@ -4938,7 +4938,7 @@ Basis JointGizmosDrawer::look_body_toward_z(const Transform3D &p_joint_transform
v_x.normalize();
Basis base;
- base.set(v_x, v_y, v_z);
+ base.set_columns(v_x, v_y, v_z);
// Absorb current joint transform
base = p_joint_transform.basis.inverse() * base;
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 344efb4f13..e0fc42165b 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -159,7 +159,7 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) {
const Basis camera_basis = viewport->to_camera_transform(viewport->cursor).get_basis().inverse();
for (int i = 0; i < 3; ++i) {
- Vector3 axis_3d = camera_basis.get_axis(i);
+ Vector3 axis_3d = camera_basis.get_column(i);
Vector2i axis_vector = Vector2(axis_3d.x, -axis_3d.y) * radius;
if (Math::abs(axis_3d.z) < 1.0) {
@@ -440,7 +440,7 @@ Vector3 Node3DEditorViewport::_get_ray_pos(const Vector2 &p_pos) const {
}
Vector3 Node3DEditorViewport::_get_camera_normal() const {
- return -_get_camera_transform().basis.get_axis(2);
+ return -_get_camera_transform().basis.get_column(2);
}
Vector3 Node3DEditorViewport::_get_ray(const Vector2 &p_pos) const {
@@ -983,7 +983,7 @@ bool Node3DEditorViewport::_transform_gizmo_select(const Vector2 &p_screenpos, b
real_t col_d = 1e20;
for (int i = 0; i < 3; i++) {
- const Vector3 grabber_pos = gt.origin + gt.basis.get_axis(i).normalized() * gizmo_scale * (GIZMO_ARROW_OFFSET + (GIZMO_ARROW_SIZE * 0.5));
+ const Vector3 grabber_pos = gt.origin + gt.basis.get_column(i).normalized() * gizmo_scale * (GIZMO_ARROW_OFFSET + (GIZMO_ARROW_SIZE * 0.5));
const real_t grabber_radius = gizmo_scale * GIZMO_ARROW_SIZE;
Vector3 r;
@@ -1003,15 +1003,15 @@ bool Node3DEditorViewport::_transform_gizmo_select(const Vector2 &p_screenpos, b
col_d = 1e20;
for (int i = 0; i < 3; i++) {
- Vector3 ivec2 = gt.basis.get_axis((i + 1) % 3).normalized();
- Vector3 ivec3 = gt.basis.get_axis((i + 2) % 3).normalized();
+ Vector3 ivec2 = gt.basis.get_column((i + 1) % 3).normalized();
+ Vector3 ivec3 = gt.basis.get_column((i + 2) % 3).normalized();
// Allow some tolerance to make the plane easier to click,
// even if the click is actually slightly outside the plane.
const Vector3 grabber_pos = gt.origin + (ivec2 + ivec3) * gizmo_scale * (GIZMO_PLANE_SIZE + GIZMO_PLANE_DST * 0.6667);
Vector3 r;
- Plane plane(gt.basis.get_axis(i).normalized(), gt.origin);
+ Plane plane(gt.basis.get_column(i).normalized(), gt.origin);
if (plane.intersects_ray(ray_pos, ray, &r)) {
const real_t dist = r.distance_to(grabber_pos);
@@ -1064,7 +1064,7 @@ bool Node3DEditorViewport::_transform_gizmo_select(const Vector2 &p_screenpos, b
float col_d = 1e20;
for (int i = 0; i < 3; i++) {
- Plane plane(gt.basis.get_axis(i).normalized(), gt.origin);
+ Plane plane(gt.basis.get_column(i).normalized(), gt.origin);
Vector3 r;
if (!plane.intersects_ray(ray_pos, ray, &r)) {
continue;
@@ -1103,7 +1103,7 @@ bool Node3DEditorViewport::_transform_gizmo_select(const Vector2 &p_screenpos, b
float col_d = 1e20;
for (int i = 0; i < 3; i++) {
- const Vector3 grabber_pos = gt.origin + gt.basis.get_axis(i).normalized() * gizmo_scale * GIZMO_SCALE_OFFSET;
+ const Vector3 grabber_pos = gt.origin + gt.basis.get_column(i).normalized() * gizmo_scale * GIZMO_SCALE_OFFSET;
const real_t grabber_radius = gizmo_scale * GIZMO_ARROW_SIZE;
Vector3 r;
@@ -1123,15 +1123,15 @@ bool Node3DEditorViewport::_transform_gizmo_select(const Vector2 &p_screenpos, b
col_d = 1e20;
for (int i = 0; i < 3; i++) {
- const Vector3 ivec2 = gt.basis.get_axis((i + 1) % 3).normalized();
- const Vector3 ivec3 = gt.basis.get_axis((i + 2) % 3).normalized();
+ const Vector3 ivec2 = gt.basis.get_column((i + 1) % 3).normalized();
+ const Vector3 ivec3 = gt.basis.get_column((i + 2) % 3).normalized();
// Allow some tolerance to make the plane easier to click,
// even if the click is actually slightly outside the plane.
const Vector3 grabber_pos = gt.origin + (ivec2 + ivec3) * gizmo_scale * (GIZMO_PLANE_SIZE + GIZMO_PLANE_DST * 0.6667);
Vector3 r;
- Plane plane(gt.basis.get_axis(i).normalized(), gt.origin);
+ Plane plane(gt.basis.get_column(i).normalized(), gt.origin);
if (plane.intersects_ray(ray_pos, ray, &r)) {
const real_t dist = r.distance_to(grabber_pos);
@@ -3389,8 +3389,8 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
return;
}
- const Vector3 camz = -camera_xform.get_basis().get_axis(2).normalized();
- const Vector3 camy = -camera_xform.get_basis().get_axis(1).normalized();
+ const Vector3 camz = -camera_xform.get_basis().get_column(2).normalized();
+ const Vector3 camy = -camera_xform.get_basis().get_column(1).normalized();
const Plane p = Plane(camz, camera_xform.origin);
const real_t gizmo_d = MAX(Math::abs(p.distance_to(xform.origin)), CMP_EPSILON);
const real_t d0 = camera->unproject_position(camera_xform.origin + camz * gizmo_d).y;
@@ -3424,8 +3424,8 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
for (int i = 0; i < 3; i++) {
Transform3D axis_angle = Transform3D();
- if (xform.basis.get_axis(i).normalized().dot(xform.basis.get_axis((i + 1) % 3).normalized()) < 1.0) {
- axis_angle = axis_angle.looking_at(xform.basis.get_axis(i).normalized(), xform.basis.get_axis((i + 1) % 3).normalized());
+ if (xform.basis.get_column(i).normalized().dot(xform.basis.get_column((i + 1) % 3).normalized()) < 1.0) {
+ axis_angle = axis_angle.looking_at(xform.basis.get_column(i).normalized(), xform.basis.get_column((i + 1) % 3).normalized());
}
axis_angle.basis.scale(scale);
axis_angle.origin = xform.origin;
@@ -4087,30 +4087,30 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
plane = Plane(_get_camera_normal(), _edit.center);
break;
case TRANSFORM_X_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(0).normalized();
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(0).normalized();
plane = Plane(motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized(), _edit.center);
break;
case TRANSFORM_Y_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(1).normalized();
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(1).normalized();
plane = Plane(motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized(), _edit.center);
break;
case TRANSFORM_Z_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(2).normalized();
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(2).normalized();
plane = Plane(motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized(), _edit.center);
break;
case TRANSFORM_YZ:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(2).normalized() + spatial_editor->get_gizmo_transform().basis.get_axis(1).normalized();
- plane = Plane(spatial_editor->get_gizmo_transform().basis.get_axis(0).normalized(), _edit.center);
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(2).normalized() + spatial_editor->get_gizmo_transform().basis.get_column(1).normalized();
+ plane = Plane(spatial_editor->get_gizmo_transform().basis.get_column(0).normalized(), _edit.center);
plane_mv = true;
break;
case TRANSFORM_XZ:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(2).normalized() + spatial_editor->get_gizmo_transform().basis.get_axis(0).normalized();
- plane = Plane(spatial_editor->get_gizmo_transform().basis.get_axis(1).normalized(), _edit.center);
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(2).normalized() + spatial_editor->get_gizmo_transform().basis.get_column(0).normalized();
+ plane = Plane(spatial_editor->get_gizmo_transform().basis.get_column(1).normalized(), _edit.center);
plane_mv = true;
break;
case TRANSFORM_XY:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(0).normalized() + spatial_editor->get_gizmo_transform().basis.get_axis(1).normalized();
- plane = Plane(spatial_editor->get_gizmo_transform().basis.get_axis(2).normalized(), _edit.center);
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(0).normalized() + spatial_editor->get_gizmo_transform().basis.get_column(1).normalized();
+ plane = Plane(spatial_editor->get_gizmo_transform().basis.get_column(2).normalized(), _edit.center);
plane_mv = true;
break;
}
@@ -4209,27 +4209,27 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
plane = Plane(_get_camera_normal(), _edit.center);
break;
case TRANSFORM_X_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(0).normalized();
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(0).normalized();
plane = Plane(motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized(), _edit.center);
break;
case TRANSFORM_Y_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(1).normalized();
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(1).normalized();
plane = Plane(motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized(), _edit.center);
break;
case TRANSFORM_Z_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(2).normalized();
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_column(2).normalized();
plane = Plane(motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized(), _edit.center);
break;
case TRANSFORM_YZ:
- plane = Plane(spatial_editor->get_gizmo_transform().basis.get_axis(0).normalized(), _edit.center);
+ plane = Plane(spatial_editor->get_gizmo_transform().basis.get_column(0).normalized(), _edit.center);
plane_mv = true;
break;
case TRANSFORM_XZ:
- plane = Plane(spatial_editor->get_gizmo_transform().basis.get_axis(1).normalized(), _edit.center);
+ plane = Plane(spatial_editor->get_gizmo_transform().basis.get_column(1).normalized(), _edit.center);
plane_mv = true;
break;
case TRANSFORM_XY:
- plane = Plane(spatial_editor->get_gizmo_transform().basis.get_axis(2).normalized(), _edit.center);
+ plane = Plane(spatial_editor->get_gizmo_transform().basis.get_column(2).normalized(), _edit.center);
plane_mv = true;
break;
}
@@ -6469,7 +6469,7 @@ void Node3DEditor::_init_grid() {
if (orthogonal) {
camera_distance = camera->get_size() / 2.0;
- Vector3 camera_direction = -camera->get_global_transform().get_basis().get_axis(2);
+ Vector3 camera_direction = -camera->get_global_transform().get_basis().get_column(2);
Plane grid_plane = Plane(normal);
Vector3 intersection;
if (grid_plane.intersects_ray(camera_position, camera_direction, &intersection)) {
@@ -7338,7 +7338,7 @@ void Node3DEditor::clear() {
void Node3DEditor::_sun_direction_draw() {
sun_direction->draw_rect(Rect2(Vector2(), sun_direction->get_size()), Color(1, 1, 1, 1));
- Vector3 z_axis = preview_sun->get_transform().basis.get_axis(Vector3::AXIS_Z);
+ Vector3 z_axis = preview_sun->get_transform().basis.get_column(Vector3::AXIS_Z);
z_axis = get_editor_viewport(0)->camera->get_camera_transform().basis.xform_inv(z_axis);
sun_direction_material->set_shader_param("sun_direction", Vector3(z_axis.x, -z_axis.y, z_axis.z));
Color color = sun_color->get_pick_color() * sun_energy->get_value();
diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp
index 3284af7bb5..3851738cfa 100644
--- a/editor/plugins/path_3d_editor_plugin.cpp
+++ b/editor/plugins/path_3d_editor_plugin.cpp
@@ -102,7 +102,7 @@ void Path3DGizmo::set_handle(int p_id, bool p_secondary, Camera3D *p_camera, con
// Setting curve point positions
if (!p_secondary) {
- const Plane p = Plane(p_camera->get_transform().basis.get_axis(2), gt.xform(original));
+ const Plane p = Plane(p_camera->get_transform().basis.get_column(2), gt.xform(original));
Vector3 inters;
@@ -126,7 +126,7 @@ void Path3DGizmo::set_handle(int p_id, bool p_secondary, Camera3D *p_camera, con
Vector3 base = c->get_point_position(idx);
- Plane p(p_camera->get_transform().basis.get_axis(2), gt.xform(original));
+ Plane p(p_camera->get_transform().basis.get_column(2), gt.xform(original));
Vector3 inters;
@@ -396,7 +396,7 @@ EditorPlugin::AfterGUIInput Path3DEditorPlugin::forward_spatial_gui_input(Camera
} else {
origin = gt.xform(c->get_point_position(c->get_point_count() - 1));
}
- Plane p(p_camera->get_transform().basis.get_axis(2), origin);
+ Plane p(p_camera->get_transform().basis.get_column(2), origin);
Vector3 ray_from = p_camera->project_ray_origin(mbpos);
Vector3 ray_dir = p_camera->project_ray_normal(mbpos);
diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp
index 2d4812c55b..1c69e0d635 100644
--- a/editor/plugins/polygon_3d_editor_plugin.cpp
+++ b/editor/plugins/polygon_3d_editor_plugin.cpp
@@ -117,7 +117,7 @@ EditorPlugin::AfterGUIInput Polygon3DEditor::forward_spatial_gui_input(Camera3D
Transform3D gt = node->get_global_transform();
Transform3D gi = gt.affine_inverse();
float depth = _get_depth() * 0.5;
- Vector3 n = gt.basis.get_axis(2).normalized();
+ Vector3 n = gt.basis.get_column(2).normalized();
Plane p(n, gt.origin + n * depth);
Ref<InputEventMouseButton> mb = p_event;