[3.0] Combine StencilMode and WriteToColorBuffer to RenderMode
[platform/core/uifw/dali-core.git] / dali / internal / event / render-tasks / render-task-impl.h
index 7e4744c..9002aa6 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_RENDER_TASK_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -23,6 +23,7 @@
 #include <dali/public-api/render-tasks/render-task.h>
 #include <dali/public-api/images/frame-buffer-image.h>
 #include <dali/internal/event/common/object-impl.h>
+#include <dali/internal/event/rendering/frame-buffer-impl.h>
 
 namespace Dali
 {
@@ -32,11 +33,12 @@ namespace Internal
 
 class Actor;
 class CameraActor;
-class EventToUpdate;
+class EventThreadServices;
 
 namespace SceneGraph
 {
 class RenderTask;
+class Camera;
 }
 
 class RenderTask : public Object
@@ -102,6 +104,16 @@ public:
   Dali::FrameBufferImage GetTargetFrameBuffer() const;
 
   /**
+    * @copydoc Dali::RenderTask::SetFrameBuffer()
+    */
+   void SetFrameBuffer( Dali::FrameBuffer frameBuffer );
+
+   /**
+    * @copydoc Dali::RenderTask::GetFrameBuffer
+    */
+   FrameBuffer* GetFrameBuffer() const;
+
+  /**
    * @copydoc Dali::RenderTask::SetScreenToFrameBufferFunction
    */
   void SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction );
@@ -162,6 +174,18 @@ public:
   const Vector4& GetClearColor() const;
 
   /**
+   * Indicate whether GL sync is required for native render target.
+   * @param[in] requiresSync whether GL sync is required.
+   */
+  void SetSyncRequired( bool requiresSync );
+
+  /**
+   * Query whether the sync object is required for native render target.
+   * @return True if the sync object is required, false otherwise.
+   */
+ bool IsSyncRequired() const;
+
+  /**
    * @copydoc Dali::RenderTask::SetClearEnabled()
    */
   void SetClearEnabled( bool enabled );
@@ -211,6 +235,16 @@ public:
    */
   bool IsSystemLevel() const;
 
+  /**
+   * @copydoc Dali::RenderTask::WorldToViewport()
+   */
+  bool WorldToViewport(const Vector3 &position, float& viewportX, float& viewportY) const;
+
+  /**
+   * @copydoc Dali::RenderTask::ViewportToLocal()
+   */
+  bool ViewportToLocal(Actor* actor, float viewportX, float viewportY, float &localX, float &localY) const;
+
 public: // Used by RenderTaskList, which owns the SceneGraph::RenderTasks
 
   /**
@@ -334,10 +368,9 @@ protected:
 
   /**
    * Construct a new RenderTask.
-   * @param[in] eventToUpdate Used to send messages to the update-thread.
    * @param[in] isSystemLevel Whether the RenderTask is on the system level task list.
    */
-  RenderTask( EventToUpdate& eventToUpdate, bool isSystemLevel );
+  RenderTask( bool isSystemLevel );
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
@@ -411,17 +444,16 @@ protected:
     RenderTask& mRenderTask;
 
     Actor* mActor; ///< Raw-pointer to the actor; not owned.
+    const SceneGraph::Camera* mCamera;    ///< Raw-pointer to camera scene-graph object; not owned.
   };
 
 private:
 
-  EventToUpdate& mEventToUpdate;
-
   SceneGraph::RenderTask* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
 
   Connector mSourceConnector; ///< Responsible for connecting/disconnecting source Nodes
   Connector mCameraConnector; ///< Responsible for connecting/disconnecting camera Nodes
-  Connector mMappingConnector; /// Responsible for connecting/disconnection actor node, which used to mapping screen to frame buffer coordinate
+  Connector mMappingConnector; /// Responsible for connecting/disconnecting actor node, which used to mapping screen to frame buffer coordinate
 
   Vector4 mClearColor;       ///< Optional clear color
 
@@ -430,6 +462,8 @@ private:
   unsigned int mRefreshOnceCounter;
 
   Dali::FrameBufferImage mFrameBufferImage;  ///< Optional off-screen render target.
+  FrameBufferPtr  mFrameBuffer;
+
 
   Dali::RenderTask::ScreenToFrameBufferFunction mScreenToFrameBufferFunction; ///< Used to convert screen to frame-buffer coordinates
 
@@ -438,6 +472,7 @@ private:
   bool mClearEnabled  : 1; ///< True if the render-task should be clear the color buffer.
   bool mCullMode      : 1; ///< True if the render-task's actors should be culled
   bool mIsSystemLevel : 1; ///< True if the render-task is on the system level task list.
+  bool mRequiresSync  : 1; ///< True if the GL sync is required to track the render of.
 
   //Signals
   Dali::RenderTask::RenderTaskSignalType  mSignalFinished; ///< Signal emmited when the render task has been processed.