Migrated methods from SceneGraph::RenderableAttachment to ImageAttachment 92/36392/4
authorDavid Steele <david.steele@partner.samsung.com>
Wed, 4 Mar 2015 18:12:18 +0000 (18:12 +0000)
committerDavid Steele <david.steele@partner.samsung.com>
Wed, 11 Mar 2015 19:48:27 +0000 (19:48 +0000)
Change-Id: I01116e156939bdbb3c420bdde0ef7a83ea9e796c

dali/internal/event/actor-attachments/image-attachment-impl.cpp
dali/internal/event/actor-attachments/image-attachment-impl.h
dali/internal/event/actor-attachments/renderable-attachment-impl.h
dali/internal/render/shaders/scene-graph-shader.h
dali/internal/update/effects/scene-graph-sampler.cpp
dali/internal/update/effects/scene-graph-sampler.h
dali/internal/update/node-attachments/scene-graph-image-attachment.cpp
dali/internal/update/node-attachments/scene-graph-image-attachment.h
dali/internal/update/node-attachments/scene-graph-renderable-attachment.cpp
dali/internal/update/node-attachments/scene-graph-renderable-attachment.h

index cf221b8..871629f 100644 (file)
@@ -137,13 +137,12 @@ SceneGraph::ImageAttachment* ImageAttachment::CreateSceneObject()
   return SceneGraph::ImageAttachment::New( 0u );
 }
 
-const SceneGraph::RenderableAttachment& ImageAttachment::GetSceneObject() const
+const SceneGraph::ImageAttachment& ImageAttachment::GetSceneObject() const
 {
   DALI_ASSERT_DEBUG( mSceneObject != NULL );
   return *mSceneObject;
 }
 
-
 void ImageAttachment::SetSortModifier(float modifier)
 {
   // Cache for actor-side getters
index bd9bea6..b945af1 100644 (file)
@@ -255,7 +255,7 @@ private:
   /**
    * @copydoc Dali::Internal::RenderableAttachment::GetSceneObject()
    */
-  virtual const SceneGraph::RenderableAttachment& GetSceneObject() const;
+  const SceneGraph::ImageAttachment& GetSceneObject() const;
 
 protected:
 
index 7ecc53d..5d89619 100644 (file)
@@ -89,12 +89,6 @@ private:
    */
   virtual void OnStageDisconnection2() = 0;
 
-  /**
-   * For derived classes to provide a corresponding scene-graph object
-   * @return The scene-object.
-   */
-  virtual const SceneGraph::RenderableAttachment& GetSceneObject() const = 0;
-
 private: // Data, cached for actor-thread getters
 
 };
index 4e19deb..bf7def5 100644 (file)
@@ -161,6 +161,22 @@ public:
   }
 
   /**
+   * @return True if the fragment shader outputs only 1.0 on the alpha channel
+   *
+   * @note Shaders that can output any value on the alpha channel
+   * including 1.0 should return false for this.
+   */
+  bool IsOutputOpaque();
+
+  /**
+   * @return True if the fragment shader can output any value but 1.0 on the alpha channel
+   *
+   * @note Shaders that can output any value on the alpha channel
+   * including 1.0 should return false for this
+   */
+  bool IsOutputTransparent();
+
+  /**
    * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties
    */
   virtual void ResetDefaultProperties( BufferIndex updateBufferIndex )
index 1c32927..92472db 100644 (file)
@@ -75,7 +75,7 @@ Sampler::FilterMode Sampler::GetMinifyFilterMode( BufferIndex bufferIndex )
   return mMinFilter[bufferIndex];
 }
 
-Sampler::FilterMode Sampler::GetMagifyFilterMode( BufferIndex bufferIndex )
+Sampler::FilterMode Sampler::GetMagnifyFilterMode( BufferIndex bufferIndex )
 {
   // @todo MESH_REWORK
   return mMagFilter[bufferIndex];
@@ -93,6 +93,11 @@ Sampler::WrapMode Sampler::GetVWrapMode( BufferIndex bufferIndex )
   return mVWrapMode[bufferIndex];
 }
 
