diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9e84e7da3b..1cce6b22b0 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -18,7 +18,7 @@ A new header is inserted each time a *tag* is created. - Added Java bindings for geometry::SurfaceOrientation. - Fixed bug rendering transparent objects with Metal backend. - Fixed crash on macOS Catalina when rendering with Metal backend. -- Fixed bug in Camera::setLensProjection() and added a variant that accepts an aspect ratio. +- Fixed bug in Camera::setLensProjection() and added the aspect ratio parameter. (⚠ API Change) - WebGL: Improved TypeScript annotations. - WebGL: Simplified callback API for glTF. (⚠ API Change) diff --git a/android/filament-android/src/main/java/com/google/android/filament/Camera.java b/android/filament-android/src/main/java/com/google/android/filament/Camera.java index e438c5fab1..3deb723608 100644 --- a/android/filament-android/src/main/java/com/google/android/filament/Camera.java +++ b/android/filament-android/src/main/java/com/google/android/filament/Camera.java @@ -225,30 +225,6 @@ public class Camera { nSetProjectionFov(getNativeObject(), fovInDegrees, aspect, near, far, direction.ordinal()); } - /** - * Sets the projection matrix from the focal length for a 35mm sensor. - * - * @param focalLength lens's focal length in millimeters. focalLength > 0 - * - * @param near distance in world units from the camera to the near plane. - * The near plane's position in view space is z = -near. - * Precondition: - * near > 0 for {@link Projection#PERSPECTIVE} or - * near != far for {@link Projection#ORTHO}. - * - * @param far distance in world units from the camera to the far plane. - * The far plane's position in view space is z = -far. - * Precondition: - * far > near - * for {@link Projection#PERSPECTIVE} or - * far != near - * for {@link Projection#ORTHO}. - * - */ - public void setLensProjection(double focalLength, double near, double far) { - nSetLensProjection(getNativeObject(), focalLength, 36.0 / 24.0, near, far); - } - /** * Sets the projection matrix from the focal length. * diff --git a/filament/include/filament/Camera.h b/filament/include/filament/Camera.h index b1cbd1e545..35d94870a7 100644 --- a/filament/include/filament/Camera.h +++ b/filament/include/filament/Camera.h @@ -189,17 +189,6 @@ public: void setProjection(double fovInDegrees, double aspect, double near, double far, Fov direction = Fov::VERTICAL) noexcept; - /** Sets the projection matrix from the focal length. The aspect ratio is fixed - * to that of a 35mm sensor. - * - * @param focalLength lens's focal length in millimeters. \p focalLength > 0. - * @param near distance in world units from the camera to the near plane. \p near > 0. - * @param far distance in world units from the camera to the far plane. \p far > \p near. - */ - void setLensProjection(double focalLength, double near, double far) noexcept { - setLensProjection(focalLength, 36.0 / 24.0, near, far); - } - /** Sets the projection matrix from the focal length. * * @param focalLength lens's focal length in millimeters. \p focalLength > 0. diff --git a/web/filament-js/filament.d.ts b/web/filament-js/filament.d.ts index 6d880abca2..2c3f15ad5c 100644 --- a/web/filament-js/filament.d.ts +++ b/web/filament-js/filament.d.ts @@ -259,8 +259,7 @@ export class Camera { top: number, near: number, far: number): void; public setProjectionFov(fovInDegrees: number, aspect: number, near: number, far: number, fov: Camera$Fov): void; - public setLensProjection(focalLength: number, near: number, far: number): void; - public setLensProjectionWithAspect(focalLength: number, aspect: number, near: number, far: number): void; + public setLensProjection(focalLength: number, aspect: number, near: number, far: number): void; public setCustomProjection(projection: mat4, near: number, far: number): void; public getProjectionMatrix(): mat4; public getCullingProjectionMatrix(): mat4; diff --git a/web/filament-js/jsbindings.cpp b/web/filament-js/jsbindings.cpp index 91cb8f50a5..45c66bcb57 100644 --- a/web/filament-js/jsbindings.cpp +++ b/web/filament-js/jsbindings.cpp @@ -522,15 +522,7 @@ class_("Camera") self->setProjection(fovInDegrees, aspect, near, far, direction); }), allow_raw_pointers()) - .function("setLensProjectionWithAspect", EMBIND_LAMBDA(void, (Camera* self, - double focalLength, double aspect, double near, double far), { - self->setLensProjection(focalLength, aspect, near, far); - }), allow_raw_pointers()) - - .function("setLensProjection", EMBIND_LAMBDA(void, (Camera* self, - double focalLength, double near, double far), { - self->setLensProjection(focalLength, near, far); - }), allow_raw_pointers()) + .function("setLensProjection", &Camera::setLensProjection) .function("setCustomProjection", EMBIND_LAMBDA(void, (Camera* self, flatmat4 m, double near, double far), { diff --git a/web/filament-js/test.ts b/web/filament-js/test.ts index c083eed27d..f6776d0301 100644 --- a/web/filament-js/test.ts +++ b/web/filament-js/test.ts @@ -43,8 +43,7 @@ function smoke_camera_frustum() { const camera: Filament.Camera = engine.createCamera(); camera.setProjection(Filament.Camera$Projection.ORTHO, 0, 1, 0, 1, 0, 1); camera.setProjectionFov(45, 1.0, 0.0, 1.0, Filament.Camera$Fov.HORIZONTAL); - camera.setLensProjection(0, 1, 2); - camera.setLensProjectionWithAspect(0, 0.33, 1, 2); + camera.setLensProjection(0, 0.33, 1, 2); camera.setCustomProjection(m4, 0, 1); const m5 = camera.getProjectionMatrix() as glm.mat4; const m6 = camera.getCullingProjectionMatrix() as glm.mat4;