From 99b9f2e8a1f9699c9568d962808238a2cc383c4d Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Wed, 4 May 2016 18:39:49 +0100 Subject: [PATCH] Removal of the Scene graph node attachment Change-Id: I1f984f6febde45db4a2db6b6e20a20c96f77f578 --- dali/integration-api/profiling.cpp | 14 +- .../event/actors/camera-actor-impl.cpp | 41 ++-- .../internal/event/actors/camera-actor-impl.h | 12 +- .../event/render-tasks/render-task-impl.cpp | 16 +- .../event/render-tasks/render-task-impl.h | 6 +- dali/internal/file.list | 3 +- .../render/common/render-instruction.cpp | 14 +- .../render/common/render-instruction.h | 15 +- dali/internal/update/common/discard-queue.cpp | 37 +++- dali/internal/update/common/discard-queue.h | 17 +- .../controllers/scene-controller-impl.cpp | 8 +- .../controllers/scene-controller-impl.h | 12 +- .../update/controllers/scene-controller.h | 13 +- .../manager/prepare-render-instructions.cpp | 50 ++--- .../manager/prepare-render-instructions.h | 7 +- .../update/manager/process-render-tasks.cpp | 4 +- .../update/manager/process-render-tasks.h | 4 +- .../update/manager/update-algorithms.cpp | 53 +++-- .../update/manager/update-algorithms.h | 14 +- .../update/manager/update-manager.cpp | 56 ++++-- dali/internal/update/manager/update-manager.h | 54 +++--- .../node-attachment-declarations.h | 47 ----- .../node-attachments/node-attachment.cpp | 54 ------ .../update/node-attachments/node-attachment.h | 130 ------------- dali/internal/update/nodes/node.cpp | 34 +--- dali/internal/update/nodes/node.h | 35 +--- .../internal/update/nodes/scene-graph-layer.h | 11 +- .../scene-graph-camera.cpp} | 141 ++++++-------- .../scene-graph-camera.h} | 183 +++++++----------- .../render-tasks/scene-graph-render-task.cpp | 51 ++--- .../render-tasks/scene-graph-render-task.h | 43 ++-- .../update/rendering/scene-graph-renderer.h | 16 +- 32 files changed, 432 insertions(+), 763 deletions(-) delete mode 100644 dali/internal/update/node-attachments/node-attachment-declarations.h delete mode 100644 dali/internal/update/node-attachments/node-attachment.cpp delete mode 100644 dali/internal/update/node-attachments/node-attachment.h rename dali/internal/update/{node-attachments/scene-graph-camera-attachment.cpp => render-tasks/scene-graph-camera.cpp} (75%) rename dali/internal/update/{node-attachments/scene-graph-camera-attachment.h => render-tasks/scene-graph-camera.h} (69%) diff --git a/dali/integration-api/profiling.cpp b/dali/integration-api/profiling.cpp index 9a27aa70c..5b8cdd372 100644 --- a/dali/integration-api/profiling.cpp +++ b/dali/integration-api/profiling.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -46,9 +46,6 @@ #include #include -#include -#include - #include #include @@ -57,6 +54,7 @@ #include #include #include +#include using Dali::Internal::GestureEventProcessor; using Dali::Internal::ThreadLocalStorage; @@ -98,20 +96,18 @@ const int CONSTRAINT_MEMORY_SIZE( sizeof( Internal::SceneGraph::Constraint > ) ); const int ACTOR_MEMORY_SIZE( sizeof( Internal::Actor ) + - sizeof( Internal::SceneGraph::Node ) + - sizeof( Internal::SceneGraph::NodeAttachment )); + sizeof( Internal::SceneGraph::Node ) ); const int CAMERA_ACTOR_MEMORY_SIZE( sizeof( Internal::CameraActor ) + sizeof( Internal::SceneGraph::Node ) + - sizeof( Internal::SceneGraph::CameraAttachment ) ); + sizeof( Internal::SceneGraph::Camera ) ); const int IMAGE_ACTOR_MEMORY_SIZE( sizeof( Internal::ImageActor ) + sizeof( Internal::SceneGraph::Node ) + sizeof( Internal::Render::Renderer )); const int LAYER_MEMORY_SIZE( sizeof( Internal::Layer ) + - sizeof( Internal::SceneGraph::Layer ) + - sizeof( Internal::SceneGraph::NodeAttachment ) ); + sizeof( Internal::SceneGraph::Layer ) ); const int IMAGE_MEMORY_SIZE( sizeof( Internal::Image ) + sizeof( Internal::ImageFactoryCache::Request ) + diff --git a/dali/internal/event/actors/camera-actor-impl.cpp b/dali/internal/event/actors/camera-actor-impl.cpp index 28d809b3a..032855ccb 100644 --- a/dali/internal/event/actors/camera-actor-impl.cpp +++ b/dali/internal/event/actors/camera-actor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace Dali { @@ -147,8 +147,8 @@ CameraActorPtr CameraActor::New( const Size& size ) actor->SetName("DefaultCamera"); // Create scene-object and transfer ownership through message - SceneGraph::CameraAttachment* sceneObject = SceneGraph::CameraAttachment::New(); - AttachToNodeMessage( actor->GetEventThreadServices().GetUpdateManager(), *actor->mNode, sceneObject ); + SceneGraph::Camera* sceneObject = SceneGraph::Camera::New(); + AddCameraMessage( actor->GetEventThreadServices().GetUpdateManager(), sceneObject ); // Keep raw pointer for message passing actor->mSceneObject = sceneObject; @@ -165,23 +165,28 @@ CameraActorPtr CameraActor::New( const Size& size ) CameraActor::CameraActor() : Actor( Actor::BASIC ), mSceneObject( NULL ), - mTarget( SceneGraph::CameraAttachment::DEFAULT_TARGET_POSITION ), - mType( SceneGraph::CameraAttachment::DEFAULT_TYPE ), - mProjectionMode( SceneGraph::CameraAttachment::DEFAULT_MODE ), - mFieldOfView( SceneGraph::CameraAttachment::DEFAULT_FIELD_OF_VIEW ), - mAspectRatio( SceneGraph::CameraAttachment::DEFAULT_ASPECT_RATIO ), - mNearClippingPlane( SceneGraph::CameraAttachment::DEFAULT_NEAR_CLIPPING_PLANE ), - mFarClippingPlane( SceneGraph::CameraAttachment::DEFAULT_FAR_CLIPPING_PLANE ), - mLeftClippingPlane( SceneGraph::CameraAttachment::DEFAULT_LEFT_CLIPPING_PLANE ), - mRightClippingPlane( SceneGraph::CameraAttachment::DEFAULT_RIGHT_CLIPPING_PLANE ), - mTopClippingPlane( SceneGraph::CameraAttachment::DEFAULT_TOP_CLIPPING_PLANE ), - mBottomClippingPlane( SceneGraph::CameraAttachment::DEFAULT_BOTTOM_CLIPPING_PLANE ), - mInvertYAxis( SceneGraph::CameraAttachment::DEFAULT_INVERT_Y_AXIS ) + mTarget( SceneGraph::Camera::DEFAULT_TARGET_POSITION ), + mType( SceneGraph::Camera::DEFAULT_TYPE ), + mProjectionMode( SceneGraph::Camera::DEFAULT_MODE ), + mFieldOfView( SceneGraph::Camera::DEFAULT_FIELD_OF_VIEW ), + mAspectRatio( SceneGraph::Camera::DEFAULT_ASPECT_RATIO ), + mNearClippingPlane( SceneGraph::Camera::DEFAULT_NEAR_CLIPPING_PLANE ), + mFarClippingPlane( SceneGraph::Camera::DEFAULT_FAR_CLIPPING_PLANE ), + mLeftClippingPlane( SceneGraph::Camera::DEFAULT_LEFT_CLIPPING_PLANE ), + mRightClippingPlane( SceneGraph::Camera::DEFAULT_RIGHT_CLIPPING_PLANE ), + mTopClippingPlane( SceneGraph::Camera::DEFAULT_TOP_CLIPPING_PLANE ), + mBottomClippingPlane( SceneGraph::Camera::DEFAULT_BOTTOM_CLIPPING_PLANE ), + mInvertYAxis( SceneGraph::Camera::DEFAULT_INVERT_Y_AXIS ) { } CameraActor::~CameraActor() { + if( EventThreadServices::IsCoreRunning() ) + { + // Create scene-object and transfer ownership through message + RemoveCameraMessage( GetEventThreadServices().GetUpdateManager(), mSceneObject ); + } } void CameraActor::SetTarget( const Vector3& target ) @@ -493,6 +498,10 @@ const Matrix& CameraActor::GetProjectionMatrix() const return Matrix::IDENTITY; } } +const SceneGraph::Camera* CameraActor::GetCamera() const +{ + return mSceneObject; +} unsigned int CameraActor::GetDefaultPropertyCount() const { diff --git a/dali/internal/event/actors/camera-actor-impl.h b/dali/internal/event/actors/camera-actor-impl.h index 5ffa23073..056945dfe 100644 --- a/dali/internal/event/actors/camera-actor-impl.h +++ b/dali/internal/event/actors/camera-actor-impl.h @@ -31,11 +31,11 @@ namespace Internal namespace SceneGraph { -class CameraAttachment; +class Camera; } /** - * An actor with CameraAttachment. + * An actor with Camera. */ class CameraActor : public Actor { @@ -190,6 +190,12 @@ public: */ const Matrix& GetProjectionMatrix() const; + /** + * Return the scene graph camera (for RenderTask) + * @return The scene graph camera. + */ + const SceneGraph::Camera* GetCamera() const; + public: // properties /** @@ -266,7 +272,7 @@ private: private: // Data - const SceneGraph::CameraAttachment* mSceneObject; ///< Not owned + const SceneGraph::Camera* mSceneObject; ///< Not owned Vector3 mTarget; Dali::Camera::Type mType; diff --git a/dali/internal/event/render-tasks/render-task-impl.cpp b/dali/internal/event/render-tasks/render-task-impl.cpp index 196719f77..4c3ba9b4e 100644 --- a/dali/internal/event/render-tasks/render-task-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -130,6 +130,14 @@ bool RenderTask::GetInputEnabled() const void RenderTask::SetCameraActor( CameraActor* cameraActor ) { + if( cameraActor ) + { + mCameraConnector.mCamera = cameraActor->GetCamera(); + } + else + { + mCameraConnector.mCamera = NULL; + } mCameraConnector.SetActor( cameraActor ); } @@ -806,7 +814,8 @@ RenderTask::~RenderTask() RenderTask::Connector::Connector( Type type, RenderTask& renderTask ) : mType( type ), mRenderTask( renderTask ), - mActor( NULL ) + mActor( NULL ), + mCamera( NULL ) { } @@ -857,6 +866,7 @@ void RenderTask::Connector::ObjectDestroyed( Object& object ) } mActor = NULL; + mCamera = NULL; // only meaningful for the camera connector but no simple way to distinguish UpdateRenderTask(); } @@ -887,7 +897,7 @@ void RenderTask::Connector::UpdateRenderTask() } else if( CAMERA_CONNECTOR == mType ) { - SetCameraNodeMessage( mRenderTask.GetEventThreadServices(), *(mRenderTask.mSceneObject), node ); + SetCameraMessage( mRenderTask.GetEventThreadServices(), *(mRenderTask.mSceneObject), node, mCamera ); } } } diff --git a/dali/internal/event/render-tasks/render-task-impl.h b/dali/internal/event/render-tasks/render-task-impl.h index 4c434a273..20204f346 100644 --- a/dali/internal/event/render-tasks/render-task-impl.h +++ b/dali/internal/event/render-tasks/render-task-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_RENDER_TASK_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -37,6 +37,7 @@ class EventThreadServices; namespace SceneGraph { class RenderTask; +class Camera; } class RenderTask : public Object @@ -432,6 +433,7 @@ protected: RenderTask& mRenderTask; Actor* mActor; ///< Raw-pointer to the actor; not owned. + const SceneGraph::Camera* mCamera; ///< Raw-pointer to camera scene-graph object; not owned. }; private: @@ -440,7 +442,7 @@ private: Connector mSourceConnector; ///< Responsible for connecting/disconnecting source Nodes Connector mCameraConnector; ///< Responsible for connecting/disconnecting camera Nodes - Connector mMappingConnector; /// Responsible for connecting/disconnection actor node, which used to mapping screen to frame buffer coordinate + Connector mMappingConnector; /// Responsible for connecting/disconnecting actor node, which used to mapping screen to frame buffer coordinate Vector4 mClearColor; ///< Optional clear color diff --git a/dali/internal/file.list b/dali/internal/file.list index 611fb10d9..7774efb9b 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -146,8 +146,7 @@ internal_src_files = \ $(internal_src_dir)/update/manager/update-algorithms.cpp \ $(internal_src_dir)/update/manager/update-manager.cpp \ $(internal_src_dir)/update/manager/update-manager-debug.cpp \ - $(internal_src_dir)/update/node-attachments/node-attachment.cpp \ - $(internal_src_dir)/update/node-attachments/scene-graph-camera-attachment.cpp \ + $(internal_src_dir)/update/render-tasks/scene-graph-camera.cpp \ $(internal_src_dir)/update/nodes/node.cpp \ $(internal_src_dir)/update/nodes/node-messages.cpp \ $(internal_src_dir)/update/nodes/scene-graph-layer.cpp \ diff --git a/dali/internal/render/common/render-instruction.cpp b/dali/internal/render/common/render-instruction.cpp index e8da77384..d3419089f 100644 --- a/dali/internal/render/common/render-instruction.cpp +++ b/dali/internal/render/common/render-instruction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -38,7 +38,7 @@ RenderInstruction::RenderInstruction() mIsViewportSet( false ), mIsClearColorSet( false ), mOffscreenTextureId( 0 ), - mCameraAttachment( 0 ), + mCamera( 0 ), mNextFreeRenderList( 0 ) { // reserve 6 lists, which is enough for three layers with opaque and transparent things on @@ -104,12 +104,12 @@ const RenderList* RenderInstruction::GetRenderList( RenderListContainer::SizeTyp return mRenderLists[ index ]; } -void RenderInstruction::Reset( CameraAttachment* cameraAttachment, - unsigned int offscreenTextureId, - const Viewport* viewport, - const Vector4* clearColor ) +void RenderInstruction::Reset( Camera* camera, + unsigned int offscreenTextureId, + const Viewport* viewport, + const Vector4* clearColor ) { - mCameraAttachment = cameraAttachment; + mCamera = camera; mViewport = viewport ? *viewport : Viewport(); mIsViewportSet = NULL != viewport; mClearColor = clearColor ? *clearColor : Color::BLACK; diff --git a/dali/internal/render/common/render-instruction.h b/dali/internal/render/common/render-instruction.h index a98fd537b..70bba45a6 100644 --- a/dali/internal/render/common/render-instruction.h +++ b/dali/internal/render/common/render-instruction.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -21,7 +21,7 @@ // INTERNAL INCLUDES #include #include -#include +#include #include namespace Dali @@ -37,7 +37,6 @@ class RenderTracker; namespace SceneGraph { -class CameraAttachment; /** * A set of rendering instructions consisting of: @@ -92,12 +91,12 @@ public: * render-lists are cleared but not released, while matrices and other settings reset in * preparation for building a set of instructions for the renderer. * - * @param[in] cameraAttachment to use to get view and projection matrices. + * @param[in] camera to use to get view and projection matrices. * @param[in] offscreenId A resource Id of an off-screen render target, or 0 * @param[in] viewport A pointer to a viewport, of NULL. * @param[in] clearColor A pointer to a color to clear with, or NULL if no clear is required. */ - void Reset( CameraAttachment* cameraAttachment, + void Reset( Camera* camera, unsigned int offscreenId, const Viewport* viewport, const Vector4* clearColor ); @@ -110,7 +109,7 @@ public: const Matrix* GetViewMatrix( BufferIndex index ) const { // inlined as this is called once per frame per render instruction - return &mCameraAttachment->GetViewMatrix( index ); + return &mCamera->GetViewMatrix( index ); } /** @@ -121,7 +120,7 @@ public: const Matrix* GetProjectionMatrix( BufferIndex index ) const { // inlined as this is called once per frame per render instruction - return &mCameraAttachment->GetProjectionMatrix( index ); + return &mCamera->GetProjectionMatrix( index ); } private: @@ -144,7 +143,7 @@ public: // Data private: // Data - CameraAttachment* mCameraAttachment; ///< camera that is used + Camera* mCamera; ///< camera that is used RenderListContainer mRenderLists; ///< container of all render lists RenderListContainer::SizeType mNextFreeRenderList; ///< index for the next free render list diff --git a/dali/internal/update/common/discard-queue.cpp b/dali/internal/update/common/discard-queue.cpp index 8a2e7e8f3..e0114b4be 100644 --- a/dali/internal/update/common/discard-queue.cpp +++ b/dali/internal/update/common/discard-queue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -25,6 +25,7 @@ #include #include #include +#include namespace Dali { @@ -61,6 +62,25 @@ void DiscardQueue::Add( BufferIndex updateBufferIndex, Node* node ) } } +void DiscardQueue::Add( BufferIndex updateBufferIndex, Shader* shader ) +{ + DALI_ASSERT_DEBUG( NULL != shader ); + + // Programs are cached for the lifetime of DALi so no need for GL cleanup for shader for now. + + // The GL resources will now be freed in frame N + // The Update for frame N+1 may occur in parallel with the rendering of frame N + // Queue the node for destruction in frame N+2 + if ( 0u == updateBufferIndex ) + { + mShaderQueue0.PushBack( shader ); + } + else + { + mShaderQueue1.PushBack( shader ); + } +} + void DiscardQueue::Add( BufferIndex updateBufferIndex, Renderer* renderer ) { DALI_ASSERT_DEBUG( NULL != renderer ); @@ -78,22 +98,17 @@ void DiscardQueue::Add( BufferIndex updateBufferIndex, Renderer* renderer ) } } -void DiscardQueue::Add( BufferIndex updateBufferIndex, Shader* shader ) +void DiscardQueue::Add( BufferIndex updateBufferIndex, Camera* camera ) { - DALI_ASSERT_DEBUG( NULL != shader ); + DALI_ASSERT_DEBUG( NULL != camera ); - // Programs are cached for the lifetime of DALi so no need for GL cleanup for shader for now. - - // The GL resources will now be freed in frame N - // The Update for frame N+1 may occur in parallel with the rendering of frame N - // Queue the node for destruction in frame N+2 if ( 0u == updateBufferIndex ) { - mShaderQueue0.PushBack( shader ); + mCameraQueue0.PushBack( camera ); } else { - mShaderQueue1.PushBack( shader ); + mCameraQueue1.PushBack( camera ); } } @@ -106,12 +121,14 @@ void DiscardQueue::Clear( BufferIndex updateBufferIndex ) mNodeQueue0.Clear(); mShaderQueue0.Clear(); mRendererQueue0.Clear(); + mCameraQueue0.Clear(); } else { mNodeQueue1.Clear(); mShaderQueue1.Clear(); mRendererQueue1.Clear(); + mCameraQueue1.Clear(); } } diff --git a/dali/internal/update/common/discard-queue.h b/dali/internal/update/common/discard-queue.h index 10d1824f2..a8a35ef67 100644 --- a/dali/internal/update/common/discard-queue.h +++ b/dali/internal/update/common/discard-queue.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_DISCARD_QUEUE_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -32,14 +32,12 @@ namespace Dali namespace Internal { -class Texture; - namespace SceneGraph { -class Node; class RenderQueue; class Shader; +class Camera; /** @@ -55,6 +53,7 @@ public: typedef OwnerContainer< Shader* > ShaderQueue; typedef OwnerContainer< Renderer* > RendererQueue; + typedef OwnerContainer< Camera* > CameraQueue; /** * Create a new DiscardQueue. @@ -93,6 +92,14 @@ public: */ void Add( BufferIndex updateBufferIndex, Renderer* renderer ); + /** + * Adds an unwanted Camera to the discard queue. + * This is done because Render thread may use Matrices from the camera + * @param[in] updateBufferIndex The current update buffer index. + * @param[in] camera The discarded renderer; DiscardQueue takes ownership. + */ + void Add( BufferIndex updateBufferIndex, Camera* camera ); + /** * Release the nodes which were queued in the frame N-2. * @pre This method should be called (once) at the beginning of every Update. @@ -116,11 +123,13 @@ private: NodeOwnerContainer mNodeQueue0; ShaderQueue mShaderQueue0; RendererQueue mRendererQueue0; + CameraQueue mCameraQueue0; // Messages are queued here when the update buffer index == 1 NodeOwnerContainer mNodeQueue1; ShaderQueue mShaderQueue1; RendererQueue mRendererQueue1; + CameraQueue mCameraQueue1; }; } // namespace SceneGraph diff --git a/dali/internal/update/controllers/scene-controller-impl.cpp b/dali/internal/update/controllers/scene-controller-impl.cpp index b89902565..718f96664 100644 --- a/dali/internal/update/controllers/scene-controller-impl.cpp +++ b/dali/internal/update/controllers/scene-controller-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -31,12 +31,10 @@ namespace SceneGraph SceneControllerImpl::SceneControllerImpl( RenderMessageDispatcher& renderMessageDispatcher, RenderQueue& renderQueue, - DiscardQueue& discardQueue, - TextureCache& textureCache ) + DiscardQueue& discardQueue ) : mRenderMessageDispatcher( renderMessageDispatcher ), mRenderQueue( renderQueue ), - mDiscardQueue( discardQueue ), - mTextureCache( textureCache ) + mDiscardQueue( discardQueue ) { } diff --git a/dali/internal/update/controllers/scene-controller-impl.h b/dali/internal/update/controllers/scene-controller-impl.h index 2707839c7..117dbf635 100644 --- a/dali/internal/update/controllers/scene-controller-impl.h +++ b/dali/internal/update/controllers/scene-controller-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_SCENE_CONTROLLER_IMPL_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -43,12 +43,10 @@ public: * @param[in] rendererDispatcher Used for passing ownership of renderers to the render-thread. * @param[in] renderQueue The renderQueue * @param[in] discardQueue The discardQueue - * @param[in] textureCache */ SceneControllerImpl( RenderMessageDispatcher& renderMessageDispatcher, RenderQueue& renderQueue, - DiscardQueue& discardQueue, - TextureCache& textureCache ); + DiscardQueue& discardQueue ); /** * Destructor @@ -72,11 +70,6 @@ public: // from SceneController */ virtual DiscardQueue& GetDiscardQueue() { return mDiscardQueue; } - /** - * @copydoc SceneController::GetTextureCache() - */ - virtual TextureCache& GetTextureCache() { return mTextureCache; } - private: // Undefined copy constructor. @@ -90,7 +83,6 @@ private: RenderMessageDispatcher& mRenderMessageDispatcher; ///< Used for passing messages to the render-thread RenderQueue& mRenderQueue; ///< render queue DiscardQueue& mDiscardQueue; ///< discard queue - TextureCache& mTextureCache; ///< texture cache }; diff --git a/dali/internal/update/controllers/scene-controller.h b/dali/internal/update/controllers/scene-controller.h index fbefd0f84..f81062266 100644 --- a/dali/internal/update/controllers/scene-controller.h +++ b/dali/internal/update/controllers/scene-controller.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_SCENE_CONTROLLER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -27,11 +27,9 @@ namespace Internal namespace SceneGraph { -class CameraController; class RenderMessageDispatcher; class RenderQueue; class DiscardQueue; -class TextureCache; /** * Abstract interface for the scene controller @@ -72,15 +70,6 @@ public: */ virtual DiscardQueue& GetDiscardQueue() = 0; - /** - * Return the texture cache - * TODO: Remove this method when renderer's & shader's second stage initialization - * is done by RenderManager rather than by the attachments in the Update thread. - * DO NOT USE THIS IN THE UPDATE THREAD! - * @return A reference to the texture cache - */ - virtual TextureCache& GetTextureCache() = 0; - private: // Undefined copy constructor. diff --git a/dali/internal/update/manager/prepare-render-instructions.cpp b/dali/internal/update/manager/prepare-render-instructions.cpp index 2b393e06a..0f703a530 100644 --- a/dali/internal/update/manager/prepare-render-instructions.cpp +++ b/dali/internal/update/manager/prepare-render-instructions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -57,7 +57,7 @@ namespace SceneGraph * @param renderList to add the item to * @param renderable Node-Renderer pair * @param viewMatrix used to calculate modelview matrix for the item - * @param cameraAttachment The camera used to render + * @param camera The camera used to render * @param isLayer3d Whether we are processing a 3D layer or not * @param cull Whether frustum culling is enabled or not */ @@ -65,7 +65,7 @@ inline void AddRendererToRenderList( BufferIndex updateBufferIndex, RenderList& renderList, Renderable& renderable, const Matrix& viewMatrix, - SceneGraph::CameraAttachment& cameraAttachment, + SceneGraph::Camera& camera, bool isLayer3d, bool cull ) { @@ -74,7 +74,7 @@ inline void AddRendererToRenderList( BufferIndex updateBufferIndex, { const Vector4& boundingSphere = renderable.mNode->GetBoundingSphere(); inside = (boundingSphere.w > Math::MACHINE_EPSILON_1000) && - (cameraAttachment.CheckSphereInFrustum( updateBufferIndex, Vector3(boundingSphere), boundingSphere.w ) ); + (camera.CheckSphereInFrustum( updateBufferIndex, Vector3(boundingSphere), boundingSphere.w ) ); } if ( inside ) @@ -107,27 +107,27 @@ inline void AddRendererToRenderList( BufferIndex updateBufferIndex, * Add all renderers to the list * @param updateBufferIndex to read the model matrix from * @param renderList to add the items to - * @param renderable attachments + * @param renderers to render * NodeRendererContainer Node-Renderer pairs * @param viewMatrix used to calculate modelview matrix for the items - * @param cameraAttachment The camera used to render + * @param camera The camera used to render * @param isLayer3d Whether we are processing a 3D layer or not * @param cull Whether frustum culling is enabled or not */ inline void AddRenderersToRenderList( BufferIndex updateBufferIndex, RenderList& renderList, - RenderableContainer& renderables, + RenderableContainer& renderers, const Matrix& viewMatrix, - SceneGraph::CameraAttachment& cameraAttachment, + SceneGraph::Camera& camera, bool isLayer3d, bool cull) { DALI_LOG_INFO( gRenderListLogFilter, Debug::Verbose, "AddRenderersToRenderList()\n"); - unsigned int rendererCount( renderables.Size() ); + unsigned int rendererCount( renderers.Size() ); for( unsigned int i(0); i #include #include -#include #include #include #include @@ -104,13 +103,13 @@ inline void UpdateNodeOpacity( Node& node, int nodeDirtyFlags, BufferIndex updat /** * This is called recursively for all children of the root Node */ -inline int UpdateNodesAndAttachments( Node& node, - int parentFlags, - BufferIndex updateBufferIndex, - ResourceManager& resourceManager, - RenderQueue& renderQueue, - Layer& currentLayer, - int inheritedDrawMode ) +inline int UpdateNodes( Node& node, + int parentFlags, + BufferIndex updateBufferIndex, + ResourceManager& resourceManager, + RenderQueue& renderQueue, + Layer& currentLayer, + int inheritedDrawMode ) { //Apply constraints to the node ConstrainPropertyOwner( node, updateBufferIndex ); @@ -169,13 +168,13 @@ inline int UpdateNodesAndAttachments( Node& node, for ( NodeIter iter = children.Begin(); iter != endIter; ++iter ) { Node& child = **iter; - cumulativeDirtyFlags |=UpdateNodesAndAttachments( child, - nodeDirtyFlags, - updateBufferIndex, - resourceManager, - renderQueue, - *layer, - inheritedDrawMode ); + cumulativeDirtyFlags |=UpdateNodes( child, + nodeDirtyFlags, + updateBufferIndex, + resourceManager, + renderQueue, + *layer, + inheritedDrawMode ); } return cumulativeDirtyFlags; @@ -184,10 +183,10 @@ inline int UpdateNodesAndAttachments( Node& node, /** * The root node is treated separately; it cannot inherit values since it has no parent */ -int UpdateNodesAndAttachments( Layer& rootNode, - BufferIndex updateBufferIndex, - ResourceManager& resourceManager, - RenderQueue& renderQueue ) +int UpdateNodeTree( Layer& rootNode, + BufferIndex updateBufferIndex, + ResourceManager& resourceManager, + RenderQueue& renderQueue ) { DALI_ASSERT_DEBUG( rootNode.IsRoot() ); @@ -219,13 +218,13 @@ int UpdateNodesAndAttachments( Layer& rootNode, for ( NodeIter iter = children.Begin(); iter != endIter; ++iter ) { Node& child = **iter; - cumulativeDirtyFlags |= UpdateNodesAndAttachments( child, - nodeDirtyFlags, - updateBufferIndex, - resourceManager, - renderQueue, - rootNode, - drawMode ); + cumulativeDirtyFlags |= UpdateNodes( child, + nodeDirtyFlags, + updateBufferIndex, + resourceManager, + renderQueue, + rootNode, + drawMode ); } return cumulativeDirtyFlags; diff --git a/dali/internal/update/manager/update-algorithms.h b/dali/internal/update/manager/update-algorithms.h index 48dc43a2d..731da13ae 100644 --- a/dali/internal/update/manager/update-algorithms.h +++ b/dali/internal/update/manager/update-algorithms.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_UPDATE_ALGORITHMS_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -45,20 +45,18 @@ class RenderQueue; void ConstrainPropertyOwner( PropertyOwner& propertyOwner, BufferIndex updateBufferIndex ); /** - * Update a tree of nodes, and attached objects. + * Update a tree of nodes * The inherited properties of each node are recalculated if necessary. - * When a renderable attachment is ready to render, PrepareResources() is called and - * it is added to the list for its Layer. * @param[in] rootNode The root of a tree of nodes. * @param[in] updateBufferIndex The current update buffer index. * @param[in] resourceManager The resource manager. * @param[in] renderQueue Used to query messages for the next Render. * @return The cumulative (ORed) dirty flags for the updated nodes */ -int UpdateNodesAndAttachments( Layer& rootNode, - BufferIndex updateBufferIndex, - ResourceManager& resourceManager, - RenderQueue& renderQueue ); +int UpdateNodeTree( Layer& rootNode, + BufferIndex updateBufferIndex, + ResourceManager& resourceManager, + RenderQueue& renderQueue ); } // namespace SceneGraph diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index bb3da5241..4b268c7c2 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -66,6 +65,7 @@ #include #include #include +#include // Un-comment to enable node tree debug logging //#define NODE_TREE_LOGGING 1 @@ -163,7 +163,7 @@ struct UpdateManager::Impl renderSortingHelper(), renderTaskWaiting( false ) { - sceneController = new SceneControllerImpl( renderMessageDispatcher, renderQueue, discardQueue, textureCache ); + sceneController = new SceneControllerImpl( renderMessageDispatcher, renderQueue, discardQueue ); renderers.SetSceneController( *sceneController ); @@ -212,7 +212,6 @@ struct UpdateManager::Impl systemLevelRoot = NULL; } - sceneController->GetTextureCache().SetBufferIndices(NULL); // TODO - Remove delete sceneController; } @@ -245,6 +244,7 @@ struct UpdateManager::Impl SortedLayerPointers sortedLayers; ///< A container of Layer pointers sorted by depth SortedLayerPointers systemLevelSortedLayers; ///< A separate container of system-level Layers + OwnerContainer< Camera* > cameras; ///< A container of cameras OwnerContainer< PropertyOwner* > customObjects; ///< A container of owned objects (with custom properties) AnimationContainer animations; ///< A container of owned animations @@ -384,14 +384,30 @@ void UpdateManager::DestroyNode( Node* node ) node->OnDestroy(); } -//@todo MESH_REWORK Extend to allow arbitrary scene objects to connect to each other -void UpdateManager::AttachToNode( Node* node, NodeAttachment* attachment ) +void UpdateManager::AddCamera( Camera* camera ) { - DALI_ASSERT_DEBUG( node != NULL ); - DALI_ASSERT_DEBUG( attachment != NULL ); + DALI_ASSERT_DEBUG( camera != NULL ); + + mImpl->cameras.PushBack( camera ); // takes ownership +} + +void UpdateManager::RemoveCamera( const Camera* camera ) +{ + // Find the camera + OwnerContainer::Iterator iter = mImpl->cameras.Begin(); + OwnerContainer::ConstIterator end = mImpl->cameras.End(); + for ( ; iter != end; ++iter ) + { + Camera* value = *iter; + if ( camera == value ) + { + // Transfer ownership to the discard queue + mImpl->discardQueue.Add( mSceneGraphBuffers.GetUpdateBufferIndex(), mImpl->cameras.Release( iter ) ); + + return; + } + } - // attach node to attachment first so that parent is known by the time attachment is connected - node->Attach( *attachment ); // node takes ownership } void UpdateManager::AddObject( PropertyOwner* object ) @@ -873,19 +889,19 @@ void UpdateManager::UpdateNodes( BufferIndex bufferIndex ) return; } - // Prepare resources, update shaders, update attachments, for each node + // Prepare resources, update shaders, for each node // And add the renderers to the sorted layers. Start from root, which is also a layer - mImpl->nodeDirtyFlags = UpdateNodesAndAttachments( *( mImpl->root ), - bufferIndex, - mImpl->resourceManager, - mImpl->renderQueue ); + mImpl->nodeDirtyFlags = UpdateNodeTree( *( mImpl->root ), + bufferIndex, + mImpl->resourceManager, + mImpl->renderQueue ); if ( mImpl->systemLevelRoot ) { - mImpl->nodeDirtyFlags |= UpdateNodesAndAttachments( *( mImpl->systemLevelRoot ), - bufferIndex, - mImpl->resourceManager, - mImpl->renderQueue ); + mImpl->nodeDirtyFlags |= UpdateNodeTree( *( mImpl->systemLevelRoot ), + bufferIndex, + mImpl->resourceManager, + mImpl->renderQueue ); } } @@ -945,7 +961,7 @@ unsigned int UpdateManager::Update( float elapsedSeconds, //Prepare texture sets and apply constraints to them PrepareTextureSets( bufferIndex ); - //Clear the lists of renderable-attachments from the previous update + //Clear the lists of renderers from the previous update for( size_t i(0); isortedLayers.size(); ++i ) { mImpl->sortedLayers[i]->ClearRenderables(); diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index 8ccae9599..49a8e1d46 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -78,10 +77,11 @@ class RenderQueue; class TextureCache; class PropertyBuffer; class TextureSet; +class Camera; /** - * UpdateManager maintains a scene graph i.e. a tree of nodes and attachments and - * other property owner objects. + * UpdateManager maintains a scene graph i.e. a tree of nodes as well as + * other scene graph property owning objects. * It controls the Update traversal, in which nodes are repositioned/animated, * and organizes the the culling and rendering of the scene. * It also maintains the lifecycle of nodes and other property owners that are @@ -173,12 +173,16 @@ public: void DestroyNode( Node* node ); /** - * Attach an object to a Node. - * The UpdateManager is responsible for calling NodeAttachment::Initialize(). - * @param[in] node The node which will own the attachment. - * @param[in] attachment The object to attach. + * Add a camera on scene + * @param[in] camera to add */ - void AttachToNode( Node* node, NodeAttachment* attachment ); + void AddCamera( Camera* camera ); + + /** + * Remove a camera from scene + * @param[in] camera to remove + */ + void RemoveCamera( const Camera* camera ); /** * Add a newly created object. @@ -520,12 +524,6 @@ private: */ unsigned int KeepUpdatingCheck( float elapsedSeconds ) const; - /** - * Helper to calculate new camera setup when root node resizes. - * @param[in] updateBuffer The buffer to read the root node size from. - */ - void UpdateProjectionAndViewMatrices(int updateBuffer); - /** * Post process resources that have been updated by renderer */ @@ -587,13 +585,6 @@ private: */ void ForwardCompiledShadersToEventThread(); - /** - * Update the default camera. - * This must be altered to match the root Node for 2D layouting. - * @param[in] updateBuffer The buffer to read the root node size from. - */ - void UpdateDefaultCamera( int updateBuffer ); - /** * Update node shaders, opacity, geometry etc. * @param[in] bufferIndex to use @@ -683,18 +674,27 @@ inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode ) new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node ); } -inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment ) +inline void AddCameraMessage( UpdateManager& manager, const Camera* constCamera ) { - // Scene graph thread can modify this object. - Node& parent = const_cast< Node& >( constParent ); + typedef MessageValue1< UpdateManager, Camera* > LocalType; + + Camera* camera = const_cast( constCamera ); + // Reserve some memory inside the message queue + unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); - typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType; + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::AddCamera, camera ); +} + +inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera ) +{ + typedef MessageValue1< UpdateManager, const Camera* > 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::AttachToNode, &parent, attachment ); + new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera ); } inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object ) diff --git a/dali/internal/update/node-attachments/node-attachment-declarations.h b/dali/internal/update/node-attachments/node-attachment-declarations.h deleted file mode 100644 index bb4a5249b..000000000 --- a/dali/internal/update/node-attachments/node-attachment-declarations.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_NODE_ATTACHMENT_DECLARATIONS_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_NODE_ATTACHMENT_DECLARATIONS_H__ - -/* - * Copyright (c) 2014 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. - * - */ - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class NodeAttachment; -typedef OwnerPointer NodeAttachmentOwner; - -typedef OwnerContainer< NodeAttachment* > NodeAttachmentOwnerContainer; -typedef NodeAttachmentOwnerContainer::Iterator NodeAttachmentIter; -typedef NodeAttachmentOwnerContainer::ConstIterator NodeAttachmentConstIter; - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_SCENE_GRAPH_NODE_ATTACHMENT_DECLARATIONS_H__ diff --git a/dali/internal/update/node-attachments/node-attachment.cpp b/dali/internal/update/node-attachments/node-attachment.cpp deleted file mode 100644 index 659d1095b..000000000 --- a/dali/internal/update/node-attachments/node-attachment.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2014 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 - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -NodeAttachment::NodeAttachment() -: mParent(NULL) -{ -} - -NodeAttachment::~NodeAttachment() -{ -} - -void NodeAttachment::SetParent( Node& parent ) -{ - DALI_ASSERT_DEBUG(mParent == NULL); - - mParent = &parent; -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/node-attachments/node-attachment.h b/dali/internal/update/node-attachments/node-attachment.h deleted file mode 100644 index ad151ae0e..000000000 --- a/dali/internal/update/node-attachments/node-attachment.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_NODE_ATTACHMENT_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_NODE_ATTACHMENT_H__ - -/* - * Copyright (c) 2014 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. - * - */ - -// EXTERNAL INCLUDES -#include // NULL - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class Node; -class SceneController; - -/** - * NodeAttachment is a base class for objects attached to Nodes in the scene graph. - * The position of the object is provided by its parent node. - * NodeAttachment data is double-buffered. This allows an update thread to modify node data, without interferring - * with another thread reading the values from the previous update traversal. - */ -class NodeAttachment -{ -public: - - /** - * Virtual destructor - */ - virtual ~NodeAttachment(); - - /** - * Second-phase construction. - * This is called by the UpdateManager when the attachment is attached to the scene-graph. - * @param[in] sceneController Allows attachments to get camera controllers. - * @param[in] updateBufferIndex The current update buffer index. - */ - virtual void Initialize( SceneController& sceneController, BufferIndex updateBufferIndex ) = 0; - - /** - * Called shortly before destruction. - * After this method has been called, the SceneController cannot be safely accessed. - */ - virtual void OnDestroy() = 0; - - /** - * Called when the parent node is connected to the SceneGraph - */ - virtual void ConnectedToSceneGraph() = 0; - - /** - * Called when the parent node is disconnected from the SceneGraph - */ - virtual void DisconnectedFromSceneGraph( ) = 0; - - /** - * Set the parent of a NodeAttachment. - * @param[in] parent the new parent. - */ - void SetParent( Node& parent ); - - /** - * Retrieve the parent node of a NodeAttachment. - * @return The parent node, or NULL if the NodeAttachment has not been added to the scene-graph. - */ - Node& GetParent() - { - DALI_ASSERT_DEBUG( mParent != NULL ); - return *mParent; - } - - /** - * Retrieve the parent node of a NodeAttachment. - * @return The parent node, or NULL if the NodeAttachment has not been added to the scene-graph. - */ - Node& GetParent() const - { - DALI_ASSERT_DEBUG( mParent != NULL ); - return *mParent; - } - -protected: - - /** - * Derived versions of NodeAttachment should be constructed. - */ - NodeAttachment(); - -private: - - // Undefined - NodeAttachment( const NodeAttachment& ); - - // Undefined - NodeAttachment& operator=( const NodeAttachment& rhs ); - -protected: - - Node* mParent; ///< Pointer to parent node which owns the attachment. -}; - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_SCENE_GRAPH_NODE_ATTACHMENT_H__ diff --git a/dali/internal/update/nodes/node.cpp b/dali/internal/update/nodes/node.cpp index e1d584702..b3a9767c7 100644 --- a/dali/internal/update/nodes/node.cpp +++ b/dali/internal/update/nodes/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -21,7 +21,6 @@ // INTERNAL INCLUDES #include #include -#include #include #include #include @@ -67,7 +66,6 @@ Node::Node() mWorldColor( Color::WHITE ), mParent( NULL ), mExclusiveRenderTask( NULL ), - mAttachment( NULL ), mChildren(), mRegenerateUniformMap( 0 ), mDepth(0u), @@ -95,12 +93,6 @@ void Node::operator delete( void* ptr ) void Node::OnDestroy() { - // Node attachments should be notified about the disconnection. - if ( mAttachment ) - { - mAttachment->OnDestroy(); - } - // Animators, Constraints etc. should be disconnected from the child's properties. PropertyOwner::Destroy(); } @@ -126,18 +118,6 @@ void Node::CreateTransform( SceneGraph::TransformManager* transformManager ) mWorldMatrix.Initialize( transformManager, mTransformId ); } -void Node::Attach( NodeAttachment& object ) -{ - DALI_ASSERT_DEBUG(!mAttachment); - - object.SetParent(*this); - - mAttachment = &object; - SetAllDirtyFlags(); - - mAttachment->ConnectedToSceneGraph(); -} - void Node::SetRoot(bool isRoot) { DALI_ASSERT_DEBUG(!isRoot || mParent == NULL); // Root nodes cannot have a parent @@ -205,12 +185,6 @@ void Node::ConnectChild( Node* childNode ) // Inform property observers of new connection childNode->ConnectToSceneGraph(); - - // Inform child node attachment that the node has been added to the stage - if( childNode->mAttachment ) - { - childNode->mAttachment->ConnectedToSceneGraph(); - } } void Node::DisconnectChild( BufferIndex updateBufferIndex, Node& childNode ) @@ -314,12 +288,6 @@ void Node::RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex ) // Remove all child pointers mChildren.Clear(); - // Inform child node attachment that the node has been removed from the stage - if( mAttachment ) - { - mAttachment->DisconnectedFromSceneGraph(); - } - if( mTransformId != INVALID_TRANSFORM_ID ) { mTransformManager->SetParent( mTransformId, INVALID_TRANSFORM_ID ); diff --git a/dali/internal/update/nodes/node.h b/dali/internal/update/nodes/node.h index 9b239e0d3..e354b32f4 100644 --- a/dali/internal/update/nodes/node.h +++ b/dali/internal/update/nodes/node.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_NODE_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -37,7 +37,6 @@ #include #include #include -#include #include namespace Dali @@ -55,7 +54,6 @@ namespace SceneGraph class DiscardQueue; class Layer; -class NodeAttachment; class RenderTask; class UpdateManager; @@ -77,8 +75,7 @@ enum NodePropertyFlags static const int AllFlags = ( ChildDeletedFlag << 1 ) - 1; // all the flags /** - * Size is not inherited. - * VisibleFlag is inherited so that attachments can be synchronized with nodes after they become visible + * Size is not inherited. VisibleFlag is inherited */ static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag; @@ -144,24 +141,6 @@ public: return NULL; } - // Attachments - - /** - * Attach an object to this Node; This should only be done by UpdateManager::AttachToNode. - * @pre The Node does not already have an attachment. - * @param[in] attachment The object to attach. - */ - void Attach( NodeAttachment& attachment ); - - /** - * Query the node if it has an attachment. - * @return True if it has an attachment. - */ - bool HasAttachment() const - { - return mAttachment; - } - /** * Add a renderer to the node * @param[in] renderer The renderer added to the node @@ -212,15 +191,6 @@ public: return mRenderer.Size(); } - /** - * Retreive the object attached to this node. - * @return The attachment. - */ - NodeAttachment& GetAttachment() const - { - return *mAttachment; - } - // Containment methods /** @@ -838,7 +808,6 @@ protected: Node* mParent; ///< Pointer to parent node (a child is owned by its parent) RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask - NodeAttachmentOwner mAttachment; ///< Optional owned attachment RendererContainer mRenderer; ///< Container of renderers; not owned NodeContainer mChildren; ///< Container of children; not owned diff --git a/dali/internal/update/nodes/scene-graph-layer.h b/dali/internal/update/nodes/scene-graph-layer.h index 4908b6150..89823a835 100644 --- a/dali/internal/update/nodes/scene-graph-layer.h +++ b/dali/internal/update/nodes/scene-graph-layer.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_LAYER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -37,6 +37,7 @@ template <> struct ParameterType< Dali::Layer::Behavior > namespace SceneGraph { +class Camera; /** * Pair of node-renderer @@ -61,9 +62,9 @@ typedef Dali::Vector< Renderable > RenderableContainer; /** * Layers have a "depth" relative to all other layers in the scene-graph. - * Non-layer child nodes (and their attachments) are considered part of the layer. + * Non-layer child nodes are considered part of the layer. * - * Layers are rendered separately, and the depth buffer is cleared before each layer is rendered. + * Layers are rendered separately, and by default the depth buffer is cleared before each layer is rendered. * Objects in higher layers, are rendered after (in front of) objects in lower layers. */ class Layer : public Node @@ -184,7 +185,7 @@ public: * to use is the same than the one used before ( Otherwise View transform will be different ) * */ - bool CanReuseRenderers(Node* camera) + bool CanReuseRenderers( Camera* camera ) { bool bReturn( mAllChildTransformsClean[ 0 ] && mAllChildTransformsClean[ 1 ] && camera == mLastCamera ); mLastCamera = camera; @@ -230,7 +231,7 @@ private: SortFunctionType mSortFunction; ///< Used to sort semi-transparent geometry ClippingBox mClippingBox; ///< The clipping box, in window coordinates - Node* mLastCamera; ///< Pointer to the last camera that has rendered the layer + Camera* mLastCamera; ///< Pointer to the last camera that has rendered the layer Dali::Layer::Behavior mBehavior; ///< The behavior of the layer diff --git a/dali/internal/update/node-attachments/scene-graph-camera-attachment.cpp b/dali/internal/update/render-tasks/scene-graph-camera.cpp similarity index 75% rename from dali/internal/update/node-attachments/scene-graph-camera-attachment.cpp rename to dali/internal/update/render-tasks/scene-graph-camera.cpp index 7078ddfbb..158ed37e8 100644 --- a/dali/internal/update/node-attachments/scene-graph-camera-attachment.cpp +++ b/dali/internal/update/render-tasks/scene-graph-camera.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -16,15 +16,16 @@ */ // CLASS HEADER -#include +#include -// INTERNAL HEADERS +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES #include -#include -#include -#include #include #include +#include namespace // unnamed namespace { @@ -135,24 +136,23 @@ void Orthographic(Matrix& result, float left, float right, float bottom, float t } // unnamed namespace -const Dali::Camera::Type CameraAttachment::DEFAULT_TYPE( Dali::Camera::FREE_LOOK ); -const Dali::Camera::ProjectionMode CameraAttachment::DEFAULT_MODE( Dali::Camera::PERSPECTIVE_PROJECTION ); -const bool CameraAttachment::DEFAULT_INVERT_Y_AXIS( false ); -const float CameraAttachment::DEFAULT_FIELD_OF_VIEW( 45.0f*(M_PI/180.0f) ); -const float CameraAttachment::DEFAULT_ASPECT_RATIO( 4.0f/3.0f ); -const float CameraAttachment::DEFAULT_LEFT_CLIPPING_PLANE(-240.0f); -const float CameraAttachment::DEFAULT_RIGHT_CLIPPING_PLANE(240.0f); -const float CameraAttachment::DEFAULT_TOP_CLIPPING_PLANE(-400.0f); -const float CameraAttachment::DEFAULT_BOTTOM_CLIPPING_PLANE(400.0f); -const float CameraAttachment::DEFAULT_NEAR_CLIPPING_PLANE( 800.0f ); // default height of the screen -const float CameraAttachment::DEFAULT_FAR_CLIPPING_PLANE( DEFAULT_NEAR_CLIPPING_PLANE + 2.f * DEFAULT_NEAR_CLIPPING_PLANE ); -const Vector2 CameraAttachment::DEFAULT_STEREO_BIAS( 0.0f, 0.0f ); -const Vector3 CameraAttachment::DEFAULT_TARGET_POSITION( 0.0f, 0.0f, 0.0f ); - - -CameraAttachment::CameraAttachment() -: NodeAttachment(), - mUpdateViewFlag( UPDATE_COUNT ), +const Dali::Camera::Type Camera::DEFAULT_TYPE( Dali::Camera::FREE_LOOK ); +const Dali::Camera::ProjectionMode Camera::DEFAULT_MODE( Dali::Camera::PERSPECTIVE_PROJECTION ); +const bool Camera::DEFAULT_INVERT_Y_AXIS( false ); +const float Camera::DEFAULT_FIELD_OF_VIEW( 45.0f*(M_PI/180.0f) ); +const float Camera::DEFAULT_ASPECT_RATIO( 4.0f/3.0f ); +const float Camera::DEFAULT_LEFT_CLIPPING_PLANE(-240.0f); +const float Camera::DEFAULT_RIGHT_CLIPPING_PLANE(240.0f); +const float Camera::DEFAULT_TOP_CLIPPING_PLANE(-400.0f); +const float Camera::DEFAULT_BOTTOM_CLIPPING_PLANE(400.0f); +const float Camera::DEFAULT_NEAR_CLIPPING_PLANE( 800.0f ); // default height of the screen +const float Camera::DEFAULT_FAR_CLIPPING_PLANE( DEFAULT_NEAR_CLIPPING_PLANE + 2.f * DEFAULT_NEAR_CLIPPING_PLANE ); +const Vector2 Camera::DEFAULT_STEREO_BIAS( 0.0f, 0.0f ); +const Vector3 Camera::DEFAULT_TARGET_POSITION( 0.0f, 0.0f, 0.0f ); + + +Camera::Camera() +: mUpdateViewFlag( UPDATE_COUNT ), mUpdateProjectionFlag( UPDATE_COUNT ), mType( DEFAULT_TYPE ), mProjectionMode( DEFAULT_MODE ), @@ -173,138 +173,118 @@ CameraAttachment::CameraAttachment() { } -CameraAttachment* CameraAttachment::New() -{ - return new CameraAttachment(); -} - -void CameraAttachment::Initialize( SceneController& sceneController, BufferIndex updateBufferIndex ) -{ - // do nothing -} - -void CameraAttachment::OnDestroy() +Camera* Camera::New() { - // do nothing + return new Camera(); } -void CameraAttachment::ConnectedToSceneGraph() +Camera::~Camera() { - // do nothing } -void CameraAttachment::DisconnectedFromSceneGraph() -{ - // do nothing -} - -CameraAttachment::~CameraAttachment() -{ -} - -void CameraAttachment::SetType( Dali::Camera::Type type ) +void Camera::SetType( Dali::Camera::Type type ) { mType = type; } -void CameraAttachment::SetProjectionMode( Dali::Camera::ProjectionMode mode ) +void Camera::SetProjectionMode( Dali::Camera::ProjectionMode mode ) { mProjectionMode = mode; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetInvertYAxis( bool invertYAxis ) +void Camera::SetInvertYAxis( bool invertYAxis ) { mInvertYAxis = invertYAxis; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetFieldOfView( float fieldOfView ) +void Camera::SetFieldOfView( float fieldOfView ) { mFieldOfView = fieldOfView; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetAspectRatio( float aspectRatio ) +void Camera::SetAspectRatio( float aspectRatio ) { mAspectRatio = aspectRatio; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetStereoBias( const Vector2& stereoBias ) +void Camera::SetStereoBias( const Vector2& stereoBias ) { mStereoBias = stereoBias; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetLeftClippingPlane( float leftClippingPlane ) +void Camera::SetLeftClippingPlane( float leftClippingPlane ) { mLeftClippingPlane = leftClippingPlane; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetRightClippingPlane( float rightClippingPlane ) +void Camera::SetRightClippingPlane( float rightClippingPlane ) { mRightClippingPlane = rightClippingPlane; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetTopClippingPlane( float topClippingPlane ) +void Camera::SetTopClippingPlane( float topClippingPlane ) { mTopClippingPlane = topClippingPlane; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetBottomClippingPlane( float bottomClippingPlane ) +void Camera::SetBottomClippingPlane( float bottomClippingPlane ) { mBottomClippingPlane = bottomClippingPlane; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetNearClippingPlane( float nearClippingPlane ) +void Camera::SetNearClippingPlane( float nearClippingPlane ) { mNearClippingPlane = nearClippingPlane; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetFarClippingPlane( float farClippingPlane ) +void Camera::SetFarClippingPlane( float farClippingPlane ) { mFarClippingPlane = farClippingPlane; mUpdateProjectionFlag = UPDATE_COUNT; } -void CameraAttachment::SetTargetPosition( const Vector3& targetPosition ) +void Camera::SetTargetPosition( const Vector3& targetPosition ) { mTargetPosition = targetPosition; mUpdateViewFlag = UPDATE_COUNT; } -const Matrix& CameraAttachment::GetProjectionMatrix( BufferIndex bufferIndex ) const +const Matrix& Camera::GetProjectionMatrix( BufferIndex bufferIndex ) const { return mProjectionMatrix[ bufferIndex ]; } -const Matrix& CameraAttachment::GetViewMatrix( BufferIndex bufferIndex ) const +const Matrix& Camera::GetViewMatrix( BufferIndex bufferIndex ) const { return mViewMatrix[ bufferIndex ]; } -const Matrix& CameraAttachment::GetInverseViewProjectionMatrix( BufferIndex bufferIndex ) const +const Matrix& Camera::GetInverseViewProjectionMatrix( BufferIndex bufferIndex ) const { return mInverseViewProjection[ bufferIndex ]; } -const PropertyInputImpl* CameraAttachment::GetProjectionMatrix() const +const PropertyInputImpl* Camera::GetProjectionMatrix() const { return &mProjectionMatrix; } -const PropertyInputImpl* CameraAttachment::GetViewMatrix() const +const PropertyInputImpl* Camera::GetViewMatrix() const { return &mViewMatrix; } -void CameraAttachment::Update( BufferIndex updateBufferIndex, const Node& owningNode ) +void Camera::Update( BufferIndex updateBufferIndex, const Node& owningNode ) { // if owning node has changes in world position we need to update camera for next 2 frames if( owningNode.IsLocalMatrixDirty() ) @@ -343,12 +323,12 @@ void CameraAttachment::Update( BufferIndex updateBufferIndex, const Node& owning } } -bool CameraAttachment::ViewMatrixUpdated() +bool Camera::ViewMatrixUpdated() { return 0u != mUpdateViewFlag; } -unsigned int CameraAttachment::UpdateViewMatrix( BufferIndex updateBufferIndex, const Node& owningNode ) +unsigned int Camera::UpdateViewMatrix( BufferIndex updateBufferIndex, const Node& owningNode ) { unsigned int retval( mUpdateViewFlag ); if( 0u != mUpdateViewFlag ) @@ -364,23 +344,22 @@ unsigned int CameraAttachment::UpdateViewMatrix( BufferIndex updateBufferIndex, { // camera orientation taken from node - i.e. look in abitrary, unconstrained direction case Dali::Camera::FREE_LOOK: - { + { Matrix& viewMatrix = mViewMatrix.Get( updateBufferIndex ); - viewMatrix = owningNode.GetWorldMatrix(updateBufferIndex); + viewMatrix = owningNode.GetWorldMatrix( updateBufferIndex ); viewMatrix.Invert(); mViewMatrix.SetDirty( updateBufferIndex ); break; } // camera orientation constrained to look at a target case Dali::Camera::LOOK_AT_TARGET: - { - const Matrix& owningNodeMatrix( owningNode.GetWorldMatrix(updateBufferIndex) ); + { + const Matrix& owningNodeMatrix( owningNode.GetWorldMatrix( updateBufferIndex ) ); Vector3 position, scale; Quaternion orientation; owningNodeMatrix.GetTransformComponents( position, orientation, scale ); Matrix& viewMatrix = mViewMatrix.Get( updateBufferIndex ); - LookAt( viewMatrix, position, mTargetPosition, - orientation.Rotate( Vector3::YAXIS ) ); + LookAt( viewMatrix, position, mTargetPosition, orientation.Rotate( Vector3::YAXIS ) ); mViewMatrix.SetDirty( updateBufferIndex ); break; } @@ -391,7 +370,7 @@ unsigned int CameraAttachment::UpdateViewMatrix( BufferIndex updateBufferIndex, return retval; } -void CameraAttachment::UpdateFrustum( BufferIndex updateBufferIndex, bool normalize ) +void Camera::UpdateFrustum( BufferIndex updateBufferIndex, bool normalize ) { // Extract the clip matrix planes @@ -460,7 +439,7 @@ void CameraAttachment::UpdateFrustum( BufferIndex updateBufferIndex, bool normal mFrustum[ updateBufferIndex ? 0 : 1 ] = planes; } -bool CameraAttachment::CheckSphereInFrustum( BufferIndex bufferIndex, const Vector3& origin, float radius ) +bool Camera::CheckSphereInFrustum( BufferIndex bufferIndex, const Vector3& origin, float radius ) { const FrustumPlanes& planes = mFrustum[ bufferIndex ]; for ( uint32_t i = 0; i < 6; ++i ) @@ -473,7 +452,7 @@ bool CameraAttachment::CheckSphereInFrustum( BufferIndex bufferIndex, const Vect return true; } -bool CameraAttachment::CheckAABBInFrustum( BufferIndex bufferIndex, const Vector3& origin, const Vector3& halfExtents ) +bool Camera::CheckAABBInFrustum( BufferIndex bufferIndex, const Vector3& origin, const Vector3& halfExtents ) { const FrustumPlanes& planes = mFrustum[ bufferIndex ]; for ( uint32_t i = 0; i < 6; ++i ) @@ -488,7 +467,7 @@ bool CameraAttachment::CheckAABBInFrustum( BufferIndex bufferIndex, const Vector return true; } -unsigned int CameraAttachment::UpdateProjection( BufferIndex updateBufferIndex ) +unsigned int Camera::UpdateProjection( BufferIndex updateBufferIndex ) { unsigned int retval( mUpdateProjectionFlag ); // Early-exit if no update required @@ -505,7 +484,7 @@ unsigned int CameraAttachment::UpdateProjection( BufferIndex updateBufferIndex ) { case Dali::Camera::PERSPECTIVE_PROJECTION: { - Matrix &projectionMatrix = mProjectionMatrix.Get(updateBufferIndex); + Matrix &projectionMatrix = mProjectionMatrix.Get( updateBufferIndex ); Perspective( projectionMatrix, mFieldOfView, mAspectRatio, @@ -517,7 +496,7 @@ unsigned int CameraAttachment::UpdateProjection( BufferIndex updateBufferIndex ) } case Dali::Camera::ORTHOGRAPHIC_PROJECTION: { - Matrix &projectionMatrix = mProjectionMatrix.Get(updateBufferIndex); + Matrix &projectionMatrix = mProjectionMatrix.Get( updateBufferIndex ); Orthographic( projectionMatrix, mLeftClippingPlane, mRightClippingPlane, mBottomClippingPlane, mTopClippingPlane, @@ -527,7 +506,7 @@ unsigned int CameraAttachment::UpdateProjection( BufferIndex updateBufferIndex ) } } - mProjectionMatrix.SetDirty(updateBufferIndex); + mProjectionMatrix.SetDirty( updateBufferIndex ); } --mUpdateProjectionFlag; } diff --git a/dali/internal/update/node-attachments/scene-graph-camera-attachment.h b/dali/internal/update/render-tasks/scene-graph-camera.h similarity index 69% rename from dali/internal/update/node-attachments/scene-graph-camera-attachment.h rename to dali/internal/update/render-tasks/scene-graph-camera.h index 949e9eaeb..1f00cd5d5 100644 --- a/dali/internal/update/node-attachments/scene-graph-camera-attachment.h +++ b/dali/internal/update/render-tasks/scene-graph-camera.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_CAMERA_ATTACHMENT_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_CAMERA_ATTACHMENT_H__ +#ifndef __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__ +#define __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include namespace Dali @@ -43,12 +41,13 @@ template <> struct ParameterType< Dali::Camera::ProjectionMode > namespace SceneGraph { +class Node; class SceneController; /** - * An attachment for camera objects and their properties. + * Scene-graph camera object */ -class CameraAttachment : public NodeAttachment +class Camera { public: static const Dali::Camera::Type DEFAULT_TYPE; @@ -84,106 +83,81 @@ public: }; /** - * Construct a new CameraAttachment. + * Construct a new Camera. * @return a new camera. */ - static CameraAttachment* New(); + static Camera* New(); /** - * @copydoc NodeAttachment::Initialize(). + * Destructor */ - virtual void Initialize( SceneController& sceneController, BufferIndex updateBufferIndex ); + ~Camera(); /** - * @copydoc NodeAttachment::OnDestroy(). - */ - virtual void OnDestroy(); - - /** - * @copydoc NodeAttachment::ConnectedToSceneGraph() - */ - virtual void ConnectedToSceneGraph(); - - /** - * @copydoc NodeAttachment::DisconnectedFromSceneGraph() - */ - virtual void DisconnectedFromSceneGraph(); - - /** - * Virtual destructor - */ - virtual ~CameraAttachment(); - - /** - * @copydoc Dali::Internal::CameraAttachment::SetType + * @copydoc Dali::Internal::CameraActor::SetType */ void SetType( Dali::Camera::Type type ); /** - * @copydoc Dali::Internal::CameraAttachment::SetInvertYAxis + * @copydoc Dali::Internal::CameraActor::SetInvertYAxis */ void SetInvertYAxis( bool invertYAxis ); /** - * @copydoc Dali::Internal::CameraAttachment::SetProjectionMode + * @copydoc Dali::Internal::CameraActor::SetProjectionMode */ void SetProjectionMode( Dali::Camera::ProjectionMode projectionMode ); /** - * @copydoc Dali::Internal::CameraAttachment::SetFieldOfView + * @copydoc Dali::Internal::CameraActor::SetFieldOfView */ void SetFieldOfView( float fieldOfView ); /** - * @copydoc Dali::Internal::CameraAttachment::SetAspectRatio + * @copydoc Dali::Internal::CameraActor::SetAspectRatio */ void SetAspectRatio( float aspectRatio ); /** - * @copydoc Dali::Internal::CameraAttachment::SetStereoBias + * @copydoc Dali::Internal::CameraActor::SetStereoBias */ void SetStereoBias(const Vector2& stereoBias); /** - * @copydoc Dali::Internal::CameraAttachment::SetLeftClippingPlane + * @copydoc Dali::Internal::CameraActor::SetLeftClippingPlane */ void SetLeftClippingPlane( float leftClippingPlane ); /** - * @copydoc Dali::Internal::CameraAttachment::SetRightClippingPlane + * @copydoc Dali::Internal::CameraActor::SetRightClippingPlane */ void SetRightClippingPlane( float rightClippingPlane ); /** - * @copydoc Dali::Internal::CameraAttachment::SetTopClippingPlane + * @copydoc Dali::Internal::CameraActor::SetTopClippingPlane */ void SetTopClippingPlane( float topClippingPlane ); /** - * @copydoc Dali::Internal::CameraAttachment::SetBottomClippingPlane + * @copydoc Dali::Internal::CameraActor::SetBottomClippingPlane */ void SetBottomClippingPlane( float bottomClippingPlane ); /** - * @copydoc Dali::Internal::CameraAttachment::SetNearClippingPlane + * @copydoc Dali::Internal::CameraActor::SetNearClippingPlane */ void SetNearClippingPlane( float nearClippingPlane ); /** - * @copydoc Dali::Internal::CameraAttachment::SetFarClippingPlane + * @copydoc Dali::Internal::CameraActor::SetFarClippingPlane */ void SetFarClippingPlane( float farClippingPlane ); /** - * @copydoc Dali::Internal::CameraAttachment::SetTarget + * @copydoc Dali::Internal::CameraActor::SetTarget */ void SetTargetPosition( const Vector3& targetPosition ); - /** - * Get Camera Target - */ - Vector3 GetTargetPosition() const; - /** * Retrieve the view-matrix; this is double buffered for input handling. * @param[in] bufferIndex The buffer to read from. @@ -229,26 +203,21 @@ public: /** * Retrieve the projection-matrix property querying interface. - * @pre The attachment is on-stage. + * @pre The camera is on-stage. * @return The projection-matrix property querying interface. */ const PropertyInputImpl* GetProjectionMatrix() const; /** * Retrieve the viewMatrix property querying interface. - * @pre The attachment is on-stage. + * @pre The camera is on-stage. * @return The viewMatrix property querying interface. */ const PropertyInputImpl* GetViewMatrix() const; - /** - * @copydoc NodeAttachment::Update - */ - virtual void Update( BufferIndex updateBufferIndex, const Node& owningNode, int nodeDirtyFlags ){}; - /** * Updates view and projection matrices. - * Called by the render task using the camera attachment + * Called by the render task using the camera * @param[in] updateBufferIndex The buffer to read from. * @param[in] owningNode The node that owns the camera */ @@ -259,20 +228,18 @@ public: */ bool ViewMatrixUpdated(); -protected: +private: /** - * Protected constructor, see New(). + * Constructor */ - CameraAttachment(); - -private: + Camera(); + // Non copyable // Undefined - CameraAttachment(const CameraAttachment&); - + Camera(const Camera&); // Undefined - CameraAttachment& operator=(const CameraAttachment& rhs); + Camera& operator=(const Camera& rhs); /** * Recalculates the view matrix. @@ -299,7 +266,6 @@ private: */ void UpdateFrustum( BufferIndex updateBufferIndex, bool normalize = true ); - 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 @@ -327,158 +293,155 @@ public: // PROPERTIES }; -// Messages for CameraAttachment +// Messages for Camera -inline void SetTypeMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, Dali::Camera::Type parameter ) +inline void SetTypeMessage( EventThreadServices& eventThreadServices, const Camera& camera, Dali::Camera::Type parameter ) { - typedef MessageValue1< CameraAttachment, Dali::Camera::Type > LocalType; + typedef MessageValue1< Camera, Dali::Camera::Type > 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( &attachment, &CameraAttachment::SetType, parameter ); + new (slot) LocalType( &camera, &Camera::SetType, parameter ); } -inline void SetProjectionModeMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, Dali::Camera::ProjectionMode parameter ) +inline void SetProjectionModeMessage( EventThreadServices& eventThreadServices, const Camera& camera, Dali::Camera::ProjectionMode parameter ) { - typedef MessageValue1< CameraAttachment, Dali::Camera::ProjectionMode > LocalProjectionMode; + typedef MessageValue1< Camera, Dali::Camera::ProjectionMode > LocalProjectionMode; // Reserve some memory inside the message queue unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalProjectionMode ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalProjectionMode( &attachment, &CameraAttachment::SetProjectionMode, parameter ); + new (slot) LocalProjectionMode( &camera, &Camera::SetProjectionMode, parameter ); } - -inline void SetFieldOfViewMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetFieldOfViewMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetFieldOfView, parameter ); + new (slot) LocalType( &camera, &Camera::SetFieldOfView, parameter ); } -inline void SetAspectRatioMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetAspectRatioMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetAspectRatio, parameter ); + new (slot) LocalType( &camera, &Camera::SetAspectRatio, parameter ); } -inline void SetStereoBiasMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, const Vector2& parameter ) +inline void SetStereoBiasMessage( EventThreadServices& eventThreadServices, const Camera& camera, const Vector2& parameter ) { - typedef MessageValue1< CameraAttachment, Vector2 > LocalType; + typedef MessageValue1< Camera, Vector2 > 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( &attachment, &CameraAttachment::SetStereoBias, parameter ); + new (slot) LocalType( &camera, &Camera::SetStereoBias, parameter ); } -inline void SetLeftClippingPlaneMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetLeftClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetLeftClippingPlane, parameter ); + new (slot) LocalType( &camera, &Camera::SetLeftClippingPlane, parameter ); } -inline void SetRightClippingPlaneMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetRightClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetRightClippingPlane, parameter ); + new (slot) LocalType( &camera, &Camera::SetRightClippingPlane, parameter ); } -inline void SetTopClippingPlaneMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetTopClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetTopClippingPlane, parameter ); + new (slot) LocalType( &camera, &Camera::SetTopClippingPlane, parameter ); } -inline void SetBottomClippingPlaneMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetBottomClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetBottomClippingPlane, parameter ); + new (slot) LocalType( &camera, &Camera::SetBottomClippingPlane, parameter ); } -inline void SetNearClippingPlaneMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetNearClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetNearClippingPlane, parameter ); + new (slot) LocalType( &camera, &Camera::SetNearClippingPlane, parameter ); } -inline void SetFarClippingPlaneMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, float parameter ) +inline void SetFarClippingPlaneMessage( EventThreadServices& eventThreadServices, const Camera& camera, float parameter ) { - typedef MessageValue1< CameraAttachment, float > LocalType; + typedef MessageValue1< Camera, float > 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( &attachment, &CameraAttachment::SetFarClippingPlane, parameter ); + new (slot) LocalType( &camera, &Camera::SetFarClippingPlane, parameter ); } -inline void SetTargetPositionMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, const Vector3& parameter ) +inline void SetTargetPositionMessage( EventThreadServices& eventThreadServices, const Camera& camera, const Vector3& parameter ) { - typedef MessageValue1< CameraAttachment, Vector3 > LocalType; + typedef MessageValue1< Camera, Vector3 > 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( &attachment, &CameraAttachment::SetTargetPosition, parameter ); + new (slot) LocalType( &camera, &Camera::SetTargetPosition, parameter ); } - -inline void SetInvertYAxisMessage( EventThreadServices& eventThreadServices, const CameraAttachment& attachment, bool parameter ) +inline void SetInvertYAxisMessage( EventThreadServices& eventThreadServices, const Camera& camera, bool parameter ) { - typedef MessageValue1< CameraAttachment, bool > LocalType; + typedef MessageValue1< Camera, bool > 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( &attachment, &CameraAttachment::SetInvertYAxis, parameter ); + new (slot) LocalType( &camera, &Camera::SetInvertYAxis, parameter ); } - } // namespace SceneGraph } // namespace Internal } // namespace Dali -#endif // __DALI_INTERNAL_SCENE_GRAPH_CAMERA_ATTACHMENT_H__ +#endif // __DALI_INTERNAL_SCENE_GRAPH_CAMERA_H__ 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 d04b2b937..29fee564f 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.cpp +++ b/dali/internal/update/render-tasks/scene-graph-render-task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -107,20 +107,10 @@ bool RenderTask::IsExclusive() const return mExclusive; } -void RenderTask::SetCameraNode( Node* cameraNode ) +void RenderTask::SetCamera( Node* cameraNode, Camera* camera ) { - // if camera changed - if( cameraNode != mCameraNode ) - { - if( cameraNode ) - { - // get attachment. when camera node is changed we will get a message from event thread object - // so no need to observe the node here - mCameraAttachment = dynamic_cast< CameraAttachment* >( &cameraNode->GetAttachment() ); - DALI_ASSERT_DEBUG( mCameraAttachment && "Camera without attachment" ); - } - mCameraNode = cameraNode; - } + mCameraNode = cameraNode; + mCamera = camera; } void RenderTask::SetFrameBufferId( unsigned int resourceId, bool isNativeFBO ) @@ -230,7 +220,7 @@ bool RenderTask::ReadyToRender( BufferIndex updateBufferIndex ) // Check camera node if ( NULL == mCameraNode || NULL == mCameraNode->GetParent() || - NULL == mCameraAttachment ) + NULL == mCamera ) { // Camera node is missing or disconnected TASK_LOG_FMT(Debug::General, " =F No Camera FC:%d\n", mFrameCounter ); @@ -238,7 +228,7 @@ bool RenderTask::ReadyToRender( BufferIndex updateBufferIndex ) return false; } - mCameraAttachment->Update( updateBufferIndex, *mCameraNode ); + mCamera->Update( updateBufferIndex, *mCameraNode ); TASK_LOG_FMT(Debug::General, " =T (FBO ID:%d) FC:%d\n", mFrameBufferResourceId , mFrameCounter ); return true; @@ -387,34 +377,34 @@ unsigned int RenderTask::GetRenderedOnceCounter() const const Matrix& RenderTask::GetViewMatrix( BufferIndex bufferIndex ) const { - DALI_ASSERT_DEBUG( NULL != mCameraAttachment ); + DALI_ASSERT_DEBUG( NULL != mCamera ); - return mCameraAttachment->GetViewMatrix( bufferIndex ); + return mCamera->GetViewMatrix( bufferIndex ); } -SceneGraph::CameraAttachment& RenderTask::GetCameraAttachment() const +SceneGraph::Camera& RenderTask::GetCamera() const { - DALI_ASSERT_DEBUG( NULL != mCameraAttachment ); - return *mCameraAttachment; + DALI_ASSERT_DEBUG( NULL != mCamera ); + return *mCamera; } const Matrix& RenderTask::GetProjectionMatrix( BufferIndex bufferIndex ) const { - DALI_ASSERT_DEBUG( NULL != mCameraAttachment ); + DALI_ASSERT_DEBUG( NULL != mCamera ); - return mCameraAttachment->GetProjectionMatrix( bufferIndex ); + return mCamera->GetProjectionMatrix( bufferIndex ); } void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, BufferIndex updateBufferIndex ) { - DALI_ASSERT_DEBUG( NULL != mCameraAttachment ); + DALI_ASSERT_DEBUG( NULL != mCamera ); TASK_LOG(Debug::General); Viewport viewport; bool viewportSet = QueryViewport( updateBufferIndex, viewport ); - instruction.Reset( mCameraAttachment, + instruction.Reset( mCamera, GetFrameBufferId(), viewportSet ? &viewport : NULL, mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL ); @@ -441,9 +431,9 @@ void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, Buffe bool RenderTask::ViewMatrixUpdated() { bool retval = false; - if( mCameraAttachment ) + if( mCamera ) { - retval = mCameraAttachment->ViewMatrixUpdated(); + retval = mCamera->ViewMatrixUpdated(); } return retval; } @@ -491,11 +481,6 @@ bool RenderTask::GetViewportEnabled( BufferIndex bufferIndex ) const return false; } -Node* RenderTask::GetCamera() const -{ - return mCameraNode; -} - void RenderTask::SetSyncRequired( bool requiresSync ) { mRequiresSync = requiresSync; @@ -518,7 +503,7 @@ RenderTask::RenderTask() mRenderSyncTracker( NULL ), mSourceNode( NULL ), mCameraNode( NULL ), - mCameraAttachment( NULL ), + mCamera( NULL ), mFrameBufferResourceId( 0 ), mResourcesFinished( false ), mWaitingToRender( false ), 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 d7abf2618..d3df77638 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.h +++ b/dali/internal/update/render-tasks/scene-graph-render-task.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -43,7 +43,7 @@ class RenderTracker; namespace SceneGraph { class Node; -class CameraAttachment; +class Camera; class RenderInstruction; class RenderMessageDispatcher; @@ -104,10 +104,11 @@ public: bool IsExclusive() const; /** - * Set the node from which the scene is viewed. - * @param[in] node The scene is viewed from the perspective of this node. + * Set the camera from which the scene is viewed. + * @param[in] cameraNode that camera is connected with + * @param[in] camera to use. */ - void SetCameraNode( Node* node ); + void SetCamera( Node* cameraNode, Camera* camera ); /** * Set the frame-buffer used as a render target. @@ -289,23 +290,23 @@ public: /** * Retrieve the view-matrix; this is double buffered for input handling. - * @pre GetCameraNode() returns a node with valid CameraAttachment. + * @pre GetCameraNode() returns a node with valid Camera. * @param[in] bufferIndex The buffer to read from. * @return The view-matrix. */ const Matrix& GetViewMatrix( BufferIndex bufferIndex ) const; /** - * @brief Retrieve the camera attachment. - * @pre GetCameraNode() returns a node with valid CameraAttachment. + * @brief Retrieve the camera. + * @pre GetCameraNode() returns a node with valid Camera. * - * @return The camera attachment. + * @return The camera. */ - SceneGraph::CameraAttachment& GetCameraAttachment() const; + SceneGraph::Camera& GetCamera() const; /** * Retrieve the projection-matrix; this is double buffered for input handling. - * @pre GetCameraNode() returns a node with valid CameraAttachment. + * @pre GetCameraNode() returns a node with valid Camera. * @param[in] bufferIndex The buffer to read from. * @return The projection-matrix. */ @@ -328,11 +329,6 @@ public: */ bool ViewMatrixUpdated(); - /** - * @return A pointer to the camera used by the RenderTask - */ - Node* GetCamera() const; - /** * Set whether GL sync is required for native render target. * @param[in] whether GL sync is required for native render target @@ -367,7 +363,7 @@ private: Render::RenderTracker* mRenderSyncTracker; Node* mSourceNode; Node* mCameraNode; - CameraAttachment* mCameraAttachment; + SceneGraph::Camera* mCamera; unsigned int mFrameBufferResourceId; bool mResourcesFinished:1; ///< True if all resources were available when the render-task was processed @@ -472,18 +468,17 @@ inline void SetSourceNodeMessage( EventThreadServices& eventThreadServices, Rend new (slot) LocalType( &task, &RenderTask::SetSourceNode, node ); } -inline void SetCameraNodeMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Node* constNode ) +inline void SetCameraMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Node* constNode, const Camera* constCamera ) { - // Scene graph thread can destroy this object. - Node* node = const_cast< Node* >( constNode ); + typedef MessageValue2< RenderTask, Node*, Camera* > LocalType; - typedef MessageValue1< RenderTask, Node* > LocalType; - - // Reserve some memory inside the message queue + Node* node = const_cast< Node* >( constNode ); + Camera* camera = const_cast< Camera* >( constCamera ); + // Reserve 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( &task, &RenderTask::SetCameraNode, node ); + new (slot) LocalType( &task, &RenderTask::SetCamera, node, camera ); } inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, RenderTask& task, bool exclusive ) diff --git a/dali/internal/update/rendering/scene-graph-renderer.h b/dali/internal/update/rendering/scene-graph-renderer.h index 5745b980a..705049c18 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.h +++ b/dali/internal/update/rendering/scene-graph-renderer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDERER2_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -312,10 +312,10 @@ private: private: - SceneController* mSceneController; ///< Used for initializing renderers whilst attached - Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager) - TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned) - Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned) + SceneController* mSceneController; ///< Used for initializing renderers + Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager) + TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned) + Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned) Shader* mShader; Vector4* mBlendColor; ///< The blend color for blending operation @@ -332,7 +332,7 @@ private: unsigned int mRegenerateUniformMap; ///< 2 if the map should be regenerated, 1 if it should be copied. unsigned char mResendFlag; ///< Indicate whether data should be resent to the renderer bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame - bool mResourcesReady; ///< Set during the Update algorithm; true if the attachment has resources ready for the current frame. + bool mResourcesReady; ///< Set during the Update algorithm; true if the renderer has resources ready for the current frame. bool mFinishedResourceAcquisition; ///< Set during DoPrepareResources; true if ready & all resource acquisition has finished (successfully or otherwise) bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required @@ -376,7 +376,7 @@ inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Re new (slot) LocalType( &renderer, &Renderer::SetShader, &shader ); } -inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Renderer& attachment, int depthIndex ) +inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex ) { typedef MessageValue1< Renderer, int > LocalType; @@ -384,7 +384,7 @@ inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, cons 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( &attachment, &Renderer::SetDepthIndex, depthIndex ); + new (slot) LocalType( &renderer, &Renderer::SetDepthIndex, depthIndex ); } inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::FaceCullingMode::Type faceCullingMode ) -- 2.34.1