+bool Sampler::IsFullyOpaque()
+{
+  return true; // @todo MESH_REWORK - check the actual image. For the moment, pretend it's opaque
+}
+
 } // namespace SceneGraph
 } // namespace Internal
 } // namespace Dali
index 78d5ef0..632170a 100644 (file)
@@ -96,7 +96,7 @@ public: // SamplerDataProvider interface
    * @param[in] bufferIndex The buffer index to use
    * @return The magnify filter mode
    */
-  virtual FilterMode GetMagifyFilterMode( BufferIndex bufferIndex );
+  virtual FilterMode GetMagnifyFilterMode( BufferIndex bufferIndex );
 
   /**
    * Get the horizontal wrap mode
@@ -112,6 +112,12 @@ public: // SamplerDataProvider interface
    */
   virtual WrapMode GetVWrapMode( BufferIndex bufferIndex );
 
+  /**
+   * @return true if the texture is fully opaque.
+   * @todo MESH_REWORK Requires access to ResourceManager::GetBitmapMetadata()
+   */
+  bool IsFullyOpaque();
+
 private:
   std::string mUniformName; ///< The name of the uniform referencing this sampler
   ResourceId mTextureId;    ///< The identity of the associated texture
index 9390463..4ecc828 100644 (file)
@@ -64,7 +64,8 @@ ImageAttachment::ImageAttachment( unsigned int textureId )
   mRefreshMeshData( true ),
   mIsPixelAreaSet( false ),
   mPreviousRefreshHints( 0 ),
-  mStyle( Dali::ImageActor::STYLE_QUAD )
+  mStyle( Dali::ImageActor::STYLE_QUAD ),
+  mCullFaceMode( CullNone )
 {
 }
 
@@ -89,6 +90,13 @@ void ImageAttachment::ConnectToSceneGraph2( BufferIndex updateBufferIndex )
     // Construct message in the render queue memory; note that delete should not be called on the return value
     new (slot) DerivedType( mImageRenderer, &ImageRenderer::SetTextureId, mTextureId );
   }
+
+  // After derived classes have (potentially) created their renderer
+  Renderer& renderer = GetRenderer();
+  renderer.SetCullFace( mCullFaceMode );
+
+  // set the default shader here as well
+  renderer.SetShader( mShader );
 }
 
 void ImageAttachment::OnDestroy2()
@@ -186,6 +194,83 @@ void ImageAttachment::SetBorder( BufferIndex updateBufferIndex, const Vector4& b
   }
 }
 
