From 65a298ff258cc898f11b042175f95a10a1bc1179 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Fri, 30 Sep 2022 16:19:58 +0900 Subject: [PATCH] Create ProjectionDirection property at CameraActor Add new property "ProjectionDirection" on CameraActor. It determine whether current FieldOfView value base on Vertical or Horizontal. Default is Vertical. Change-Id: I237f557af4bc03315ce5d6d6eeb25913e4fe7de4 Signed-off-by: Eunki, Hong --- .../src/dali/utc-Dali-CameraActor.cpp | 123 +++++++++++++++++- dali/devel-api/actors/camera-actor-devel.h | 27 +++- dali/internal/common/type-abstraction-enums.h | 7 +- .../event/actors/camera-actor-impl.cpp | 26 +++- .../internal/event/actors/camera-actor-impl.h | 39 +++--- .../render-tasks/scene-graph-camera.cpp | 49 ++++--- .../update/render-tasks/scene-graph-camera.h | 54 +++++--- 7 files changed, 271 insertions(+), 54 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-CameraActor.cpp b/automated-tests/src/dali/utc-Dali-CameraActor.cpp index 7063dca4f..7a37225c7 100644 --- a/automated-tests/src/dali/utc-Dali-CameraActor.cpp +++ b/automated-tests/src/dali/utc-Dali-CameraActor.cpp @@ -275,7 +275,7 @@ int UtcDaliCameraActorSetGetTypeP(void) actor.SetType(Dali::Camera::LOOK_AT_TARGET); DALI_TEST_EQUALS(actor.GetType(), Dali::Camera::LOOK_AT_TARGET, TEST_LOCATION); - Dali::Camera::Type cameraType = actor.GetProperty(CameraActor::Property::TYPE); + Dali::Camera::Type cameraType = actor.GetProperty(CameraActor::Property::TYPE); Dali::Camera::Type currentCameraType = actor.GetCurrentProperty(CameraActor::Property::TYPE); DALI_TEST_EQUALS(Camera::LOOK_AT_TARGET, cameraType, TEST_LOCATION); DALI_TEST_EQUALS(Camera::LOOK_AT_TARGET, currentCameraType, TEST_LOCATION); @@ -1229,7 +1229,6 @@ int UtcDaliCameraActorSetCameraOnScene(void) DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); DALI_TEST_EQUALS(false, actor.GetInvertYAxis(), TEST_LOCATION); - Dali::Camera::Type cameraType = actor.GetProperty(CameraActor::Property::TYPE); DALI_TEST_EQUALS(cameraType, Camera::LOOK_AT_TARGET, TEST_LOCATION); @@ -1801,6 +1800,125 @@ int UtcDaliCameraActorReflectionByPlane(void) END_TEST; } +int UtcDaliCameraActorProjectionDirection(void) +{ + TestApplication application; + + Integration::Scene stage = application.GetScene(); + Vector2 stageSize = stage.GetSize(); + + CameraActor defaultCameraActor = stage.GetRenderTaskList().GetTask(0).GetCameraActor(); + CameraActor expectCameraActor1 = CameraActor::New(stageSize); + CameraActor expectCameraActor2 = CameraActor::New(stageSize); + CameraActor expectCameraActor3 = CameraActor::New(stageSize); + + float fieldOfView = defaultCameraActor.GetFieldOfView(); + float aspectRatio = defaultCameraActor.GetAspectRatio(); + + // Calculate expect camera 1's fov. + float anotherFieldOfView = 2.0f * std::atan(std::tan(fieldOfView * 0.5f) / aspectRatio); + expectCameraActor1.SetFieldOfView(anotherFieldOfView); + + // Calculate expect camera 2's fov and aspect ratio. + float anotherFieldOfView2 = 2.0f * std::atan(std::tan(fieldOfView * 0.5f) * aspectRatio); + float anotherAspectRatio = 1.0f / aspectRatio; + expectCameraActor2.SetFieldOfView(anotherFieldOfView2); + expectCameraActor2.SetAspectRatio(anotherAspectRatio); + + // Calculate expect camera 3's aspect raio + expectCameraActor3.SetAspectRatio(anotherAspectRatio); + + stage.Add(expectCameraActor1); + stage.Add(expectCameraActor2); + stage.Add(expectCameraActor3); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + // Test default projection direction is VERTICAL + DALI_TEST_EQUALS(defaultCameraActor.GetProperty(Dali::DevelCameraActor::Property::PROJECTION_DIRECTION), static_cast(Dali::DevelCameraActor::ProjectionDirection::VERTICAL), TEST_LOCATION); + + Matrix matrixBefore, matrixAfter; + Matrix matrixExpect1, matrixExpect2, matrixExpect3; + + defaultCameraActor.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixBefore); + expectCameraActor1.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixExpect1); + expectCameraActor2.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixExpect2); + expectCameraActor3.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixExpect3); + + tet_printf("Check ProjectionDirection::HORIZONTAL\n"); + + defaultCameraActor.SetProperty(Dali::DevelCameraActor::Property::PROJECTION_DIRECTION, Dali::DevelCameraActor::ProjectionDirection::HORIZONTAL); + DALI_TEST_EQUALS(defaultCameraActor.GetProperty(Dali::DevelCameraActor::Property::PROJECTION_DIRECTION), static_cast(Dali::DevelCameraActor::ProjectionDirection::HORIZONTAL), TEST_LOCATION); + // NOTE : ProjectionDirection doesn't change camera actor's FieldOfView and AspectRatio value.) + DALI_TEST_EQUALS(defaultCameraActor.GetFieldOfView(), fieldOfView, TEST_LOCATION); + DALI_TEST_EQUALS(defaultCameraActor.GetAspectRatio(), aspectRatio, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + defaultCameraActor.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixAfter); + + // Check camera's ProjectionMatrix same as expect camera 1's ProjectionMatrix. + DALI_TEST_EQUALS(matrixAfter, matrixExpect1, Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION); + + tet_printf("Check ProjectionDirection::HORIZONTAL + Change aspect ratio\n"); + + defaultCameraActor.SetAspectRatio(anotherAspectRatio); + DALI_TEST_EQUALS(defaultCameraActor.GetAspectRatio(), anotherAspectRatio, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + defaultCameraActor.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixAfter); + + // Check camera's ProjectionMatrix same as expect camera 2's ProjectionMatrix. + DALI_TEST_EQUALS(matrixAfter, matrixExpect2, Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION); + + tet_printf("Check ProjectionDirection::HORIZONTAL + Change aspect ratio + Change fov\n"); + + defaultCameraActor.SetFieldOfView(anotherFieldOfView); + DALI_TEST_EQUALS(defaultCameraActor.GetFieldOfView(), anotherFieldOfView, TEST_LOCATION); + DALI_TEST_EQUALS(defaultCameraActor.GetAspectRatio(), anotherAspectRatio, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + defaultCameraActor.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixAfter); + + // Check camera's ProjectionMatrix same as expect camera 3's ProjectionMatrix. + DALI_TEST_EQUALS(matrixAfter, matrixExpect3, Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION); + + tet_printf("Check ProjectionDirection::VERTICAL, the original camera\n"); + + defaultCameraActor.SetProperty(Dali::DevelCameraActor::Property::PROJECTION_DIRECTION, Dali::DevelCameraActor::ProjectionDirection::VERTICAL); + defaultCameraActor.SetFieldOfView(fieldOfView); + defaultCameraActor.SetAspectRatio(aspectRatio); + DALI_TEST_EQUALS(defaultCameraActor.GetProperty(Dali::DevelCameraActor::Property::PROJECTION_DIRECTION), static_cast(Dali::DevelCameraActor::ProjectionDirection::VERTICAL), TEST_LOCATION); + DALI_TEST_EQUALS(defaultCameraActor.GetFieldOfView(), fieldOfView, TEST_LOCATION); + DALI_TEST_EQUALS(defaultCameraActor.GetAspectRatio(), aspectRatio, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + + defaultCameraActor.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(matrixAfter); + + // Check vertical camera's ProjectionMatrix same as original ProjectionMatrix. + DALI_TEST_EQUALS(matrixAfter, matrixBefore, Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION); + + END_TEST; +} + int UtcDaliCameraActorGetAspectRatioNegative(void) { TestApplication application; @@ -2236,7 +2354,6 @@ int UtcDaliCameraActorCulling01(void) END_TEST; } - int UtcDaliCameraActorSetProperty(void) { TestApplication application; diff --git a/dali/devel-api/actors/camera-actor-devel.h b/dali/devel-api/actors/camera-actor-devel.h index b42653cd1..3951ca4b4 100644 --- a/dali/devel-api/actors/camera-actor-devel.h +++ b/dali/devel-api/actors/camera-actor-devel.h @@ -2,7 +2,7 @@ #define DALI_CAMERA_ACTOR_DEVEL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,15 @@ namespace Dali { namespace DevelCameraActor { +/** + * @brief Enumeration for projection direction. + */ +enum ProjectionDirection +{ + VERTICAL, ///< Field of view direction based on vertial. + HORIZONTAL, ///< Field of view direction based on horizontal. +}; + namespace Property { enum @@ -33,7 +42,21 @@ enum * @details Type Property::VECTOR4 * @note Optional */ - REFLECTION_PLANE = CameraActor::Property::INVERT_Y_AXIS + 1 + REFLECTION_PLANE = CameraActor::Property::INVERT_Y_AXIS + 1, + + /** + * @brief Determine basic direction of projection relative properties. + * It will be used when we need to calculate some values relative with aspect ratio automatically. + * + * For example, if aspect ratio is 4:3 and set fieldOfView as 60 degree. + * If ProjectionDirection::VERTICAL, basic direction is vertical. so, FoV of horizontal direction become ~75.2 degree + * If ProjectionDirection::HORIZONTAL, basic direction is horizontal. so, FoV of vertical direction become ~46.8 degree + * + * @details Type Property::INT + * @note This property doesn't change FieldOfView value automatically. So result scene might be changed. + * @note Default is ProjectionDirection::VERTICAL. + */ + PROJECTION_DIRECTION, }; } // Namespace Property diff --git a/dali/internal/common/type-abstraction-enums.h b/dali/internal/common/type-abstraction-enums.h index 543c71fb5..e2ba0a6be 100644 --- a/dali/internal/common/type-abstraction-enums.h +++ b/dali/internal/common/type-abstraction-enums.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_TYPE_ABSTRACTION_ENUMS_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include #include #include @@ -68,6 +69,10 @@ template<> struct ParameterType : public BasicType { }; +template<> +struct ParameterType : public BasicType +{ +}; } //namespace Internal diff --git a/dali/internal/event/actors/camera-actor-impl.cpp b/dali/internal/event/actors/camera-actor-impl.cpp index 79971ff85..0025ac8f4 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -159,6 +159,7 @@ CameraActor::CameraActor(const SceneGraph::Node& node) mTarget(SceneGraph::Camera::DEFAULT_TARGET_POSITION), mType(SceneGraph::Camera::DEFAULT_TYPE), mProjectionMode(SceneGraph::Camera::DEFAULT_MODE), + mProjectionDirection(SceneGraph::Camera::DEFAULT_PROJECTION_DIRECTION), mFieldOfView(SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW), mAspectRatio(SceneGraph::Camera::DEFAULT_ASPECT_RATIO), mNearClippingPlane(SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE), @@ -269,6 +270,18 @@ Dali::Camera::ProjectionMode CameraActor::GetProjectionMode() const return mProjectionMode; } +void CameraActor::SetProjectionDirection(Dali::DevelCameraActor::ProjectionDirection direction) +{ + mPropertyChanged = true; + if(direction != mProjectionDirection) + { + mProjectionDirection = direction; + + // sceneObject is being used in a separate thread; queue a message to set + SetProjectionDirectionMessage(GetEventThreadServices(), *mSceneObject, mProjectionDirection); + } +} + void CameraActor::SetFieldOfView(float fieldOfView) { mPropertyChanged = true; @@ -431,7 +444,7 @@ void CameraActor::SetPerspectiveProjection(const Size& size) CalculateClippingAndZ(width, height, nearClippingPlane, farClippingPlane, cameraZ); // calculate the position of the camera to have the desired aspect ratio - const float fieldOfView = 2.0f * std::atan(height * 0.5f / cameraZ); + const float fieldOfView = 2.0f * std::atan((mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? height : width) * 0.5f / cameraZ); // unless it is too small, we want at least as much space to the back as we have torwards the front const float minClippingFarPlane = 2.f * nearClippingPlane; @@ -660,6 +673,12 @@ void CameraActor::SetDefaultProperty(Property::Index index, const Property::Valu SetReflectByPlane(propertyValue.Get()); break; } + case Dali::DevelCameraActor::Property::PROJECTION_DIRECTION: + { + Dali::DevelCameraActor::ProjectionDirection projectionDirection = Dali::DevelCameraActor::ProjectionDirection(propertyValue.Get()); + SetProjectionDirection(projectionDirection); + break; + } default: { @@ -752,6 +771,11 @@ Property::Value CameraActor::GetDefaultProperty(Property::Index index) const ret = mInvertYAxis; break; } + case Dali::DevelCameraActor::Property::PROJECTION_DIRECTION: + { + ret = mProjectionDirection; + break; + } } // switch(index) } diff --git a/dali/internal/event/actors/camera-actor-impl.h b/dali/internal/event/actors/camera-actor-impl.h index 2869b5940..a817811c9 100644 --- a/dali/internal/event/actors/camera-actor-impl.h +++ b/dali/internal/event/actors/camera-actor-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_CAMERA_ACTOR_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ */ // INTERNAL INCLUES +#include #include #include #include @@ -88,6 +89,13 @@ public: */ Dali::Camera::ProjectionMode GetProjectionMode() const; + /** + * @brief Set the projection direction + * + * @param[in] direction Direction of projection + */ + void SetProjectionDirection(Dali::DevelCameraActor::ProjectionDirection direction); + /** * @copydoc Dali::CameraActor::SetFieldOfView */ @@ -259,20 +267,21 @@ private: private: // Data const SceneGraph::Camera* mSceneObject; ///< Not owned - Vector3 mTarget; - Vector2 mCanvasSize; - Dali::Camera::Type mType; - Dali::Camera::ProjectionMode mProjectionMode; - float mFieldOfView; - float mAspectRatio; - float mNearClippingPlane; - float mFarClippingPlane; - float mLeftClippingPlane; - float mRightClippingPlane; - float mTopClippingPlane; - float mBottomClippingPlane; - bool mInvertYAxis; - bool mPropertyChanged; + Vector3 mTarget; + Vector2 mCanvasSize; + Dali::Camera::Type mType; + Dali::Camera::ProjectionMode mProjectionMode; + Dali::DevelCameraActor::ProjectionDirection mProjectionDirection; + float mFieldOfView; + float mAspectRatio; + float mNearClippingPlane; + float mFarClippingPlane; + float mLeftClippingPlane; + float mRightClippingPlane; + float mTopClippingPlane; + float mBottomClippingPlane; + bool mInvertYAxis; + bool mPropertyChanged; }; } // namespace Internal diff --git a/dali/internal/update/render-tasks/scene-graph-camera.cpp b/dali/internal/update/render-tasks/scene-graph-camera.cpp index c6e99739e..e8350a032 100644 --- a/dali/internal/update/render-tasks/scene-graph-camera.cpp +++ b/dali/internal/update/render-tasks/scene-graph-camera.cpp @@ -96,10 +96,20 @@ void Frustum(Matrix& result, float left, float right, float bottom, float top, f m[12] = m[13] = m[15] = 0.0f; } -void Perspective(Matrix& result, float fovy, float aspect, float near, float far, bool invertYAxis) +void Perspective(Matrix& result, Dali::DevelCameraActor::ProjectionDirection fovDir, float fov, float aspect, float near, float far, bool invertYAxis) { - float frustumH = tanf(fovy * 0.5f) * near; - float frustumW = frustumH * aspect; + float frustumH; + float frustumW; + if(fovDir == Dali::DevelCameraActor::ProjectionDirection::VERTICAL) + { + frustumH = tanf(fov * 0.5f) * near; + frustumW = frustumH * aspect; + } + else + { + frustumW = tanf(fov * 0.5f) * near; + frustumH = frustumW / aspect; + } Frustum(result, -frustumW, frustumW, -frustumH, frustumH, near, far, invertYAxis); } @@ -140,18 +150,19 @@ void Orthographic(Matrix& result, float left, float right, float bottom, float t } // unnamed namespace -const Dali::Camera::Type Camera::DEFAULT_TYPE(Dali::Camera::FREE_LOOK); -const Dali::Camera::ProjectionMode Camera::DEFAULT_MODE(Dali::Camera::PERSPECTIVE_PROJECTION); -const bool Camera::DEFAULT_INVERT_Y_AXIS(false); -const float Camera::DEFAULT_FIELD_OF_VIEW(45.0f * (Math::PI / 180.0f)); -const float Camera::DEFAULT_ASPECT_RATIO(800.0f / 480.0f); -const float Camera::DEFAULT_LEFT_CLIPPING_PLANE(-240.0f); -const float Camera::DEFAULT_RIGHT_CLIPPING_PLANE(240.0f); -const float Camera::DEFAULT_TOP_CLIPPING_PLANE(-400.0f); -const float Camera::DEFAULT_BOTTOM_CLIPPING_PLANE(400.0f); -const float Camera::DEFAULT_NEAR_CLIPPING_PLANE(800.0f); // default height of the screen -const float Camera::DEFAULT_FAR_CLIPPING_PLANE(DEFAULT_NEAR_CLIPPING_PLANE + 2.f * DEFAULT_NEAR_CLIPPING_PLANE); -const Vector3 Camera::DEFAULT_TARGET_POSITION(0.0f, 0.0f, 0.0f); +const Dali::Camera::Type Camera::DEFAULT_TYPE(Dali::Camera::FREE_LOOK); +const Dali::Camera::ProjectionMode Camera::DEFAULT_MODE(Dali::Camera::PERSPECTIVE_PROJECTION); +const Dali::DevelCameraActor::ProjectionDirection Camera::DEFAULT_PROJECTION_DIRECTION(Dali::DevelCameraActor::VERTICAL); +const bool Camera::DEFAULT_INVERT_Y_AXIS(false); +const float Camera::DEFAULT_FIELD_OF_VIEW(45.0f * (Math::PI / 180.0f)); +const float Camera::DEFAULT_ASPECT_RATIO(800.0f / 480.0f); +const float Camera::DEFAULT_LEFT_CLIPPING_PLANE(-240.0f); +const float Camera::DEFAULT_RIGHT_CLIPPING_PLANE(240.0f); +const float Camera::DEFAULT_TOP_CLIPPING_PLANE(-400.0f); +const float Camera::DEFAULT_BOTTOM_CLIPPING_PLANE(400.0f); +const float Camera::DEFAULT_NEAR_CLIPPING_PLANE(800.0f); // default height of the screen +const float Camera::DEFAULT_FAR_CLIPPING_PLANE(DEFAULT_NEAR_CLIPPING_PLANE + 2.f * DEFAULT_NEAR_CLIPPING_PLANE); +const Vector3 Camera::DEFAULT_TARGET_POSITION(0.0f, 0.0f, 0.0f); Camera::Camera() : mUpdateViewFlag(UPDATE_COUNT), @@ -160,6 +171,7 @@ Camera::Camera() mNode(nullptr), mType(DEFAULT_TYPE), mProjectionMode(DEFAULT_MODE), + mProjectionDirection(DEFAULT_PROJECTION_DIRECTION), mInvertYAxis(DEFAULT_INVERT_Y_AXIS), mFieldOfView(DEFAULT_FIELD_OF_VIEW), mAspectRatio(DEFAULT_ASPECT_RATIO), @@ -205,6 +217,12 @@ void Camera::SetProjectionMode(Dali::Camera::ProjectionMode mode) mUpdateProjectionFlag = UPDATE_COUNT; } +void Camera::SetProjectionDirection(Dali::DevelCameraActor::ProjectionDirection direction) +{ + mProjectionDirection = direction; + mUpdateProjectionFlag = UPDATE_COUNT; +} + void Camera::SetInvertYAxis(bool invertYAxis) { mInvertYAxis = invertYAxis; @@ -619,6 +637,7 @@ uint32_t Camera::UpdateProjection(BufferIndex updateBufferIndex) { Matrix& projectionMatrix = mProjectionMatrix.Get(updateBufferIndex); Perspective(projectionMatrix, + mProjectionDirection, mFieldOfView, mAspectRatio, mNearClippingPlane, diff --git a/dali/internal/update/render-tasks/scene-graph-camera.h b/dali/internal/update/render-tasks/scene-graph-camera.h index 23e1c5420..2af3cecb2 100644 --- a/dali/internal/update/render-tasks/scene-graph-camera.h +++ b/dali/internal/update/render-tasks/scene-graph-camera.h @@ -19,7 +19,9 @@ */ // INTERNAL INCLUDES +#include #include +#include #include #include #include @@ -53,19 +55,20 @@ class SceneController; class Camera { public: - static const Dali::Camera::Type DEFAULT_TYPE; - static const Dali::Camera::ProjectionMode DEFAULT_MODE; - static const bool DEFAULT_INVERT_Y_AXIS; - static const float DEFAULT_FIELD_OF_VIEW; - static const float DEFAULT_ASPECT_RATIO; - static const float DEFAULT_LEFT_CLIPPING_PLANE; - static const float DEFAULT_RIGHT_CLIPPING_PLANE; - static const float DEFAULT_TOP_CLIPPING_PLANE; - static const float DEFAULT_BOTTOM_CLIPPING_PLANE; - static const float DEFAULT_NEAR_CLIPPING_PLANE; - static const float DEFAULT_FAR_CLIPPING_PLANE; - static const Vector2 DEFAULT_STEREO_BIAS; - static const Vector3 DEFAULT_TARGET_POSITION; + static const Dali::Camera::Type DEFAULT_TYPE; + static const Dali::Camera::ProjectionMode DEFAULT_MODE; + static const Dali::DevelCameraActor::ProjectionDirection DEFAULT_PROJECTION_DIRECTION; + static const bool DEFAULT_INVERT_Y_AXIS; + static const float DEFAULT_FIELD_OF_VIEW; + static const float DEFAULT_ASPECT_RATIO; + static const float DEFAULT_LEFT_CLIPPING_PLANE; + static const float DEFAULT_RIGHT_CLIPPING_PLANE; + static const float DEFAULT_TOP_CLIPPING_PLANE; + static const float DEFAULT_BOTTOM_CLIPPING_PLANE; + static const float DEFAULT_NEAR_CLIPPING_PLANE; + static const float DEFAULT_FAR_CLIPPING_PLANE; + static const Vector2 DEFAULT_STEREO_BIAS; + static const Vector3 DEFAULT_TARGET_POSITION; /** * Plane equation container for a plane of the view frustum @@ -132,6 +135,11 @@ public: */ void SetProjectionMode(Dali::Camera::ProjectionMode projectionMode); + /** + * @copydoc Dali::Internal::CameraActor::SetProjectionDirection + */ + void SetProjectionDirection(Dali::DevelCameraActor::ProjectionDirection direction); + /** * @copydoc Dali::Internal::CameraActor::SetFieldOfView */ @@ -320,10 +328,11 @@ private: int mProjectionRotation; ///< The rotaion angle of the projection const Node* mNode; ///< The node this scene graph camera belongs to -public: // PROPERTIES - Dali::Camera::Type mType; // Non-animatable - Dali::Camera::ProjectionMode mProjectionMode; // Non-animatable - bool mInvertYAxis; // Non-animatable +public: // PROPERTIES + Dali::Camera::Type mType; // Non-animatable + Dali::Camera::ProjectionMode mProjectionMode; // Non-animatable + Dali::DevelCameraActor::ProjectionDirection mProjectionDirection; // Non-animatable + bool mInvertYAxis; // Non-animatable float mFieldOfView; float mAspectRatio; @@ -373,6 +382,17 @@ inline void SetProjectionModeMessage(EventThreadServices& eventThreadServices, c new(slot) LocalProjectionMode(&camera, &Camera::SetProjectionMode, parameter); } +inline void SetProjectionDirectionMessage(EventThreadServices& eventThreadServices, const Camera& camera, Dali::DevelCameraActor::ProjectionDirection parameter) +{ + using LocalProjectionDirection = MessageValue1; + + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalProjectionDirection)); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalProjectionDirection(&camera, &Camera::SetProjectionDirection, parameter); +} + inline void SetFieldOfViewMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter) { using LocalType = MessageValue1; -- 2.34.1