#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>
+#include <dali/public-api/rendering/frame-buffer.h>
using Dali::Internal::SceneGraph::Node;
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
mRootLayer->Remove( actor );
}
-void Stage::SurfaceResized(float width, float height)
+void Stage::SurfaceResized( float width, float height )
{
- mSurfaceSize.width = width;
- mSurfaceSize.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;
- // Internally we want to report the actual size of the stage.
- mSize.width = width;
- mSize.height = height - mTopMargin;
+ // Internally we want to report the actual size of the stage.
+ mSize.width = width;
+ mSize.height = height - mTopMargin;
- // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
- mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
+ // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
+ mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
- // Adjust the camera height to allow for top-margin
- SetDefaultCameraPosition();
+ // Adjust the camera height to allow for top-margin
+ SetDefaultCameraPosition();
- mRootLayer->SetSize( mSize.width, mSize.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 );
- }
+ // 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 ) );
+ 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 mDefaultRenderTask = mRenderTaskList->GetTask(0);
+ // 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(!mDefaultRenderTask.GetTargetFrameBuffer())
+ if( mRenderToFbo )
{
- mDefaultRenderTask.SetViewport( Viewport(0, 0, width, height) );
+ 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
mTopMargin( 0 ),
mSystemOverlay( NULL ),
mDepthTreeDirty( false ),
- mForceNextUpdate( false )
+ mForceNextUpdate( false ),
+ mRenderToFbo( false )
{
}