+void ImageAttachment::SetBlendingOptions( BufferIndex updateBufferIndex, unsigned int options )
+{
+  // Blending options are forwarded to renderer in render-thread
+  typedef MessageValue1< Renderer, unsigned int > DerivedType;
+
+  // Reserve some memory inside the render queue
+  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+
+  // Construct message in the render queue memory; note that delete should not be called on the return value
+  new (slot) DerivedType( &GetRenderer(), &Renderer::SetBlendingOptions, options );
+}
+
+void ImageAttachment::SetBlendColor( BufferIndex updateBufferIndex, const Vector4& color )
+{
+  // Blend color is forwarded to renderer in render-thread
+  typedef MessageValue1< Renderer, Vector4 > DerivedType;
+
+  // Reserve some memory inside the render queue
+  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+
+  // Construct message in the render queue memory; note that delete should not be called on the return value
+  new (slot) DerivedType( &GetRenderer(), &Renderer::SetBlendColor, color );
+}
+
+void ImageAttachment::SetCullFace( BufferIndex updateBufferIndex, CullFaceMode mode )
+{
+  DALI_ASSERT_DEBUG(mSceneController);
+  DALI_ASSERT_DEBUG(mode >= CullNone && mode <= CullFrontAndBack);
+
+  mCullFaceMode = mode;
+
+  typedef MessageValue1< Renderer, CullFaceMode > DerivedType;
+
+  // Reserve some memory inside the render queue
+  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+
+  // Construct message in the render queue memory; note that delete should not be called on the return value
+  new (slot) DerivedType( &GetRenderer(), &Renderer::SetCullFace, mode );
+}
+
+void ImageAttachment::SetSampler( BufferIndex updateBufferIndex, unsigned int samplerBitfield )
+{
+  DALI_ASSERT_DEBUG(mSceneController);
+
+  typedef MessageValue1< Renderer, unsigned int > DerivedType;
+
+  // Reserve some memory inside the render queue
+  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+
+  // Construct message in the render queue memory; note that delete should not be called on the return value
+  new (slot) DerivedType( &GetRenderer(), &Renderer::SetSampler, samplerBitfield );
+}
+
+void ImageAttachment::ApplyShader( BufferIndex updateBufferIndex, Shader* shader )
+{
+  mShader = shader;
+
+  // send the message to renderer
+  SendShaderChangeMessage( updateBufferIndex );
+
+  // tell derived class to do something
+  ShaderChanged( updateBufferIndex );
+}
+
+void ImageAttachment::RemoveShader( BufferIndex updateBufferIndex )
+{
+  // return to default shader
+  mShader = NULL;
+
+  // send the message to renderer
+  SendShaderChangeMessage( updateBufferIndex );
+
+  // tell derived class to do something
+  ShaderChanged( updateBufferIndex );
+}
+
+
 void ImageAttachment::ShaderChanged( BufferIndex updateBufferIndex )
 {
   DALI_ASSERT_DEBUG( mSceneController );
@@ -348,6 +433,17 @@ bool ImageAttachment::IsFullyOpaque( BufferIndex updateBufferIndex )
   return opaque;
 }
 
+void ImageAttachment::SendShaderChangeMessage( BufferIndex updateBufferIndex )
+{
+  typedef MessageValue1< Renderer, Shader* > DerivedType;
+  // Reserve memory inside the render queue
+  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+  // Construct message in the mRenderer queue memory; note that delete should not be called on the return value
+  new (slot) DerivedType( &GetRenderer(), &Renderer::SetShader, mShader );
+}
+
+
+
 } // namespace SceneGraph
 
 } // namespace Internal
index 6c39a63..bd83297 100644 (file)
@@ -127,7 +127,52 @@ public:
   void SetBorder( BufferIndex updateBufferIndex, const Vector4& border, bool inPixels );
 
   /**
-   * @copydoc RenderableAttachment::ShaderChanged()
+   * Set the blending options. This should only be called from the update-thread.
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @param[in] options A bitmask of blending options.
+   */
+  void SetBlendingOptions( BufferIndex updateBufferIndex, unsigned int options );
+
+  /**
+   * Set the blend-color. This should only be called from the update-thread.
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @param[in] color The new blend-color.
+   */
+  void SetBlendColor( BufferIndex updateBufferIndex, const Vector4& color );
+
+  /**
+   * Set the face-culling mode.
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @param[in] mode The face-culling mode.
+   */
+  void SetCullFace( BufferIndex updateBufferIndex, CullFaceMode mode );
+
+  /**
+   * Set the sampler used to render the texture for this renderable.
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @param[in] samplerBitfield The image sampler packed options to set.
+   */
+  void SetSampler( BufferIndex updateBufferIndex, unsigned int samplerBitfield );
+
+  /**
+   * Apply a shader on the renderable
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @param[in] shader to apply.
+   */
+  void ApplyShader( BufferIndex updateBufferIndex, Shader* shader );
+
+  /**
+   * Remove the shader from the renderable
+   * @param[in] updateBufferIndex The current update buffer index.
+   */
+  void RemoveShader( BufferIndex updateBufferIndex );
+
+  /**
+   * Called to notify that the shader might have been changed
+   * The implementation should recalculate geometry and scale based on the
+   * hints from the new shader
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @return Return true if the geometry changed.
    */
   virtual void ShaderChanged( BufferIndex updateBufferIndex );
 
