Merge "Remove String::EMPTY" into tizen
[platform/core/uifw/dali-core.git] / dali / internal / event / common / stage-impl.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/common/stage-impl.h>
20
21 // EXTERNAL INCLUDES
22 #include <algorithm>
23 #include <cmath>
24 #include <cstring> // for strcmp
25
26 // INTERNAL INCLUDES
27 #include <dali/integration-api/system-overlay.h>
28 #include <dali/internal/event/actors/layer-impl.h>
29 #include <dali/internal/event/actors/layer-list.h>
30 #include <dali/internal/event/actors/camera-actor-impl.h>
31 #include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
32 #include <dali/internal/event/common/system-overlay-impl.h>
33 #include <dali/internal/event/common/thread-local-storage.h>
34 #include <dali/internal/event/common/property-notification-manager.h>
35 #include <dali/internal/event/render-tasks/render-task-list-impl.h>
36 #include <dali/internal/update/nodes/node.h>
37 #include <dali/internal/event/common/object-registry-impl.h>
38 #include <dali/integration-api/platform-abstraction.h>
39 #include <dali/public-api/common/constants.h>
40 #include <dali/public-api/object/type-registry.h>
41 #include <dali/public-api/render-tasks/render-task-list.h>
42
43 #ifdef DYNAMICS_SUPPORT
44 #include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
45 #include <dali/internal/event/dynamics/dynamics-world-impl.h>
46 #include <dali/integration-api/dynamics/dynamics-factory-intf.h>
47 #include <dali/integration-api/dynamics/dynamics-world-settings.h>
48 #endif
49
50 using Dali::Internal::SceneGraph::Node;
51
52 namespace Dali
53 {
54
55 namespace Internal
56 {
57
58 namespace
59 {
60
61 const float DEFAULT_STEREO_BASE( 65.0f );
62
63 // Signals
64
65 const char* const SIGNAL_KEY_EVENT =                 "key-event";
66 const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "event-processing-finished";
67 const char* const SIGNAL_TOUCHED =                   "touched";
68 const char* const SIGNAL_WHEEL_EVENT =               "wheel-event";
69 const char* const SIGNAL_CONTEXT_LOST =              "context-lost";
70 const char* const SIGNAL_CONTEXT_REGAINED =          "context-regained";
71 const char* const SIGNAL_SCENE_CREATED =             "scene-created";
72
73 TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), NULL );
74
75 SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT,                 &Stage::DoConnectSignal );
76 SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
77 SignalConnectorType signalConnector3( mType, SIGNAL_TOUCHED,                   &Stage::DoConnectSignal );
78 SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT,               &Stage::DoConnectSignal );
79 SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST,              &Stage::DoConnectSignal );
80 SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED,          &Stage::DoConnectSignal );
81 SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED,             &Stage::DoConnectSignal );
82
83 } // unnamed namespace
84
85 StagePtr Stage::New( AnimationPlaylist& playlist,
86                      PropertyNotificationManager& propertyNotificationManager,
87                      SceneGraph::UpdateManager& updateManager,
88                      NotificationManager& notificationManager )
89 {
90   return StagePtr( new Stage( playlist, propertyNotificationManager, updateManager, notificationManager ) );
91 }
92
93 void Stage::Initialize()
94 {
95   mObjectRegistry = ObjectRegistry::New();
96
97   // Create the ordered list of layers
98   mLayerList = LayerList::New( mUpdateManager, false/*not system-level*/ );
99
100   // The stage owns the default layer
101   mRootLayer = Layer::NewRoot( *mLayerList, mUpdateManager, false/*not system-level*/ );
102   mRootLayer->SetName("RootLayer");
103
104   // Create the default camera actor first; this is needed by the RenderTaskList
105   CreateDefaultCameraActor();
106
107   // Create the list of render-tasks
108   mRenderTaskList = RenderTaskList::New( *this, *this, false/*not system-level*/ );
109
110   // Create the default render-task
111   Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask();
112 }
113
114 void Stage::Uninitialize()
115 {
116   // Remove actors added to SystemOverlay
117   delete mSystemOverlay;
118   mSystemOverlay = NULL;
119
120   if( mDefaultCamera )
121   {
122     // its enough to release the handle so the object is released
123     // don't need to remove it from root actor as root actor will delete the object
124     mDefaultCamera.Reset();
125   }
126
127   if( mRootLayer )
128   {
129     // we are closing down so just delete the root, no point emit disconnect
130     // signals or send messages to update
131     mRootLayer.Reset();
132   }
133 }
134
135 StagePtr Stage::GetCurrent()
136 {
137   StagePtr stage( NULL );
138   // no checking in this version
139   ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
140   if( tls )
141   {
142     stage = tls->GetCurrentStage();
143   }
144   return stage;
145 }
146
147 bool Stage::IsInstalled()
148 {
149   return ThreadLocalStorage::Created();
150 }
151
152 ObjectRegistry& Stage::GetObjectRegistry()
153 {
154   return *mObjectRegistry;
155 }
156
157 void Stage::RegisterObject( Dali::BaseObject* object )
158 {
159   mObjectRegistry->RegisterObject( object );
160 }
161
162 void Stage::UnregisterObject( Dali::BaseObject* object )
163 {
164   mObjectRegistry->UnregisterObject( object );
165 }
166
167 Layer& Stage::GetRootActor()
168 {
169   return *mRootLayer;
170 }
171
172 AnimationPlaylist& Stage::GetAnimationPlaylist()
173 {
174   return mAnimationPlaylist;
175 }
176
177 PropertyNotificationManager& Stage::GetPropertyNotificationManager()
178 {
179   return mPropertyNotificationManager;
180 }
181
182 void Stage::Add( Actor& actor )
183 {
184   mRootLayer->Add( actor );
185 }
186
187 void Stage::Remove( Actor& actor )
188 {
189   mRootLayer->Remove( actor );
190 }
191
192 void Stage::SetSize(float width, float height)
193 {
194   // Internally we want to report the actual size of the stage.
195   mSize.width  = width;
196   mSize.height = height;
197
198   // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
199   mDefaultCamera->SetPerspectiveProjection( mSize );
200
201   // The depth of the stage gets set to the maximun of these values
202   mRootLayer->SetSize( mSize );
203
204   // Repeat for SystemOverlay actors
205   if( mSystemOverlay )
206   {
207     mSystemOverlay->GetImpl()->SetSize( mSize.width, mSize.height );
208   }
209
210   SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
211 }
212
213 Vector2 Stage::GetSize() const
214 {
215   return mSize;
216 }
217
218 RenderTaskList& Stage::GetRenderTaskList() const
219 {
220   return *mRenderTaskList;
221 }
222
223 void Stage::CreateDefaultCameraActor()
224 {
225   // The default camera attributes and position is such that
226   // children of the default layer, can be positioned at (0,0) and
227   // be at the top-left of the viewport.
228   mDefaultCamera = CameraActor::New( Size::ZERO );
229   mDefaultCamera->SetParentOrigin(ParentOrigin::CENTER);
230   Add(*(mDefaultCamera.Get()));
231 }
232
233 Actor& Stage::GetDefaultRootActor()
234 {
235   return *mRootLayer;
236 }
237
238 CameraActor& Stage::GetDefaultCameraActor()
239 {
240   return *mDefaultCamera;
241 }
242
243 unsigned int Stage::GetLayerCount() const
244 {
245   return mLayerList->GetLayerCount();
246 }
247
248 Dali::Layer Stage::GetLayer( unsigned int depth ) const
249 {
250   return Dali::Layer(mLayerList->GetLayer( depth ));
251 }
252
253 Dali::Layer Stage::GetRootLayer() const
254 {
255   return Dali::Layer( mRootLayer.Get() );
256 }
257
258 LayerList& Stage::GetLayerList()
259 {
260   return *mLayerList;
261 }
262
263 Integration::SystemOverlay& Stage::GetSystemOverlay()
264 {
265   // Lazily create system-level if requested
266   if( !mSystemOverlay )
267   {
268     mSystemOverlay = new Integration::SystemOverlay( SystemOverlay::New( *this ) );
269     DALI_ASSERT_ALWAYS( NULL != mSystemOverlay && "Failed to create system overlay" );
270
271     mSystemOverlay->GetImpl()->SetSize( mSize.width, mSize.height );
272   }
273
274   return *mSystemOverlay;
275 }
276
277 SystemOverlay* Stage::GetSystemOverlayInternal()
278 {
279   SystemOverlay* overlay( NULL );
280
281   if( mSystemOverlay )
282   {
283     overlay = mSystemOverlay->GetImpl();
284   }
285
286   return overlay;
287 }
288
289 void Stage::SetViewMode( ViewMode viewMode )
290 {
291   if( mViewMode != viewMode )
292   {
293     DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "View mode changed from %d to %d\n", mViewMode, viewMode);
294
295     if( mViewMode == MONO )
296     {
297       mDefaultCamera->SetOrientation( Dali::ANGLE_180, Vector3::YAXIS );
298       mRenderTaskList->GetTask(0).SetSourceActor( Dali::Actor() );
299
300       //Create camera and RenderTask for left eye
301       mLeftCamera = CameraActor::New( Size::ZERO );
302       mLeftCamera->SetParentOrigin( ParentOrigin::CENTER );
303       mDefaultCamera->Add( *mLeftCamera.Get() );
304       mLeftRenderTask = mRenderTaskList->CreateTask();
305       mLeftRenderTask.SetCameraActor( Dali::CameraActor( mLeftCamera.Get() ) );
306       mLeftCamera->SetType( Dali::Camera::FREE_LOOK );
307
308       //Create camera and RenderTask for right eye
309       mRightCamera = CameraActor::New( Size::ZERO );
310       mRightCamera->SetParentOrigin( ParentOrigin::CENTER );
311       mDefaultCamera->Add( *mRightCamera.Get() );
312       mRightRenderTask = mRenderTaskList->CreateTask();
313       mRightRenderTask.SetClearColor( Vector4( 1.0f,0.0f,0.0f,1.0f));
314
315       mRightRenderTask.SetCameraActor( Dali::CameraActor( mRightCamera.Get() ) );
316       mRightCamera->SetType( Dali::Camera::FREE_LOOK );
317     }
318
319     // save new mode
320     mViewMode = viewMode;
321
322     switch( viewMode )
323     {
324       case MONO:
325       {
326         // delete extra stereoscopic render tasks and cameras
327         mRenderTaskList->RemoveTask( mLeftRenderTask );
328         mDefaultCamera->Remove( *mLeftCamera.Get() );
329         mLeftRenderTask.Reset();
330         mLeftCamera.Reset();
331         mRenderTaskList->RemoveTask( mRightRenderTask );
332         mDefaultCamera->Remove( *mRightCamera.Get() );
333         mRightRenderTask.Reset();
334         mRightCamera.Reset();
335         mDefaultCamera->SetOrientation( Dali::ANGLE_0, Vector3::YAXIS );
336         mDefaultCamera->SetType( Dali::Camera::LOOK_AT_TARGET );
337         mRenderTaskList->GetTask(0).SetSourceActor( Dali::Layer(mRootLayer.Get()) );
338
339         break;
340       }
341       case STEREO_HORIZONTAL:
342       {
343         //Stereo mode with horizontal split is for landscape mode. That's the reason for the cameras being rotated
344         //Top camera renders the scene as seen from the right eye and bottom camera as seen from left.
345
346         //Calculate separation in pixels along vertical axis ( mStereoBase is defined in millimetres )
347         const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().y ) * 0.5f );
348
349         //Calculate aspect ratio
350         float aspect = mSize.width / (mSize.height * 0.5f);
351
352         mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0f,stereoBase) );
353         mLeftCamera->SetAspectRatio( aspect );
354
355         mLeftCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
356         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
357         mLeftRenderTask.SetViewport( Viewport(0, mSize.height * 0.5f, mSize.width, mSize.height * 0.5f) );
358
359         mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0,  -stereoBase) );
360         mRightCamera->SetAspectRatio( aspect );
361         mRightCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
362         mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
363         mRightRenderTask.SetViewport( Viewport(0, 0, mSize.width, mSize.height * 0.5f ) );
364
365         break;
366       }
367       case STEREO_VERTICAL:
368       {
369         //Calculate separation in pixels along horizontal axis
370         const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().x ) * 0.5f );
371
372         //Recalculate fov based on viewport size
373         const float fov = 2.0f * std::atan(  mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
374
375         mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
376         mLeftCamera->SetFieldOfView( fov );
377         mLeftCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
378         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
379         mLeftRenderTask.SetViewport( Viewport(0, 0, mSize.width * 0.5f, mSize.height ) );
380
381         mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
382         mRightCamera->SetFieldOfView( fov );
383         mRightCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
384         mRightCamera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
385         mRightRenderTask.SetViewport( Viewport(mSize.width * 0.5f, 0, mSize.width * 0.5f, mSize.height ) );
386
387         break;
388       }
389       case STEREO_INTERLACED:
390       {
391         break;
392       }
393     }
394   }
395 }
396
397 ViewMode Stage::GetViewMode() const
398 {
399   return mViewMode;
400 }
401
402 void Stage::SetStereoBase( float stereoBase )
403 {
404   if( ! Equals( mStereoBase, stereoBase ) )
405   {
406     DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "old( %.2f) new(%.2f)", mStereoBase, stereoBase );
407     mStereoBase = stereoBase;
408
409     switch( mViewMode  )
410     {
411       case STEREO_HORIZONTAL:
412       {
413         stereoBase = mStereoBase / 25.4f * GetDpi().y * 0.5f;
414         float aspect = mSize.width / (mSize.height * 0.5f);
415
416         mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, stereoBase) );
417         mLeftCamera->SetAspectRatio( aspect );
418         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
419
420         mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
421         mRightCamera->SetAspectRatio( aspect );
422         mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
423
424         break;
425       }
426       case STEREO_VERTICAL:
427       {
428         stereoBase = mStereoBase / 25.4f * GetDpi().x * 0.5f;
429         const float fov = 2.0f * std::atan(  mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
430
431         mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
432         mLeftCamera->SetFieldOfView( fov );
433         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
434
435         mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
436         mRightCamera->SetFieldOfView( fov );
437         mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
438
439         break;
440       }
441       default:
442         break;
443     }
444   }
445 }
446
447 float Stage::GetStereoBase() const
448 {
449   return mStereoBase;
450 }
451
452 void Stage::SetBackgroundColor(Vector4 color)
453 {
454   // Cache for public GetBackgroundColor()
455   mBackgroundColor = color;
456
457   // Send message to change color in next frame
458   SetBackgroundColorMessage( mUpdateManager, color );
459 }
460
461 Vector4 Stage::GetBackgroundColor() const
462 {
463   return mBackgroundColor;
464 }
465
466 Vector2 Stage::GetDpi() const
467 {
468   return mDpi;
469 }
470
471 void Stage::SetDpi(Vector2 dpi)
472 {
473   mDpi = dpi;
474 }
475
476 #ifdef DYNAMICS_SUPPORT
477
478 DynamicsNotifier& Stage::GetDynamicsNotifier()
479 {
480   return mDynamicsNotifier;
481 }
482
483 DynamicsWorldPtr Stage::InitializeDynamics(DynamicsWorldConfigPtr config)
484 {
485   if( !mDynamicsFactory )
486   {
487     mDynamicsFactory = ThreadLocalStorage::Get().GetPlatformAbstraction().GetDynamicsFactory();
488   }
489
490   if( mDynamicsFactory && !mDynamicsWorld )
491   {
492     if( mDynamicsFactory->InitializeDynamics( *(config->GetSettings()) ) )
493     {
494       mDynamicsWorld = DynamicsWorld::New();
495       mDynamicsWorld->Initialize( *this, *mDynamicsFactory, config );
496     }
497   }
498   return mDynamicsWorld;
499 }
500
501 DynamicsWorldPtr Stage::GetDynamicsWorld()
502 {
503   return mDynamicsWorld;
504 }
505
506 void Stage::TerminateDynamics()
507 {
508   if( mDynamicsWorld )
509   {
510     mDynamicsWorld->Terminate(*this);
511     mDynamicsWorld = NULL;
512   }
513 }
514
515 #endif // DYNAMICS_SUPPORT
516
517 void Stage::KeepRendering( float durationSeconds )
518 {
519   // Send message to keep rendering
520   KeepRenderingMessage( mUpdateManager, durationSeconds );
521 }
522
523 bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
524 {
525   bool connected( true );
526   Stage* stage = dynamic_cast<Stage*>(object);
527
528   if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
529   {
530     stage->KeyEventSignal().Connect( tracker, functor );
531   }
532   else if( 0 == strcmp( signalName.c_str(), SIGNAL_EVENT_PROCESSING_FINISHED ) )
533   {
534     stage->EventProcessingFinishedSignal().Connect( tracker, functor );
535   }
536   else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
537   {
538     stage->TouchedSignal().Connect( tracker, functor );
539   }
540   else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
541   {
542     stage->WheelEventSignal().Connect( tracker, functor );
543   }
544   else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) )
545   {
546     stage->ContextLostSignal().Connect( tracker, functor );
547   }
548   else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_REGAINED ) )
549   {
550     stage->ContextRegainedSignal().Connect( tracker, functor );
551   }
552   else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCENE_CREATED ) )
553   {
554     stage->SceneCreatedSignal().Connect( tracker, functor );
555   }
556   else
557   {
558     // signalName does not match any signal
559     connected = false;
560   }
561
562   return connected;
563 }
564
565 void Stage::EmitKeyEventSignal(const KeyEvent& event)
566 {
567   // Emit the key event signal when no actor in the stage has gained the key input focus
568
569   mKeyEventSignal.Emit( event );
570 }
571
572 void Stage::EmitEventProcessingFinishedSignal()
573 {
574    mEventProcessingFinishedSignal.Emit();
575 }
576
577 void Stage::EmitTouchedSignal( const TouchEvent& touch )
578 {
579   mTouchedSignal.Emit( touch );
580 }
581
582 void Stage::EmitWheelEventSignal(const WheelEvent& event)
583 {
584   // Emit the wheel event signal when no actor in the stage has gained the wheel input focus
585
586   mWheelEventSignal.Emit( event );
587 }
588
589 void Stage::EmitSceneCreatedSignal()
590 {
591   mSceneCreatedSignal.Emit();
592 }
593
594 Dali::Stage::KeyEventSignalType& Stage::KeyEventSignal()
595 {
596   return mKeyEventSignal;
597 }
598
599 Dali::Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
600 {
601   return mEventProcessingFinishedSignal;
602 }
603
604 Dali::Stage::TouchedSignalType& Stage::TouchedSignal()
605 {
606   return mTouchedSignal;
607 }
608
609 Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal()
610 {
611   return mWheelEventSignal;
612 }
613
614 Dali::Stage::ContextStatusSignal& Stage::ContextLostSignal()
615 {
616   return mContextLostSignal;
617 }
618
619 Dali::Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
620 {
621   return mContextRegainedSignal;
622 }
623
624 Dali::Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
625 {
626   return mSceneCreatedSignal;
627 }
628
629 void Stage::NotifyContextLost()
630 {
631   mContextLostSignal.Emit();
632 }
633
634 void Stage::NotifyContextRegained()
635 {
636   mContextRegainedSignal.Emit();
637 }
638
639 Stage::Stage( AnimationPlaylist& playlist,
640               PropertyNotificationManager& propertyNotificationManager,
641               SceneGraph::UpdateManager& updateManager,
642               NotificationManager& notificationManager )
643 : mAnimationPlaylist( playlist ),
644   mPropertyNotificationManager(propertyNotificationManager),
645   mUpdateManager(updateManager),
646   mNotificationManager(notificationManager),
647   mSize(Vector2::ZERO),
648   mBackgroundColor(Dali::Stage::DEFAULT_BACKGROUND_COLOR),
649   mViewMode( MONO ),
650   mStereoBase( DEFAULT_STEREO_BASE ),
651 #ifdef DYNAMICS_SUPPORT
652   mDynamicsFactory(NULL),
653 #endif
654   mSystemOverlay(NULL)
655 {
656 }
657
658 SceneGraph::UpdateManager& Stage::GetUpdateManager()
659 {
660   return mUpdateManager;
661 }
662
663 unsigned int* Stage::ReserveMessageSlot( std::size_t size, bool updateScene )
664 {
665   return mUpdateManager.ReserveMessageSlot( size, updateScene );
666 }
667
668 BufferIndex Stage::GetEventBufferIndex() const
669 {
670   return mUpdateManager.GetEventBufferIndex();
671 }
672
673 Stage::~Stage()
674 {
675   delete mSystemOverlay;
676
677   mObjectRegistry.Reset();
678 }
679
680 } // namespace Internal
681
682 } // namespace Dali