Change depth-index to non-animatable property. 07/41607/5
authorFrancisco Santos <f1.santos@samsung.com>
Tue, 16 Jun 2015 15:02:48 +0000 (16:02 +0100)
committerFrancisco Santos <f1.santos@samsung.com>
Mon, 22 Jun 2015 10:43:46 +0000 (11:43 +0100)
Change-Id: I5f27e5912de519cbd672cd1ced32cb81ae152411

12 files changed:
automated-tests/src/dali/utc-Dali-Renderer.cpp
dali/internal/event/actors/renderer-impl.cpp
dali/internal/event/actors/renderer-impl.h
dali/internal/event/events/hit-test-algorithm-impl.cpp
dali/internal/update/manager/prepare-render-instructions.cpp
dali/internal/update/manager/update-manager.cpp
dali/internal/update/node-attachments/node-attachment.h
dali/internal/update/node-attachments/scene-graph-renderable-attachment.h
dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp
dali/internal/update/node-attachments/scene-graph-renderer-attachment.h
dali/public-api/actors/renderer.cpp
dali/public-api/actors/renderer.h

index f84560635f721f1d20c886260ba8bb4b010677ad..ce0489e51c8a071b5b169d8a7913f0760a5c0534 100644 (file)
@@ -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<int>(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<int>(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<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION );
 
   END_TEST;
index 0c83a08abd63e0a078c55c35e7381dd76be24365..feee2b16f525ea5e853ab579533c8b874a89c7c5 100644 (file)
@@ -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<DEFAULT_PROPERTY_COUNT> 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<const PropertyInputImpl*>( 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)
 {
 }
index f02a3ac21629f02495e660a4fe4d8e29255148d2..b7abd849d0ac8d6dfb9e4b4042b5eba54a32fc5c 100644 (file)
@@ -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<Geometry> mGeometryConnector; ///< Connector that holds the geometry used by this renderer
   ObjectConnector<Material> mMaterialConnector; ///< Connector that holds the material used by this renderer
+  int mDepthIndex;
   bool mOnStage;
 };
 
index 218c7798250f4e3af5c7619586ddecd536b21ef3..683ec4aee8caf0f54800ac9ec400848ceae54feb 100644 (file)
@@ -225,7 +225,7 @@ HitActor HitTestWithinLayer( Actor& actor,
             {
               if ( actor.GetRendererCount() )
               {
-                hit.depth = actor.GetRendererAt( 0 ).GetCurrentDepthIndex();
+                hit.depth = actor.GetRendererAt( 0 ).GetDepthIndex();
               }
               else
               {
index dde9c688008fc5dd140872507804d4904f9337fe..b3a03ab4ee47a64e53c977ae0dfde6826cd9f942 100644 (file)
@@ -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();
index 53391bc5e3a4f5f60cdd61a7dc8aacf1bd5176fb..2731ae8d7358d8be06045ce2889cab87b73f8286 100644 (file)
@@ -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()
index a7d340294d8fbbdcf61d33ae2ee8803522dd1406..78034504e0af8f513786074548c5b690fc60af88 100644 (file)
@@ -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
index 3f87a6bcc86d55cb4506ca8c77ca8d219090385c..0f012087d4ba9b62445d089f9361cb83086bbb39 100644 (file)
@@ -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<int>( mSortModifier );
   }
index 0ded538e5eed64da0172af8db14079d3c6b8581a..33fc2e72d0f67f6a277f1cbc2ae7d0808474be16 100644 (file)
@@ -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;
index bd71042b27a9bd5320141c1ff97e7a1e256deb8e..2c93f4075cce57227f9a8090fc55af20d5f05041 100644 (file)
@@ -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<int> 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 ) );
index e9705f396870b72b156d88f3a797fba007196bf6..aaf2c758863b07534d902842424966044d36424e 100644 (file)
@@ -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 )
index e718fb2d2712332aaed8147116428e63fe42928d..9963f05e45bcc65baa4ee0cd79c19b7a6aea6239 100644 (file)
@@ -141,7 +141,7 @@ public:
    * @sa SetDepthIndex()
    * @return the depth index
    */
-  int GetCurrentDepthIndex();
+  int GetDepthIndex();
 
 public:
   /**