@@ -154,6 +199,11 @@ protected:
   ImageAttachment( unsigned int textureId );
 
 private:
+  /**
+   * Sends the shader to the renderer
+   * @param updateBufferIndex for the message buffer
+   */
+  void SendShaderChangeMessage( BufferIndex updateBufferIndex );
 
   /**
    * @copydoc RenderableAttachment::ConnectToSceneGraph2().
@@ -192,6 +242,7 @@ private: // Data
   bool mIsPixelAreaSet       : 1; ///< Whether pixel area is set, cached for image actor to be able to ask for it
   int  mPreviousRefreshHints : 4; ///< The shader geometry hints, when the vertex buffer was last refreshed, 4 bits is enough as there's 4 flags
   Style mStyle               : 2; ///< rendering style, 2 bits is enough as only 2 values in the enum
+  CullFaceMode mCullFaceMode : 3; ///< Cullface mode, 3 bits is enough for 4 values
 
   BitmapMetadata  mBitmapMetadata;///< The bitmap metadata
   Vector2 mGeometrySize;          ///< The size of the currently used geometry
@@ -255,6 +306,84 @@ inline void SetNinePatchBorderMessage( EventToUpdate& eventToUpdate, const Image
   new (slot) LocalType( &attachment, &ImageAttachment::SetBorder, border, inPixels );
 }
 
+inline void SetSortModifierMessage( EventToUpdate& eventToUpdate, const ImageAttachment& attachment, float modifier )
+{
+  typedef MessageValue1< ImageAttachment, float > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventToUpdate.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, &ImageAttachment::SetSortModifier, modifier );
+}
+
+inline void SetCullFaceMessage( EventToUpdate& eventToUpdate, const ImageAttachment& attachment, CullFaceMode mode )
+{
+  typedef MessageDoubleBuffered1< ImageAttachment, CullFaceMode > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventToUpdate.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, &ImageAttachment::SetCullFace, mode );
+}
+
+inline void SetBlendingOptionsMessage( EventToUpdate& eventToUpdate, const ImageAttachment& attachment, unsigned int options )
+{
+  typedef MessageDoubleBuffered1< ImageAttachment, unsigned int > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
+
+  new (slot) LocalType( &attachment, &ImageAttachment::SetBlendingOptions, options );
+}
+
+inline void SetBlendColorMessage( EventToUpdate& eventToUpdate, const ImageAttachment& attachment, const Vector4& color )
+{
+  typedef MessageDoubleBuffered1< ImageAttachment, Vector4 > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
+
+  new (slot) LocalType( &attachment, &ImageAttachment::SetBlendColor, color );
+}
+
+inline void SetSamplerMessage( EventToUpdate& eventToUpdate, const ImageAttachment& attachment, unsigned int samplerBitfield )
+{
+  typedef MessageDoubleBuffered1< ImageAttachment, unsigned int > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventToUpdate.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, &ImageAttachment::SetSampler, samplerBitfield );
+}
+
+inline void ApplyShaderMessage( EventToUpdate& eventToUpdate, const ImageAttachment& attachment, const Shader& constShader )
+{
+  // Update thread can edit the object
+  Shader& shader = const_cast< Shader& >( constShader );
+
+  typedef MessageDoubleBuffered1< ImageAttachment, Shader* > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventToUpdate.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, &ImageAttachment::ApplyShader, &shader );
+}
+
+inline void RemoveShaderMessage( EventToUpdate& eventToUpdate, const ImageAttachment& attachment )
+{
+  typedef MessageDoubleBuffered0< ImageAttachment > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventToUpdate.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, &ImageAttachment::RemoveShader );
+}
+
 } // namespace SceneGraph
 
 } // namespace Internal
index ac18ea1..1ba9c7a 100644 (file)
@@ -39,17 +39,6 @@ namespace Internal
 namespace SceneGraph
 {
 
-void RenderableAttachment::SetSortModifier(float modifier)
-{
-  // Setting sort modifier makes the node dirty, i.e. we cannot reuse previous frames render items
-  if( mParent )
-  {
-    // only do this if we are on-stage
-    mParent->SetDirtyFlag( SortModifierFlag );
-  }
-  mSortModifier = modifier;
-}
-
 void RenderableAttachment::SetBlendingMode( BlendingMode::Type mode )
 {
   mBlendingMode = mode;
@@ -60,46 +49,6 @@ BlendingMode::Type RenderableAttachment::GetBlendingMode() const
   return mBlendingMode;
 }
 
-void RenderableAttachment::ChangeBlending( BufferIndex updateBufferIndex, bool useBlend )
-{
-  if ( mUseBlend != useBlend )
-  {
-    mUseBlend = useBlend;
-
-    // Enable/disable blending in the next render
-    typedef MessageValue1< Renderer, bool > DerivedType;
-
-    // Reserve some memory inside the render queue
-    unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-
-    // Construct message in the render queue memory; note that delete should not be called on the return value
-    new (slot) DerivedType( &GetRenderer(), &Renderer::SetUseBlend, useBlend );
-  }
-}
-
-void RenderableAttachment::SetBlendingOptions( BufferIndex updateBufferIndex, unsigned int options )
-{
-  // Blending options are forwarded to renderer in render-thread
-  typedef MessageValue1< Renderer, unsigned int > DerivedType;
-
-  // Reserve some memory inside the render queue
-  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-
-  // Construct message in the render queue memory; note that delete should not be called on the return value
-  new (slot) DerivedType( &GetRenderer(), &Renderer::SetBlendingOptions, options );
-}
-
-void RenderableAttachment::SetBlendColor( BufferIndex updateBufferIndex, const Vector4& color )
-{
-  // Blend color is forwarded to renderer in render-thread
-  typedef MessageValue1< Renderer, Vector4 > DerivedType;
-
-  // Reserve some memory inside the render queue
-  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-
-  // Construct message in the render queue memory; note that delete should not be called on the return value
-  new (slot) DerivedType( &GetRenderer(), &Renderer::SetBlendColor, color );
-}
 
 void RenderableAttachment::PrepareResources( BufferIndex updateBufferIndex, ResourceManager& resourceManager )
 {
@@ -161,34 +110,6 @@ void RenderableAttachment::FollowTracker( Integration::ResourceId id )
   }
 }
 
-void RenderableAttachment::SetCullFace( BufferIndex updateBufferIndex, CullFaceMode mode )
-{
-  DALI_ASSERT_DEBUG(mSceneController);
-  DALI_ASSERT_DEBUG(mode >= CullNone && mode <= CullFrontAndBack);
-
-  mCullFaceMode = mode;
-
-  typedef MessageValue1< Renderer, CullFaceMode > DerivedType;
-
-  // Reserve some memory inside the render queue
-  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-
-  // Construct message in the render queue memory; note that delete should not be called on the return value
-  new (slot) DerivedType( &GetRenderer(), &Renderer::SetCullFace, mode );
-}
-
-void RenderableAttachment::SetSampler( BufferIndex updateBufferIndex, unsigned int samplerBitfield )
-{
-  DALI_ASSERT_DEBUG(mSceneController);
-
-  typedef MessageValue1< Renderer, unsigned int > DerivedType;
-
-  // Reserve some memory inside the render queue
-  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-
-  // Construct message in the render queue memory; note that delete should not be called on the return value
-  new (slot) DerivedType( &GetRenderer(), &Renderer::SetSampler, samplerBitfield );
-}
 
 void RenderableAttachment::SetRecalculateScaleForSize()
 {
@@ -201,29 +122,6 @@ void RenderableAttachment::GetScaleForSize( const Vector3& nodeSize, Vector3& sc
   mScaleForSizeDirty = false;
 }
 
-void RenderableAttachment::ApplyShader( BufferIndex updateBufferIndex, Shader* shader )
-{
-  mShader = shader;
-
-  // send the message to renderer
-  SendShaderChangeMessage( updateBufferIndex );
-
-  // tell derived class to do something
-  ShaderChanged( updateBufferIndex );
-}
-
-void RenderableAttachment::RemoveShader( BufferIndex updateBufferIndex )
-{
-  // return to default shader
-  mShader = NULL;
-
-  // send the message to renderer
-  SendShaderChangeMessage( updateBufferIndex );
-
-  // tell derived class to do something
-  ShaderChanged( updateBufferIndex );
-}
-
 bool RenderableAttachment::ResolveVisibility( BufferIndex updateBufferIndex )
 {
   mHasSizeAndColorFlag = false;
@@ -318,6 +216,23 @@ bool RenderableAttachment::IsBlendingOn( BufferIndex updateBufferIndex )
   return blend;
 }
 
+void RenderableAttachment::ChangeBlending( BufferIndex updateBufferIndex, bool useBlend )
+{
+  if ( mUseBlend != useBlend )
+  {
+    mUseBlend = useBlend;
+
+    // Enable/disable blending in the next render
+    typedef MessageValue1< Renderer, bool > DerivedType;
+
+    // Reserve some memory inside the render queue
+    unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
+
+    // Construct message in the render queue memory; note that delete should not be called on the return value
+    new (slot) DerivedType( &GetRenderer(), &Renderer::SetUseBlend, useBlend );
+  }
+}
+
 void RenderableAttachment::PrepareRender( BufferIndex updateBufferIndex )
 {
   // call the derived class first as it might change its state regarding blending
@@ -339,8 +254,7 @@ RenderableAttachment::RenderableAttachment( bool usesGeometryScaling )
   mHasSizeAndColorFlag( false ),
   mResourcesReady( false ),
   mFinishedResourceAcquisition( false ),
-  mHasUntrackedResources( false ),
-  mCullFaceMode( CullNone )
+  mHasUntrackedResources( false )
 {
 }
 
@@ -355,12 +269,7 @@ void RenderableAttachment::ConnectToSceneGraph( SceneController& sceneController
   // Chain to derived attachments
   ConnectToSceneGraph2( updateBufferIndex );
 
-  // After derived classes have (potentially) created their renderer
-  Renderer& renderer = GetRenderer();
-  renderer.SetCullFace( mCullFaceMode );
-
-  // set the default shader here as well
-  renderer.SetShader( mShader );
+  // @todo MESH_REWORK: removed: renderer.SetCullFace & renderer.SetShader;
 }
 
 void RenderableAttachment::OnDestroy()
@@ -377,15 +286,18 @@ RenderableAttachment* RenderableAttachment::GetRenderable()
   return this;
 }
 
-void RenderableAttachment::SendShaderChangeMessage( BufferIndex updateBufferIndex )
+void RenderableAttachment::SetSortModifier(float modifier)
 {
-  typedef MessageValue1< Renderer, Shader* > DerivedType;
-  // Reserve memory inside the render queue
-  unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-  // Construct message in the mRenderer queue memory; note that delete should not be called on the return value
-  new (slot) DerivedType( &GetRenderer(), &Renderer::SetShader, mShader );
+  // Setting sort modifier makes the node dirty, i.e. we cannot reuse previous frames render items
+  if( mParent )
+  {
+    // only do this if we are on-stage
+    mParent->SetDirtyFlag( SortModifierFlag );
+  }
+  mSortModifier = modifier;
 }
 
+
 } // namespace SceneGraph
 
 } // namespace Internal
index 57a33c9..f208e8c 100644 (file)
@@ -51,22 +51,6 @@ class RenderableAttachment : public NodeAttachment
 public: // API
 
   /**
-   * Set the sort-modifier for the attachment.
-   * @param[in] modifier The depth-sort modifier.
-   */
-  void SetSortModifier(float modifier);
-
-  /**
-   * Retrieve the sort-modifier for the attachment.
-   * @return The sort-modifier.
-   */
-  float GetSortModifier() const
-  {
-    // inlined as its called a lot when sorting transparent renderers
-    return mSortModifier;
-  }
-
-  /**
    * @See Dali::RenderableActor::SetBlendMode().
    */
   void SetBlendingMode( BlendingMode::Type mode );
