Remove double-buffered properties from SceneGraph::Geometry 02/50002/10
authorFerran Sole <ferran.sole@samsung.com>
Thu, 22 Oct 2015 13:56:11 +0000 (14:56 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Fri, 23 Oct 2015 14:01:59 +0000 (07:01 -0700)
-Removed mCenter, mGeometryType and mRequiresDepthTest double buffered properties from SceneGraph::Geometry
-Added those properties to RenderGeometry
-When any of those properties change, RenderGeometry is updated via message to RenderManager
-Fixed RequiresDepthTest which wasn't being considered when rendering

Change-Id: Idb70db083ef9c51005a442e7cde158a13994a7f5

17 files changed:
dali/devel-api/rendering/geometry.h
dali/internal/event/rendering/geometry-impl.cpp
dali/internal/event/rendering/geometry-impl.h
dali/internal/render/common/render-algorithms.cpp
dali/internal/render/common/render-manager.cpp
dali/internal/render/common/render-manager.h
dali/internal/render/data-providers/geometry-data-provider.h [deleted file]
dali/internal/render/data-providers/material-data-provider.h
dali/internal/render/data-providers/render-data-provider.h
dali/internal/render/renderers/render-geometry.cpp
dali/internal/render/renderers/render-geometry.h
dali/internal/render/renderers/render-new-renderer.cpp
dali/internal/update/controllers/render-message-dispatcher.cpp
dali/internal/update/controllers/render-message-dispatcher.h
dali/internal/update/rendering/scene-graph-geometry.cpp
dali/internal/update/rendering/scene-graph-geometry.h
dali/internal/update/rendering/scene-graph-renderer.h

index ea9196b..1ff8b78 100644 (file)
@@ -59,8 +59,7 @@ public:
   {
     enum
     {
-      GEOMETRY_TYPE = DEFAULT_OBJECT_PROPERTY_START_INDEX,  ///< name "depth-index",            type STRING
-      GEOMETRY_CENTER,                                      ///< name "geometry-center",        type VECTOR3
+      GEOMETRY_TYPE = DEFAULT_OBJECT_PROPERTY_START_INDEX,  ///< name "geometry-type",            type STRING
       REQUIRES_DEPTH_TEST,                                  ///< name "requires-depth-testing", type BOOLEAN
     };
   };
index 1759c79..c70a671 100644 (file)
@@ -38,9 +38,8 @@ namespace
  *            |name                    |type     |writable|animatable|constraint-input|enum for index-checking|
  */
 DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "geometry-type",         STRING,   true, false,  true, Dali::Geometry::Property::GEOMETRY_TYPE )
-DALI_PROPERTY( "geometry-center",       VECTOR3,  true, true,   true, Dali::Geometry::Property::GEOMETRY_CENTER )
-DALI_PROPERTY( "requires-depth-test",   BOOLEAN,  true, false,  true, Dali::Geometry::Property::REQUIRES_DEPTH_TEST )
+DALI_PROPERTY( "geometry-type",         STRING,   true, false, true, Dali::Geometry::Property::GEOMETRY_TYPE )
+DALI_PROPERTY( "requires-depth-test",   BOOLEAN,  true, false, true, Dali::Geometry::Property::REQUIRES_DEPTH_TEST )
 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
 
 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> GEOMETRY_IMPL = { DEFAULT_PROPERTY_DETAILS };
