From 05fccd29ba45f749c2748b54345ad721e3f3a26a Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 20 Nov 2018 11:12:58 +0900 Subject: [PATCH] [4.0] Support surface rotation Change-Id: I4e17cbde891b74c10590e462b6260da8779ba472 --- .../dali-test-suite-utils/test-application.cpp | 4 +- dali/integration-api/core.cpp | 9 +- dali/integration-api/core.h | 14 +-- dali/internal/common/core-impl.cpp | 13 +-- dali/internal/common/core-impl.h | 9 +- dali/internal/event/actors/camera-actor-impl.cpp | 6 ++ dali/internal/event/actors/camera-actor-impl.h | 7 ++ dali/internal/event/common/stage-impl.cpp | 101 +++------------------ dali/internal/event/common/stage-impl.h | 15 +-- dali/internal/render/common/render-instruction.h | 2 +- dali/internal/render/common/render-manager.cpp | 17 +++- dali/internal/render/common/render-manager.h | 6 ++ dali/internal/update/manager/update-manager.cpp | 11 +++ dali/internal/update/manager/update-manager.h | 17 ++++ .../update/render-tasks/scene-graph-camera.cpp | 47 +++++++++- .../update/render-tasks/scene-graph-camera.h | 25 +++++ .../render-tasks/scene-graph-render-task.cpp | 1 - .../update/render-tasks/scene-graph-render-task.h | 1 + 18 files changed, 164 insertions(+), 141 deletions(-) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp index a247f7d..13f4415 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp @@ -73,7 +73,7 @@ void TestApplication::Initialize() Integration::StencilBufferAvailable::TRUE ); mCore->ContextCreated(); - mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); + mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight, 0, false ); mCore->SetDpi( mDpi.x, mDpi.y ); Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); @@ -153,7 +153,7 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height ) mSurfaceWidth = width; mSurfaceHeight = height; - mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); + mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight, 0, false ); } void TestApplication::SetTopMargin( unsigned int margin ) diff --git a/dali/integration-api/core.cpp b/dali/integration-api/core.cpp index ac83383..1342069 100755 --- a/dali/integration-api/core.cpp +++ b/dali/integration-api/core.cpp @@ -79,14 +79,9 @@ void Core::RecoverFromContextLoss() mImpl->RecoverFromContextLoss(); } -void Core::SurfaceResized(unsigned int width, unsigned int height) +void Core::SurfaceResized( unsigned int width, unsigned int height, int orientation, bool forceUpdate ) { - mImpl->SurfaceResized(width, height); -} - -void Core::SurfaceResized( unsigned int width, unsigned int height, int orientation ) -{ - mImpl->SurfaceResized(width, height, orientation); + mImpl->SurfaceResized(width, height, orientation, forceUpdate ); } void Core::SetTopMargin( unsigned int margin ) diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index 268184b..c5423e7 100755 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -280,17 +280,6 @@ public: void RecoverFromContextLoss(); /** - * Notify the Core that the GL surface has been resized. - * This should be done at least once i.e. after the first call to ContextCreated(). - * The Core will use the surface size for camera calculations, and to set the GL viewport. - * Multi-threading note: this method should be called from the main thread - * @param[in] width The new surface width. - * @param[in] height The new surface height. - */ - void SurfaceResized(unsigned int width, unsigned int height); - - - /** * Notify the Core that the GL surface has been resized and rotated. * This should be done at least once i.e. after the first call to ContextCreated(). * The Core will use the surface size or orientation for camera calculations, and to set the GL viewport. @@ -298,8 +287,9 @@ public: * @param[in] width The new surface width. * @param[in] height The new surface height. * @param[in] orientation The new surface orientation. + * @param[in] forceUpdate The flag to update force. */ - void SurfaceResized( unsigned int width, unsigned int height, int orientation ); + void SurfaceResized( unsigned int width, unsigned int height, int orientation, bool forceUpdate ); /** * Notify the Core about the top margin size. diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index ae5a35a..8384977 100755 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -187,18 +187,9 @@ void Core::ContextDestroyed() mRenderManager->ContextDestroyed(); } -void Core::SurfaceResized( unsigned int width, unsigned int height ) +void Core::SurfaceResized( unsigned int width, unsigned int height, int orientation, bool forceUpdate ) { - mStage->SurfaceResized( width, height ); - - // The stage-size may be less than surface-size (reduced by top-margin) - Vector2 size = mStage->GetSize(); - mRelayoutController->SetStageSize( size.width, size.height ); -} - -void Core::SurfaceResized( unsigned int width, unsigned int height, int orientation ) -{ - mStage->SurfaceResized( width, height, orientation ); + mStage->SurfaceResized( width, height, orientation, forceUpdate ); // The stage-size may be less than surface-size (reduced by top-margin) Vector2 size = mStage->GetSize(); diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h index 02b6223..fc6e8a2 100755 --- a/dali/internal/common/core-impl.h +++ b/dali/internal/common/core-impl.h @@ -111,14 +111,9 @@ public: void RecoverFromContextLoss(); /** - * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int) + * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int, int orientation, bool forceUpdate ) */ - void SurfaceResized(unsigned int width, unsigned int height); - - /** - * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int, int orientation) - */ - void SurfaceResized( unsigned int width, unsigned int height, int orientation ); + void SurfaceResized( unsigned int width, unsigned int height, int orientation, bool forceUpdate ); /** * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin ) diff --git a/dali/internal/event/actors/camera-actor-impl.cpp b/dali/internal/event/actors/camera-actor-impl.cpp index c8f5d75..c8fa916 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -509,6 +509,12 @@ const SceneGraph::Camera* CameraActor::GetCamera() const return mSceneObject; } +void CameraActor::RotateProjection( int rotationAngle ) +{ + // sceneObject is being used in a separate thread; queue a message to set + RotateProjectionMessage( GetEventThreadServices(), *mSceneObject, rotationAngle ); +} + unsigned int CameraActor::GetDefaultPropertyCount() const { return Actor::GetDefaultPropertyCount() + DEFAULT_PROPERTY_COUNT; diff --git a/dali/internal/event/actors/camera-actor-impl.h b/dali/internal/event/actors/camera-actor-impl.h index a3a4ae6..672d5d9 100644 --- a/dali/internal/event/actors/camera-actor-impl.h +++ b/dali/internal/event/actors/camera-actor-impl.h @@ -196,6 +196,13 @@ public: */ const SceneGraph::Camera* GetCamera() const; + /** + * Rotate the projection. + * It is used in case that the target buffer direction is different from the window direction. + * @param [in] rotationAngle The rotation angle + */ + void RotateProjection( int rotationAngle ); + public: // properties /** diff --git a/dali/internal/event/common/stage-impl.cpp b/dali/internal/event/common/stage-impl.cpp index 18a44e9..c8641dd 100755 --- a/dali/internal/event/common/stage-impl.cpp +++ b/dali/internal/event/common/stage-impl.cpp @@ -120,10 +120,6 @@ void Stage::Initialize( bool renderToFbo ) // Create the default render-task Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask(); - - // init current default camera orientation - mNeedToRotation = false; - mCurrentOrientation = 0; } void Stage::Uninitialize() @@ -204,15 +200,14 @@ void Stage::Remove( Actor& actor ) mRootLayer->Remove( actor ); } -void Stage::SurfaceResized( float width, float height ) +void Stage::SurfaceResized( float width, float height, int orientation, bool forceUpdate ) { if( ( fabs( width - mSurfaceSize.width ) > Math::MACHINE_EPSILON_1000 ) || ( fabs( height - mSurfaceSize.height ) > Math::MACHINE_EPSILON_1000 ) - || mNeedToRotation ) + || ( orientation != mOrientation ) || ( forceUpdate ) ) { - mNeedToRotation = false; - mSurfaceSize.width = width; mSurfaceSize.height = height; + mOrientation = orientation; // Internally we want to report the actual size of the stage. mSize.width = width; @@ -220,6 +215,12 @@ void Stage::SurfaceResized( float width, float height ) // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. mDefaultCamera->SetPerspectiveProjection( mSurfaceSize ); + mDefaultCamera->RotateProjection( orientation ); + + if( mSystemOverlay ) + { + mSystemOverlay->GetImpl()->GetDefaultCameraActor().RotateProjection( orientation ); + } // Adjust the camera height to allow for top-margin SetDefaultCameraPosition(); @@ -234,14 +235,8 @@ void Stage::SurfaceResized( float width, float height ) mSystemOverlay->GetImpl()->SetSize( width, height ); } - if( mCurrentOrientation == 90 || mCurrentOrientation == 270) - { - SetDefaultSurfaceRectMessage( mUpdateManager, Rect( 0, 0, height, width ) ); - } - else - { - SetDefaultSurfaceRectMessage( mUpdateManager, Rect( 0, 0, width, height ) ); - } + SetDefaultSurfaceRectMessage( mUpdateManager, Rect( 0, 0, width, height ) ); + SetDefaultSurfaceOrientationMessage( mUpdateManager, orientation ); // if single render task to screen then set its viewport parameters if( 1 == mRenderTaskList->GetTaskCount() ) @@ -250,14 +245,7 @@ void Stage::SurfaceResized( float width, float height ) if(!defaultRenderTask.GetTargetFrameBuffer()) { - if( mCurrentOrientation == 90 || mCurrentOrientation == 270) - { - defaultRenderTask.SetViewport( Viewport(0, 0, height, width) ); - } - else - { - defaultRenderTask.SetViewport( Viewport(0, 0, width, height) ); - } + defaultRenderTask.SetViewport( Viewport(0, 0, width, height) ); } } @@ -273,66 +261,6 @@ void Stage::SurfaceResized( float width, float height ) } } -void Stage::SurfaceResized( float width, float height, int orientation ) -{ - // Calculates the angle of rotation. - int rotDelta = ( 360 + orientation - mCurrentOrientation ) % 360; - Quaternion rotateAngle; - - switch( rotDelta ) - { - case 90: - { - rotateAngle = Quaternion( Dali::ANGLE_270, Vector3::ZAXIS ); - break; - } - case 270: - { - rotateAngle = Quaternion( Dali::ANGLE_90, Vector3::ZAXIS ); - break; - } - case 180: - { - rotateAngle = Quaternion( Dali::ANGLE_180, Vector3::ZAXIS ); - break; - } - default: - rotateAngle = Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ); - break; - } - - // set current orientation - mCurrentOrientation = orientation; - if( rotDelta ) - { - mNeedToRotation = true; - } - - // do surface resized - SurfaceResized( width, height ); - - // If we need to rotate, rotate the camera. - if( rotDelta ) - { - // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position depending on the orientation - if( mCurrentOrientation == 90 || mCurrentOrientation == 270 ) - { - mDefaultCamera->SetPerspectiveProjection( Vector2( height, width ) ); - if( mSystemOverlay ) - { - mSystemOverlay->GetImpl()->GetDefaultCameraActor().SetPerspectiveProjection( Vector2( height, width ) ); - } - } - - mDefaultCamera->RotateBy( rotateAngle ); - - if( mSystemOverlay ) - { - mSystemOverlay->GetImpl()->GetDefaultCameraActor().RotateBy( rotateAngle ); - } - } -} - Vector2 Stage::GetSize() const { return mSize; @@ -818,14 +746,13 @@ Stage::Stage( AnimationPlaylist& playlist, mBackgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ), mViewMode( MONO ), mStereoBase( DEFAULT_STEREO_BASE ), + mOrientation( 0 ), mTopMargin( 0 ), mSystemOverlay( NULL ), mRenderingBehavior( DevelStage::Rendering::IF_REQUIRED ), mDepthTreeDirty( false ), mForceNextUpdate( false ), - mRenderToFbo( false ), - mNeedToRotation( false ), - mCurrentOrientation( 0 ) + mRenderToFbo( false ) { } diff --git a/dali/internal/event/common/stage-impl.h b/dali/internal/event/common/stage-impl.h index e1c2409..b81243a 100755 --- a/dali/internal/event/common/stage-impl.h +++ b/dali/internal/event/common/stage-impl.h @@ -143,19 +143,13 @@ public: void Remove( Actor& actor ); /** - * Used to calculate the size of the stage and indirectly, the root actor. - * @param [in] width The new surface width. - * @param [in] height The new surface height. - */ - void SurfaceResized( float width, float height ); - - /** * Used to calculate the size and orientation of the stage and indirectly, the root actor. * @param [in] width The new surface width. * @param [in] height The new surface height. * @param [in] orientation The new surface orientation. + * @param [in] forceUpdate The flag to update force. */ - void SurfaceResized( float width, float height, int orientation ); + void SurfaceResized( float width, float height, int orientation, bool forceUpdate ); /** * Sets the top margin size. @@ -528,6 +522,8 @@ private: ViewMode mViewMode; float mStereoBase; + int mOrientation; + unsigned int mTopMargin; Vector2 mDpi; @@ -568,9 +564,6 @@ private: bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating bool mForceNextUpdate:1; ///< True if the next rendering is really required. bool mRenderToFbo:1; ///< Whether to render to a Frame Buffer Object. - - bool mNeedToRotation:1; - int mCurrentOrientation; }; } // namespace Internal diff --git a/dali/internal/render/common/render-instruction.h b/dali/internal/render/common/render-instruction.h index 3157f85..3d0d64b 100644 --- a/dali/internal/render/common/render-instruction.h +++ b/dali/internal/render/common/render-instruction.h @@ -121,7 +121,7 @@ public: const Matrix* GetProjectionMatrix( BufferIndex index ) const { // inlined as this is called once per frame per render instruction - return &mCamera->GetProjectionMatrix( index ); + return &mCamera->GetFinalProjectionMatrix( index ); } private: diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index 9261a6d..609214f 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -73,7 +73,8 @@ struct RenderManager::Impl lastFrameWasRendered( false ), programController( glAbstraction ), depthBufferAvailable( depthBufferAvailableParam ), - stencilBufferAvailable( stencilBufferAvailableParam ) + stencilBufferAvailable( stencilBufferAvailableParam ), + defaultSurfaceOrientation( 0 ) { } @@ -134,6 +135,8 @@ struct RenderManager::Impl Integration::DepthBufferAvailable depthBufferAvailable; ///< Whether the depth buffer is available Integration::StencilBufferAvailable stencilBufferAvailable; ///< Whether the stencil buffer is available + int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to + }; RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction, @@ -217,6 +220,11 @@ void RenderManager::SetDefaultSurfaceRect(const Rect& rect) mImpl->defaultSurfaceRect = rect; } +void RenderManager::SetDefaultSurfaceOrientation( int orientation ) +{ + mImpl->defaultSurfaceOrientation = orientation; +} + void RenderManager::AddRenderer( OwnerPointer< Render::Renderer >& renderer ) { // Initialize the renderer as we are now in render thread @@ -538,6 +546,13 @@ void RenderManager::DoRender( RenderInstruction& instruction ) { viewportRect = mImpl->defaultSurfaceRect; } + + if ( mImpl->defaultSurfaceOrientation == 90 || mImpl->defaultSurfaceOrientation == 270 ) + { + int temp = viewportRect.width; + viewportRect.width = viewportRect.height; + viewportRect.height = temp; + } } mImpl->context.Viewport(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height); diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index 5e48692..8731156 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -138,6 +138,12 @@ public: void SetDefaultSurfaceRect( const Rect& rect ); /** + * Returns the orintation for the default surface (probably the application window). + * @return Orientation for the surface. + */ + void SetDefaultSurfaceOrientation( int orientation ); + + /** * Add a Renderer to the render manager. * @param[in] renderer The renderer to add. * @post renderer is owned by RenderManager diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index e25bee5..c490144 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -1030,6 +1030,17 @@ void UpdateManager::SetDefaultSurfaceRect( const Rect& rect ) new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetDefaultSurfaceRect, rect ); } +void UpdateManager::SetDefaultSurfaceOrientation( int orientation ) +{ + typedef MessageValue1< RenderManager, int > DerivedType; + + // Reserve some memory inside the render queue + unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) ); + + // Construct message in the render queue memory; note that delete should not be called on the return value + new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetDefaultSurfaceOrientation, orientation ); +} + void UpdateManager::KeepRendering( float durationSeconds ) { mImpl->keepRenderingSeconds = std::max( mImpl->keepRenderingSeconds, durationSeconds ); diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index 705eecf..bdb5fb8 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -582,6 +582,12 @@ public: void SetDefaultSurfaceRect( const Rect& rect ); /** + * Set the default surface orientation. + * @param[in] orientation The orientation value representing the surface. + */ + void SetDefaultSurfaceOrientation( int orientation ); + + /** * @copydoc Dali::Stage::KeepRendering() */ void KeepRendering( float durationSeconds ); @@ -954,6 +960,17 @@ inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceOrientation, orientation ); +} + inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds ) { typedef MessageValue1< UpdateManager, float > LocalType; diff --git a/dali/internal/update/render-tasks/scene-graph-camera.cpp b/dali/internal/update/render-tasks/scene-graph-camera.cpp index 56e6b9e..0116662 100644 --- a/dali/internal/update/render-tasks/scene-graph-camera.cpp +++ b/dali/internal/update/render-tasks/scene-graph-camera.cpp @@ -154,6 +154,7 @@ const Vector3 Camera::DEFAULT_TARGET_POSITION( 0.0f, 0.0f, 0.0f ); Camera::Camera() : mUpdateViewFlag( UPDATE_COUNT ), mUpdateProjectionFlag( UPDATE_COUNT ), + mProjectionRotation( 0 ), mNode( NULL ), mType( DEFAULT_TYPE ), mProjectionMode( DEFAULT_MODE ), @@ -170,7 +171,8 @@ Camera::Camera() mTargetPosition( DEFAULT_TARGET_POSITION ), mViewMatrix(), mProjectionMatrix(), - mInverseViewProjection( Matrix::IDENTITY ) + mInverseViewProjection( Matrix::IDENTITY ), + mFinalProjection( Matrix::IDENTITY ) { } @@ -265,6 +267,12 @@ void Camera::SetTargetPosition( const Vector3& targetPosition ) mUpdateViewFlag = UPDATE_COUNT; } +void Camera::RotateProjection( int rotationAngle ) +{ + mProjectionRotation = rotationAngle; + mUpdateViewFlag = UPDATE_COUNT; +} + const Matrix& Camera::GetProjectionMatrix( BufferIndex bufferIndex ) const { return mProjectionMatrix[ bufferIndex ]; @@ -280,6 +288,11 @@ const Matrix& Camera::GetInverseViewProjectionMatrix( BufferIndex bufferIndex ) return mInverseViewProjection[ bufferIndex ]; } +const Matrix& Camera::GetFinalProjectionMatrix( BufferIndex bufferIndex ) const +{ + return mFinalProjection[ bufferIndex ]; +} + const PropertyInputImpl* Camera::GetProjectionMatrix() const { return &mProjectionMatrix; @@ -513,6 +526,38 @@ unsigned int Camera::UpdateProjection( BufferIndex updateBufferIndex ) } mProjectionMatrix.SetDirty( updateBufferIndex ); + + Matrix &finalProjection = mFinalProjection[ updateBufferIndex ]; + finalProjection.SetIdentity(); + + Quaternion rotationAngle; + switch( mProjectionRotation ) + { + case 90: + { + rotationAngle = Quaternion( Dali::ANGLE_90, Vector3::ZAXIS ); + break; + } + case 180: + { + rotationAngle = Quaternion( Dali::ANGLE_180, Vector3::ZAXIS ); + break; + } + case 270: + { + rotationAngle = Quaternion( Dali::ANGLE_270, Vector3::ZAXIS ); + break; + } + default: + rotationAngle = Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ); + break; + } + + Matrix rotation; + rotation.SetIdentity(); + rotation.SetTransformComponents( Vector3( 1.0f, 1.0f, 1.0f ), rotationAngle, Vector3( 0.0f, 0.0f, 0.0f ) ); + + Matrix::Multiply( finalProjection, mProjectionMatrix.Get( updateBufferIndex ), rotation ); } --mUpdateProjectionFlag; } diff --git a/dali/internal/update/render-tasks/scene-graph-camera.h b/dali/internal/update/render-tasks/scene-graph-camera.h index 44b7518..3c9716f 100644 --- a/dali/internal/update/render-tasks/scene-graph-camera.h +++ b/dali/internal/update/render-tasks/scene-graph-camera.h @@ -165,6 +165,11 @@ public: void SetTargetPosition( const Vector3& targetPosition ); /** + * @copydoc Dali::Internal::CameraActor::RotateProjection + */ + void RotateProjection( int rotationAngle ); + + /** * Retrieve the view-matrix; this is double buffered for input handling. * @param[in] bufferIndex The buffer to read from. * @return The view-matrix. @@ -208,6 +213,13 @@ public: const Matrix& GetInverseViewProjectionMatrix( BufferIndex bufferIndex ) const; /** + * Retrieve the final projection-matrix; this is double buffered for input handling. + * @param[in] bufferIndex The buffer to read from. + * @return The projection-matrix that should be used to render. + */ + const Matrix& GetFinalProjectionMatrix( BufferIndex bufferIndex ) const; + + /** * Retrieve the projection-matrix property querying interface. * @pre The camera is on-stage. * @return The projection-matrix property querying interface. @@ -272,6 +284,7 @@ private: unsigned int mUpdateViewFlag; ///< This is non-zero if the view matrix requires an update unsigned int mUpdateProjectionFlag; ///< This is non-zero if the projection matrix requires an update + int mProjectionRotation; ///< The rotaion angle of the projection const Node* mNode; ///< The node this scene graph camera belongs to public: // PROPERTIES @@ -295,6 +308,7 @@ public: // PROPERTIES DoubleBuffered< FrustumPlanes > mFrustum; ///< Clipping frustum; double buffered for input handling DoubleBuffered< Matrix > mInverseViewProjection; ///< Inverted viewprojection; double buffered for input handling + DoubleBuffered< Matrix > mFinalProjection; ///< Final projection matrix; double buffered for input handling }; @@ -443,6 +457,17 @@ inline void SetInvertYAxisMessage( EventThreadServices& eventThreadServices, con new (slot) LocalType( &camera, &Camera::SetInvertYAxis, parameter ); } +inline void RotateProjectionMessage( EventThreadServices& eventThreadServices, const Camera& camera, int parameter ) +{ + typedef MessageValue1< Camera, int > LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &camera, &Camera::RotateProjection, parameter ); +} + } // namespace SceneGraph } // namespace Internal diff --git a/dali/internal/update/render-tasks/scene-graph-render-task.cpp b/dali/internal/update/render-tasks/scene-graph-render-task.cpp index d4305b9..1757c2f 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.cpp +++ b/dali/internal/update/render-tasks/scene-graph-render-task.cpp @@ -452,7 +452,6 @@ void RenderTask::SetSyncRequired( bool requiresSync ) mRequiresSync = requiresSync; } - RenderTask::RenderTask() : mViewportPosition( Vector2::ZERO), mViewportSize( Vector2::ZERO), diff --git a/dali/internal/update/render-tasks/scene-graph-render-task.h b/dali/internal/update/render-tasks/scene-graph-render-task.h index b66077e..ccbe865 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.h +++ b/dali/internal/update/render-tasks/scene-graph-render-task.h @@ -364,6 +364,7 @@ private: unsigned int mFrameCounter; ///< counter for rendering every N frames unsigned int mRenderedOnceCounter; ///< Incremented whenever state changes to RENDERED_ONCE_AND_NOTIFIED + bool mRequiresSync; ///< Whether sync is needed to track the render }; -- 2.7.4