@@ -77,41 +61,6 @@ public: // API
   BlendingMode::Type GetBlendingMode() const;
 
   /**
-   * Check if the blending mode has changed - if it has, send message to renderer
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] useBlending True if the renderer should use blending option
-   */
-  void ChangeBlending( BufferIndex updateBufferIndex, bool useBlending );
-
-  /**
-   * Set the blending options. This should only be called from the update-thread.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] options A bitmask of blending options.
-   */
-  void SetBlendingOptions( BufferIndex updateBufferIndex, unsigned int options );
-
-  /**
-   * Set the blend-color. This should only be called from the update-thread.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] color The new blend-color.
-   */
-  void SetBlendColor( BufferIndex updateBufferIndex, const Vector4& color );
-
-  /**
-   * Set the face-culling mode.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] mode The face-culling mode.
-   */
-  void SetCullFace( BufferIndex updateBufferIndex, CullFaceMode mode );
-
-  /**
-   * Set the sampler used to render the texture for this renderable.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] samplerBitfield The image sampler packed options to set.
-   */
-  void SetSampler( BufferIndex updateBufferIndex, unsigned int samplerBitfield );
-
-  /**
    * Flag to check if any geometry scaling is needed, inlined as called from update algorithm often
    * @return true if the derived renderable uses geometry scaling
    */
