-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// CLASS HEADER
#include <dali/internal/event/common/stage-impl.h>
// EXTERNAL INCLUDES
#include <algorithm>
+#include <cmath>
+#include <cstring> // for strcmp
// INTERNAL INCLUDES
#include <dali/integration-api/system-overlay.h>
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/actors/layer-list.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
-#include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
#include <dali/internal/event/common/system-overlay-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/common/property-notification-manager.h>
#include <dali/internal/event/common/object-registry-impl.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/public-api/common/constants.h>
+#include <dali/public-api/events/touch-data.h>
+#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-
-#ifdef DYNAMICS_SUPPORT
-#include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
-#include <dali/internal/event/dynamics/dynamics-world-impl.h>
-#include <dali/integration-api/dynamics/dynamics-factory-intf.h>
-#include <dali/integration-api/dynamics/dynamics-world-settings.h>
-#endif
-
-using namespace std;
-using namespace boost;
+#include <dali/public-api/rendering/frame-buffer.h>
using Dali::Internal::SceneGraph::Node;
+namespace
+{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER" );
+#endif
+}
+
namespace Dali
{
const float DEFAULT_STEREO_BASE( 65.0f );
+// Signals
+
+const char* const SIGNAL_KEY_EVENT = "keyEvent";
+const char* const SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
+const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
+const char* const SIGNAL_TOUCHED = "touched";
+const char* const SIGNAL_TOUCH = "touch";
+const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
+const char* const SIGNAL_CONTEXT_LOST = "contextLost";
+const char* const SIGNAL_CONTEXT_REGAINED = "contextRegained";
+const char* const SIGNAL_SCENE_CREATED = "sceneCreated";
+
+TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), NULL );
+
+SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector3( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector8( mType, SIGNAL_KEY_EVENT_GENERATED, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector9( mType, SIGNAL_TOUCH, &Stage::DoConnectSignal );
+
} // unnamed namespace
StagePtr Stage::New( AnimationPlaylist& playlist,
PropertyNotificationManager& propertyNotificationManager,
SceneGraph::UpdateManager& updateManager,
- NotificationManager& notificationManager )
+ NotificationManager& notificationManager,
+ Integration::RenderController& renderController )
{
- return StagePtr( new Stage( playlist, propertyNotificationManager, updateManager, notificationManager ) );
+ return StagePtr( new Stage( playlist, propertyNotificationManager, updateManager, notificationManager, renderController ) );
}
-void Stage::Initialize()
+void Stage::Initialize( bool renderToFbo )
{
+ mRenderToFbo = renderToFbo;
mObjectRegistry = ObjectRegistry::New();
// Create the ordered list of layers
- mLayerList = LayerList::New( *this, false/*not system-level*/ );
+ mLayerList = LayerList::New( mUpdateManager, false/*not system-level*/ );
// The stage owns the default layer
- mRootLayer = Layer::NewRoot( *this, *mLayerList, mUpdateManager, false/*not system-level*/ );
+ mRootLayer = Layer::NewRoot( *mLayerList, mUpdateManager, false/*not system-level*/ );
mRootLayer->SetName("RootLayer");
+ // The root layer needs to have a fixed resize policy (as opposed to the default USE_NATURAL_SIZE).
+ // This stops actors parented to the stage having their relayout requests propagating
+ // up to the root layer, and down through other children unnecessarily.
+ mRootLayer->SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
// Create the default camera actor first; this is needed by the RenderTaskList
CreateDefaultCameraActor();
// Create the list of render-tasks
- mRenderTaskList = RenderTaskList::New( mUpdateManager, *this, false/*not system-level*/ );
+ mRenderTaskList = RenderTaskList::New( *this, *this, false/*not system-level*/ );
// Create the default render-task
Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask();
if( mDefaultCamera )
{
- Remove(*(mDefaultCamera.Get()));
+ // its enough to release the handle so the object is released
+ // don't need to remove it from root actor as root actor will delete the object
+ mDefaultCamera.Reset();
}
if( mRootLayer )
StagePtr Stage::GetCurrent()
{
- return ThreadLocalStorage::Get().GetCurrentStage();
+ StagePtr stage( NULL );
+ // no checking in this version
+ ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
+ if( tls )
+ {
+ stage = tls->GetCurrentStage();
+ }
+ return stage;
}
bool Stage::IsInstalled()
return *mObjectRegistry;
}
-Layer& Stage::GetRootActor()
+void Stage::RegisterObject( Dali::BaseObject* object )
{
- return *mRootLayer;
+ mObjectRegistry->RegisterObject( object );
}
-SceneGraph::UpdateManager& Stage::GetUpdateManager()
+void Stage::UnregisterObject( Dali::BaseObject* object )
{
- return mUpdateManager;
+ mObjectRegistry->UnregisterObject( object );
}
-EventToUpdate& Stage::GetUpdateInterface()
+Layer& Stage::GetRootActor()
{
- return mUpdateManager.GetEventToUpdate();
+ return *mRootLayer;
}
AnimationPlaylist& Stage::GetAnimationPlaylist()
mRootLayer->Remove( actor );
}
-void Stage::SetSize(float width, float height)
+void Stage::SurfaceResized( float width, float height )
{
- // Internally we want to report the actual size of the stage.
- mSize.width = width;
- mSize.height = height;
+ if( ( fabs( width - mSurfaceSize.width ) > Math::MACHINE_EPSILON_1000 ) || ( fabs( height - mSurfaceSize.height ) > Math::MACHINE_EPSILON_1000 ) )
+ {
+ mSurfaceSize.width = width;
+ mSurfaceSize.height = height;
- // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
- mDefaultCamera->SetPerspectiveProjection( mSize );
+ // Internally we want to report the actual size of the stage.
+ mSize.width = width;
+ mSize.height = height - mTopMargin;
- // The depth of the stage gets set to the maximun of these values
- mRootLayer->SetSize( mSize );
+ // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
+ mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
- // Repeat for SystemOverlay actors
- if( mSystemOverlay )
- {
- mSystemOverlay->GetImpl()->SetSize( mSize.width, mSize.height );
- }
+ // Adjust the camera height to allow for top-margin
+ SetDefaultCameraPosition();
- SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
+ mRootLayer->SetSize( mSize.width, mSize.height );
+
+ // Repeat for SystemOverlay actors
+ if( mSystemOverlay )
+ {
+ // Note that the SystemOverlay has a separate camera, configured for the full surface-size.
+ // This will remain unaffected by changes in SetDefaultCameraPosition()
+ mSystemOverlay->GetImpl()->SetSize( width, height );
+ }
+
+ SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
+
+ // if single render task to screen then set its viewport parameters
+ if( 1 == mRenderTaskList->GetTaskCount() )
+ {
+ Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u );
+
+ if(!defaultRenderTask.GetTargetFrameBuffer())
+ {
+ defaultRenderTask.SetViewport( Viewport(0, 0, width, height) );
+ }
+ }
+
+ if( mRenderToFbo )
+ {
+ Dali::FrameBuffer frameBuffer = Dali::FrameBuffer::New( width, height, Dali::FrameBuffer::Attachment::NONE );
+ Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, Dali::Pixel::RGB888, width, height );
+ frameBuffer.AttachColorTexture( texture );
+
+ Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u );
+ defaultRenderTask.SetFrameBuffer( frameBuffer );
+ }
+ }
}
Vector2 Stage::GetSize() const
return mSize;
}
+void Stage::SetTopMargin( unsigned int margin )
+{
+ if (mTopMargin == margin)
+ {
+ return;
+ }
+ mTopMargin = margin;
+
+ mSize.width = mSurfaceSize.width;
+ mSize.height = mSurfaceSize.height - mTopMargin;
+
+ // Adjust the camera height to allow for top-margin
+ SetDefaultCameraPosition();
+
+ mRootLayer->SetSize( mSize.width, mSize.height );
+}
+
RenderTaskList& Stage::GetRenderTaskList() const
{
return *mRenderTaskList;
Add(*(mDefaultCamera.Get()));
}
+void Stage::SetDefaultCameraPosition()
+{
+ mDefaultCamera->SetY( -(static_cast<float>(mTopMargin) * 0.5f) );
+}
+
Actor& Stage::GetDefaultRootActor()
{
return *mRootLayer;
{
DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "View mode changed from %d to %d\n", mViewMode, viewMode);
- const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().x ) * 0.5f );
-
if( mViewMode == MONO )
{
- mDefaultCamera->SetRotation( Degree( 180.0f ), Vector3::YAXIS );
+ mDefaultCamera->SetOrientation( Dali::ANGLE_180, Vector3::YAXIS );
mRenderTaskList->GetTask(0).SetSourceActor( Dali::Actor() );
+ //Create camera and RenderTask for left eye
mLeftCamera = CameraActor::New( Size::ZERO );
mLeftCamera->SetParentOrigin( ParentOrigin::CENTER );
- mLeftCamera->SetPerspectiveProjection( mSize, stereoBase );
- mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
mDefaultCamera->Add( *mLeftCamera.Get() );
mLeftRenderTask = mRenderTaskList->CreateTask();
mLeftRenderTask.SetCameraActor( Dali::CameraActor( mLeftCamera.Get() ) );
mLeftCamera->SetType( Dali::Camera::FREE_LOOK );
+ //Create camera and RenderTask for right eye
mRightCamera = CameraActor::New( Size::ZERO );
mRightCamera->SetParentOrigin( ParentOrigin::CENTER );
- mRightCamera->SetPerspectiveProjection( mSize, -stereoBase );
- mRightCamera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
mDefaultCamera->Add( *mRightCamera.Get() );
mRightRenderTask = mRenderTaskList->CreateTask();
+ mRightRenderTask.SetClearColor( Vector4( 1.0f,0.0f,0.0f,1.0f));
+
mRightRenderTask.SetCameraActor( Dali::CameraActor( mRightCamera.Get() ) );
mRightCamera->SetType( Dali::Camera::FREE_LOOK );
}
mDefaultCamera->Remove( *mRightCamera.Get() );
mRightRenderTask.Reset();
mRightCamera.Reset();
-
- mDefaultCamera->SetRotation( Degree( 0.0f ), Vector3::YAXIS );
+ mDefaultCamera->SetOrientation( Dali::ANGLE_0, Vector3::YAXIS );
mDefaultCamera->SetType( Dali::Camera::LOOK_AT_TARGET );
mRenderTaskList->GetTask(0).SetSourceActor( Dali::Layer(mRootLayer.Get()) );
+
break;
}
case STEREO_HORIZONTAL:
{
- mLeftRenderTask.SetViewport( Viewport(0, 0, mSize.width, mSize.height * 0.5f ) );
- mRightRenderTask.SetViewport( Viewport(0, mSize.height * 0.5f, mSize.width, mSize.height * 0.5f) );
+ //Stereo mode with horizontal split is for landscape mode. That's the reason for the cameras being rotated
+ //Top camera renders the scene as seen from the right eye and bottom camera as seen from left.
+
+ //Calculate separation in pixels along vertical axis ( mStereoBase is defined in millimetres )
+ const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().y ) * 0.5f );
+
+ //Calculate aspect ratio
+ float aspect = mSize.width / (mSize.height * 0.5f);
+
+ mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0f,stereoBase) );
+ mLeftCamera->SetAspectRatio( aspect );
+
+ mLeftCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
+ mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
+ mLeftRenderTask.SetViewport( Viewport(0, mSize.height * 0.5f, mSize.width, mSize.height * 0.5f) );
+
+ mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
+ mRightCamera->SetAspectRatio( aspect );
+ mRightCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
+ mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
+ mRightRenderTask.SetViewport( Viewport(0, 0, mSize.width, mSize.height * 0.5f ) );
+
break;
}
case STEREO_VERTICAL:
{
+ //Calculate separation in pixels along horizontal axis
+ const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().x ) * 0.5f );
+
+ //Recalculate fov based on viewport size
+ const float fov = 2.0f * std::atan( mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
+
+ mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
+ mLeftCamera->SetFieldOfView( fov );
+ mLeftCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
+ mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
mLeftRenderTask.SetViewport( Viewport(0, 0, mSize.width * 0.5f, mSize.height ) );
+
+ mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
+ mRightCamera->SetFieldOfView( fov );
+ mRightCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
+ mRightCamera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
mRightRenderTask.SetViewport( Viewport(mSize.width * 0.5f, 0, mSize.width * 0.5f, mSize.height ) );
+
break;
}
case STEREO_INTERLACED:
{
if( ! Equals( mStereoBase, stereoBase ) )
{
- DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "old( %.2f) new(%.2f)", mStereoBase, stereoBase );
+ DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "old( %.2f) new(%.2f)\n", mStereoBase, stereoBase );
mStereoBase = stereoBase;
- if( mViewMode != MONO )
+ switch( mViewMode )
{
- stereoBase *= 0.5f;
- mLeftCamera->SetX( stereoBase );
- mLeftCamera->SetPerspectiveProjection( mSize, stereoBase );
- mRightCamera->SetX( -stereoBase );
- mRightCamera->SetPerspectiveProjection( mSize, -stereoBase );
+ case STEREO_HORIZONTAL:
+ {
+ stereoBase = mStereoBase / 25.4f * GetDpi().y * 0.5f;
+ float aspect = mSize.width / (mSize.height * 0.5f);
+
+ mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, stereoBase) );
+ mLeftCamera->SetAspectRatio( aspect );
+ mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
+
+ mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
+ mRightCamera->SetAspectRatio( aspect );
+ mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
+
+ break;
+ }
+ case STEREO_VERTICAL:
+ {
+ stereoBase = mStereoBase / 25.4f * GetDpi().x * 0.5f;
+ const float fov = 2.0f * std::atan( mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
+
+ mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
+ mLeftCamera->SetFieldOfView( fov );
+ mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
+
+ mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
+ mRightCamera->SetFieldOfView( fov );
+ mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
+
+ break;
+ }
+ default:
+ break;
}
}
}
mDpi = dpi;
}
-#ifdef DYNAMICS_SUPPORT
-
-DynamicsNotifier& Stage::GetDynamicsNotifier()
+void Stage::KeepRendering( float durationSeconds )
{
- return mDynamicsNotifier;
+ // Send message to keep rendering
+ KeepRenderingMessage( mUpdateManager, durationSeconds );
}
-DynamicsWorldPtr Stage::InitializeDynamics(DynamicsWorldConfigPtr config)
+bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
- if( !mDynamicsFactory )
+ bool connected( true );
+ Stage* stage = static_cast< Stage* >(object); // TypeRegistry guarantees that this is the correct type.
+
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
{
- mDynamicsFactory = ThreadLocalStorage::Get().GetPlatformAbstraction().GetDynamicsFactory();
+ stage->KeyEventSignal().Connect( tracker, functor );
}
-
- if( mDynamicsFactory && !mDynamicsWorld )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT_GENERATED ) )
{
- if( mDynamicsFactory->InitializeDynamics( *(config->GetSettings()) ) )
- {
- mDynamicsWorld = DynamicsWorld::New();
- mDynamicsWorld->Initialize( *this, *mDynamicsFactory, config );
- }
+ stage->KeyEventGeneratedSignal().Connect( tracker, functor );
}
- return mDynamicsWorld;
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_EVENT_PROCESSING_FINISHED ) )
+ {
+ stage->EventProcessingFinishedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
+ {
+ stage->TouchedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCH ) )
+ {
+ stage->TouchSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
+ {
+ stage->WheelEventSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) )
+ {
+ stage->ContextLostSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_REGAINED ) )
+ {
+ stage->ContextRegainedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCENE_CREATED ) )
+ {
+ stage->SceneCreatedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
}
-DynamicsWorldPtr Stage::GetDynamicsWorld()
+void Stage::EmitKeyEventSignal(const KeyEvent& event)
{
- return mDynamicsWorld;
+ // Emit the key event signal when no actor in the stage has gained the key input focus
+
+ mKeyEventSignal.Emit( event );
}
-void Stage::TerminateDynamics()
+bool Stage::EmitKeyEventGeneratedSignal(const KeyEvent& event)
{
- if( mDynamicsWorld )
- {
- mDynamicsWorld->Terminate(*this);
- mDynamicsWorld = NULL;
- }
+ // Emit the KeyEventGenerated signal when KeyEvent is generated
+
+ return mKeyEventGeneratedSignal.Emit( event );
}
-#endif // DYNAMICS_SUPPORT
+void Stage::EmitEventProcessingFinishedSignal()
+{
+ mEventProcessingFinishedSignal.Emit();
+}
-void Stage::KeepRendering( float durationSeconds )
+void Stage::EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch )
{
- // Send message to keep rendering
- KeepRenderingMessage( mUpdateManager, durationSeconds );
+ mTouchedSignal.Emit( touchEvent );
+ mTouchSignal.Emit( touch );
}
-void Stage::EmitKeyEventSignal(const KeyEvent& event)
+void Stage::EmitWheelEventSignal(const WheelEvent& event)
{
- // Emit the key event signal when no actor in the stage has gained the key input focus
+ // Emit the wheel event signal when no actor in the stage has gained the wheel input focus
- mKeyEventSignalV2.Emit( event );
+ mWheelEventSignal.Emit( event );
}
-void Stage::EmitEventProcessingFinishedSignal()
+void Stage::EmitSceneCreatedSignal()
{
- mEventProcessingFinishedSignalV2.Emit();
+ mSceneCreatedSignal.Emit();
}
-void Stage::EmitTouchedSignal( const TouchEvent& touch )
+Dali::Stage::KeyEventSignalType& Stage::KeyEventSignal()
{
- mTouchedSignalV2.Emit( touch );
+ return mKeyEventSignal;
}
-Dali::Stage::KeyEventSignalV2& Stage::KeyEventSignal()
+Dali::DevelStage::KeyEventGeneratedSignalType& Stage::KeyEventGeneratedSignal()
{
- return mKeyEventSignalV2;
+ return mKeyEventGeneratedSignal;
}
-Dali::Stage::EventProcessingFinishedSignalV2& Stage::EventProcessingFinishedSignal()
+Dali::Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
{
- return mEventProcessingFinishedSignalV2;
+ return mEventProcessingFinishedSignal;
}
-Dali::Stage::TouchedSignalV2& Stage::TouchedSignal()
+Dali::Stage::TouchedSignalType& Stage::TouchedSignal()
{
- return mTouchedSignalV2;
+ DALI_LOG_WARNING( "Deprecated. Use TouchSignal() instead.\n" );
+ return mTouchedSignal;
}
+Dali::Stage::TouchSignalType& Stage::TouchSignal()
+{
+ return mTouchSignal;
+}
+
+Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal()
+{
+ return mWheelEventSignal;
+}
+
+Dali::Stage::ContextStatusSignal& Stage::ContextLostSignal()
+{
+ return mContextLostSignal;
+}
+
+Dali::Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
+{
+ return mContextRegainedSignal;
+}
+
+Dali::Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
+{
+ return mSceneCreatedSignal;
+}
+
+void Stage::NotifyContextLost()
+{
+ mContextLostSignal.Emit();
+}
+
+void Stage::NotifyContextRegained()
+{
+ mContextRegainedSignal.Emit();
+}
+
+
+void Stage::RequestRebuildDepthTree()
+{
+ DALI_LOG_INFO(gLogFilter, Debug::General, "RequestRebuildDepthTree()\n");
+ mDepthTreeDirty = true;
+}
+
+void Stage::RebuildDepthTree()
+{
+ // If the depth tree needs rebuilding, do it in this frame only.
+ if( mDepthTreeDirty )
+ {
+ DALI_LOG_INFO(gLogFilter, Debug::Concise, "RebuildDepthTree() dirty:T\n");
+
+ ActorPtr actor( mRootLayer.Get() );
+ actor->RebuildDepthTree();
+ mDepthTreeDirty = false;
+ }
+}
+
+
Stage::Stage( AnimationPlaylist& playlist,
PropertyNotificationManager& propertyNotificationManager,
SceneGraph::UpdateManager& updateManager,
- NotificationManager& notificationManager )
+ NotificationManager& notificationManager,
+ Integration::RenderController& renderController )
: mAnimationPlaylist( playlist ),
- mPropertyNotificationManager(propertyNotificationManager),
- mUpdateManager(updateManager),
- mNotificationManager(notificationManager),
- mSize(Vector2::ZERO),
- mBackgroundColor(Dali::Stage::DEFAULT_BACKGROUND_COLOR),
+ mPropertyNotificationManager( propertyNotificationManager ),
+ mUpdateManager( updateManager ),
+ mNotificationManager( notificationManager ),
+ mRenderController( renderController ),
+ mSize( Vector2::ZERO ),
+ mBackgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ),
mViewMode( MONO ),
mStereoBase( DEFAULT_STEREO_BASE ),
-#ifdef DYNAMICS_SUPPORT
- mDynamicsFactory(NULL),
-#endif
- mSystemOverlay(NULL)
+ mTopMargin( 0 ),
+ mSystemOverlay( NULL ),
+ mDepthTreeDirty( false ),
+ mForceNextUpdate( false ),
+ mRenderToFbo( false )
+{
+}
+
+SceneGraph::UpdateManager& Stage::GetUpdateManager()
+{
+ return mUpdateManager;
+}
+
+Integration::RenderController& Stage::GetRenderController()
+{
+ return mRenderController;
+}
+
+unsigned int* Stage::ReserveMessageSlot( std::size_t size, bool updateScene )
+{
+ return mUpdateManager.ReserveMessageSlot( size, updateScene );
+}
+
+BufferIndex Stage::GetEventBufferIndex() const
+{
+ return mUpdateManager.GetEventBufferIndex();
+}
+
+void Stage::ForceNextUpdate()
+{
+ mForceNextUpdate = true;
+}
+
+bool Stage::IsNextUpdateForced()
{
+ bool nextUpdateForced = mForceNextUpdate;
+ mForceNextUpdate = false;
+ return nextUpdateForced;
}
Stage::~Stage()