[Tizen] Revert "Remove StereoMode"
[platform/core/uifw/dali-core.git] / dali / internal / common / core-impl.h
1 #ifndef DALI_INTERNAL_CORE_H
2 #define DALI_INTERNAL_CORE_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali/public-api/object/ref-object.h>
24 #include <dali/integration-api/context-notifier.h>
25 #include <dali/integration-api/core-enumerations.h>
26 #include <dali/internal/common/owner-pointer.h>
27 #include <dali/internal/event/animation/animation-playlist-declarations.h>
28 #include <dali/internal/event/common/stage-def.h>
29 #include <dali/public-api/common/view-mode.h>
30 #include <dali/integration-api/resource-policies.h>
31
32 namespace Dali
33 {
34
35 namespace Integration
36 {
37 class Processor;
38 class RenderController;
39 class PlatformAbstraction;
40 class GestureManager;
41 class GlAbstraction;
42 class GlSyncAbstraction;
43 class SystemOverlay;
44 class UpdateStatus;
45 class RenderStatus;
46 struct Event;
47 struct TouchData;
48 }
49
50 namespace Internal
51 {
52
53 class NotificationManager;
54 class AnimationPlaylist;
55 class PropertyNotificationManager;
56 class EventProcessor;
57 class GestureEventProcessor;
58 class ShaderFactory;
59 class TouchResampler;
60 class RelayoutController;
61
62 namespace SceneGraph
63 {
64 class UpdateManager;
65 class RenderManager;
66 class DiscardQueue;
67 class RenderTaskProcessor;
68 }
69
70 /**
71  * Internal class for Dali::Integration::Core
72  */
73 class Core
74 {
75 public:
76
77   /**
78    * Create and initialise a new Core instance
79    */
80   Core( Integration::RenderController& renderController,
81         Integration::PlatformAbstraction& platform,
82         Integration::GlAbstraction& glAbstraction,
83         Integration::GlSyncAbstraction& glSyncAbstraction,
84         Integration::GestureManager& gestureManager,
85         ResourcePolicy::DataRetention dataRetentionPolicy,
86         Integration::RenderToFrameBuffer renderToFboEnabled,
87         Integration::DepthBufferAvailable depthBufferAvailable,
88         Integration::StencilBufferAvailable stencilBufferAvailable );
89
90   /**
91    * Destructor
92    */
93   ~Core();
94
95   /**
96    * @copydoc Dali::Integration::Core::GetContextNotifier()
97    */
98   Integration::ContextNotifierInterface* GetContextNotifier();
99
100   /**
101    * @copydoc Dali::Integration::Core::ContextCreated()
102    */
103   void ContextCreated();
104
105   /**
106    * @copydoc Dali::Integration::Core::ContextDestroyed()
107    */
108   void ContextDestroyed();
109
110   /**
111    * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
112    */
113   void RecoverFromContextLoss();
114
115   /**
116    * @copydoc Dali::Integration::Core::SurfaceResized(uint32_t, uint32_t)
117    */
118   void SurfaceResized(uint32_t width, uint32_t height);
119
120   /**
121    * @copydoc Dali::Integration::Core::SetTopMargin( uint32_t margin )
122    */
123   void SetTopMargin( uint32_t margin );
124
125   /**
126    * @copydoc Dali::Integration::Core::SetDpi(uint32_t, uint32_t)
127    */
128   void SetDpi(uint32_t dpiHorizontal, uint32_t dpiVertical);
129
130   /**
131    * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(uint32_t)
132    */
133   void SetMinimumFrameTimeInterval(uint32_t interval);
134
135   /**
136    * @copydoc Dali::Integration::Core::Update()
137    */
138   void Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
139
140   /**
141    * @copydoc Dali::Integration::Core::Render()
142    */
143   void Render( Integration::RenderStatus& status, bool forceClear );
144
145   /**
146    * @copydoc Dali::Integration::Core::SceneCreated()
147    */
148   void SceneCreated();
149
150   /**
151    * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
152    */
153   void QueueEvent( const Integration::Event& event );
154
155   /**
156    * @copydoc Dali::Integration::Core::ProcessEvents()
157    */
158   void ProcessEvents();
159
160   /**
161    * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
162    */
163   uint32_t GetMaximumUpdateCount() const;
164
165   /**
166    * @copydoc Dali::Integration::Core::GetSystemOverlay()
167    */
168   Integration::SystemOverlay& GetSystemOverlay();
169
170   // Stereoscopy
171
172   /**
173    * @copydoc Dali::Integration::Core::SetViewMode()
174    */
175   void SetViewMode( ViewMode viewMode );
176
177   /**
178    * @copydoc Dali::Integration::Core::GetViewMode()
179    */
180   ViewMode GetViewMode() const;
181
182   /**
183    * @copydoc Dali::Integration::Core::SetStereoBase()
184    */
185   void SetStereoBase( float stereoBase );
186
187   /**
188    * @copydoc Dali::Integration::Core::GetStereoBase()
189    */
190   float GetStereoBase() const;
191
192
193   /**
194    * @copydoc Dali::Integration::Core::RegisterProcessor
195    */
196   void RegisterProcessor( Dali::Integration::Processor& processor );
197
198   /**
199    * @copydoc Dali::Integration::Core::UnregisterProcessor
200    */
201   void UnregisterProcessor( Dali::Integration::Processor& processor );
202
203 private:
204   /**
205    * Run each registered processor
206    */
207   void RunProcessors();
208
209   // for use by ThreadLocalStorage
210
211   /**
212    * Returns the current stage.
213    * @return A smart-pointer to the current stage.
214    */
215   StagePtr GetCurrentStage();
216
217   /**
218    * Returns the platform abstraction.
219    * @return A reference to the platform abstraction.
220    */
221   Integration::PlatformAbstraction& GetPlatform();
222
223   /**
224    * Returns the update manager.
225    * @return A reference to the update manager.
226    */
227   SceneGraph::UpdateManager& GetUpdateManager();
228
229   /**
230    * Returns the render manager.
231    * @return A reference to the render manager.
232    */
233   SceneGraph::RenderManager& GetRenderManager();
234
235   /**
236    * Returns the notification manager.
237    * @return A reference to the Notification Manager.
238    */
239   NotificationManager& GetNotificationManager();
240
241   /**
242    * Returns the Shader factory
243    * @return A reference to the Shader binary factory.
244    */
245   ShaderFactory& GetShaderFactory();
246
247   /**
248    * Returns the gesture event processor.
249    * @return A reference to the gesture event processor.
250    */
251   GestureEventProcessor& GetGestureEventProcessor();
252
253   /**
254    * Return the relayout controller
255    * @Return Return a reference to the relayout controller
256    */
257   RelayoutController& GetRelayoutController();
258
259 private:
260
261   /**
262    * Undefined copy and assignment operators
263    */
264   Core(const Core& core);  // No definition
265   Core& operator=(const Core& core);  // No definition
266
267   /**
268    * Create Thread local storage
269    */
270   void CreateThreadLocalStorage();
271
272 private:
273
274   Integration::RenderController&            mRenderController;            ///< Reference to Render controller to tell it to keep rendering
275   Integration::PlatformAbstraction&         mPlatform;                    ///< The interface providing platform specific services.
276
277   IntrusivePtr<Stage>                       mStage;                       ///< The current stage
278   AnimationPlaylistOwner                    mAnimationPlaylist;           ///< For 'Fire and forget' animation support
279   OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
280   IntrusivePtr< RelayoutController >        mRelayoutController;          ///< Size negotiation relayout controller
281   bool                                      mProcessingEvent  : 1;        ///< True during ProcessEvents()
282
283   OwnerPointer<SceneGraph::RenderTaskProcessor> mRenderTaskProcessor;         ///< Handles the processing of render tasks
284   OwnerPointer<SceneGraph::RenderManager>       mRenderManager;               ///< Render manager
285   OwnerPointer<SceneGraph::UpdateManager>       mUpdateManager;               ///< Update manager
286   OwnerPointer<SceneGraph::DiscardQueue>        mDiscardQueue;                ///< Used to cleanup nodes & resources when no longer in use.
287   OwnerPointer<ShaderFactory>                   mShaderFactory;               ///< Shader resource factory
288   OwnerPointer<NotificationManager>             mNotificationManager;         ///< Notification manager
289   OwnerPointer<GestureEventProcessor>           mGestureEventProcessor;       ///< The gesture event processor
290   OwnerPointer<EventProcessor>                  mEventProcessor;              ///< The event processor
291   Dali::Vector<Integration::Processor*>         mProcessors;                  ///< Registered processors (not owned)
292
293   friend class ThreadLocalStorage;
294
295 };
296
297 } // namespace Internal
298
299 } // namespace Dali
300
301 #endif // DALI_INTERNAL_CORE_H