@@ -142,18 +91,6 @@ public: // API
    */
   void GetScaleForSize( const Vector3& nodeSize, Vector3& scaling );
 
-  /**
-   * Apply a shader on the renderable
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] shader to apply.
-   */
-  void ApplyShader( BufferIndex updateBufferIndex, Shader* shader );
-
-  /**
-   * Remove the shader from the renderable
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void RemoveShader( BufferIndex updateBufferIndex );
 
 public: // For use during in the update algorithm only
 
@@ -189,6 +126,13 @@ public: // For use during in the update algorithm only
   bool IsBlendingOn( BufferIndex updateBufferIndex );
 
   /**
+   * Check if the blending mode has changed - if it has, send message to renderer
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @param[in] useBlending True if the renderer should use blending option
+   */
+  void ChangeBlending( BufferIndex updateBufferIndex, bool useBlending );
+
+  /**
    * Prepare the object for rendering.
    * This is called by the UpdateManager when an object is due to be rendered in the current frame.
    * @param[in] updateBufferIndex The current update buffer index.
@@ -242,17 +186,9 @@ public: // API for derived classes
   virtual bool IsFullyOpaque( BufferIndex updateBufferIndex ) = 0;
 
   /**
-   * Called to notify that the shader might have been changed
-   * The implementation should recalculate geometry and scale based on the
-   * hints from the new shader
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @return Return true if the geometry changed.
-   */
-  virtual void ShaderChanged( BufferIndex updateBufferIndex ) = 0;
-
-  /**
    * Called to notify that the size has been changed
-   * The implementation may tell the renderer to recalculate geometry and scale based on the new size
+   * The implementation may tell the renderer to recalculate scale
+   * based on the new size
    * @param[in] updateBufferIndex The current update buffer index.
    */
   virtual void SizeChanged( BufferIndex updateBufferIndex ) = 0;
