From: Francisco Santos Date: Tue, 16 Jun 2015 15:02:48 +0000 (+0100) Subject: Change depth-index to non-animatable property. X-Git-Tag: dali_1.0.47~8^2^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F07%2F41607%2F5;p=platform%2Fcore%2Fuifw%2Fdali-core.git Change depth-index to non-animatable property. Change-Id: I5f27e5912de519cbd672cd1ced32cb81ae152411 --- diff --git a/automated-tests/src/dali/utc-Dali-Renderer.cpp b/automated-tests/src/dali/utc-Dali-Renderer.cpp index f84560635..ce0489e51 100644 --- a/automated-tests/src/dali/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali/utc-Dali-Renderer.cpp @@ -210,7 +210,7 @@ int UtcDaliRendererSetGetDepthIndex(void) { TestApplication application; - tet_infoline("Test SetDepthIndex, GetCurrentDepthIndex"); + tet_infoline("Test SetDepthIndex, GetDepthIndex"); Material material = CreateMaterial(1.0f); Geometry geometry = CreateQuadGeometry(); @@ -222,21 +222,21 @@ int UtcDaliRendererSetGetDepthIndex(void) application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetCurrentDepthIndex(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS( renderer.GetDepthIndex(), 0, TEST_LOCATION ); DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION ); renderer.SetDepthIndex(1); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetCurrentDepthIndex(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS( renderer.GetDepthIndex(), 1, TEST_LOCATION ); DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION ); renderer.SetDepthIndex(10); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetCurrentDepthIndex(), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( renderer.GetDepthIndex(), 10, TEST_LOCATION ); DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION ); END_TEST; diff --git a/dali/internal/event/actors/renderer-impl.cpp b/dali/internal/event/actors/renderer-impl.cpp index 0c83a08ab..feee2b16f 100644 --- a/dali/internal/event/actors/renderer-impl.cpp +++ b/dali/internal/event/actors/renderer-impl.cpp @@ -38,7 +38,7 @@ namespace * |name |type |writable|animatable|constraint-input|enum for index-checking| */ DALI_PROPERTY_TABLE_BEGIN -DALI_PROPERTY( "depth-index", INTEGER, true, true, true, Dali::Renderer::Property::DEPTH_INDEX ) +DALI_PROPERTY( "depth-index", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX ) DALI_PROPERTY_TABLE_END( DEFAULT_OBJECT_PROPERTY_START_INDEX ) const ObjectImplHelper RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS }; @@ -79,18 +79,16 @@ Material* Renderer::GetMaterial() const void Renderer::SetDepthIndex( int depthIndex ) { - SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex ); + if ( mDepthIndex != depthIndex ) + { + mDepthIndex = depthIndex; + SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex ); + } } -int Renderer::GetCurrentDepthIndex() const +int Renderer::GetDepthIndex() const { - int depthIndex = 0; - if( mSceneObject ) - { - BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex(); - depthIndex = mSceneObject->mDepthIndex[bufferIndex]; - } - return depthIndex; + return mDepthIndex; } SceneGraph::RendererAttachment* Renderer::GetRendererSceneObject() @@ -166,7 +164,7 @@ Property::Value Renderer::GetDefaultProperty( Property::Index index ) const { case Dali::Renderer::Property::DEPTH_INDEX: { - value = GetCurrentDepthIndex(); + value = GetDepthIndex(); } break; } @@ -195,18 +193,6 @@ const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Prop &Renderer::FindAnimatableProperty, &Renderer::FindCustomProperty, index ); - - if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT ) - { - switch(index) - { - case Dali::Renderer::Property::DEPTH_INDEX: - { - property = &mSceneObject->mDepthIndex; - } - break; - } - } } return property; @@ -224,18 +210,6 @@ const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index &Renderer::FindCustomProperty, index ); property = static_cast( baseProperty ); - - if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT ) - { - switch(index) - { - case Dali::Renderer::Property::DEPTH_INDEX: - { - property = &mSceneObject->mDepthIndex; - } - break; - } - } } return property; @@ -269,6 +243,7 @@ void Renderer::Disconnect() Renderer::Renderer() : mSceneObject(NULL), + mDepthIndex(0), mOnStage(false) { } diff --git a/dali/internal/event/actors/renderer-impl.h b/dali/internal/event/actors/renderer-impl.h index f02a3ac21..b7abd849d 100644 --- a/dali/internal/event/actors/renderer-impl.h +++ b/dali/internal/event/actors/renderer-impl.h @@ -79,9 +79,9 @@ public: void SetDepthIndex( int depthIndex ); /** - * @copydoc Dali::Renderer::GetCurrentDepthIndex() + * @copydoc Dali::Renderer::GetDepthIndex() */ - int GetCurrentDepthIndex() const; + int GetDepthIndex() const; /** * @brief Get the scene graph object ( the node attachment ) @@ -207,6 +207,7 @@ private: // data SceneGraph::RendererAttachment* mSceneObject; ObjectConnector mGeometryConnector; ///< Connector that holds the geometry used by this renderer ObjectConnector mMaterialConnector; ///< Connector that holds the material used by this renderer + int mDepthIndex; bool mOnStage; }; diff --git a/dali/internal/event/events/hit-test-algorithm-impl.cpp b/dali/internal/event/events/hit-test-algorithm-impl.cpp index 218c77982..683ec4aee 100644 --- a/dali/internal/event/events/hit-test-algorithm-impl.cpp +++ b/dali/internal/event/events/hit-test-algorithm-impl.cpp @@ -225,7 +225,7 @@ HitActor HitTestWithinLayer( Actor& actor, { if ( actor.GetRendererCount() ) { - hit.depth = actor.GetRendererAt( 0 ).GetCurrentDepthIndex(); + hit.depth = actor.GetRendererAt( 0 ).GetDepthIndex(); } else { diff --git a/dali/internal/update/manager/prepare-render-instructions.cpp b/dali/internal/update/manager/prepare-render-instructions.cpp index dde9c6880..b3a03ab4e 100644 --- a/dali/internal/update/manager/prepare-render-instructions.cpp +++ b/dali/internal/update/manager/prepare-render-instructions.cpp @@ -204,7 +204,7 @@ inline void AddRendererToRenderList( BufferIndex updateBufferIndex, RenderItem& item = renderList.GetNextFreeItem(); const Renderer& renderer = renderable.GetRenderer(); item.SetRenderer( const_cast< Renderer* >( &renderer ) ); - item.SetDepthIndex( renderable.GetDepthIndex(updateBufferIndex) ); + item.SetDepthIndex( renderable.GetDepthIndex() ); // save MV matrix onto the item Matrix& modelViewMatrix = item.GetModelViewMatrix(); diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 53391bc5e..2731ae8d7 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -697,16 +697,6 @@ void UpdateManager::ResetNodeProperty( Node& node ) BufferIndex bufferIndex = mSceneGraphBuffers.GetUpdateBufferIndex(); node.ResetToBaseValues( bufferIndex ); - - // @todo MESH_REWORK Only perform this step for RendererAttachments - consider - // storing them again? Split out to separate scene graph object (called e.g. RendererPropertyOwner) owned by UpdateManager - // It is after all, a property owner, and always requires resetting... - // The depth index should not be an animatable property... and probably not even - // a constraint input? (Double buffering will slow down the sort algorithm slightly) - if( node.HasAttachment() ) - { - node.GetAttachment().ResetToBaseValues( bufferIndex ); - } } void UpdateManager::ResetProperties() diff --git a/dali/internal/update/node-attachments/node-attachment.h b/dali/internal/update/node-attachments/node-attachment.h index a7d340294..78034504e 100644 --- a/dali/internal/update/node-attachments/node-attachment.h +++ b/dali/internal/update/node-attachments/node-attachment.h @@ -121,12 +121,6 @@ public: // Update methods - /** - * Called to reset attachment's properties to base values. - * Attachments without properties should not override this method - */ - virtual void ResetToBaseValues(BufferIndex bufferIndex) { } - /** * Called when the attachment or it's owning node is flagged as dirty during scene graph updates. * Allows derived classes to perform extra processing diff --git a/dali/internal/update/node-attachments/scene-graph-renderable-attachment.h b/dali/internal/update/node-attachments/scene-graph-renderable-attachment.h index 3f87a6bcc..0f012087d 100644 --- a/dali/internal/update/node-attachments/scene-graph-renderable-attachment.h +++ b/dali/internal/update/node-attachments/scene-graph-renderable-attachment.h @@ -248,7 +248,7 @@ public: // API for derived classes * Get the depth index for the attachment * @param[in] bufferIndex The current update buffer index. */ - virtual int GetDepthIndex(BufferIndex bufferIndex) + virtual int GetDepthIndex() { return static_cast( mSortModifier ); } diff --git a/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp b/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp index 0ded538e5..33fc2e72d 100644 --- a/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp +++ b/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp @@ -159,9 +159,9 @@ void RendererAttachment::SetSortAttributes( BufferIndex bufferIndex, RendererWit sortAttributes.geometry = mGeometry; } -void RendererAttachment::SetDepthIndex( BufferIndex updateBufferIndex, int depthIndex ) +void RendererAttachment::SetDepthIndex( int depthIndex ) { - mDepthIndex.Bake(updateBufferIndex, depthIndex); + mDepthIndex = depthIndex; if( mParent ) { @@ -170,11 +170,6 @@ void RendererAttachment::SetDepthIndex( BufferIndex updateBufferIndex, int depth } } -void RendererAttachment::ResetToBaseValues( BufferIndex updateBufferIndex ) -{ - mDepthIndex.ResetToBaseValue( updateBufferIndex ); -} - Renderer& RendererAttachment::GetRenderer() { return *mRenderer; diff --git a/dali/internal/update/node-attachments/scene-graph-renderer-attachment.h b/dali/internal/update/node-attachments/scene-graph-renderer-attachment.h index bd71042b2..2c93f4075 100644 --- a/dali/internal/update/node-attachments/scene-graph-renderer-attachment.h +++ b/dali/internal/update/node-attachments/scene-graph-renderer-attachment.h @@ -127,23 +127,18 @@ public: /** * Set the depth index - * @param[in] bufferIndex The buffer index * @param[in] depthIndex the new depth index to use */ - void SetDepthIndex( BufferIndex bufferIndex, int depthIndex ); + void SetDepthIndex( int depthIndex ); protected: // From NodeAttachment /** - * @copydoc NodeAttachment::ResetToBaseValues - */ - virtual void ResetToBaseValues( BufferIndex updateBufferIndex ); - - /** - * @param[in] bufferIndex The buffer index + * @brief Get the depth index + * @return The depth index */ - virtual int GetDepthIndex( BufferIndex bufferIndex ) + virtual int GetDepthIndex() { - return mDepthIndex[bufferIndex]; + return mDepthIndex; } /** @@ -241,7 +236,7 @@ private: public: // Properties - AnimatableProperty mDepthIndex; ///< Used only in PrepareRenderInstructions + int mDepthIndex; ///< Used only in PrepareRenderInstructions }; // Messages for RendererAttachment @@ -270,7 +265,7 @@ inline void SetGeometryMessage( EventThreadServices& eventThreadServices, const inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const RendererAttachment& attachment, int depthIndex ) { - typedef MessageDoubleBuffered1< RendererAttachment, int > LocalType; + typedef MessageValue1< RendererAttachment, int > LocalType; // Reserve some memory inside the message queue unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); diff --git a/dali/public-api/actors/renderer.cpp b/dali/public-api/actors/renderer.cpp index e9705f396..aaf2c7588 100644 --- a/dali/public-api/actors/renderer.cpp +++ b/dali/public-api/actors/renderer.cpp @@ -85,9 +85,9 @@ void Renderer::SetDepthIndex( int depthIndex ) GetImplementation(*this).SetDepthIndex( depthIndex ); } -int Renderer::GetCurrentDepthIndex() +int Renderer::GetDepthIndex() { - return GetImplementation(*this).GetCurrentDepthIndex(); + return GetImplementation(*this).GetDepthIndex(); } Renderer::Renderer( Internal::Renderer* pointer ) diff --git a/dali/public-api/actors/renderer.h b/dali/public-api/actors/renderer.h index e718fb2d2..9963f05e4 100644 --- a/dali/public-api/actors/renderer.h +++ b/dali/public-api/actors/renderer.h @@ -141,7 +141,7 @@ public: * @sa SetDepthIndex() * @return the depth index */ - int GetCurrentDepthIndex(); + int GetDepthIndex(); public: /**