From 09f188659a16be9e4dc4b26b3d723cce641a4e95 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 6 Jul 2022 13:27:44 -0700 Subject: [PATCH] fix typos in Camera documentation --- .../com/google/android/filament/Camera.java | 28 +++++++++---------- filament/include/filament/Camera.h | 16 +++++------ filament/src/details/Camera.h | 22 +++++++-------- 3 files changed, 33 insertions(+), 33 deletions(-) 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 ff3c35bfef..8bdfebf7af 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 @@ -400,7 +400,7 @@ public class Camera { } /** - * Sets the camera's view matrix. + * Sets the camera's model matrix. *

* Helper method to set the camera's entity transform component. * Remember that the Camera "looks" towards its -z axis. @@ -412,29 +412,29 @@ public class Camera { * engine.getTransformManager().getInstance(camera->getEntity()), viewMatrix); * * - * @param viewMatrix The camera position and orientation provided as a rigid transform matrix. + * @param modelMatrix The camera position and orientation provided as a rigid transform matrix. */ - public void setModelMatrix(@NonNull @Size(min = 16) float[] viewMatrix) { - Asserts.assertMat4fIn(viewMatrix); - nSetModelMatrix(getNativeObject(), viewMatrix); + public void setModelMatrix(@NonNull @Size(min = 16) float[] modelMatrix) { + Asserts.assertMat4fIn(modelMatrix); + nSetModelMatrix(getNativeObject(), modelMatrix); } /** - * Sets the camera's view matrix. + * Sets the camera's model matrix. *

* Helper method to set the camera's entity transform component. * Remember that the Camera "looks" towards its -z axis. *

* - * @param viewMatrix The camera position and orientation provided as a rigid transform matrix. + * @param modelMatrix The camera position and orientation provided as a rigid transform matrix. */ - public void setModelMatrix(@NonNull @Size(min = 16) double[] viewMatrix) { - Asserts.assertMat4In(viewMatrix); - nSetModelMatrixFp64(getNativeObject(), viewMatrix); + public void setModelMatrix(@NonNull @Size(min = 16) double[] modelMatrix) { + Asserts.assertMat4In(modelMatrix); + nSetModelMatrixFp64(getNativeObject(), modelMatrix); } /** - * Sets the camera's view matrix. + * Sets the camera's model matrix. * * @param eyeX x-axis position of the camera in world space * @param eyeY y-axis position of the camera in world space @@ -549,10 +549,10 @@ public class Camera { /** * Retrieves the camera's view matrix. The view matrix is the inverse of the model matrix. * - * @param out A 16-float array where the model view will be stored, or null in which + * @param out A 16-float array where the view matrix will be stored, or null in which * case a new array is allocated. * - * @return A 16-float array containing the camera's view as a column-major matrix. + * @return A 16-float array containing the camera's column-major view matrix. */ @NonNull @Size(min = 16) public float[] getViewMatrix(@Nullable @Size(min = 16) float[] out) { @@ -567,7 +567,7 @@ public class Camera { * @param out A 16-double array where the model view will be stored, or null in which * case a new array is allocated. * - * @return A 16-double array containing the camera's view as a column-major matrix. + * @return A 16-double array containing the camera's column-major view matrix. */ @NonNull @Size(min = 16) public double[] getViewMatrix(@Nullable @Size(min = 16) double[] out) { diff --git a/filament/include/filament/Camera.h b/filament/include/filament/Camera.h index a459715690..09ff27109c 100644 --- a/filament/include/filament/Camera.h +++ b/filament/include/filament/Camera.h @@ -313,26 +313,26 @@ public: //! Returns the frustum's far plane used for culling float getCullingFar() const noexcept; - /** Sets the camera's view matrix. + /** Sets the camera's model matrix. * * Helper method to set the camera's entity transform component. * It has the same effect as calling: * * ~~~~~~~~~~~{.cpp} * engine.getTransformManager().setTransform( - * engine.getTransformManager().getInstance(camera->getEntity()), view); + * engine.getTransformManager().getInstance(camera->getEntity()), model); * ~~~~~~~~~~~ * - * @param view The camera position and orientation provided as a rigid transform matrix. + * @param model The camera position and orientation provided as a rigid transform matrix. * * @note The Camera "looks" towards its -z axis * - * @warning \p view must be a rigid transform + * @warning \p model must be a rigid transform */ - void setModelMatrix(const math::mat4& view) noexcept; - void setModelMatrix(const math::mat4f& view) noexcept; //!< \overload + void setModelMatrix(const math::mat4& model) noexcept; + void setModelMatrix(const math::mat4f& model) noexcept; //!< @overload - /** Sets the camera's view matrix + /** Sets the camera's model matrix * * @param eye The position of the camera in world space. * @param center The point in world space the camera is looking at. @@ -342,7 +342,7 @@ public: const math::float3& center, const math::float3& up) noexcept; - /** Sets the camera's view matrix, assuming up is along the y axis + /** Sets the camera's model matrix, assuming up is along the y axis * * @param eye The position of the camera in world space. * @param center The point in world space the camera is looking at. diff --git a/filament/src/details/Camera.h b/filament/src/details/Camera.h index 0e70aab3fd..67167efd13 100644 --- a/filament/src/details/Camera.h +++ b/filament/src/details/Camera.h @@ -69,7 +69,7 @@ public: void setShift(math::double2 shift) noexcept { mShiftCS = shift * 2.0; } - const math::double2 getShift() const noexcept { return mShiftCS * 0.5; } + math::double2 getShift() const noexcept { return mShiftCS * 0.5; } // viewing the projection matrix to be used for rendering, contains scaling/shift and possibly // other transforms needed by the shaders @@ -88,28 +88,28 @@ public: float getCullingFar() const noexcept { return mFar; } - // sets the camera's view matrix (must be a rigid transform) + // sets the camera's model matrix (must be a rigid transform) void setModelMatrix(const math::mat4& modelMatrix) noexcept; void setModelMatrix(const math::mat4f& modelMatrix) noexcept; - // sets the camera's view matrix - void lookAt(const math::float3& eye, const math::float3& center, const math::float3& up = { 0, 1, 0 }) noexcept; + // sets the camera's model matrix + void lookAt(const math::float3& eye, const math::float3& center, + const math::float3& up = { 0, 1, 0 }) noexcept; - // returns the view matrix + // returns the model matrix math::mat4 getModelMatrix() const noexcept; - // returns the inverse of the view matrix + // returns the view matrix (inverse of the model matrix) math::mat4 getViewMatrix() const noexcept; - template + template static math::details::TMat44 rigidTransformInverse(math::details::TMat44 const& v) noexcept { // The inverse of a rigid transform can be computed from the transpose // | R T |^-1 | Rt -Rt*T | // | 0 1 | = | 0 1 | - - const math::details::TMat33 rt(transpose(v.upperLeft())); - const math::details::TVec3 t(rt * v[3].xyz); - return math::details::TMat44(rt, -t); + const auto rt(transpose(v.upperLeft())); + const auto t(rt * v[3].xyz); + return { rt, -t }; } math::double3 getPosition() const noexcept {