Added getters in Renderer to get material and geometry, and in Material to get samplers 96/39796/3
authorFerran Sole <ferran.sole@samsung.com>
Fri, 22 May 2015 11:26:53 +0000 (12:26 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Mon, 1 Jun 2015 08:45:22 +0000 (09:45 +0100)
Change-Id: Ib290d16ff63fe35cb1d7925e153c4ee6bfc6bee1

dali/internal/event/actors/renderer-impl.cpp
dali/internal/event/actors/renderer-impl.h
dali/internal/event/effects/material-impl.cpp
dali/internal/event/effects/material-impl.h
dali/public-api/actors/renderer.cpp
dali/public-api/actors/renderer.h
dali/public-api/shader-effects/material.cpp
dali/public-api/shader-effects/material.h

index 3085c6a..0c83a08 100644 (file)
@@ -60,6 +60,11 @@ void Renderer::SetGeometry( Geometry& geometry )
   SetGeometryMessage( GetEventThreadServices(), *mSceneObject, *geometrySceneObject );
 }
 
+Geometry* Renderer::GetGeometry() const
+{
+  return mGeometryConnector.Get().Get();
+}
+
 void Renderer::SetMaterial( Material& material )
 {
   mMaterialConnector.Set( material, OnStage() );
@@ -67,6 +72,11 @@ void Renderer::SetMaterial( Material& material )
   SetMaterialMessage( GetEventThreadServices(), *mSceneObject, *materialSceneObject );
 }
 
+Material* Renderer::GetMaterial() const
+{
+  return mMaterialConnector.Get().Get();
+}
+
 void Renderer::SetDepthIndex( int depthIndex )
 {
   SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex );
index 64fa58c..f02a3ac 100644 (file)
@@ -59,11 +59,21 @@ public:
   void SetGeometry( Geometry& geometry );
 
   /**
+   * @copydoc Dali::Renderer::GetGeometry()
+   */
+  Geometry* GetGeometry() const;
+
+  /**
    * @copydoc Dali::Renderer::SetMaterial()
    */
   void SetMaterial( Material& material );
 
   /**
+   * @copydoc Dali::Renderer::GetMaterial()
+   */
+  Material* GetMaterial() const;
+
+  /**
    * @copydoc Dali::Renderer::SetDepthIndex()
    */
   void SetDepthIndex( int depthIndex );
index ecfd1fd..a769c1e 100644 (file)
@@ -90,6 +90,11 @@ void Material::RemoveSampler( std::size_t index )
   mSamplerConnectors.erase( mSamplerConnectors.begin() + index );
 }
 
+Sampler* Material::GetSamplerAt( unsigned int index ) const
+{
+  return mSamplerConnectors[index].Get().Get();
+}
+
 void Material::SetFaceCullingMode( Dali::Material::FaceCullingMode cullingMode )
 {
   if( NULL != mSceneObject )
index 48392c2..7691a43 100644 (file)
@@ -80,6 +80,11 @@ public:
   void RemoveSampler( std::size_t index );
 
   /**
+   * @copydoc Dali::Material::GetSamplerAt()
+   */
+  Sampler* GetSamplerAt( unsigned int index ) const;
+
+  /**
    * @copydoc Dali::Material::SetFaceCullingMode()
    */
   void SetFaceCullingMode( Dali::Material::FaceCullingMode cullingMode );
index 2af1722..e9705f3 100644 (file)
@@ -62,12 +62,24 @@ void Renderer::SetGeometry( Geometry& geometry )
   GetImplementation(*this).SetGeometry( GetImplementation(geometry) );
 }
 
+Geometry Renderer::GetGeometry() const
+{
+  Internal::Geometry* geometryPtr( GetImplementation(*this).GetGeometry() );
+  return Dali::Geometry( geometryPtr );
+}
+
 void Renderer::SetMaterial( Material& material )
 {
   DALI_ASSERT_ALWAYS( material && "Material handle not initialized" );
   GetImplementation(*this).SetMaterial( GetImplementation(material) );
 }
 
+Material Renderer::GetMaterial() const
+{
+  Internal::Material* materialPtr( GetImplementation(*this).GetMaterial() );
+  return Dali::Material( materialPtr );
+}
+
 void Renderer::SetDepthIndex( int depthIndex )
 {
   GetImplementation(*this).SetDepthIndex( depthIndex );
index 758b361..e718fb2 100644 (file)
@@ -103,6 +103,13 @@ public:
   void SetGeometry( Geometry& geometry );
 
   /**
+   * @brief Gets the geometry used by this renderer
+   *
+   * @return The geometry used by the renderer
+   */
+  Geometry GetGeometry() const;
+
+  /**
    * @brief Sets the material to be used by this renderer
    *
    * @param[in] material The material to be used by this renderer
@@ -110,6 +117,13 @@ public:
   void SetMaterial( Material& material );
 
   /**
+   * @brief Gets the material used by this renderer
+   *
+   * @return The material used by the renderer
+   */
+  Material GetMaterial() const;
+
+  /**
    * @brief Set the depth index of this renderer
    *
    * Renderer with higher depth indices are rendered in front of other renderers with smaller values
index 3a13458..c5ac258 100644 (file)
@@ -81,6 +81,12 @@ void Material::RemoveSampler( std::size_t index )
   GetImplementation(*this).RemoveSampler( index );
 }
 
+Sampler Material::GetSamplerAt( unsigned int index ) const
+{
+  Internal::Sampler* samplerPtr( GetImplementation(*this).GetSamplerAt(index) );
+  return Dali::Sampler( samplerPtr );
+}
+
 void Material::SetFaceCullingMode( FaceCullingMode cullingMode )
 {
   GetImplementation(*this).SetFaceCullingMode( cullingMode );
index b6bcbe9..f5c21f7 100644 (file)
@@ -155,6 +155,16 @@ public:
   void RemoveSampler( std::size_t index );
 
   /**
+   * @brief Get the sampler at the given index for this material
+   *
+   * The index must be between 0 and GetNumberOfSamplers()-1
+   *
+   * @param[in] index The index of the sampler
+   * @return The sampler at that index
+   */
+  Sampler GetSamplerAt( unsigned int index ) const;
+
+  /**
    * @brief Set the culling mode for this material
    *
    * Calling this function sets the properties CULLING_MODE