@@ -89,38 +88,36 @@ void Geometry::SetIndexBuffer( PropertyBuffer& indexBuffer )
 
 void Geometry::SetGeometryType( Dali::Geometry::GeometryType geometryType )
 {
-  if( NULL != mSceneObject )
+  if( geometryType != mGeometryType )
   {
-    SceneGraph::DoubleBufferedPropertyMessage<int>::Send(
-      GetEventThreadServices(),
-      mSceneObject,
-      &mSceneObject->mGeometryType,
-      &SceneGraph::DoubleBufferedProperty<int>::Set,
-      static_cast<int>(geometryType) );
+    SceneGraph::SetGeometryTypeMessage(GetEventThreadServices(),
+                                       *mSceneObject,
+                                       geometryType );
+
+    mGeometryType = geometryType;
   }
 }
 
 Dali::Geometry::GeometryType Geometry::GetGeometryType() const
 {
-  return mSceneObject->GetGeometryType(GetEventThreadServices().GetEventBufferIndex());
+  return mGeometryType;
 }
 
 void Geometry::SetRequiresDepthTesting( bool requiresDepthTest )
 {
-  if( NULL != mSceneObject )
+  if( requiresDepthTest != mRequiresDepthTest )
   {
-    SceneGraph::DoubleBufferedPropertyMessage<bool>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mRequiresDepthTest, &SceneGraph::DoubleBufferedProperty<bool>::Set, static_cast<int>(requiresDepthTest) );
+    SceneGraph::SetGeometryRequiresDepthTestMessage(GetEventThreadServices(),
+                                                    *mSceneObject,
+                                                    requiresDepthTest );
+
+    mRequiresDepthTest = requiresDepthTest;
   }
 }
 
 bool Geometry::GetRequiresDepthTesting() const
 {
-  if( mSceneObject )
-  {
-    // mSceneObject is being used in a separate thread; copy the value from the previous update
-    return mSceneObject->GetRequiresDepthTesting(GetEventThreadServices().GetEventBufferIndex());
-  }
-  return false;
+  return mRequiresDepthTest;
 }
 
 const SceneGraph::Geometry* Geometry::GetGeometrySceneObject() const
@@ -175,17 +172,22 @@ void Geometry::SetDefaultProperty( Property::Index index,
   {
     case Dali::Geometry::Property::GEOMETRY_TYPE :
     {
-      SceneGraph::DoubleBufferedPropertyMessage<int>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mGeometryType, &SceneGraph::DoubleBufferedProperty<int>::Set, propertyValue.Get<int>() );
-      break;
-    }
-    case Dali::Geometry::Property::GEOMETRY_CENTER :
-    {
-      SceneGraph::AnimatablePropertyMessage<Vector3>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mCenter, &SceneGraph::AnimatableProperty<Vector3>::Bake, propertyValue.Get<Vector3>() );
+      Dali::Geometry::GeometryType geometryType = static_cast<Dali::Geometry::GeometryType>(propertyValue.Get<int>());
+      if( geometryType != mGeometryType )
+      {
+        SceneGraph::SetGeometryTypeMessage(GetEventThreadServices(), *mSceneObject, geometryType );
+        mGeometryType = geometryType;
+      }
       break;
     }
     case Dali::Geometry::Property::REQUIRES_DEPTH_TEST :
     {
-      SceneGraph::DoubleBufferedPropertyMessage<bool>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mRequiresDepthTest, &SceneGraph::DoubleBufferedProperty<bool>::Set, propertyValue.Get<bool>() );
+      bool requiresDepthTest = propertyValue.Get<bool>();
+      if( requiresDepthTest != mRequiresDepthTest )
+      {
+        SceneGraph::SetGeometryRequiresDepthTestMessage(GetEventThreadServices(), *mSceneObject, requiresDepthTest);
+        mRequiresDepthTest = requiresDepthTest;
+      }
       break;
     }
   }