@@ -274,6 +210,23 @@ public: // API for derived classes
    */
   virtual void DoGetScaleForSize( const Vector3& nodeSize, Vector3& scaling );
 
+
+  /**
+   * Set the sort-modifier for the attachment.
+   * @param[in] modifier The depth-sort modifier.
+   */
+  void SetSortModifier(float modifier);
+
+  /**
+   * Retrieve the sort-modifier for the attachment.
+   * @return The sort-modifier.
+   */
+  float GetSortModifier() const
+  {
+    // inlined as its called a lot when sorting transparent renderers
+    return mSortModifier;
+  }
+
 protected:
 
   /**
@@ -315,12 +268,6 @@ private:
    */
   virtual bool DoPrepareResources( BufferIndex updateBufferIndex, ResourceManager& resourceManager ) = 0;
 
-  /**
-   * Sends the shader to the renderer
-   * @param updateBufferIndex for the message buffer
-   */
-  void SendShaderChangeMessage( BufferIndex updateBufferIndex );
-
   // Undefined
   RenderableAttachment( const RenderableAttachment& );
 
@@ -328,7 +275,6 @@ private:
   RenderableAttachment& operator=( const RenderableAttachment& rhs );
 
 protected:
-
   SceneController* mSceneController;   ///< Used for initializing renderers whilst attached
   Shader*          mShader;            ///< A pointer to the shader
 
