-#ifndef __DALI_INTERNAL_CAMERA_ACTOR_H__
-#define __DALI_INTERNAL_CAMERA_ACTOR_H__
+#ifndef DALI_INTERNAL_CAMERA_ACTOR_H
+#define DALI_INTERNAL_CAMERA_ACTOR_H
/*
- * Copyright (c) 2014 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.
*/
// INTERNAL INCLUES
-#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/actors/camera-actor.h>
-#include <dali/internal/event/actors/actor-impl.h>
+#include <dali/devel-api/actors/camera-actor-devel.h>
#include <dali/internal/event/actors/actor-declarations.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
+#include <dali/internal/event/actors/actor-impl.h>
+#include <dali/public-api/actors/camera-actor.h>
namespace Dali
{
-
namespace Internal
{
+namespace SceneGraph
+{
+class Camera;
+}
/**
- * An actor with a conveniently pre-attached CameraAttachment.
+ * An actor with Camera.
*/
class CameraActor : public Actor
{
public:
-
/**
* Create an initialised camera actor.
*
*
* @return A smart-pointer to a newly allocated camera actor.
*/
- static CameraActorPtr New( const Size& size );
+ static CameraActorPtr New(const Size& size);
/**
- * @copydoc Dali::Actor::OnInitialize
+ * Sets the reflection plane for the camera
+ *
+ * @param[in] plane Plane parameters
+ *
+ * @note plane.xyz are normal vector of the plane.
*/
- void OnInitialize();
+ void SetReflectByPlane(const Vector4& plane);
/**
- * Retrieve the camera attachment.
- * @return The attachment.
+ * @copydoc Dali::CameraActor::SetTargetPosition
*/
- CameraAttachment& GetCameraAttachment()
- {
- return *mCameraAttachment;
- }
+ void SetTarget(const Vector3& targetPosition);
+
+ /**
+ * @copydoc Dali::CameraActor::GetTargetPosition
+ */
+ Vector3 GetTarget() const;
/**
* @copydoc Dali::CameraActor::SetType
*/
- void SetType( Dali::Camera::Type type );
+ void SetType(Dali::Camera::Type type);
/**
* @copydoc Dali::CameraActor::GetType
/**
* @copydoc Dali::CameraActor::SetProjectionMode
*/
- void SetProjectionMode( Dali::Camera::ProjectionMode mode );
+ void SetProjectionMode(Dali::Camera::ProjectionMode mode);
/**
* @copydoc Dali::CameraActor::GetProjectionMode
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
*/
- void SetFieldOfView( float fieldOfView );
+ void SetFieldOfView(float fieldOfView);
/**
* @copydoc Dali::CameraActor::GetFieldOfView
*/
- float GetFieldOfView( ) const;
+ float GetFieldOfView() const;
/**
* @copydoc Dali::CameraActor::SetAspectRatio
*/
- void SetAspectRatio( float aspectRatio );
+ void SetAspectRatio(float aspectRatio);
/**
* @copydoc Dali::CameraActor::GetAspectRatio
*/
- float GetAspectRatio( ) const;
+ float GetAspectRatio() const;
/**
* @copydoc Dali::CameraActor::SetNearClippingPlane
*/
- void SetNearClippingPlane( float nearClippingPlane );
+ void SetNearClippingPlane(float nearClippingPlane);
/**
* @copydoc Dali::CameraActor::GetNearClippingPlane
*/
- float GetNearClippingPlane( ) const;
+ float GetNearClippingPlane() const;
/**
* @copydoc Dali::CameraActor::SetFarClippingPlane
*/
- void SetFarClippingPlane( float farClippingPlane );
+ void SetFarClippingPlane(float farClippingPlane);
/**
* @copydoc Dali::CameraActor::GetFarClippingPlane
*/
- float GetFarClippingPlane( ) const;
+ float GetFarClippingPlane() const;
/**
- * @copydoc Dali::CameraActor::SetTargetPosition
+ * @param leftClippingPlane to use
*/
- void SetTargetPosition( const Vector3& targetPosition );
+ void SetLeftClippingPlane(float leftClippingPlane);
/**
- * @copydoc Dali::CameraActor::GetTargetPosition
+ * @param rightClippingPlane to use
*/
- Vector3 GetTargetPosition() const;
+ void SetRightClippingPlane(float rightClippingPlane);
+
+ /**
+ * @param topClippingPlane to use
+ */
+ void SetTopClippingPlane(float topClippingPlane);
+
+ /**
+ * @param bottomClippingPlane to use
+ */
+ void SetBottomClippingPlane(float bottomClippingPlane);
/**
* @copydoc Dali::CameraActor::SetInvertYAxis
/**
* @copydoc Dali::CameraActor::SetPerspectiveProjection()
- * @param[in] stereoBias The frustum horizontal and vertical offset for stereoscopic cameras
*/
- void SetPerspectiveProjection( const Size& size, const Vector2& stereoBias = Vector2::ZERO );
+ void SetPerspectiveProjection(const Size& size);
/**
* @copydoc Dali::CameraActor::SetOrthographicProjection(const Vector2& size);
*/
- void 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);
*/
- void SetOrthographicProjection( float left, float right, float top, float bottom, float near, float far );
+ void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far);
/**
* Build a picking ray with this camera and given screen coordinates
* @param [out] rayDirection for the picking ray
* @return true if the building was successful, false if its not possible (camera is not valid for hit testing)
*/
- bool BuildPickingRay( const Vector2& screenCoordinates, const Viewport& viewport, Vector4& rayOrigin, Vector4& rayDirection );
+ bool BuildPickingRay(const Vector2& screenCoordinates, const Viewport& viewport, Vector4& rayOrigin, Vector4& rayDirection);
/**
* Retrieve the view-matrix; This will only be valid when the actor is on-stage.
*/
const Matrix& GetProjectionMatrix() const;
-public: // properties
-
- /**
- * copydoc Dali::Internal::ProxyObject
- */
- virtual unsigned int GetDefaultPropertyCount() const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
- */
- virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
-
- /**
- * copydoc Dali::Internal::ProxyObject
- */
- virtual bool IsDefaultPropertyAnimatable( Property::Index index ) const;
-
/**
- * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
+ * Return the scene graph camera (for RenderTask)
+ * @return The scene graph camera.
*/
- virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
+ const SceneGraph::Camera* GetCamera() const;
/**
- * copydoc Dali::Internal::ProxyObject
+ * Rotate the projection.
+ * It is used in case that the target buffer direction is different from the window direction.
+ * @param [in] rotationAngle The rotation angle
*/
- virtual Property::Type GetDefaultPropertyType( Property::Index index ) const;
+ void RotateProjection(int rotationAngle);
+public: // properties
/**
- * copydoc Dali::Internal::ProxyObject
+ * copydoc Dali::Internal::Object::SetDefaultProperty()
*/
- virtual const char* GetDefaultPropertyName( Property::Index index ) const;
+ void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
/**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
+ * copydoc Dali::Internal::Object::GetDefaultProperty()
*/
- virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
+ Property::Value GetDefaultProperty(Property::Index index) const override;
/**
- * copydoc Dali::Internal::ProxyObject
+ * copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
*/
- virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
+ Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
/**
- * copydoc Dali::Internal::ProxyObject
+ * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
*/
- virtual Property::Value GetDefaultProperty( Property::Index index ) const;
+ const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
+private:
/**
- * copydoc Dali::Internal::ProxyObject
+ * Constructor; see also CameraActor::New()
+ * @param node the scene graph node
*/
- virtual bool IsDefaultPropertyWritable( Property::Index index ) const ;
+ CameraActor(const SceneGraph::Node& node);
/**
- * @copydoc Dali::Internal::ProxyObject::GetSceneObjectAnimatableProperty()
+ * A reference counted object may only be deleted by calling Unreference()
*/
- virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
+ ~CameraActor() override;
/**
- * @copydoc Dali::Internal::ProxyObject::GetSceneObjectInputProperty()
+ * @copydoc Dali::Internal::Actor::OnInitialize()
*/
- virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
-
-protected:
+ void OnInitialize() override;
/**
- * Protected constructor; see also CameraActor::New()
+ * @copydoc Dali::Internal::Actor::OnSceneConnectionInternal()
*/
- CameraActor();
+ void OnSceneConnectionInternal() override;
/**
- * A reference counted object may only be deleted by calling Unreference()
+ * @copydoc Internal::Object::OnPropertySet
*/
- virtual ~CameraActor();
-
-private:
+ void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override;
- CameraAttachmentPtr mCameraAttachment;
+private: // Data
+ const SceneGraph::Camera* mSceneObject; ///< Not owned
+ 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
} // namespace Dali
-#endif // __DALI_INTERNAL_CAMERA_ACTOR_H__
+#endif // DALI_INTERNAL_CAMERA_ACTOR_H