@@ -200,7 +202,6 @@ void Geometry::SetSceneGraphProperty( Property::Index index,
 
 Property::Value Geometry::GetDefaultProperty( Property::Index index ) const
 {
-  BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
   Property::Value value;
 
   switch( index )
@@ -209,24 +210,15 @@ Property::Value Geometry::GetDefaultProperty( Property::Index index ) const
     {
       if( mSceneObject )
       {
-        value = mSceneObject->mGeometryType[bufferIndex];
-      }
-      break;
-    }
-    case Dali::Geometry::Property::GEOMETRY_CENTER :
-    {
-      if( mSceneObject )
-      {
-        value = mSceneObject->mCenter[bufferIndex];
+        value = mGeometryType;
       }
       break;
     }
-
     case Dali::Geometry::Property::REQUIRES_DEPTH_TEST :
     {
       if( mSceneObject )
       {
-        value = mSceneObject->mRequiresDepthTest[bufferIndex];
+        value = mRequiresDepthTest;
       }
       break;
     }
@@ -248,31 +240,14 @@ const SceneGraph::PropertyOwner* Geometry::GetSceneObject() const
 const SceneGraph::PropertyBase* Geometry::GetSceneObjectAnimatableProperty( Property::Index index ) const
 {
   const SceneGraph::PropertyBase* property = NULL;
-
   if( OnStage() )
   {
     property = GEOMETRY_IMPL.GetRegisteredSceneGraphProperty ( this,
                                                                &Geometry::FindAnimatableProperty,
                                                                &Geometry::FindCustomProperty,
                                                                index );
-
-    if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
-    {
-      switch(index)
-      {
-        case Dali::Geometry::Property::GEOMETRY_CENTER :
-        {
-          property = &mSceneObject->mCenter;
-          break;
-        }
-        default:
-        {
-          DALI_ASSERT_ALWAYS( 0 && "Property is not animatable" );
-          break;
-        }
-      }
-    }
   }
+
   return property;
 }
 
@@ -283,50 +258,17 @@ const PropertyInputImpl* Geometry::GetSceneObjectInputProperty( Property::Index
   if( OnStage() )
   {
     const SceneGraph::PropertyBase* baseProperty =
-      GEOMETRY_IMPL.GetRegisteredSceneGraphProperty ( this,
-                                                      &Geometry::FindAnimatableProperty,
-                                                      &Geometry::FindCustomProperty,
-                                                      index );
+        GEOMETRY_IMPL.GetRegisteredSceneGraphProperty ( this,
+                                                        &Geometry::FindAnimatableProperty,
+                                                        &Geometry::FindCustomProperty,
+                                                        index );
 
     property = static_cast<const PropertyInputImpl*>( baseProperty );
-
-    if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
-    {
-      switch(index)
-      {
-        case Dali::Geometry::Property::GEOMETRY_TYPE :
-        {
-          property = &mSceneObject->mGeometryType;
-          break;
-        }
-        case Dali::Geometry::Property::GEOMETRY_CENTER :
-        {
-          property = &mSceneObject->mCenter;
-          break;
-        }
-        case Dali::Geometry::Property::REQUIRES_DEPTH_TEST :
-        {
-          property = &mSceneObject->mRequiresDepthTest;
-          break;
-        }
-        default:
-        {
-          DALI_ASSERT_ALWAYS( 0 && "Property cannot be a constraint input");
-          break;
-        }
-      }
-    }
   }
 
   return property;
 }
 
-int Geometry::GetPropertyComponentIndex( Property::Index index ) const
-{
-  // @todo MESH_REWORK - Change this if component properties are added for center/half-extent
-  return Property::INVALID_COMPONENT_INDEX;
-}
-
 bool Geometry::OnStage() const
 {
   return mOnStage;
@@ -343,8 +285,10 @@ void Geometry::Disconnect()
 }
 
 Geometry::Geometry()
-: mIndexBuffer( NULL ),
-  mSceneObject( NULL ),
+: mSceneObject( NULL ),
+  mIndexBuffer( NULL ),
+  mGeometryType(Dali::Geometry::TRIANGLES),
+  mRequiresDepthTest(false),
   mOnStage( false )
 {
 }
index c8636fa..ae3acf1 100644 (file)
@@ -180,11 +180,6 @@ public: // Default property extensions from Object
    */
   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
 
-  /**
-   * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
-   */
-  virtual int GetPropertyComponentIndex( Property::Index index ) const;
-
 public: // Functions from Connectable
   /**
    * @copydoc Dali::Internal::Connectable::OnStage()
@@ -221,9 +216,14 @@ private: // unimplemented methods
 
 private: // data
 
-  std::vector<PropertyBufferPtr> mVertexBuffers; ///< Vector of intrusive pointers to vertex buffers
-  PropertyBufferPtr mIndexBuffer;                ///< Intrusive pointer to index buffer
   SceneGraph::Geometry* mSceneObject;
+
+  std::vector<PropertyBufferPtr> mVertexBuffers; ///< Vector of intrusive pointers to vertex buffers
+  PropertyBufferPtr              mIndexBuffer;   ///< Intrusive pointer to index buffer
+
+  Dali::Geometry::GeometryType mGeometryType;      ///< Geometry type (cached)
+  bool                         mRequiresDepthTest; ///< Establish if geometry requires depth testing (cached)
+
   bool mOnStage;
 };
 
index 646053d..37c8e0f 100644 (file)
@@ -138,7 +138,7 @@ inline void ProcessRenderList(
       DALI_PRINT_RENDER_ITEM( item );
 
       //Enable depth writes if depth buffer is enabled and item is opaque
-      context.DepthMask( depthBufferEnabled && item.IsOpaque() );
+      context.DepthMask( depthBufferEnabled && ( item.IsOpaque() || item.GetRenderer().RequiresDepthTest() ) );
 
       item.GetRenderer().Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, cullMode, !item.IsOpaque() );
     }
index c6aa9b9..7c713f4 100644 (file)
@@ -35,8 +35,8 @@
 #include <dali/internal/render/gl-resources/context.h>
 #include <dali/internal/render/gl-resources/frame-buffer-texture.h>
 #include <dali/internal/render/gl-resources/texture-cache.h>
-#include <dali/internal/render/renderers/render-renderer.h>
 #include <dali/internal/render/renderers/render-geometry.h>
+#include <dali/internal/render/renderers/render-renderer.h>
 #include <dali/internal/render/renderers/render-sampler.h>
 #include <dali/internal/render/shaders/program-controller.h>
 
@@ -411,6 +411,15 @@ void RenderManager::RemovePropertyBuffer( RenderGeometry* renderGeometry, Render
   }
 }
 
+void RenderManager::SetGeometryType( RenderGeometry* geometry, int type )
+{
+  geometry->SetGeometryType( static_cast<Geometry::GeometryType>(type) );
+}
+
+void RenderManager::SetGeometryRequiresDepthTest( RenderGeometry* geometry, bool requiresDepthTest )
+{
+  geometry->SetRequiresDepthTest( requiresDepthTest );
+}
 
 void RenderManager::AddRenderTracker( RenderTracker* renderTracker )
 {
index e04b252..28a1ea3 100644 (file)
@@ -251,6 +251,20 @@ public:
   void SetPropertyBufferSize(Render::PropertyBuffer* propertyBuffer, size_t size );
 
   /**
+   * Set the geometry type of an existing render geometry
+   * @param[in] geometry The render geometry
+   * @param[in] geometryType The new geometry type
+   */
+  void SetGeometryType( RenderGeometry* geometry, int geometryType );
+
+  /**
+   * Set if an existing geometry requires depth testing
+   * @param[in] geometry The render geometry
+   * @param[in] requiresDepthTest True if depth testing is required, false otherwise
+   */
+  void SetGeometryRequiresDepthTest( RenderGeometry* geometry, bool requiresDepthTest );
+
+  /**
    * Adds a render tracker to the RenderManager. RenderManager takes ownership of the
    * tracker. The lifetime of the tracker is related to the lifetime of the tracked
    * object, usually an offscreen render task.
diff --git a/dali/internal/render/data-providers/geometry-data-provider.h b/dali/internal/render/data-providers/geometry-data-provider.h
deleted file mode 100644 (file)
index 8d9487c..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_GEOMETRY_DATA_PROVIDER_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_GEOMETRY_DATA_PROVIDER_H__
-/*
- * Copyright (c) 2015 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.
- *
- */
-
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/common/owner-container.h>
-#include <dali/internal/common/buffer-index.h>
-#include <dali/internal/render/data-providers/property-buffer-data-provider.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace SceneGraph
-{
-class PropertyBuffer;
-
-/**
- * An interface to provide geometry properties to the render thread.
- */
-class GeometryDataProvider
-{
-public:
-  typedef Dali::Geometry::GeometryType GeometryType;
-
-  /**
-   * Constructor. Nothing to do as a pure interface.
-   */
-  GeometryDataProvider() { }
-
-public: // GeometryDataProvider
-  /**
-   * Get the type of geometry to draw
-   */
-  virtual GeometryType GetGeometryType( BufferIndex bufferIndex ) const = 0;
-
-  /**
-   * @todo MESH_REWORK - Should only use this in Update Sorting algorithm
-   * Returns true if this geometry requires depth testing, e.g. if it is
-   * a set of vertices with differing z values.
-   */
-  virtual bool GetRequiresDepthTesting( BufferIndex bufferIndex ) const = 0;
-
-protected:
-
-  /**
-   * Virtual destructor, this is an interface, no deletion through this interface
-   */
-  virtual ~GeometryDataProvider() { }
-};
-
-} // SceneGraph
-} // Internal
-} // Dali
-
-#endif // __DALI_INTERNAL_SCENE_GRAPH_GEOMETRY_DATA_PROVIDER_H__
index 2f40f90..0aaf795 100644 (file)
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+#include <dali/internal/common/buffer-index.h>
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/actors/blending.h>
 
