Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-core.git] / dali / internal / update / render-tasks / scene-graph-camera.h
index 1f00cd5..f75f81b 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_CAMERA_H
+#define DALI_INTERNAL_SCENE_GRAPH_CAMERA_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -94,6 +94,18 @@ public:
   ~Camera();
 
   /**
+   * Set the node this scene graph camera belongs to.
+   * @param[in] node The owning node.
+   */
+  void SetNode( const Node* node );
+
+  /**
+   * Get the node this scene graph camera belongs to.
+   * @return node The owning node.
+   */
+  const Node* GetNode() const;
+
+  /**
    * @copydoc Dali::Internal::CameraActor::SetType
    */
   void SetType( Dali::Camera::Type type );
@@ -118,11 +130,6 @@ public:
    */
   void SetAspectRatio( float aspectRatio );
 
-  /**
-   * @copydoc Dali::Internal::CameraActor::SetStereoBias
-   */
-  void SetStereoBias(const Vector2& stereoBias);
-
    /**
    * @copydoc Dali::Internal::CameraActor::SetLeftClippingPlane
    */
@@ -159,6 +166,21 @@ public:
   void SetTargetPosition( const Vector3& targetPosition );
 
   /**
+   * Sets the reflection plane
+   * @param[in] plane reflection plane
+   */
+  void SetReflectByPlane( const Vector4& plane );
+
+  /**
+   * Tests whether reflection is used
+   * @return True if used, False otherwise
+   */
+  bool GetReflectionUsed() const
+  {
+    return mUseReflection;
+  }
+
+  /**
    * Retrieve the view-matrix; this is double buffered for input handling.
    * @param[in] bufferIndex The buffer to read from.
    * @return The view-matrix.
@@ -219,9 +241,8 @@ public:
    * Updates view and projection matrices.
    * Called by the render task using the camera
    * @param[in] updateBufferIndex The buffer to read from.
-   * @param[in] owningNode The node that owns the camera
    */
-  void Update( BufferIndex updateBufferIndex, const Node& owningNode );
+  void Update( BufferIndex updateBufferIndex );
 
   /**
    * @return true if the view matrix of camera is updated this or the previous frame
@@ -244,17 +265,16 @@ private:
   /**
    * Recalculates the view matrix.
    * @param[in] bufferIndex The current update buffer index.
-   * @param[in] owningNode to use for calculations.
    * @return count how many frames ago the matrix was changed.
    */
-  unsigned int UpdateViewMatrix( BufferIndex updateBufferIndex, const Node& owningNode );
+  uint32_t UpdateViewMatrix( BufferIndex updateBufferIndex );
 
   /**
    * Recalculates the projection matrix.
    * @param[in] bufferIndex The current update buffer index.
    * @return count how many frames ago the matrix was changed.
    */
-  unsigned int UpdateProjection( BufferIndex updateBufferIndex );
+  uint32_t UpdateProjection( BufferIndex updateBufferIndex );
 
 private:
 
@@ -266,8 +286,16 @@ private:
    */
   void UpdateFrustum( BufferIndex updateBufferIndex, bool normalize = true );
 
-  unsigned int                  mUpdateViewFlag;       ///< This is non-zero if the view matrix requires an update
-  unsigned int                  mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update
+  /**
+   * Adjust near plane for reflection
+   * @param perspective Perspective matrix
+   * @param clipPlane Clipping plane
+   */
+  void AdjustNearPlaneForPerspective( Matrix& perspective, const Vector4& clipPlane );
+
+  uint32_t                  mUpdateViewFlag;       ///< This is non-zero if the view matrix requires an update
+  uint32_t                  mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update
+  const Node*                   mNode;                 ///< The node this scene graph camera belongs to
 
 public:  // PROPERTIES
   Dali::Camera::Type            mType;                 // Non-animatable
@@ -282,9 +310,14 @@ public:  // PROPERTIES
   float                         mBottomClippingPlane;
   float                         mNearClippingPlane;
   float                         mFarClippingPlane;
-  Vector2                       mStereoBias;
   Vector3                       mTargetPosition;
 
+  Dali::Matrix                  mReflectionMtx;
+  Dali::Vector4                 mReflectionPlane;
+  Dali::Vector4                 mReflectionEye;
+  bool                          mUseReflection{ false };
+  bool                          mUseReflectionClip{ false };
+
   InheritedMatrix mViewMatrix;           ///< The viewMatrix; this is double buffered for input handling.
   InheritedMatrix mProjectionMatrix;     ///< The projectionMatrix; this is double buffered for input handling.
 
@@ -300,7 +333,7 @@ inline void SetTypeMessage( EventThreadServices& eventThreadServices, const Came
   typedef MessageValue1< Camera, Dali::Camera::Type > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetType, parameter );
@@ -311,7 +344,7 @@ inline void SetProjectionModeMessage( EventThreadServices& eventThreadServices,
   typedef MessageValue1< Camera, Dali::Camera::ProjectionMode > LocalProjectionMode;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalProjectionMode ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalProjectionMode ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalProjectionMode( &camera, &Camera::SetProjectionMode, parameter );
@@ -322,7 +355,7 @@ inline void SetFieldOfViewMessage( EventThreadServices& eventThreadServices, con
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetFieldOfView, parameter );
@@ -333,29 +366,18 @@ inline void SetAspectRatioMessage( EventThreadServices& eventThreadServices, con
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetAspectRatio, parameter );
 }
 
-inline void SetStereoBiasMessage( EventThreadServices& eventThreadServices, const Camera& camera, const Vector2& parameter )
-{
-  typedef MessageValue1< Camera, Vector2 > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &camera, &Camera::SetStereoBias, parameter );
-}
-
 inline void SetLeftClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter )
 {
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetLeftClippingPlane, parameter );
@@ -366,7 +388,7 @@ inline void SetRightClippingPlaneMessage( EventThreadServices& eventThreadServic
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetRightClippingPlane, parameter );
@@ -377,7 +399,7 @@ inline void SetTopClippingPlaneMessage( EventThreadServices& eventThreadServices
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetTopClippingPlane, parameter );
@@ -388,7 +410,7 @@ inline void SetBottomClippingPlaneMessage( EventThreadServices& eventThreadServi
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetBottomClippingPlane, parameter );
@@ -399,7 +421,7 @@ inline void SetNearClippingPlaneMessage( EventThreadServices& eventThreadService
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetNearClippingPlane, parameter );
@@ -410,7 +432,7 @@ inline void SetFarClippingPlaneMessage( EventThreadServices& eventThreadServices
   typedef MessageValue1< Camera, float > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetFarClippingPlane, parameter );
@@ -421,7 +443,7 @@ inline void SetTargetPositionMessage( EventThreadServices& eventThreadServices,
   typedef MessageValue1< Camera, Vector3 > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetTargetPosition, parameter );
@@ -432,7 +454,7 @@ inline void SetInvertYAxisMessage( EventThreadServices& eventThreadServices, con
   typedef MessageValue1< Camera, bool > LocalType;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &camera, &Camera::SetInvertYAxis, parameter );
@@ -444,4 +466,4 @@ inline void SetInvertYAxisMessage( EventThreadServices& eventThreadServices, con
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_CAMERA_H