@@ -345,34 +291,10 @@ protected:
   bool mResourcesReady:1;              ///< Set during the Update algorithm; true if the attachment has resources ready for the current frame.
   bool mFinishedResourceAcquisition:1; ///< Set during DoPrepareResources; true if ready & all resource acquisition has finished (successfully or otherwise)
   bool mHasUntrackedResources:1;       ///< Set during PrepareResources, true if have tried to follow untracked resources
-  CullFaceMode mCullFaceMode:3;        ///< Cullface mode, 3 bits is enough for 4 values
-
 };
 
 // Messages for RenderableAttachment
 
-inline void SetSortModifierMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment, float modifier )
-{
-  typedef MessageValue1< RenderableAttachment, float > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventToUpdate.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, &RenderableAttachment::SetSortModifier, modifier );
-}
-
-inline void SetCullFaceMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment, CullFaceMode mode )
-{
-  typedef MessageDoubleBuffered1< RenderableAttachment, CullFaceMode > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventToUpdate.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, &RenderableAttachment::SetCullFace, mode );
-}
-
 inline void SetBlendingModeMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment, BlendingMode::Type mode )
 {
   typedef MessageValue1< RenderableAttachment, BlendingMode::Type > LocalType;
@@ -383,62 +305,6 @@ inline void SetBlendingModeMessage( EventToUpdate& eventToUpdate, const Renderab
   new (slot) LocalType( &attachment, &RenderableAttachment::SetBlendingMode, mode );
 }
 
-inline void SetBlendingOptionsMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment, unsigned int options )
-{
-  typedef MessageDoubleBuffered1< RenderableAttachment, unsigned int > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &attachment, &RenderableAttachment::SetBlendingOptions, options );
-}
-
-inline void SetBlendColorMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment, const Vector4& color )
-{
-  typedef MessageDoubleBuffered1< RenderableAttachment, Vector4 > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &attachment, &RenderableAttachment::SetBlendColor, color );
-}
-
-inline void SetSamplerMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment, unsigned int samplerBitfield )
-{
-  typedef MessageDoubleBuffered1< RenderableAttachment, unsigned int > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventToUpdate.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, &RenderableAttachment::SetSampler, samplerBitfield );
-}
-
-inline void ApplyShaderMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment, const Shader& constShader )
-{
-  // Update thread can edit the object
-  Shader& shader = const_cast< Shader& >( constShader );
-
-  typedef MessageDoubleBuffered1< RenderableAttachment, Shader* > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventToUpdate.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, &RenderableAttachment::ApplyShader, &shader );
-}
-
-inline void RemoveShaderMessage( EventToUpdate& eventToUpdate, const RenderableAttachment& attachment )
-{
-  typedef MessageDoubleBuffered0< RenderableAttachment > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventToUpdate.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, &RenderableAttachment::RemoveShader );
-}
-
 } // namespace SceneGraph
 
 } // namespace Internal