X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Factors%2Fcamera-actor-impl.cpp;h=883a28db269b71832f72b52610e9e24c3630369b;hb=9c6cd5cbe26eb355f2f0daeaae85a28a8d81a3b3;hp=9fc8eadfc7b6867352b46ce079f45b16d87b34be;hpb=1f28c4c4fb2cd1edc8f20be3f71db30dab766a26;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/actors/camera-actor-impl.cpp b/dali/internal/event/actors/camera-actor-impl.cpp index 9fc8ead..883a28d 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -32,6 +32,7 @@ #include #include +#include namespace Dali { @@ -48,20 +49,22 @@ namespace */ // clang-format off DALI_PROPERTY_TABLE_BEGIN -DALI_PROPERTY( "type", INTEGER, true, false, true, Dali::CameraActor::Property::TYPE ) -DALI_PROPERTY( "projectionMode", INTEGER, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE ) -DALI_PROPERTY( "fieldOfView", FLOAT, true, true, true, Dali::CameraActor::Property::FIELD_OF_VIEW ) -DALI_PROPERTY( "aspectRatio", FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO ) -DALI_PROPERTY( "nearPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE ) -DALI_PROPERTY( "farPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE ) -DALI_PROPERTY( "leftPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE ) -DALI_PROPERTY( "rightPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE ) -DALI_PROPERTY( "topPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE ) -DALI_PROPERTY( "bottomPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE ) -DALI_PROPERTY( "targetPosition", VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION ) -DALI_PROPERTY( "projectionMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX ) -DALI_PROPERTY( "viewMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX ) -DALI_PROPERTY( "invertYAxis", BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS ) +DALI_PROPERTY( "type", INTEGER, true, false, true, Dali::CameraActor::Property::TYPE ) +DALI_PROPERTY( "projectionMode", INTEGER, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE ) +DALI_PROPERTY( "fieldOfView", FLOAT, true, true, true, Dali::CameraActor::Property::FIELD_OF_VIEW ) +DALI_PROPERTY( "aspectRatio", FLOAT, true, true, true, Dali::CameraActor::Property::ASPECT_RATIO ) +DALI_PROPERTY( "nearPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE ) +DALI_PROPERTY( "farPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE ) +DALI_PROPERTY( "leftPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE ) +DALI_PROPERTY( "rightPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE ) +DALI_PROPERTY( "topPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE ) +DALI_PROPERTY( "bottomPlaneDistance", FLOAT, false, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE ) +DALI_PROPERTY( "targetPosition", VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION ) +DALI_PROPERTY( "projectionMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX ) +DALI_PROPERTY( "viewMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX ) +DALI_PROPERTY( "invertYAxis", BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS ) +DALI_PROPERTY( "orthographicSize", FLOAT, true, true, true, Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE ) +DALI_PROPERTY( "projectionDirection", INTEGER, true, false, true, Dali::DevelCameraActor::Property::PROJECTION_DIRECTION ) DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, CameraDefaultProperties ) // clang-format on @@ -105,7 +108,7 @@ void BuildOrthoPickingRay(const Matrix& viewMatrix, // Transforms the touch point from the screen reference system to the world reference system. Matrix invViewProjection(false); // Don't initialize. - MatrixUtils::Multiply(invViewProjection, viewMatrix, projectionMatrix); + MatrixUtils::MultiplyProjectionMatrix(invViewProjection, viewMatrix, projectionMatrix); if(!invViewProjection.Invert()) { DALI_ASSERT_DEBUG(false); @@ -136,9 +139,80 @@ void BuildOrthoPickingRay(const Matrix& viewMatrix, rayDir.w = 1.0f; } +/** + * @brief Helper class to calculate left/right/top/bottom plane distance by orthographicSize and something other info. + * It will resolve some confuse case of plane distance value. + * (Something like, Is top plane distance is positive or negative? is aspect ratio is width/height or height/width?) + */ +struct OrthographicSizeConverter +{ + constexpr OrthographicSizeConverter(float orthographicSize, float aspectRatio, Dali::DevelCameraActor::ProjectionDirection projectionDirection) + : mOrthographicSize(orthographicSize), + mAspectRatio(aspectRatio), + mProjectionDirection(projectionDirection) + { + } + + inline float LeftPlaneDistance() const + { + return -(mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize * mAspectRatio : mOrthographicSize); + } + + inline float RightPlaneDistance() const + { + return (mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize * mAspectRatio : mOrthographicSize); + } + + inline float TopPlaneDistance() const + { + return (mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize : mOrthographicSize / mAspectRatio); + } + + inline float BottomPlaneDistance() const + { + return -(mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? mOrthographicSize : mOrthographicSize / mAspectRatio); + } + + float mOrthographicSize; + float mAspectRatio; + Dali::DevelCameraActor::ProjectionDirection mProjectionDirection; +}; + +static const float DEFAULT_NEAR_CLIPPING_PLANE_FOR_3D = 0.1f; +static const float DEFAULT_FAR_CLIPPING_PLANE_FOR_3D = 100.0f; + +static const Dali::Camera::ProjectionMode DEFAULT_MODE_FOR_3D = SceneGraph::Camera::DEFAULT_MODE; +static const Dali::DevelCameraActor::ProjectionDirection DEFAULT_PROJECTION_DIRECTION_FOR_3D = SceneGraph::Camera::DEFAULT_PROJECTION_DIRECTION; + +static const float DEFAULT_FIELD_OF_VIEW_FOR_3D = SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW; +static const float DEFAULT_POSITIN_Z_FOR_3D = 5.0f; +static const Quaternion DEFAULT_ORIENTATION_FOR_3D = Quaternion(Dali::ANGLE_180, Vector3::YAXIS); +static const float DEFAULT_ORTHOGRAPHIC_SIZE_FOR_3D = 2.071068f; // DEFAULT_POSITIN_Z_FOR_3D * std::tan(DEFAULT_FIELD_OF_VIEW_FOR_3D * 0.5f); // Rectangle size of z=0. + +/** + * @brief Setup CameraActor's parameters for 3D apps. + * Conceptually, We can must see 1 world unit cube at world origin. + * Detail value can be changed by UX. + * + * @param[in,out] cameraActorObject CameraActor who need to apply default camera parameters. + */ +void SetupDefault3DCameraProperties(Internal::CameraActor& cameraActorObject) +{ + cameraActorObject.SetNearClippingPlane(DEFAULT_NEAR_CLIPPING_PLANE_FOR_3D); + cameraActorObject.SetFarClippingPlane(DEFAULT_FAR_CLIPPING_PLANE_FOR_3D); + + cameraActorObject.SetProjectionMode(DEFAULT_MODE_FOR_3D); + cameraActorObject.SetProjectionDirection(DEFAULT_PROJECTION_DIRECTION_FOR_3D); + cameraActorObject.SetFieldOfView(DEFAULT_FIELD_OF_VIEW_FOR_3D); + cameraActorObject.SetZ(DEFAULT_POSITIN_Z_FOR_3D); + cameraActorObject.SetOrientation(DEFAULT_ORIENTATION_FOR_3D); + + cameraActorObject.SetOrthographicSize(DEFAULT_ORTHOGRAPHIC_SIZE_FOR_3D); +} + } // namespace -CameraActorPtr CameraActor::New(const Size& size) +CameraActorPtr CameraActor::New(const Size& size, bool hintFor3D) { // create camera. Cameras are owned by the update manager SceneGraph::Camera* camera = SceneGraph::Camera::New(); @@ -156,11 +230,19 @@ CameraActorPtr CameraActor::New(const Size& size) actor->Initialize(); actor->SetName("DefaultCamera"); - actor->SetPerspectiveProjection(size); + if(hintFor3D) + { + // Initialize camera property for 3D case. + SetupDefault3DCameraProperties(*actor); + } + else + { + actor->SetPerspectiveProjection(size); - // By default Actors face in the positive Z direction in world space - // CameraActors should face in the negative Z direction, towards the other actors - actor->SetOrientation(Quaternion(Dali::ANGLE_180, Vector3::YAXIS)); + // By default Actors face in the positive Z direction in world space + // CameraActors should face in the negative Z direction, towards the other actors + actor->SetOrientation(Quaternion(Dali::ANGLE_180, Vector3::YAXIS)); + } return actor; } @@ -172,13 +254,10 @@ CameraActor::CameraActor(const SceneGraph::Node& node) mProjectionMode(SceneGraph::Camera::DEFAULT_MODE), mProjectionDirection(SceneGraph::Camera::DEFAULT_PROJECTION_DIRECTION), mFieldOfView(SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW), + mOrthographicSize(SceneGraph::Camera::DEFAULT_ORTHOGRAPHIC_SIZE), mAspectRatio(SceneGraph::Camera::DEFAULT_ASPECT_RATIO), mNearClippingPlane(SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE), mFarClippingPlane(SceneGraph::Camera::DEFAULT_FAR_CLIPPING_PLANE), - mLeftClippingPlane(SceneGraph::Camera::DEFAULT_LEFT_CLIPPING_PLANE), - mRightClippingPlane(SceneGraph::Camera::DEFAULT_RIGHT_CLIPPING_PLANE), - mTopClippingPlane(SceneGraph::Camera::DEFAULT_TOP_CLIPPING_PLANE), - mBottomClippingPlane(SceneGraph::Camera::DEFAULT_BOTTOM_CLIPPING_PLANE), mInvertYAxis(SceneGraph::Camera::DEFAULT_INVERT_Y_AXIS), mPropertyChanged(false) { @@ -293,6 +372,29 @@ float CameraActor::GetCurrentFieldOfView() const return GetCameraSceneObject().GetFieldOfView(GetEventThreadServices().GetEventBufferIndex()); } +void CameraActor::SetOrthographicSize(float orthographicSize) +{ + mPropertyChanged = true; + if(!Equals(orthographicSize, mOrthographicSize)) + { + mOrthographicSize = orthographicSize; + + // sceneObject is being used in a separate thread; queue a message to set + BakeOrthographicSizeMessage(GetEventThreadServices(), GetCameraSceneObject(), mOrthographicSize); + } +} + +float CameraActor::GetOrthographicSize() const +{ + return mOrthographicSize; +} + +float CameraActor::GetCurrentOrthographicSize() const +{ + // node is being used in a separate thread; copy the value from the previous update + return GetCameraSceneObject().GetOrthographicSize(GetEventThreadServices().GetEventBufferIndex()); +} + void CameraActor::SetAspectRatio(float aspectRatio) { mPropertyChanged = true; @@ -301,7 +403,7 @@ void CameraActor::SetAspectRatio(float aspectRatio) mAspectRatio = aspectRatio; // sceneObject is being used in a separate thread; queue a message to set - SetAspectRatioMessage(GetEventThreadServices(), GetCameraSceneObject(), mAspectRatio); + BakeAspectRatioMessage(GetEventThreadServices(), GetCameraSceneObject(), mAspectRatio); } } @@ -310,6 +412,12 @@ float CameraActor::GetAspectRatio() const return mAspectRatio; } +float CameraActor::GetCurrentAspectRatio() const +{ + // node is being used in a separate thread; copy the value from the previous update + return GetCameraSceneObject().GetAspectRatio(GetEventThreadServices().GetEventBufferIndex()); +} + void CameraActor::SetNearClippingPlane(float nearClippingPlane) { mPropertyChanged = true; @@ -344,54 +452,6 @@ float CameraActor::GetFarClippingPlane() const return mFarClippingPlane; } -void CameraActor::SetLeftClippingPlane(float leftClippingPlane) -{ - mPropertyChanged = true; - if(!Equals(leftClippingPlane, mLeftClippingPlane)) - { - mLeftClippingPlane = leftClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetLeftClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mLeftClippingPlane); - } -} - -void CameraActor::SetRightClippingPlane(float rightClippingPlane) -{ - mPropertyChanged = true; - if(!Equals(rightClippingPlane, mRightClippingPlane)) - { - mRightClippingPlane = rightClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetRightClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mRightClippingPlane); - } -} - -void CameraActor::SetTopClippingPlane(float topClippingPlane) -{ - mPropertyChanged = true; - if(!Equals(topClippingPlane, mTopClippingPlane)) - { - mTopClippingPlane = topClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetTopClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mTopClippingPlane); - } -} - -void CameraActor::SetBottomClippingPlane(float bottomClippingPlane) -{ - mPropertyChanged = true; - if(!Equals(bottomClippingPlane, mBottomClippingPlane)) - { - mBottomClippingPlane = bottomClippingPlane; - - // sceneObject is being used in a separate thread; queue a message to set - SetBottomClippingPlaneMessage(GetEventThreadServices(), GetCameraSceneObject(), mBottomClippingPlane); - } -} - void CameraActor::SetInvertYAxis(bool invertYAxis) { if(invertYAxis != mInvertYAxis) @@ -411,7 +471,7 @@ bool CameraActor::GetInvertYAxis() const void CameraActor::SetPerspectiveProjection(const Size& size) { SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION); - mCanvasSize = size; + mCanvasSize = static_cast(size); if((size.width < Math::MACHINE_EPSILON_1000) || (size.height < Math::MACHINE_EPSILON_1000)) { @@ -428,43 +488,13 @@ void CameraActor::SetPerspectiveProjection(const Size& size) return; } } - - float width = mCanvasSize.width; - float height = mCanvasSize.height; - - float nearClippingPlane; - float farClippingPlane; - float cameraZ; - 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((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; - if(farClippingPlane < minClippingFarPlane) - { - farClippingPlane = minClippingFarPlane; - } - - const float aspectRatio = width / height; - - // sceneObject is being used in a separate thread; queue a message to set - SetFieldOfView(fieldOfView); - SetNearClippingPlane(nearClippingPlane); - SetFarClippingPlane(farClippingPlane); - SetLeftClippingPlane(width * -0.5f); - SetRightClippingPlane(width * 0.5f); - SetTopClippingPlane(height * 0.5f); // Top is +ve to keep consistency with orthographic values - SetBottomClippingPlane(height * -0.5f); // Bottom is -ve to keep consistency with orthographic values - SetAspectRatio(aspectRatio); - SetZ(cameraZ); + ApplyDefaultProjection(); } -void CameraActor::SetOrthographicProjection(const Vector2& size) +void CameraActor::SetOrthographicProjection(const Size& size) { SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION); - mCanvasSize = size; + mCanvasSize = static_cast(size); if((size.width < Math::MACHINE_EPSILON_1000) || (size.height < Math::MACHINE_EPSILON_1000)) { @@ -482,24 +512,42 @@ void CameraActor::SetOrthographicProjection(const Vector2& size) } } + ApplyDefaultProjection(); +} + +void CameraActor::ApplyDefaultProjection() +{ + const float width = mCanvasSize.width; + const float height = mCanvasSize.height; + // Choose near, far and Z parameters to match the SetPerspectiveProjection above. float nearClippingPlane; float farClippingPlane; float cameraZ; - CalculateClippingAndZ(size.width, size.height, nearClippingPlane, farClippingPlane, cameraZ); - SetOrthographicProjection(-size.x * 0.5f, size.x * 0.5f, size.y * 0.5f, size.y * -0.5f, nearClippingPlane, farClippingPlane); - SetZ(cameraZ); -} + CalculateClippingAndZ(width, height, nearClippingPlane, farClippingPlane, cameraZ); -void CameraActor::SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far) -{ - SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION); - SetLeftClippingPlane(left); - SetRightClippingPlane(right); - SetTopClippingPlane(top); - SetBottomClippingPlane(bottom); - SetNearClippingPlane(near); - SetFarClippingPlane(far); + // calculate orthographic size. + const float orthographicSize = (mProjectionDirection == DevelCameraActor::ProjectionDirection::VERTICAL ? height : width) * 0.5f; + + // calculate the position of the camera to have the desired aspect ratio + const float fieldOfView = 2.0f * std::atan(orthographicSize / 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; + if(farClippingPlane < minClippingFarPlane) + { + farClippingPlane = minClippingFarPlane; + } + + const float aspectRatio = width / height; + + // sceneObject is being used in a separate thread; queue a message to set + SetFieldOfView(fieldOfView); + SetNearClippingPlane(nearClippingPlane); + SetFarClippingPlane(farClippingPlane); + SetAspectRatio(aspectRatio); + SetOrthographicSize(orthographicSize); + SetZ(cameraZ); } bool CameraActor::BuildPickingRay(const Vector2& screenCoordinates, @@ -607,6 +655,11 @@ void CameraActor::SetDefaultProperty(Property::Index index, const Property::Valu SetFieldOfView(propertyValue.Get()); // set to 0 in case property is not float break; } + case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE: + { + SetOrthographicSize(propertyValue.Get()); // set to 0 in case property is not float + break; + } case Dali::CameraActor::Property::ASPECT_RATIO: { SetAspectRatio(propertyValue.Get()); // set to 0 in case property is not float @@ -624,22 +677,22 @@ void CameraActor::SetDefaultProperty(Property::Index index, const Property::Valu } case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE: { - SetLeftClippingPlane(propertyValue.Get()); // set to 0 in case property is not float + DALI_LOG_WARNING("LEFT_PLANE_DISTANCE is read-only\n"); break; } case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE: { - SetRightClippingPlane(propertyValue.Get()); // set to 0 in case property is not float + DALI_LOG_WARNING("RIGHT_PLANE_DISTANCE is read-only\n"); break; } case Dali::CameraActor::Property::TOP_PLANE_DISTANCE: { - SetTopClippingPlane(propertyValue.Get()); // set to 0 in case property is not float + DALI_LOG_WARNING("TOP_PLANE_DISTANCE is read-only\n"); break; } case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE: { - SetBottomClippingPlane(propertyValue.Get()); // set to 0 in case property is not float + DALI_LOG_WARNING("BOTTOM_PLANE_DISTANCE is read-only\n"); break; } case Dali::CameraActor::Property::TARGET_POSITION: @@ -710,6 +763,11 @@ Property::Value CameraActor::GetDefaultProperty(Property::Index index) const ret = mFieldOfView; break; } + case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE: + { + ret = mOrthographicSize; + break; + } case Dali::CameraActor::Property::ASPECT_RATIO: { ret = mAspectRatio; @@ -727,22 +785,22 @@ Property::Value CameraActor::GetDefaultProperty(Property::Index index) const } case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE: { - ret = mLeftClippingPlane; + ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).LeftPlaneDistance(); break; } case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE: { - ret = mRightClippingPlane; + ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).RightPlaneDistance(); break; } case Dali::CameraActor::Property::TOP_PLANE_DISTANCE: { - ret = mTopClippingPlane; + ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).TopPlaneDistance(); break; } case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE: { - ret = mBottomClippingPlane; + ret = OrthographicSizeConverter(mOrthographicSize, mAspectRatio, mProjectionDirection).BottomPlaneDistance(); break; } case Dali::CameraActor::Property::TARGET_POSITION: @@ -792,6 +850,36 @@ Property::Value CameraActor::GetDefaultPropertyCurrentValue(Property::Index inde ret = GetCurrentFieldOfView(); break; } + case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE: + { + ret = GetCurrentOrthographicSize(); + break; + } + case Dali::CameraActor::Property::ASPECT_RATIO: + { + ret = GetCurrentAspectRatio(); + break; + } + case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE: + { + ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).LeftPlaneDistance(); + break; + } + case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE: + { + ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).RightPlaneDistance(); + break; + } + case Dali::CameraActor::Property::TOP_PLANE_DISTANCE: + { + ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).TopPlaneDistance(); + break; + } + case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE: + { + ret = OrthographicSizeConverter(GetCurrentOrthographicSize(), GetCurrentAspectRatio(), mProjectionDirection).BottomPlaneDistance(); + break; + } default: { ret = GetDefaultProperty(index); // Most are event-side properties, the scene-graph properties are only on the scene-graph @@ -822,6 +910,16 @@ void CameraActor::OnNotifyDefaultPropertyAnimation(Animation& animation, Propert value.Get(mFieldOfView); break; } + case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE: + { + value.Get(mOrthographicSize); + break; + } + case Dali::CameraActor::Property::ASPECT_RATIO: + { + value.Get(mAspectRatio); + break; + } } break; } @@ -834,6 +932,16 @@ void CameraActor::OnNotifyDefaultPropertyAnimation(Animation& animation, Propert AdjustValue(mFieldOfView, value); break; } + case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE: + { + AdjustValue(mOrthographicSize, value); + break; + } + case Dali::CameraActor::Property::ASPECT_RATIO: + { + AdjustValue(mAspectRatio, value); + break; + } } break; } @@ -851,6 +959,16 @@ const SceneGraph::PropertyBase* CameraActor::GetSceneObjectAnimatableProperty(Pr property = GetCameraSceneObject().GetFieldOfView(); break; } + case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE: + { + property = GetCameraSceneObject().GetOrthographicSize(); + break; + } + case Dali::CameraActor::Property::ASPECT_RATIO: + { + property = GetCameraSceneObject().GetAspectRatio(); + break; + } // no default on purpose as we chain method up to actor } if(!property) @@ -861,6 +979,7 @@ const SceneGraph::PropertyBase* CameraActor::GetSceneObjectAnimatableProperty(Pr return property; } + const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty(Property::Index index) const { const PropertyInputImpl* property(nullptr); @@ -872,6 +991,16 @@ const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty(Property::Inde property = GetCameraSceneObject().GetFieldOfView(); break; } + case Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE: + { + property = GetCameraSceneObject().GetOrthographicSize(); + break; + } + case Dali::CameraActor::Property::ASPECT_RATIO: + { + property = GetCameraSceneObject().GetAspectRatio(); + break; + } case Dali::CameraActor::Property::PROJECTION_MATRIX: { property = GetCameraSceneObject().GetProjectionMatrix();