From fa7a7795f09688b1c71ddad40243e46909989054 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Tue, 3 May 2022 07:50:35 -0500 Subject: Rename Basis get_axis to get_column, remove redundant methods --- modules/csg/csg.cpp | 6 +++--- modules/gltf/gltf_document.cpp | 30 +++++++++++++++--------------- modules/mobile_vr/mobile_vr_interface.cpp | 6 +++--- modules/raycast/raycast_occlusion_cull.cpp | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'modules') diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index 82dc4a4175..760ee0846d 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -1336,9 +1336,9 @@ CSGBrushOperation::Build2DFaces::Build2DFaces(const CSGBrush &p_brush, int p_fac plane = Plane(points_3D[0], points_3D[1], points_3D[2]); to_3D.origin = points_3D[0]; - to_3D.basis.set_axis(2, plane.normal); - to_3D.basis.set_axis(0, (points_3D[1] - points_3D[2]).normalized()); - to_3D.basis.set_axis(1, to_3D.basis.get_axis(0).cross(to_3D.basis.get_axis(2)).normalized()); + to_3D.basis.set_column(2, plane.normal); + to_3D.basis.set_column(0, (points_3D[1] - points_3D[2]).normalized()); + to_3D.basis.set_column(1, to_3D.basis.get_column(0).cross(to_3D.basis.get_column(2)).normalized()); to_2D = to_3D.affine_inverse(); Face2D face; diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 281f62c4ad..082b4ce1ec 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -360,9 +360,9 @@ static Transform3D _arr_to_xform(const Array &p_array) { ERR_FAIL_COND_V(p_array.size() != 16, Transform3D()); Transform3D xform; - xform.basis.set_axis(Vector3::AXIS_X, Vector3(p_array[0], p_array[1], p_array[2])); - xform.basis.set_axis(Vector3::AXIS_Y, Vector3(p_array[4], p_array[5], p_array[6])); - xform.basis.set_axis(Vector3::AXIS_Z, Vector3(p_array[8], p_array[9], p_array[10])); + xform.basis.set_column(Vector3::AXIS_X, Vector3(p_array[0], p_array[1], p_array[2])); + xform.basis.set_column(Vector3::AXIS_Y, Vector3(p_array[4], p_array[5], p_array[6])); + xform.basis.set_column(Vector3::AXIS_Z, Vector3(p_array[8], p_array[9], p_array[10])); xform.set_origin(Vector3(p_array[12], p_array[13], p_array[14])); return xform; @@ -371,17 +371,17 @@ static Transform3D _arr_to_xform(const Array &p_array) { static Vector _xform_to_array(const Transform3D p_transform) { Vector array; array.resize(16); - Vector3 axis_x = p_transform.get_basis().get_axis(Vector3::AXIS_X); + Vector3 axis_x = p_transform.get_basis().get_column(Vector3::AXIS_X); array.write[0] = axis_x.x; array.write[1] = axis_x.y; array.write[2] = axis_x.z; array.write[3] = 0.0f; - Vector3 axis_y = p_transform.get_basis().get_axis(Vector3::AXIS_Y); + Vector3 axis_y = p_transform.get_basis().get_column(Vector3::AXIS_Y); array.write[4] = axis_y.x; array.write[5] = axis_y.y; array.write[6] = axis_y.z; array.write[7] = 0.0f; - Vector3 axis_z = p_transform.get_basis().get_axis(Vector3::AXIS_Z); + Vector3 axis_z = p_transform.get_basis().get_column(Vector3::AXIS_Z); array.write[8] = axis_z.x; array.write[9] = axis_z.y; array.write[10] = axis_z.z; @@ -1960,20 +1960,20 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref state, for (int i = 0; i < p_attribs.size(); i++) { Transform3D attrib = p_attribs[i]; Basis basis = attrib.get_basis(); - Vector3 axis_0 = basis.get_axis(Vector3::AXIS_X); + Vector3 axis_0 = basis.get_column(Vector3::AXIS_X); attribs.write[i * element_count + 0] = Math::snapped(axis_0.x, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 1] = Math::snapped(axis_0.y, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 2] = Math::snapped(axis_0.z, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 3] = 0.0; - Vector3 axis_1 = basis.get_axis(Vector3::AXIS_Y); + Vector3 axis_1 = basis.get_column(Vector3::AXIS_Y); attribs.write[i * element_count + 4] = Math::snapped(axis_1.x, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 5] = Math::snapped(axis_1.y, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 6] = Math::snapped(axis_1.z, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 7] = 0.0; - Vector3 axis_2 = basis.get_axis(Vector3::AXIS_Z); + Vector3 axis_2 = basis.get_column(Vector3::AXIS_Z); attribs.write[i * element_count + 8] = Math::snapped(axis_2.x, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 9] = Math::snapped(axis_2.y, CMP_NORMALIZE_TOLERANCE); attribs.write[i * element_count + 10] = Math::snapped(axis_2.z, CMP_NORMALIZE_TOLERANCE); @@ -2105,9 +2105,9 @@ Vector GLTFDocument::_decode_accessor_as_basis(Ref state, cons ERR_FAIL_COND_V(attribs.size() % 9 != 0, ret); ret.resize(attribs.size() / 9); for (int i = 0; i < ret.size(); i++) { - ret.write[i].set_axis(0, Vector3(attribs[i * 9 + 0], attribs[i * 9 + 1], attribs[i * 9 + 2])); - ret.write[i].set_axis(1, Vector3(attribs[i * 9 + 3], attribs[i * 9 + 4], attribs[i * 9 + 5])); - ret.write[i].set_axis(2, Vector3(attribs[i * 9 + 6], attribs[i * 9 + 7], attribs[i * 9 + 8])); + ret.write[i].set_column(0, Vector3(attribs[i * 9 + 0], attribs[i * 9 + 1], attribs[i * 9 + 2])); + ret.write[i].set_column(1, Vector3(attribs[i * 9 + 3], attribs[i * 9 + 4], attribs[i * 9 + 5])); + ret.write[i].set_column(2, Vector3(attribs[i * 9 + 6], attribs[i * 9 + 7], attribs[i * 9 + 8])); } return ret; } @@ -2123,9 +2123,9 @@ Vector GLTFDocument::_decode_accessor_as_xform(Ref state ERR_FAIL_COND_V(attribs.size() % 16 != 0, ret); ret.resize(attribs.size() / 16); for (int i = 0; i < ret.size(); i++) { - ret.write[i].basis.set_axis(0, Vector3(attribs[i * 16 + 0], attribs[i * 16 + 1], attribs[i * 16 + 2])); - ret.write[i].basis.set_axis(1, Vector3(attribs[i * 16 + 4], attribs[i * 16 + 5], attribs[i * 16 + 6])); - ret.write[i].basis.set_axis(2, Vector3(attribs[i * 16 + 8], attribs[i * 16 + 9], attribs[i * 16 + 10])); + ret.write[i].basis.set_column(0, Vector3(attribs[i * 16 + 0], attribs[i * 16 + 1], attribs[i * 16 + 2])); + ret.write[i].basis.set_column(1, Vector3(attribs[i * 16 + 4], attribs[i * 16 + 5], attribs[i * 16 + 6])); + ret.write[i].basis.set_column(2, Vector3(attribs[i * 16 + 8], attribs[i * 16 + 9], attribs[i * 16 + 10])); ret.write[i].set_origin(Vector3(attribs[i * 16 + 12], attribs[i * 16 + 13], attribs[i * 16 + 14])); } return ret; diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index f5aef56724..5876b6cbf3 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -175,9 +175,9 @@ void MobileVRInterface::set_position_from_sensors() { if (has_gyro) { // start with applying our gyro (do NOT smooth our gyro!) Basis rotate; - rotate.rotate(orientation.get_axis(0), gyro.x * delta_time); - rotate.rotate(orientation.get_axis(1), gyro.y * delta_time); - rotate.rotate(orientation.get_axis(2), gyro.z * delta_time); + rotate.rotate(orientation.get_column(0), gyro.x * delta_time); + rotate.rotate(orientation.get_column(1), gyro.y * delta_time); + rotate.rotate(orientation.get_column(2), gyro.z * delta_time); orientation = rotate * orientation; tracking_state = XRInterface::XR_NORMAL_TRACKING; diff --git a/modules/raycast/raycast_occlusion_cull.cpp b/modules/raycast/raycast_occlusion_cull.cpp index 2e0d17fb28..1550f0ef8b 100644 --- a/modules/raycast/raycast_occlusion_cull.cpp +++ b/modules/raycast/raycast_occlusion_cull.cpp @@ -85,7 +85,7 @@ void RaycastOcclusionCull::RaycastHZBuffer::update_camera_rays(const Transform3D td.z_near = p_cam_projection.get_z_near(); td.z_far = p_cam_projection.get_z_far() * 1.05f; td.camera_pos = p_cam_transform.origin; - td.camera_dir = -p_cam_transform.basis.get_axis(2); + td.camera_dir = -p_cam_transform.basis.get_column(2); td.camera_orthogonal = p_cam_orthogonal; CameraMatrix inv_camera_matrix = p_cam_projection.inverse(); @@ -548,7 +548,7 @@ void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform3D &p_cam_ buffer.update_camera_rays(p_cam_transform, p_cam_projection, p_cam_orthogonal, p_thread_pool); scenario.raycast(buffer.camera_rays, buffer.camera_ray_masks.ptr(), buffer.camera_rays_tile_count, p_thread_pool); - buffer.sort_rays(-p_cam_transform.basis.get_axis(2), p_cam_orthogonal); + buffer.sort_rays(-p_cam_transform.basis.get_column(2), p_cam_orthogonal); buffer.update_mips(); } -- cgit v1.2.3