2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/event/actors/camera-actor-impl.h>
23 #include <cstring> // for strcmp
26 #include <dali/devel-api/actors/camera-actor-devel.h>
27 #include <dali/internal/event/common/projection.h>
28 #include <dali/internal/event/common/property-helper.h>
29 #include <dali/internal/event/common/thread-local-storage.h>
30 #include <dali/public-api/object/type-registry.h>
32 #include <dali/internal/update/manager/update-manager.h>
43 * We want to discourage the use of property strings (minimize string comparisons),
44 * particularly for the default properties.
45 * Name Type writable animatable constraint-input enum for index-checking
48 DALI_PROPERTY_TABLE_BEGIN
49 DALI_PROPERTY( "type", INTEGER, true, false, true, Dali::CameraActor::Property::TYPE )
50 DALI_PROPERTY( "projectionMode", INTEGER, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE )
51 DALI_PROPERTY( "fieldOfView", FLOAT, true, false, true, Dali::CameraActor::Property::FIELD_OF_VIEW )
52 DALI_PROPERTY( "aspectRatio", FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO )
53 DALI_PROPERTY( "nearPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE )
54 DALI_PROPERTY( "farPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE )
55 DALI_PROPERTY( "leftPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE )
56 DALI_PROPERTY( "rightPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE )
57 DALI_PROPERTY( "topPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE )
58 DALI_PROPERTY( "bottomPlaneDistance", FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE )
59 DALI_PROPERTY( "targetPosition", VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION )
60 DALI_PROPERTY( "projectionMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX )
61 DALI_PROPERTY( "viewMatrix", MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX )
62 DALI_PROPERTY( "invertYAxis", BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS )
63 DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, CameraDefaultProperties )
66 // calculate the far plane distance for a 16bit depth buffer with 4 bits per unit precision
67 void CalculateClippingAndZ(float width, float height, float& nearClippingPlane, float& farClippingPlane, float& cameraZ)
69 nearClippingPlane = std::max(width, height);
70 farClippingPlane = nearClippingPlane + static_cast<float>(0xFFFF >> 4);
71 cameraZ = 2.0f * nearClippingPlane;
76 return Dali::CameraActor::New();
79 TypeRegistration mType(typeid(Dali::CameraActor), typeid(Dali::Actor), Create, CameraDefaultProperties);
82 * Builds the picking ray in the world reference system from an orthographic camera
83 * The ray origin is the screen coordinate in the near plane translated to a parallel
84 * plane at the camera origin. The ray direction is the direction the camera is facing
85 * (i.e. Z=-1 in view space).
87 void BuildOrthoPickingRay(const Matrix& viewMatrix,
88 const Matrix& projectionMatrix,
89 const Viewport& viewport,
94 float nearPlaneDistance)
96 // inv( modelMatrix ) inv( viewMatrix ) inv( projectionMatrix ) normalize
97 // <----------------- <----------------- <-------------- <-------------
98 // Local World Camera Normalized Screen
99 // reference reference reference clip coordinates
100 // system system system coordinates
101 // -----------------> -----------------> --------------> ------------->
102 // modelMatrix viewMatrix projectionMatrix viewport
104 // Transforms the touch point from the screen reference system to the world reference system.
105 Matrix invViewProjection(false); // Don't initialize.
106 Matrix::Multiply(invViewProjection, viewMatrix, projectionMatrix);
107 if(!invViewProjection.Invert())
109 DALI_ASSERT_DEBUG(false);
112 Vector4 near(screenX - static_cast<float>(viewport.x),
113 static_cast<float>(viewport.height) - (screenY - static_cast<float>(viewport.y)),
116 if(!Unproject(near, invViewProjection, static_cast<float>(viewport.width), static_cast<float>(viewport.height), rayOrigin))
118 DALI_ASSERT_DEBUG(false);
121 Matrix invView = viewMatrix;
122 if(!invView.Invert())
124 DALI_ASSERT_DEBUG(false);
127 Vector4 cameraOrigin = invView * Vector4(0.f, 0.f, 0.f, 1.f);
128 Vector4 nearPlaneOrigin = invView * Vector4(0.0f, 0.0f, -nearPlaneDistance, 1.0f);
130 // Vector pointing from the camera to the near plane
131 rayDir = cameraOrigin - nearPlaneOrigin;
138 * @brief Convert from vertical FoV to horizontal FoV
140 * @param aspectRatio aspect ratio.
141 * @param verticalFov Vertical field of view by radian.
142 * @return Horizontal field of view by radian.
144 inline float ConvertFovFromVerticalToHorizontal(float aspectRatio, float verticalFov)
146 return 2.0f * std::atan(std::tan(verticalFov * 0.5f) * aspectRatio);
150 * @brief Convert from horizontal FoV to vertical FoV
152 * @param aspectRatio aspect ratio.
153 * @param horizontalFov Horizontal field of view by radian.
154 * @return Vertical field of view by radian.
156 inline float ConvertFovFromHorizontalToVertical(float aspectRatio, float horizontalFov)
158 return 2.0f * std::atan(std::tan(horizontalFov * 0.5f) / aspectRatio);
163 CameraActorPtr CameraActor::New(const Size& size)
165 CameraActorPtr actor(new CameraActor(*CreateNode()));
167 // Second-phase construction
170 actor->SetName("DefaultCamera");
171 actor->SetPerspectiveProjection(size);
173 // By default Actors face in the positive Z direction in world space
174 // CameraActors should face in the negative Z direction, towards the other actors
175 actor->SetOrientation(Quaternion(Dali::ANGLE_180, Vector3::YAXIS));
180 CameraActor::CameraActor(const SceneGraph::Node& node)
181 : Actor(Actor::BASIC, node),
182 mSceneObject(nullptr),
183 mTarget(SceneGraph::Camera::DEFAULT_TARGET_POSITION),
184 mType(SceneGraph::Camera::DEFAULT_TYPE),
185 mProjectionMode(SceneGraph::Camera::DEFAULT_MODE),
186 mProjectionDirection(Dali::DevelCameraActor::ProjectionDirection::VERTICAL),
187 mFieldOfView(SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW),
188 mAspectRatio(SceneGraph::Camera::DEFAULT_ASPECT_RATIO),
189 mNearClippingPlane(SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE),
190 mFarClippingPlane(SceneGraph::Camera::DEFAULT_FAR_CLIPPING_PLANE),
191 mLeftClippingPlane(SceneGraph::Camera::DEFAULT_LEFT_CLIPPING_PLANE),
192 mRightClippingPlane(SceneGraph::Camera::DEFAULT_RIGHT_CLIPPING_PLANE),
193 mTopClippingPlane(SceneGraph::Camera::DEFAULT_TOP_CLIPPING_PLANE),
194 mBottomClippingPlane(SceneGraph::Camera::DEFAULT_BOTTOM_CLIPPING_PLANE),
195 mInvertYAxis(SceneGraph::Camera::DEFAULT_INVERT_Y_AXIS),
196 mPropertyChanged(false)
200 CameraActor::~CameraActor()
202 if(EventThreadServices::IsCoreRunning())
204 // Create scene-object and transfer ownership through message
205 RemoveCameraMessage(GetEventThreadServices().GetUpdateManager(), mSceneObject);
209 void CameraActor::OnInitialize()
211 // Create scene-object and keep raw pointer for message passing.
212 SceneGraph::Camera* sceneGraphCamera = SceneGraph::Camera::New();
214 // Store a pointer to this camera node inside the scene-graph camera.
215 sceneGraphCamera->SetNode(&GetNode());
217 mSceneObject = sceneGraphCamera;
218 OwnerPointer<SceneGraph::Camera> sceneGraphCameraOwner(sceneGraphCamera);
220 // Send message to inform update of this camera (and move ownership).
221 AddCameraMessage(GetEventThreadServices().GetUpdateManager(), sceneGraphCameraOwner);
224 void CameraActor::OnSceneConnectionInternal()
226 // If the canvas size has not been set, then use the size of the scene to which we've been added
227 // in order to set up the current projection
228 if(!mPropertyChanged && ((mCanvasSize.width < Math::MACHINE_EPSILON_1000) || (mCanvasSize.height < Math::MACHINE_EPSILON_1000)))
230 if(mProjectionMode == Dali::Camera::ORTHOGRAPHIC_PROJECTION)
232 SetOrthographicProjection(GetScene().GetSize());
234 else //if(mProjectionMode == Dali::Camera::PERSPECTIVE_PROJECTION)
236 SetPerspectiveProjection(GetScene().GetSize());
241 void CameraActor::SetReflectByPlane(const Vector4& plane)
245 SetReflectByPlaneMessage(GetEventThreadServices(), *mSceneObject, plane);
249 void CameraActor::SetTarget(const Vector3& target)
251 mPropertyChanged = true;
252 if(target != mTarget) // using range epsilon
256 SetTargetPositionMessage(GetEventThreadServices(), *mSceneObject, mTarget);
260 Vector3 CameraActor::GetTarget() const
265 void CameraActor::SetType(Dali::Camera::Type type)
271 // sceneObject is being used in a separate thread; queue a message to set
272 SetTypeMessage(GetEventThreadServices(), *mSceneObject, mType);
276 Dali::Camera::Type CameraActor::GetType() const
281 void CameraActor::SetProjectionMode(Dali::Camera::ProjectionMode mode)
283 if(mode != mProjectionMode)
285 mProjectionMode = mode;
287 // sceneObject is being used in a separate thread; queue a message to set
288 SetProjectionModeMessage(GetEventThreadServices(), *mSceneObject, mProjectionMode);
292 Dali::Camera::ProjectionMode CameraActor::GetProjectionMode() const
294 return mProjectionMode;
297 void CameraActor::SetProjectionDirection(Dali::DevelCameraActor::ProjectionDirection direction)
299 mPropertyChanged = true;
300 if(direction != mProjectionDirection)
302 mProjectionDirection = direction;
304 // Update update side FoV value.
305 float verticalFieldOfView = mFieldOfView;
306 if(DALI_UNLIKELY(mProjectionDirection == DevelCameraActor::HORIZONTAL))
308 verticalFieldOfView = ConvertFovFromHorizontalToVertical(mAspectRatio, mFieldOfView);
311 // sceneObject is being used in a separate thread; queue a message to set
312 SetFieldOfViewMessage(GetEventThreadServices(), *mSceneObject, verticalFieldOfView);
316 void CameraActor::SetFieldOfView(float fieldOfView)
318 mPropertyChanged = true;
319 if(!Equals(fieldOfView, mFieldOfView))
321 mFieldOfView = fieldOfView;
323 float verticalFieldOfView = mFieldOfView;
324 if(DALI_UNLIKELY(mProjectionDirection == DevelCameraActor::HORIZONTAL))
326 verticalFieldOfView = ConvertFovFromHorizontalToVertical(mAspectRatio, mFieldOfView);
329 // sceneObject is being used in a separate thread; queue a message to set
330 SetFieldOfViewMessage(GetEventThreadServices(), *mSceneObject, verticalFieldOfView);
334 float CameraActor::GetFieldOfView() const
339 void CameraActor::SetAspectRatio(float aspectRatio)
341 mPropertyChanged = true;
342 if(!Equals(aspectRatio, mAspectRatio))
344 mAspectRatio = aspectRatio;
346 // sceneObject is being used in a separate thread; queue a message to set
347 SetAspectRatioMessage(GetEventThreadServices(), *mSceneObject, mAspectRatio);
349 if(DALI_UNLIKELY(mProjectionDirection == DevelCameraActor::HORIZONTAL))
351 float verticalFieldOfView = ConvertFovFromHorizontalToVertical(mAspectRatio, mFieldOfView);
353 // sceneObject is being used in a separate thread; queue a message to set
354 SetFieldOfViewMessage(GetEventThreadServices(), *mSceneObject, verticalFieldOfView);
359 float CameraActor::GetAspectRatio() const
364 void CameraActor::SetNearClippingPlane(float nearClippingPlane)
366 mPropertyChanged = true;
367 if(!Equals(nearClippingPlane, mNearClippingPlane))
369 mNearClippingPlane = nearClippingPlane;
371 // sceneObject is being used in a separate thread; queue a message to set
372 SetNearClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mNearClippingPlane);
376 float CameraActor::GetNearClippingPlane() const
378 return mNearClippingPlane;
381 void CameraActor::SetFarClippingPlane(float farClippingPlane)
383 mPropertyChanged = true;
384 if(!Equals(farClippingPlane, mFarClippingPlane))
386 mFarClippingPlane = farClippingPlane;
388 // sceneObject is being used in a separate thread; queue a message to set
389 SetFarClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mFarClippingPlane);
393 float CameraActor::GetFarClippingPlane() const
395 return mFarClippingPlane;
398 void CameraActor::SetLeftClippingPlane(float leftClippingPlane)
400 mPropertyChanged = true;
401 if(!Equals(leftClippingPlane, mLeftClippingPlane))
403 mLeftClippingPlane = leftClippingPlane;
405 // sceneObject is being used in a separate thread; queue a message to set
406 SetLeftClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mLeftClippingPlane);
410 void CameraActor::SetRightClippingPlane(float rightClippingPlane)
412 mPropertyChanged = true;
413 if(!Equals(rightClippingPlane, mRightClippingPlane))
415 mRightClippingPlane = rightClippingPlane;
417 // sceneObject is being used in a separate thread; queue a message to set
418 SetRightClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mRightClippingPlane);
422 void CameraActor::SetTopClippingPlane(float topClippingPlane)
424 mPropertyChanged = true;
425 if(!Equals(topClippingPlane, mTopClippingPlane))
427 mTopClippingPlane = topClippingPlane;
429 // sceneObject is being used in a separate thread; queue a message to set
430 SetTopClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mTopClippingPlane);
434 void CameraActor::SetBottomClippingPlane(float bottomClippingPlane)
436 mPropertyChanged = true;
437 if(!Equals(bottomClippingPlane, mBottomClippingPlane))
439 mBottomClippingPlane = bottomClippingPlane;
441 // sceneObject is being used in a separate thread; queue a message to set
442 SetBottomClippingPlaneMessage(GetEventThreadServices(), *mSceneObject, mBottomClippingPlane);
446 void CameraActor::SetInvertYAxis(bool invertYAxis)
448 if(invertYAxis != mInvertYAxis)
450 mInvertYAxis = invertYAxis;
452 // sceneObject is being used in a separate thread; queue a message to set
453 SetInvertYAxisMessage(GetEventThreadServices(), *mSceneObject, mInvertYAxis);
457 bool CameraActor::GetInvertYAxis() const
462 void CameraActor::SetPerspectiveProjection(const Size& size)
464 SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
467 if((size.width < Math::MACHINE_EPSILON_1000) || (size.height < Math::MACHINE_EPSILON_1000))
469 // If the size given is invalid, i.e. ZERO, then check if we've been added to a scene
472 // We've been added to a scene already, set the canvas size to the scene's size
473 mCanvasSize = GetScene().GetSize();
477 // We've not been added to a scene yet, so just return.
478 // We'll set the canvas size when we get added to a scene later
483 float width = mCanvasSize.width;
484 float height = mCanvasSize.height;
486 float nearClippingPlane;
487 float farClippingPlane;
489 CalculateClippingAndZ(width, height, nearClippingPlane, farClippingPlane, cameraZ);
491 // calculate the position of the camera to have the desired aspect ratio
492 const float fieldOfView = 2.0f * std::atan(height * 0.5f / cameraZ);
494 // unless it is too small, we want at least as much space to the back as we have torwards the front
495 const float minClippingFarPlane = 2.f * nearClippingPlane;
496 if(farClippingPlane < minClippingFarPlane)
498 farClippingPlane = minClippingFarPlane;
501 const float aspectRatio = width / height;
503 // sceneObject is being used in a separate thread; queue a message to set
504 SetFieldOfView(fieldOfView);
505 SetNearClippingPlane(nearClippingPlane);
506 SetFarClippingPlane(farClippingPlane);
507 SetLeftClippingPlane(width * -0.5f);
508 SetRightClippingPlane(width * 0.5f);
509 SetTopClippingPlane(height * 0.5f); // Top is +ve to keep consistency with orthographic values
510 SetBottomClippingPlane(height * -0.5f); // Bottom is -ve to keep consistency with orthographic values
511 SetAspectRatio(aspectRatio);
515 void CameraActor::SetOrthographicProjection(const Vector2& size)
517 SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
520 if((size.width < Math::MACHINE_EPSILON_1000) || (size.height < Math::MACHINE_EPSILON_1000))
522 // If the size given is invalid, i.e. ZERO, then check if we've been added to a scene
525 // We've been added to a scene already, set the canvas size to the scene's size
526 mCanvasSize = GetScene().GetSize();
530 // We've not been added to a scene yet, so just return.
531 // We'll set the canvas size when we get added to a scene later
536 // Choose near, far and Z parameters to match the SetPerspectiveProjection above.
537 float nearClippingPlane;
538 float farClippingPlane;
540 CalculateClippingAndZ(size.width, size.height, nearClippingPlane, farClippingPlane, cameraZ);
541 SetOrthographicProjection(-size.x * 0.5f, size.x * 0.5f, size.y * 0.5f, size.y * -0.5f, nearClippingPlane, farClippingPlane);
545 void CameraActor::SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
547 SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
548 SetLeftClippingPlane(left);
549 SetRightClippingPlane(right);
550 SetTopClippingPlane(top);
551 SetBottomClippingPlane(bottom);
552 SetNearClippingPlane(near);
553 SetFarClippingPlane(far);
556 bool CameraActor::BuildPickingRay(const Vector2& screenCoordinates,
557 const Viewport& viewport,
559 Vector4& rayDirection)
562 if(mProjectionMode == Dali::Camera::PERSPECTIVE_PROJECTION)
564 // Build a picking ray in the world reference system.
565 // ray starts from the camera world position
566 rayOrigin = GetNode().GetWorldMatrix(0).GetTranslation();
569 // Transform the touch point from the screen coordinate system to the world coordinates system.
570 Vector4 near(screenCoordinates.x - static_cast<float>(viewport.x),
571 static_cast<float>(viewport.height) - (screenCoordinates.y - static_cast<float>(viewport.y)),
574 const Matrix& inverseViewProjection = mSceneObject->GetInverseViewProjectionMatrix(GetEventThreadServices().GetEventBufferIndex());
575 success = Unproject(near, inverseViewProjection, static_cast<float>(viewport.width), static_cast<float>(viewport.height), near);
577 // Compute the ray's director vector.
578 rayDirection.x = near.x - rayOrigin.x;
579 rayDirection.y = near.y - rayOrigin.y;
580 rayDirection.z = near.z - rayOrigin.z;
581 rayDirection.Normalize();
582 rayDirection.w = 1.f;
586 float nearPlaneDistance = GetNearClippingPlane();
587 BuildOrthoPickingRay(GetViewMatrix(),
588 GetProjectionMatrix(),
600 const Matrix& CameraActor::GetViewMatrix() const
604 return mSceneObject->GetViewMatrix(GetEventThreadServices().GetEventBufferIndex());
608 return Matrix::IDENTITY;
612 const Matrix& CameraActor::GetProjectionMatrix() const
616 return mSceneObject->GetProjectionMatrix(GetEventThreadServices().GetEventBufferIndex());
620 return Matrix::IDENTITY;
623 const SceneGraph::Camera* CameraActor::GetCamera() const
628 void CameraActor::RotateProjection(int rotationAngle)
630 // sceneObject is being used in a separate thread; queue a message to set
631 RotateProjectionMessage(GetEventThreadServices(), *mSceneObject, rotationAngle);
634 void CameraActor::SetDefaultProperty(Property::Index index, const Property::Value& propertyValue)
636 if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
638 Actor::SetDefaultProperty(index, propertyValue);
644 case Dali::CameraActor::Property::TYPE:
646 Dali::Camera::Type cameraType = Dali::Camera::Type(propertyValue.Get<int>());
650 case Dali::CameraActor::Property::PROJECTION_MODE:
652 Dali::Camera::ProjectionMode projectionMode = Dali::Camera::ProjectionMode(propertyValue.Get<int>());
653 SetProjectionMode(projectionMode);
656 case Dali::CameraActor::Property::FIELD_OF_VIEW:
658 SetFieldOfView(propertyValue.Get<float>()); // set to 0 in case property is not float
661 case Dali::CameraActor::Property::ASPECT_RATIO:
663 SetAspectRatio(propertyValue.Get<float>()); // set to 0 in case property is not float
666 case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
668 SetNearClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
671 case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
673 SetFarClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
676 case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
678 SetLeftClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
681 case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
683 SetRightClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
686 case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
688 SetTopClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
691 case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
693 SetBottomClippingPlane(propertyValue.Get<float>()); // set to 0 in case property is not float
696 case Dali::CameraActor::Property::TARGET_POSITION:
698 SetTarget(propertyValue.Get<Vector3>()); // set to 0 in case property is not Vector3
701 case Dali::CameraActor::Property::PROJECTION_MATRIX:
703 DALI_LOG_WARNING("projection-matrix is read-only\n");
706 case Dali::CameraActor::Property::VIEW_MATRIX:
708 DALI_LOG_WARNING("view-matrix is read-only\n");
711 case Dali::CameraActor::Property::INVERT_Y_AXIS:
713 SetInvertYAxis(propertyValue.Get<bool>()); // set to false in case property is not bool
716 case Dali::DevelCameraActor::Property::REFLECTION_PLANE:
718 SetReflectByPlane(propertyValue.Get<Vector4>());
721 case Dali::DevelCameraActor::Property::PROJECTION_DIRECTION:
723 Dali::DevelCameraActor::ProjectionDirection projectionDirection = Dali::DevelCameraActor::ProjectionDirection(propertyValue.Get<int>());
724 SetProjectionDirection(projectionDirection);
730 DALI_LOG_WARNING("Unknown property (%d)\n", index);
738 Property::Value CameraActor::GetDefaultProperty(Property::Index index) const
741 if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
743 ret = Actor::GetDefaultProperty(index);
749 case Dali::CameraActor::Property::TYPE:
754 case Dali::CameraActor::Property::PROJECTION_MODE:
756 ret = mProjectionMode;
759 case Dali::CameraActor::Property::FIELD_OF_VIEW:
764 case Dali::CameraActor::Property::ASPECT_RATIO:
769 case Dali::CameraActor::Property::NEAR_PLANE_DISTANCE:
771 ret = mNearClippingPlane;
774 case Dali::CameraActor::Property::FAR_PLANE_DISTANCE:
776 ret = mFarClippingPlane;
779 case Dali::CameraActor::Property::LEFT_PLANE_DISTANCE:
781 ret = mLeftClippingPlane;
784 case Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE:
786 ret = mRightClippingPlane;
789 case Dali::CameraActor::Property::TOP_PLANE_DISTANCE:
791 ret = mTopClippingPlane;
794 case Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE:
796 ret = mBottomClippingPlane;
799 case Dali::CameraActor::Property::TARGET_POSITION:
804 case Dali::CameraActor::Property::PROJECTION_MATRIX:
806 ret = GetProjectionMatrix(); // Only on scene-graph
809 case Dali::CameraActor::Property::VIEW_MATRIX:
811 ret = GetViewMatrix(); // Only on scene-graph
814 case Dali::CameraActor::Property::INVERT_Y_AXIS:
819 case Dali::DevelCameraActor::Property::PROJECTION_DIRECTION:
821 ret = mProjectionDirection;
830 Property::Value CameraActor::GetDefaultPropertyCurrentValue(Property::Index index) const
833 if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
835 ret = Actor::GetDefaultPropertyCurrentValue(index);
839 ret = GetDefaultProperty(index); // Most are event-side properties, the scene-graph properties are only on the scene-graph
845 const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty(Property::Index index) const
847 const PropertyInputImpl* property(nullptr);
851 case Dali::CameraActor::Property::PROJECTION_MATRIX:
853 property = mSceneObject->GetProjectionMatrix();
856 case Dali::CameraActor::Property::VIEW_MATRIX:
858 property = mSceneObject->GetViewMatrix();
861 // no default on purpose as we chain method up to actor
865 property = Actor::GetSceneObjectInputProperty(index);
871 void CameraActor::OnPropertySet(Property::Index index, const Property::Value& propertyValue)
873 // If Position or Orientation are explicitly set, make mPropertyChanged flag true.
874 if(index == Dali::Actor::Property::POSITION ||
875 index == Dali::Actor::Property::POSITION_X ||
876 index == Dali::Actor::Property::POSITION_Y ||
877 index == Dali::Actor::Property::POSITION_Z ||
878 index == Dali::Actor::Property::ORIENTATION)
880 mPropertyChanged = true;
884 } // namespace Internal