index 6b60e04..347d66d 100644 (file)
@@ -18,7 +18,6 @@
  *
  */
 
-#include <dali/internal/render/data-providers/geometry-data-provider.h>
 #include <dali/internal/render/data-providers/material-data-provider.h>
 #include <dali/internal/render/data-providers/node-data-provider.h>
 #include <dali/internal/render/data-providers/property-buffer-data-provider.h>
index f48bee0..5a3961f 100644 (file)
  */
 
 #include <dali/internal/render/renderers/render-geometry.h>
-
 #include <dali/internal/common/buffer-index.h>
-#include <dali/internal/update/rendering/scene-graph-geometry.h>
-#include <dali/internal/render/data-providers/render-data-provider.h>
 #include <dali/internal/render/gl-resources/context.h>
 #include <dali/internal/render/gl-resources/gpu-buffer.h>
 #include <dali/internal/render/renderers/render-property-buffer.h>
@@ -31,9 +28,10 @@ namespace Internal
 namespace SceneGraph
 {
 
-RenderGeometry::RenderGeometry( const GeometryDataProvider& geometryDataProvider )
-: mGeometryDataProvider( geometryDataProvider ),
-  mIndexBuffer(0),
+RenderGeometry::RenderGeometry( GeometryType type, bool requiresDepthTest )
+: mIndexBuffer(0),
+  mGeometryType( type ),
+  mRequiresDepthTest(requiresDepthTest ),
   mHasBeenUpdated(false),
   mAttributesChanged(true)
 {
@@ -163,8 +161,7 @@ void RenderGeometry::UploadAndDraw(
   }
 
   //Draw call
-  GeometryDataProvider::GeometryType type = mGeometryDataProvider.GetGeometryType( bufferIndex );
-  switch(type)
+  switch(mGeometryType)
   {
     case Dali::Geometry::TRIANGLES:
     {
index c8878cb..7ac3e75 100644 (file)
@@ -22,8 +22,8 @@
 #include <dali/integration-api/gl-defines.h>
 #include <dali/internal/common/buffer-index.h>
 #include <dali/internal/common/owner-pointer.h>
-#include <dali/internal/render/data-providers/render-data-provider.h>
 #include <dali/integration-api/gl-abstraction.h>
+#include <dali/internal/update/rendering/scene-graph-geometry.h>
 
 namespace Dali
 {
@@ -40,8 +40,6 @@ class PropertyBuffer;
 
 namespace SceneGraph
 {
-class RenderDataProvider;
-class GeometryDataProvider;
 
 /**
  * This class encapsulates the GPU buffers. It is used to upload vertex data
@@ -52,11 +50,14 @@ class RenderGeometry
 {
 public:
 
+  typedef SceneGraph::Geometry::GeometryType GeometryType;
   /**
    * Constructor. Creates a render geometry object with no GPU buffers.
+   * @param[in] center The center of the geometry
+   * @param[in] geometryType The geometry type
+   * @param[in] requiresDepthTest True if geometry requires depth testing, false otherwise
    */
-  RenderGeometry( const GeometryDataProvider& geometryDataProvider );
-
+  RenderGeometry( GeometryType geometryType, bool requiresDepthTest );
   /**
    * Destructor
    */
@@ -108,6 +109,33 @@ public:
   }
 
   /**
+   * Sets the geometry type
+   * @param[in] type The new geometry type
+   */
+  void SetGeometryType( GeometryType type )
+  {
+    mGeometryType = type;
+  }
+
+  /**
+   * Sets if the geometry requires depth testing
+   * @param[in] requiresDepthTest True if depth testing is required, false otherwise
+   */
+  void SetRequiresDepthTest( bool requiresDepthTest )
+  {
+    mRequiresDepthTest = requiresDepthTest;
+  }
+
+  /**
+   * Check if geometry requires depth testing
+   * @return True if depth testing is required, false otherwise
+   */
+  bool RequiresDepthTest() const
+  {
+    return mRequiresDepthTest;
+  }
+
+  /**
    * Upload the geometry if it has changed, set up the attributes and perform
    * the Draw call corresponding to the geometry type
    * @param[in] context The GL context
@@ -120,15 +148,17 @@ public:
 
 private:
 
-  const GeometryDataProvider& mGeometryDataProvider;  //Reference to update thread object
-
   // PropertyBuffers
   Render::PropertyBuffer* mIndexBuffer;
   Vector<Render::PropertyBuffer*> mVertexBuffers;
 
+  GeometryType  mGeometryType;
+
   // Booleans
+  bool mRequiresDepthTest : 1;
   bool mHasBeenUpdated : 1;
   bool mAttributesChanged : 1;
+
 };
 
 } // namespace SceneGraph
index ae500f7..ba44229 100644 (file)
@@ -71,6 +71,11 @@ void NewRenderer::SetGeometry( SceneGraph::RenderGeometry* renderGeometry )
 // @todo MESH_REWORK Should use Update thread objects only in PrepareRenderInstructions.
 bool NewRenderer::RequiresDepthTest() const
 {
+  if( mRenderGeometry )
+  {
+    return mRenderGeometry->RequiresDepthTest();
+  }
+
   return true;
 }
 
index 0c49a26..8051534 100644 (file)
@@ -109,6 +109,28 @@ void RenderMessageDispatcher::RemovePropertyBuffer( RenderGeometry& renderGeomet
   new (slot) DerivedType( &mRenderManager, &RenderManager::RemovePropertyBuffer, &renderGeometry, propertyBuffer );
 }
 
+void RenderMessageDispatcher::SetGeometryType( RenderGeometry& geometry, int geometryType )
+{
+  typedef MessageValue2< RenderManager, RenderGeometry*, int > DerivedType;
+
+  // Reserve some memory inside the render queue
+  unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+
+  // Construct message in the render queue memory; note that delete should not be called on the return value
+  new (slot) DerivedType( &mRenderManager, &RenderManager::SetGeometryType, &geometry, geometryType );
+}
+
+void RenderMessageDispatcher::SetGeometryRequiresDepthTest( RenderGeometry& geometry, bool requiresDepthTest )
+{
+  typedef MessageValue2< RenderManager, RenderGeometry*, bool > DerivedType;
+
+  // Reserve some memory inside the render queue
+  unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+
+  // Construct message in the render queue memory; note that delete should not be called on the return value
+  new (slot) DerivedType( &mRenderManager, &RenderManager::SetGeometryRequiresDepthTest, &geometry, requiresDepthTest );
+}
+
 void RenderMessageDispatcher::AddRenderTracker( RenderTracker& renderTracker )
 {
   typedef MessageValue1< RenderManager, RenderTracker* > DerivedType;
index 92c2164..2cb6a60 100644 (file)
@@ -104,6 +104,20 @@ public:
   void RemovePropertyBuffer( RenderGeometry& renderGeometry, Render::PropertyBuffer* propertyBuffer );
 
   /**
+   * Set the geometry type of an existing render geometry
+   * @param[in] geometry The render geometry
+   * @param[in] geometryType The new geometry type
+   */
+  void SetGeometryType( RenderGeometry& geometry, int geometryType );
+
+  /**
+   * Set if an existing geometry requires depth testing
+   * @param[in] geometry The render geometry
+   * @param[in] requiresDepthTest True if depth testing is required, false otherwise
+   */
+  void SetGeometryRequiresDepthTest( RenderGeometry& geometry, bool requiresDepthTest );
+
+  /**
    * Add a Render tracker.
    * @param[in] renderTracker The render tracker to add.
    * @post ownership is transferred
index 7271343..8b712d1 100644 (file)
@@ -31,12 +31,11 @@ namespace SceneGraph
 {
 
 Geometry::Geometry()
-: mIndexBuffer( NULL ),
-  mRenderGeometry(0),
-  mSceneController(0),
-  mRendererRefCount(0u),
-  mCenter(),
+: mRenderGeometry(NULL),
+  mSceneController(NULL),
+  mIndexBuffer( NULL ),
   mGeometryType(Dali::Geometry::TRIANGLES),
+  mRendererRefCount(0u),
   mRequiresDepthTest(false)
 {
 
@@ -108,9 +107,22 @@ void Geometry::ClearIndexBuffer()
   mConnectionObservers.ConnectionsChanged(*this);
 }
 
-void Geometry::SetGeometryType( BufferIndex bufferIndex, Geometry::GeometryType geometryType )
+void Geometry::SetGeometryType(Geometry::GeometryType geometryType )
 {
-  mGeometryType.Set( bufferIndex, geometryType);
+  mGeometryType = geometryType;
+  if( mRenderGeometry )
+  {
+    mSceneController->GetRenderMessageDispatcher().SetGeometryType( *mRenderGeometry, static_cast<int>(geometryType) );
+  }
+}
+
+void Geometry::SetRequiresDepthTest( bool requiresDepthTest )
+{
+  mRequiresDepthTest = requiresDepthTest;
+  if( mRenderGeometry )
+  {
+    mSceneController->GetRenderMessageDispatcher().SetGeometryRequiresDepthTest( *mRenderGeometry, requiresDepthTest );
+  }
 }
 
 Vector<Render::PropertyBuffer*>& Geometry::GetVertexBuffers()
@@ -125,23 +137,12 @@ Render::PropertyBuffer* Geometry::GetIndexBuffer()
 
 Geometry::GeometryType Geometry::GetGeometryType( BufferIndex bufferIndex) const
 {
-  int geometryType = mGeometryType[ bufferIndex ];
-  return static_cast< GeometryDataProvider::GeometryType > ( geometryType );
+  return mGeometryType;
 }
 
 bool Geometry::GetRequiresDepthTesting( BufferIndex bufferIndex ) const
 {
-  return mRequiresDepthTest.GetBoolean( bufferIndex );
-}
-
-void Geometry::ResetDefaultProperties( BufferIndex updateBufferIndex )
-{
-  // Reset the animated properties
-  mCenter.ResetToBaseValue( updateBufferIndex );
-
-  // Age the double buffered properties
-  mGeometryType.CopyPrevious(updateBufferIndex);
-  mRequiresDepthTest.CopyPrevious(updateBufferIndex);
+  return mRequiresDepthTest;
 }
 
 void Geometry::ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex )
@@ -175,7 +176,7 @@ RenderGeometry* Geometry::GetRenderGeometry(SceneController* sceneController)
   {
     //Create RenderGeometry
     mSceneController = sceneController;
-    mRenderGeometry = new RenderGeometry( *this );
+    mRenderGeometry = new RenderGeometry( mGeometryType, mRequiresDepthTest );
 
     size_t vertexBufferCount( mVertexBuffers.Size() );
     for( size_t i(0); i<vertexBufferCount; ++i )
index 36e2083..4e58fba 100644 (file)
@@ -26,7 +26,6 @@
 #include <dali/internal/update/common/property-boolean.h>
 #include <dali/internal/update/common/uniform-map.h>
 #include <dali/internal/update/common/scene-graph-connection-change-propagator.h>
-#include <dali/internal/render/data-providers/geometry-data-provider.h>
 #include <dali/internal/render/data-providers/render-data-provider.h>
 
 namespace Dali
@@ -46,10 +45,11 @@ class RenderGeometry;
  * This scene graph object is a property owner. It describes a geometry using a
  * number of PropertyBuffers acting as Vertex buffers.
  */
-class Geometry : public PropertyOwner, public GeometryDataProvider, public UniformMap::Observer
+class Geometry : public PropertyOwner, public UniformMap::Observer
 {
 public:
 
+  typedef Dali::Geometry::GeometryType GeometryType;
   /**
    * Constructor
    */
@@ -88,7 +88,13 @@ public:
    * @param[in] bufferIndex Index for double buffered values
    * @param[in] geometryType The geometry type
    */
-  void SetGeometryType( BufferIndex bufferIndex, GeometryType geometryType );
+  void SetGeometryType( GeometryType geometryType );
+
+  /**
+   * Set if the geometry requires depth testing
+   * @param[in] requiresDepthTest True if depth testing is required, false otherwise
+   */
+  void SetRequiresDepthTest( bool requiresDepthTest );
 
   /**
    * Connect the object to the scene graph
@@ -160,26 +166,19 @@ public: // GeometryDataProvider
    */
   virtual bool GetRequiresDepthTesting( BufferIndex bufferIndex ) const;
 
-protected: // From PropertyOwner
-  /**
-   * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
-   */
-  virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
-
 private:
 
+  RenderGeometry*  mRenderGeometry;
+  SceneController* mSceneController;
+
+  Render::PropertyBuffer*         mIndexBuffer;   ///< The index buffer if required
   Vector<Render::PropertyBuffer*> mVertexBuffers; ///< The vertex buffers
-  Render::PropertyBuffer* mIndexBuffer;  ///< The index buffer if required
-  ConnectionChangePropagator mConnectionObservers;
 
-  RenderGeometry*               mRenderGeometry;
-  SceneController*              mSceneController;
-  unsigned int                  mRendererRefCount;
+  ConnectionChangePropagator mConnectionObservers;
 
-public: // Properties
-  AnimatableProperty<Vector3>   mCenter;
-  DoubleBufferedProperty<int>   mGeometryType;
-  DoubleBufferedProperty<bool>  mRequiresDepthTest;
+  Geometry::GeometryType  mGeometryType;
+  unsigned int            mRendererRefCount;
+  bool                    mRequiresDepthTest;
 };
 
 inline void AddVertexBufferMessage( EventThreadServices& eventThreadServices , const Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
@@ -236,7 +235,7 @@ namespace SceneGraph
 
 inline void SetGeometryTypeMessage( EventThreadServices& eventThreadServices, const Geometry& geometry, SceneGraph::Geometry::GeometryType geometryType )
 {
-  typedef MessageDoubleBuffered1< Geometry, SceneGraph::Geometry::GeometryType > LocalType;
+  typedef MessageValue1< Geometry, SceneGraph::Geometry::GeometryType > LocalType;
 
   // Reserve some memory inside the message queue
   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -245,6 +244,17 @@ inline void SetGeometryTypeMessage( EventThreadServices& eventThreadServices, co
   new (slot) LocalType( &geometry, &Geometry::SetGeometryType, geometryType );
 }
 
+inline void SetGeometryRequiresDepthTestMessage( EventThreadServices& eventThreadServices, const Geometry& geometry, bool requiresDepthTest )
+{
+  typedef MessageValue1< Geometry, 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( &geometry, &Geometry::SetRequiresDepthTest, requiresDepthTest );
+}
+
 } // namespace SceneGraph
 } // namespace Internal
 } // namespace Dali
index d714a86..748a059 100644 (file)
@@ -27,7 +27,6 @@
 #include <dali/internal/update/common/property-boolean.h>
 #include <dali/internal/update/common/uniform-map.h>
 #include <dali/internal/update/common/scene-graph-connection-change-propagator.h>
-#include <dali/internal/render/data-providers/geometry-data-provider.h>
 #include <dali/internal/render/data-providers/render-data-provider.h>
 #include <dali/internal/render/renderers/render-new-renderer.h>
 #include <dali/internal/update/resources/resource-manager.h>