#define DALI_INTERNAL_CAMERA_ACTOR_H
/*
- * 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.
/**
* Create an initialised camera actor.
*
- * Sets the default camera perspective projection for the given canvas size. @see SetPerspectiveProjection().
+ * If hintFor3D is false, Sets the default camera perspective projection for the given canvas size. @see SetPerspectiveProjection().
*
* @param[in] size The canvas size.
+ * @param[in] hintFor3D True if user set hint that this camera used for 3D. Default is false.
*
* @return A smart-pointer to a newly allocated camera actor.
*/
- static CameraActorPtr New(const Size& size);
+ static CameraActorPtr New(const Size& size, bool hintFor3D = false);
/**
* Sets the reflection plane for the camera
float GetFieldOfView() const;
/**
+ * @brief Sets the orthographic size.
+ * Orthographic size will be used when ProjectoinMode is ORTHOGRAPHIC_PROJECTION.
+ *
+ * @param[in] orthographicSize The orthographic size.
+ */
+ void SetOrthographicSize(float orthographicSize);
+
+ /**
+ * @brief Gets the orthographic size.
+ *
+ * The default orthographic size is 400.0f.
+ * @return The orthographic size.
+ */
+ float GetOrthographicSize() const;
+
+ /**
* @copydoc Dali::CameraActor::SetAspectRatio
*/
void SetAspectRatio(float aspectRatio);
float GetFarClippingPlane() const;
/**
- * @param leftClippingPlane to use
- */
- void SetLeftClippingPlane(float leftClippingPlane);
-
- /**
- * @param rightClippingPlane to use
- */
- void SetRightClippingPlane(float rightClippingPlane);
-
- /**
- * @param topClippingPlane to use
- */
- void SetTopClippingPlane(float topClippingPlane);
-
- /**
- * @param bottomClippingPlane to use
- */
- void SetBottomClippingPlane(float bottomClippingPlane);
-
- /**
* @copydoc Dali::CameraActor::SetInvertYAxis
*/
void SetInvertYAxis(bool invertYAxis);
void SetPerspectiveProjection(const Size& size);
/**
- * @copydoc Dali::CameraActor::SetOrthographicProjection(const Vector2& size);
- */
- void SetOrthographicProjection(const Vector2& size);
-
- /**
- * @copydoc Dali::CameraActor::SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far);
+ * @copydoc Dali::CameraActor::SetOrthographicProjection(const Size& size);
*/
- void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far);
+ void SetOrthographicProjection(const Size& size);
/**
* Build a picking ray with this camera and given screen coordinates
const Matrix& GetProjectionMatrix() const;
/**
- * Return the scene graph camera (for RenderTask)
+ * Return the scene graph camera
* @return The scene graph camera.
*/
- const SceneGraph::Camera* GetCamera() const;
+ const SceneGraph::Camera& GetCameraSceneObject() const;
/**
* Rotate the projection.
Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
/**
+ * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
+ */
+ void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
+
+ /**
+ * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
+ */
+ const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
+
+ /**
* @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
*/
const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
~CameraActor() override;
/**
- * @copydoc Dali::Internal::Actor::OnInitialize()
- */
- void OnInitialize() override;
-
- /**
* @copydoc Dali::Internal::Actor::OnSceneConnectionInternal()
*/
void OnSceneConnectionInternal() override;
*/
void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override;
-private: // Data
- const SceneGraph::Camera* mSceneObject; ///< Not owned
+ /**
+ * @brief Set the camera projection values with mCanvasSize
+ */
+ void ApplyDefaultProjection();
+
+private:
+ /**
+ * @brief Retrieve the CameraActor's field of view from update side.
+ * This is either the last value set, or the currently animating value.
+ * It may be defferent to GetFieldOfView() if the set message hasn't been processed yet.
+ * @return The field of view.
+ */
+ float GetCurrentFieldOfView() const;
+
+ /**
+ * @brief Retrieve the CameraActor's orthographic size from update side.
+ * This is either the last value set, or the currently animating value.
+ * It may be defferent to GetOrthographicSize() if the set message hasn't been processed yet.
+ * @return The orthographic size.
+ */
+ float GetCurrentOrthographicSize() const;
+
+ /**
+ * @brief Retrieve the CameraActor's aspect ratio from update side.
+ * This is either the last value set, or the currently animating value.
+ * It may be defferent to GetAspectRatio() if the set message hasn't been processed yet.
+ * @return The aspect ratio.
+ */
+ float GetCurrentAspectRatio() const;
+
+ /**
+ * @brief Retrieve the CameraActor's near clipping plane distance from update side.
+ * This is either the last value set, or the currently animating value.
+ * It may be defferent to GetNearClippingPlane() if the set message hasn't been processed yet.
+ * @return Near clipping plane distance.
+ */
+ float GetCurrentNearClippingPlane() const;
+
+ /**
+ * @brief Retrieve the CameraActor's far clipping plane distance from update side.
+ * This is either the last value set, or the currently animating value.
+ * It may be defferent to GetFarClippingPlane() if the set message hasn't been processed yet.
+ * @return Far clipping plane distance.
+ */
+ float GetCurrentFarClippingPlane() const;
+private: // Data
Vector3 mTarget;
Vector2 mCanvasSize;
Dali::Camera::Type mType;
Dali::Camera::ProjectionMode mProjectionMode;
Dali::DevelCameraActor::ProjectionDirection mProjectionDirection;
float mFieldOfView;
+ float mOrthographicSize;
float mAspectRatio;
float mNearClippingPlane;
float mFarClippingPlane;
- float mLeftClippingPlane;
- float mRightClippingPlane;
- float mTopClippingPlane;
- float mBottomClippingPlane;
bool mInvertYAxis;
bool mPropertyChanged;
};