diff options
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/camera_matrix.cpp | 29 | ||||
-rw-r--r-- | core/math/triangle_mesh.cpp | 2 |
2 files changed, 14 insertions, 17 deletions
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 572a6c5239..7132b6573e 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -131,7 +131,6 @@ void CameraMatrix::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_ void CameraMatrix::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_dist, real_t p_display_width, real_t p_display_to_lens, real_t p_oversample, real_t p_z_near, real_t p_z_far) { // we first calculate our base frustum on our values without taking our lens magnification into account. - real_t display_to_eye = 2.0 * p_display_to_lens; real_t f1 = (p_intraocular_dist * 0.5) / p_display_to_lens; real_t f2 = ((p_display_width - p_intraocular_dist) * 0.5) / p_display_to_lens; real_t f3 = (p_display_width / 4.0) / p_display_to_lens; @@ -266,27 +265,26 @@ void CameraMatrix::get_viewport_size(real_t &r_width, real_t &r_height) const { bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8points) const { Vector<Plane> planes = get_projection_planes(Transform()); - const Planes intersections[8][3]={ - {PLANE_FAR,PLANE_LEFT,PLANE_TOP}, - {PLANE_FAR,PLANE_LEFT,PLANE_BOTTOM}, - {PLANE_FAR,PLANE_RIGHT,PLANE_TOP}, - {PLANE_FAR,PLANE_RIGHT,PLANE_BOTTOM}, - {PLANE_NEAR,PLANE_LEFT,PLANE_TOP}, - {PLANE_NEAR,PLANE_LEFT,PLANE_BOTTOM}, - {PLANE_NEAR,PLANE_RIGHT,PLANE_TOP}, - {PLANE_NEAR,PLANE_RIGHT,PLANE_BOTTOM}, + const Planes intersections[8][3] = { + { PLANE_FAR, PLANE_LEFT, PLANE_TOP }, + { PLANE_FAR, PLANE_LEFT, PLANE_BOTTOM }, + { PLANE_FAR, PLANE_RIGHT, PLANE_TOP }, + { PLANE_FAR, PLANE_RIGHT, PLANE_BOTTOM }, + { PLANE_NEAR, PLANE_LEFT, PLANE_TOP }, + { PLANE_NEAR, PLANE_LEFT, PLANE_BOTTOM }, + { PLANE_NEAR, PLANE_RIGHT, PLANE_TOP }, + { PLANE_NEAR, PLANE_RIGHT, PLANE_BOTTOM }, }; - for(int i=0;i<8;i++) { + for (int i = 0; i < 8; i++) { Vector3 point; - bool res = planes[intersections[i][0]].intersect_3(planes[intersections[i][1]],planes[intersections[i][2]], &point); + bool res = planes[intersections[i][0]].intersect_3(planes[intersections[i][1]], planes[intersections[i][2]], &point); ERR_FAIL_COND_V(!res, false); - p_8points[i]=p_transform.xform(point); + p_8points[i] = p_transform.xform(point); } return true; - } Vector<Plane> CameraMatrix::get_projection_planes(const Transform &p_transform) const { @@ -564,10 +562,9 @@ int CameraMatrix::get_pixels_per_meter(int p_for_pixel_width) const { bool CameraMatrix::is_orthogonal() const { - return matrix[3][3]==1.0; + return matrix[3][3] == 1.0; } - real_t CameraMatrix::get_fov() const { const real_t *matrix = (const real_t *)this->matrix; diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 614104f698..3b246cb183 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -158,7 +158,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { max_depth = 0; int max_alloc = fc; - int max = _create_bvh(bw.ptr(), bwp.ptr(), 0, fc, 1, max_depth, max_alloc); + _create_bvh(bw.ptr(), bwp.ptr(), 0, fc, 1, max_depth, max_alloc); bw = PoolVector<BVH>::Write(); //clearup bvh.resize(max_alloc); //resize back |