054df4618cb2a4fcbdb059b7b9b019b87c0520a3
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / material-impl.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/rendering/material-impl.h> // Dali::Internal::Material
20
21 //EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/object/type-registry.h>
26 #include <dali/devel-api/rendering/material.h> // Dali::Internal::Material
27 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
28 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
29 #include <dali/internal/update/manager/update-manager.h>
30 #include <dali/internal/update/rendering/scene-graph-material.h>
31
32 namespace Dali
33 {
34 namespace Internal
35 {
36
37 namespace
38 {
39
40 /**
41  *            |name                              |type     |writable|animatable|constraint-input|enum for index-checking|
42  */
43 DALI_PROPERTY_TABLE_BEGIN
44 DALI_PROPERTY( "faceCullingMode",                 INTEGER,   true, false,  false, Dali::Material::Property::FACE_CULLING_MODE )
45 DALI_PROPERTY( "blendingMode",                    INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_MODE )
46 DALI_PROPERTY( "blendEquationRgb",                INTEGER,   true, false,  false, Dali::Material::Property::BLEND_EQUATION_RGB )
47 DALI_PROPERTY( "blendEquationAlpha",              INTEGER,   true, false,  false, Dali::Material::Property::BLEND_EQUATION_ALPHA )
48 DALI_PROPERTY( "sourceBlendFactorRgb",            INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_SRC_FACTOR_RGB )
49 DALI_PROPERTY( "destinationBlendFactorRgb",       INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_DEST_FACTOR_RGB )
50 DALI_PROPERTY( "sourceBlendFactorAlpha",          INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_SRC_FACTOR_ALPHA )
51 DALI_PROPERTY( "destinationBlendFactorAlpha",     INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_DEST_FACTOR_ALPHA )
52 DALI_PROPERTY( "blendColor",                      VECTOR4,   true, false,  false, Dali::Material::Property::BLEND_COLOR )
53 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
54
55 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> MATERIAL_IMPL = { DEFAULT_PROPERTY_DETAILS };
56
57 BaseHandle Create()
58 {
59   return Dali::BaseHandle();
60 }
61
62 TypeRegistration mType( typeid( Dali::Material ), typeid( Dali::Handle ), Create );
63
64 } // unnamed namespace
65
66 MaterialPtr Material::New()
67 {
68   MaterialPtr material( new Material() );
69   material->Initialize();
70   return material;
71 }
72
73 void Material::SetShader( Shader& shader )
74 {
75   DALI_ASSERT_DEBUG( mSceneObject )
76   mShader = &shader;
77
78   SceneGraph::Shader& sceneGraphShader = *shader.GetShaderSceneObject();
79   SceneGraph::SetShaderMessage( GetEventThreadServices(), *mSceneObject, sceneGraphShader );
80 }
81
82 Shader* Material::GetShader() const
83 {
84   return mShader.Get();
85 }
86
87 size_t Material::AddTexture( ImagePtr image, const std::string& uniformName, SamplerPtr sampler )
88 {
89   size_t index = mTextures.size();
90   mTextures.push_back( Texture( uniformName, image, sampler ) );
91
92   Render::Sampler* renderSampler(0);
93   if( sampler )
94   {
95     renderSampler = sampler->GetSamplerRenderObject();
96   }
97
98   if( mOnStage )
99   {
100     image->Connect();
101   }
102
103   SceneGraph::AddTextureMessage( GetEventThreadServices(), *mSceneObject, uniformName, image->GetResourceId(), renderSampler );
104   return index;
105 }
106
107 void Material::RemoveTexture( size_t index )
108 {
109   if( index < GetNumberOfTextures() )
110   {
111     mTextures.erase( mTextures.begin() + index );
112     SceneGraph::RemoveTextureMessage( GetEventThreadServices(), *mSceneObject, index );
113   }
114 }
115
116 void Material::SetTextureImage( size_t index, Image* image )
117 {
118   if( index < GetNumberOfTextures() )
119   {
120     if( mTextures[index].mImage && mOnStage )
121     {
122       mTextures[index].mImage->Disconnect();
123
124       if( image )
125       {
126         image->Connect();
127       }
128     }
129
130     mTextures[index].mImage.Reset(image);
131     SceneGraph::SetTextureImageMessage( GetEventThreadServices(), *mSceneObject, index, mTextures[index].mImage.Get()->GetResourceId() );
132   }
133 }
134
135 void Material::SetTextureSampler( size_t index, Sampler* sampler )
136 {
137   if( index < GetNumberOfTextures() )
138   {
139     mTextures[index].mSampler.Reset(sampler);
140
141     Render::Sampler* renderSampler(0);
142     if( sampler )
143     {
144       renderSampler = sampler->GetSamplerRenderObject();
145     }
146     SceneGraph::SetTextureSamplerMessage( GetEventThreadServices(), *mSceneObject, index,  renderSampler );
147   }
148 }
149
150 Sampler* Material::GetTextureSampler( size_t index ) const
151 {
152   if( index < GetNumberOfTextures() )
153   {
154     return mTextures[index].mSampler.Get();
155   }
156
157   return NULL;
158 }
159
160 void Material::SetTextureUniformName( size_t index, const std::string& uniformName )
161 {
162   if( index < GetNumberOfTextures() )
163   {
164     mTextures[index].mUniformName = uniformName;
165     SceneGraph::SetTextureUniformNameMessage( GetEventThreadServices(), *mSceneObject, index,  uniformName );
166   }
167 }
168
169 int Material::GetTextureIndex( const std::string& uniformName ) const
170 {
171   size_t textureCount(GetNumberOfTextures());
172   for( size_t i(0); i<textureCount; ++i )
173   {
174     if( uniformName.compare( mTextures[i].mUniformName ) == 0 )
175     {
176       return i;
177     }
178   }
179
180   return -1;
181 }
182
183 Image* Material::GetTexture( const std::string& uniformName ) const
184 {
185   int textureId = GetTextureIndex( uniformName );
186   if( textureId != -1 )
187   {
188     return GetTexture( textureId );
189   }
190
191   return NULL;
192 }
193
194 Image* Material::GetTexture( size_t index ) const
195 {
196   if( index < GetNumberOfTextures() )
197   {
198     return mTextures[ index ].mImage.Get();
199   }
200
201   return NULL;
202 }
203
204 size_t Material::GetNumberOfTextures() const
205 {
206   return mTextures.size();
207 }
208
209 void Material::SetFaceCullingMode( Dali::Material::FaceCullingMode cullingMode )
210 {
211   if( mFaceCullingMode != cullingMode )
212   {
213     mFaceCullingMode = cullingMode;
214
215     SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, mFaceCullingMode );
216   }
217 }
218
219 Dali::Material::FaceCullingMode Material::GetFaceCullingMode()
220 {
221   return mFaceCullingMode;
222 }
223
224 void Material::SetBlendMode( BlendingMode::Type mode )
225 {
226   if( mBlendingMode != mode )
227   {
228     mBlendingMode = mode;
229
230     SetBlendingModeMessage( GetEventThreadServices(), *mSceneObject, mBlendingMode );
231   }
232 }
233
234 BlendingMode::Type Material::GetBlendMode() const
235 {
236   return mBlendingMode;
237 }
238
239 void Material::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba )
240 {
241   mBlendingOptions.SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
242   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
243 }
244
245 void Material::SetBlendFunc( BlendingFactor::Type srcFactorRgb,
246                              BlendingFactor::Type destFactorRgb,
247                              BlendingFactor::Type srcFactorAlpha,
248                              BlendingFactor::Type destFactorAlpha )
249 {
250   mBlendingOptions.SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
251   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
252 }
253
254 void Material::GetBlendFunc( BlendingFactor::Type& srcFactorRgb,
255                              BlendingFactor::Type& destFactorRgb,
256                              BlendingFactor::Type& srcFactorAlpha,
257                              BlendingFactor::Type& destFactorAlpha ) const
258 {
259   srcFactorRgb    = mBlendingOptions.GetBlendSrcFactorRgb();
260   destFactorRgb   = mBlendingOptions.GetBlendDestFactorRgb();
261   srcFactorAlpha  = mBlendingOptions.GetBlendSrcFactorAlpha();
262   destFactorAlpha = mBlendingOptions.GetBlendDestFactorAlpha();
263 }
264
265 void Material::SetBlendEquation( BlendingEquation::Type equationRgba )
266 {
267   mBlendingOptions.SetBlendEquation( equationRgba, equationRgba );
268   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
269 }
270
271 void Material::SetBlendEquation( BlendingEquation::Type equationRgb,
272                                  BlendingEquation::Type equationAlpha )
273 {
274   mBlendingOptions.SetBlendEquation( equationRgb, equationAlpha );
275   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
276 }
277
278 void Material::GetBlendEquation( BlendingEquation::Type& equationRgb,
279                                  BlendingEquation::Type& equationAlpha ) const
280 {
281   // These are not animatable, the cached values are up-to-date.
282   equationRgb   = mBlendingOptions.GetBlendEquationRgb();
283   equationAlpha = mBlendingOptions.GetBlendEquationAlpha();
284 }
285
286 void Material::SetBlendColor( const Vector4& color )
287 {
288   if( !mBlendColor )
289   {
290     mBlendColor = new Vector4();
291   }
292   if( *mBlendColor != color )
293   {
294     *mBlendColor = color;
295     SetBlendColorMessage( GetEventThreadServices(), *mSceneObject, *mBlendColor );
296   }
297 }
298
299 Vector4 Material::GetBlendColor() const
300 {
301   if( mBlendColor )
302   {
303     return *mBlendColor;
304   }
305   return Color::TRANSPARENT; // GL default
306 }
307
308 const SceneGraph::Material* Material::GetMaterialSceneObject() const
309 {
310   return mSceneObject;
311 }
312
313 unsigned int Material::GetDefaultPropertyCount() const
314 {
315   return MATERIAL_IMPL.GetDefaultPropertyCount();
316 }
317
318 void Material::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
319 {
320   MATERIAL_IMPL.GetDefaultPropertyIndices( indices );
321 }
322
323 const char* Material::GetDefaultPropertyName(Property::Index index) const
324 {
325   return MATERIAL_IMPL.GetDefaultPropertyName( index );
326 }
327
328 Property::Index Material::GetDefaultPropertyIndex( const std::string& name ) const
329 {
330   return MATERIAL_IMPL.GetDefaultPropertyIndex( name );
331 }
332
333 bool Material::IsDefaultPropertyWritable( Property::Index index ) const
334 {
335   return MATERIAL_IMPL.IsDefaultPropertyWritable( index );
336 }
337
338 bool Material::IsDefaultPropertyAnimatable( Property::Index index ) const
339 {
340   return MATERIAL_IMPL.IsDefaultPropertyAnimatable( index );
341 }
342
343 bool Material::IsDefaultPropertyAConstraintInput( Property::Index index ) const
344 {
345   return MATERIAL_IMPL.IsDefaultPropertyAConstraintInput( index );
346 }
347
348 Property::Type Material::GetDefaultPropertyType( Property::Index index ) const
349 {
350   return MATERIAL_IMPL.GetDefaultPropertyType( index );
351 }
352
353 void Material::SetDefaultProperty( Property::Index index,
354                                    const Property::Value& propertyValue )
355 {
356   switch( index )
357   {
358     case Dali::Material::Property::FACE_CULLING_MODE:
359     {
360       int faceCullingMode;
361       if( propertyValue.Get( faceCullingMode ) )
362       {
363         SetFaceCullingMode( Dali::Material::FaceCullingMode( faceCullingMode ) );
364       }
365       break;
366     }
367     case Dali::Material::Property::BLENDING_MODE:
368     {
369       int blendingMode;
370       if( propertyValue.Get( blendingMode ) )
371       {
372         SetBlendMode( BlendingMode::Type( blendingMode ) );
373       }
374       break;
375     }
376     case Dali::Material::Property::BLEND_EQUATION_RGB:
377     {
378       int blendingEquation;
379       if( propertyValue.Get( blendingEquation ) )
380       {
381         BlendingEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
382         mBlendingOptions.SetBlendEquation( static_cast<BlendingEquation::Type>( blendingEquation ), alphaEquation );
383         SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
384       }
385       break;
386     }
387     case Dali::Material::Property::BLEND_EQUATION_ALPHA:
388     {
389       int blendingEquation;
390       if( propertyValue.Get( blendingEquation ) )
391       {
392         BlendingEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
393         mBlendingOptions.SetBlendEquation( rgbEquation, static_cast<BlendingEquation::Type>( blendingEquation ) );
394         SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
395       }
396       break;
397     }
398     case Dali::Material::Property::BLENDING_SRC_FACTOR_RGB:
399     {
400       int blendingFactor;
401       if( propertyValue.Get( blendingFactor ) )
402       {
403         BlendingFactor::Type srcFactorRgb;
404         BlendingFactor::Type destFactorRgb;
405         BlendingFactor::Type srcFactorAlpha;
406         BlendingFactor::Type destFactorAlpha;
407         GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
408         SetBlendFunc( static_cast<BlendingFactor::Type>( blendingFactor ),
409                       destFactorRgb,
410                       srcFactorAlpha,
411                       destFactorAlpha );
412       }
413       break;
414     }
415     case Dali::Material::Property::BLENDING_DEST_FACTOR_RGB:
416     {
417       int blendingFactor;
418       if( propertyValue.Get( blendingFactor ) )
419       {
420         BlendingFactor::Type srcFactorRgb;
421         BlendingFactor::Type destFactorRgb;
422         BlendingFactor::Type srcFactorAlpha;
423         BlendingFactor::Type destFactorAlpha;
424         GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
425         SetBlendFunc( srcFactorRgb,
426                       static_cast<BlendingFactor::Type>( blendingFactor ),
427                       srcFactorAlpha,
428                       destFactorAlpha );
429       }
430       break;
431     }
432     case Dali::Material::Property::BLENDING_SRC_FACTOR_ALPHA:
433     {
434       int blendingFactor;
435       if( propertyValue.Get( blendingFactor ) )
436       {
437         BlendingFactor::Type srcFactorRgb;
438         BlendingFactor::Type destFactorRgb;
439         BlendingFactor::Type srcFactorAlpha;
440         BlendingFactor::Type destFactorAlpha;
441         GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
442         SetBlendFunc( srcFactorRgb,
443                       destFactorRgb,
444                       static_cast<BlendingFactor::Type>( blendingFactor ),
445                       destFactorAlpha );
446       }
447       break;
448     }
449     case Dali::Material::Property::BLENDING_DEST_FACTOR_ALPHA:
450     {
451       int blendingFactor;
452       if( propertyValue.Get( blendingFactor ) )
453       {
454         BlendingFactor::Type srcFactorRgb;
455         BlendingFactor::Type destFactorRgb;
456         BlendingFactor::Type srcFactorAlpha;
457         BlendingFactor::Type destFactorAlpha;
458         GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
459         SetBlendFunc( srcFactorRgb,
460                       destFactorRgb,
461                       srcFactorAlpha,
462                       static_cast<BlendingFactor::Type>( blendingFactor ) );
463       }
464       break;
465     }
466     case Dali::Material::Property::BLEND_COLOR:
467     {
468       Vector4 blendColor;
469       if( propertyValue.Get( blendColor ) )
470       {
471         SetBlendColor( blendColor );
472       }
473       break;
474     }
475   }
476 }
477
478 void Material::SetSceneGraphProperty( Property::Index index,
479                                       const PropertyMetadata& entry,
480                                       const Property::Value& value )
481 {
482   MATERIAL_IMPL.SetSceneGraphProperty( GetEventThreadServices(), this, index, entry, value );
483   OnPropertySet(index, value);
484 }
485
486 Property::Value Material::GetDefaultProperty( Property::Index index ) const
487 {
488   Property::Value value;
489
490   switch( index )
491   {
492     case Dali::Material::Property::FACE_CULLING_MODE:
493     {
494       value = mFaceCullingMode;
495       break;
496     }
497     case Dali::Material::Property::BLENDING_MODE:
498     {
499       value = mBlendingMode;
500       break;
501     }
502     case Dali::Material::Property::BLEND_EQUATION_RGB:
503     {
504       value = static_cast<int>( mBlendingOptions.GetBlendEquationRgb() );
505       break;
506     }
507     case Dali::Material::Property::BLEND_EQUATION_ALPHA:
508     {
509       value = static_cast<int>( mBlendingOptions.GetBlendEquationAlpha() );
510       break;
511     }
512     case Dali::Material::Property::BLENDING_SRC_FACTOR_RGB:
513     {
514       BlendingFactor::Type srcFactorRgb;
515       BlendingFactor::Type destFactorRgb;
516       BlendingFactor::Type srcFactorAlpha;
517       BlendingFactor::Type destFactorAlpha;
518       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
519       value = static_cast<int>( srcFactorRgb );
520       break;
521     }
522     case Dali::Material::Property::BLENDING_DEST_FACTOR_RGB:
523     {
524       BlendingFactor::Type srcFactorRgb;
525       BlendingFactor::Type destFactorRgb;
526       BlendingFactor::Type srcFactorAlpha;
527       BlendingFactor::Type destFactorAlpha;
528       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
529       value = static_cast<int>( destFactorRgb );
530       break;
531     }
532     case Dali::Material::Property::BLENDING_SRC_FACTOR_ALPHA:
533     {
534       BlendingFactor::Type srcFactorRgb;
535       BlendingFactor::Type destFactorRgb;
536       BlendingFactor::Type srcFactorAlpha;
537       BlendingFactor::Type destFactorAlpha;
538       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
539       value = static_cast<int>( srcFactorAlpha );
540       break;
541     }
542     case Dali::Material::Property::BLENDING_DEST_FACTOR_ALPHA:
543     {
544       BlendingFactor::Type srcFactorRgb;
545       BlendingFactor::Type destFactorRgb;
546       BlendingFactor::Type srcFactorAlpha;
547       BlendingFactor::Type destFactorAlpha;
548       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
549       value = static_cast<int>( destFactorAlpha );
550       break;
551     }
552     case Dali::Material::Property::BLEND_COLOR:
553     {
554       value = mBlendColor;
555       break;
556     }
557   }
558
559   return value;
560 }
561
562 const SceneGraph::PropertyOwner* Material::GetPropertyOwner() const
563 {
564   return mSceneObject;
565 }
566
567 const SceneGraph::PropertyOwner* Material::GetSceneObject() const
568 {
569   return mSceneObject;
570 }
571
572 const SceneGraph::PropertyBase* Material::GetSceneObjectAnimatableProperty( Property::Index index ) const
573 {
574   PropertyMetadata* property = index >= PROPERTY_CUSTOM_START_INDEX ? static_cast<PropertyMetadata*>(FindCustomProperty( index )) : static_cast<PropertyMetadata*>(FindAnimatableProperty( index ));
575   DALI_ASSERT_ALWAYS( property && "Property index is invalid" );
576   return property->GetSceneGraphProperty();
577 }
578
579 const PropertyInputImpl* Material::GetSceneObjectInputProperty( Property::Index index ) const
580 {
581   return GetSceneObjectAnimatableProperty( index );
582 }
583
584 int Material::GetPropertyComponentIndex( Property::Index index ) const
585 {
586   return Property::INVALID_COMPONENT_INDEX;
587 }
588
589 bool Material::OnStage() const
590 {
591   return mOnStage;
592 }
593
594 void Material::Connect()
595 {
596   mOnStage = true;
597
598   for( size_t i(0); i<mTextures.size(); ++i )
599   {
600     if( mTextures[i].mImage )
601     {
602       mTextures[i].mImage->Connect();
603       if( mTextures[i].mImage->GetResourceId() != 0 )
604       {
605         SceneGraph::SetTextureImageMessage( GetEventThreadServices(), *mSceneObject, i, mTextures[i].mImage->GetResourceId() );
606       }
607     }
608   }
609 }
610
611 void Material::Disconnect()
612 {
613   for( size_t i(0); i<mTextures.size(); ++i )
614   {
615     if( mTextures[i].mImage )
616     {
617       mTextures[i].mImage->Disconnect();
618     }
619   }
620
621   mOnStage = false;
622 }
623
624 Material::Material()
625 : mSceneObject( NULL ),
626   mShader( NULL ),
627   mTextures(),
628   mFaceCullingMode( Dali::Material::NONE ),
629   mBlendingMode( Dali::BlendingMode::AUTO ),
630   mBlendingOptions(), // initialises to defaults
631   mBlendColor( NULL ),
632   mOnStage( false )
633 {
634 }
635
636 void Material::Initialize()
637 {
638   EventThreadServices& eventThreadServices = GetEventThreadServices();
639   SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
640
641   mSceneObject = SceneGraph::Material::New();
642   AddMessage( updateManager, updateManager.GetMaterialOwner(), *mSceneObject );
643
644   eventThreadServices.RegisterObject( this );
645 }
646
647 Material::~Material()
648 {
649   delete mBlendColor;
650   if( EventThreadServices::IsCoreRunning() )
651   {
652     EventThreadServices& eventThreadServices = GetEventThreadServices();
653     SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
654     RemoveMessage( updateManager, updateManager.GetMaterialOwner(), *mSceneObject );
655
656     eventThreadServices.UnregisterObject( this );
657   }
658 }
659
660 } // namespace Internal
661 } // namespace Dali