Refactor SceneGraphProperty handling code in event side to make RegisterProperty...
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / renderer-impl.cpp
1 /*
2  * Copyright (c) 2018 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/renderer-impl.h> // Dali::Internal::Renderer
20
21 // INTERNAL INCLUDES
22 #include <dali/devel-api/scripting/scripting.h>
23 #include <dali/devel-api/rendering/renderer-devel.h>
24 #include <dali/public-api/object/type-registry.h>
25 #include <dali/internal/event/common/property-helper.h>    // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
26 #include <dali/internal/event/common/property-input-impl.h>
27 #include <dali/internal/render/renderers/render-geometry.h>
28 #include <dali/internal/update/manager/update-manager.h>
29 #include <dali/internal/update/rendering/scene-graph-renderer.h>
30
31 namespace Dali
32 {
33 namespace Internal
34 {
35
36 namespace
37 {
38
39 /**
40  * Properties: |name                              |type     |writable|animatable|constraint-input|enum for index-checking|
41  */
42 DALI_PROPERTY_TABLE_BEGIN
43 DALI_PROPERTY( "depthIndex",                      INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_INDEX )
44 DALI_PROPERTY( "faceCullingMode",                 INTEGER,   true, false,  false, Dali::Renderer::Property::FACE_CULLING_MODE )
45 DALI_PROPERTY( "blendMode",                       INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_MODE )
46 DALI_PROPERTY( "blendEquationRgb",                INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_EQUATION_RGB )
47 DALI_PROPERTY( "blendEquationAlpha",              INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_EQUATION_ALPHA )
48 DALI_PROPERTY( "blendFactorSrcRgb",               INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB )
49 DALI_PROPERTY( "blendFactorDestRgb",              INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB )
50 DALI_PROPERTY( "blendFactorSrcAlpha",             INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA )
51 DALI_PROPERTY( "blendFactorDestAlpha",            INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA )
52 DALI_PROPERTY( "blendColor",                      VECTOR4,   true, false,  false, Dali::Renderer::Property::BLEND_COLOR )
53 DALI_PROPERTY( "blendPreMultipliedAlpha",         BOOLEAN,   true, false,  false, Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA )
54 DALI_PROPERTY( "indexRangeFirst",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_FIRST )
55 DALI_PROPERTY( "indexRangeCount",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_COUNT )
56 DALI_PROPERTY( "depthWriteMode",                  INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
57 DALI_PROPERTY( "depthFunction",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_FUNCTION )
58 DALI_PROPERTY( "depthTestMode",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_TEST_MODE )
59 DALI_PROPERTY( "renderMode",                      INTEGER,   true, false,  false, Dali::Renderer::Property::RENDER_MODE )
60 DALI_PROPERTY( "stencilFunction",                 INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION )
61 DALI_PROPERTY( "stencilFunctionMask",             INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
62 DALI_PROPERTY( "stencilFunctionReference",        INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
63 DALI_PROPERTY( "stencilMask",                     INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_MASK )
64 DALI_PROPERTY( "stencilOperationOnFail",          INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
65 DALI_PROPERTY( "stencilOperationOnZFail",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
66 DALI_PROPERTY( "stencilOperationOnZPass",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
67 DALI_PROPERTY( "opacity",                         FLOAT,     true, true,   true,  Dali::DevelRenderer::Property::OPACITY )
68 DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX, RendererDefaultProperties )
69
70 // Property string to enumeration tables:
71
72 DALI_ENUM_TO_STRING_TABLE_BEGIN( FACE_CULLING_MODE )
73 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, NONE )
74 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT )
75 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, BACK )
76 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT_AND_BACK )
77 DALI_ENUM_TO_STRING_TABLE_END( FACE_CULLING_MODE )
78
79 DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_MODE )
80 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, OFF )
81 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, AUTO )
82 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, ON )
83 DALI_ENUM_TO_STRING_TABLE_END( BLEND_MODE )
84
85 DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_EQUATION )
86 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, ADD )
87 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, SUBTRACT )
88 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, REVERSE_SUBTRACT )
89 DALI_ENUM_TO_STRING_TABLE_END( BLEND_EQUATION )
90
91 DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_FACTOR )
92 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ZERO )
93 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE )
94 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_COLOR )
95 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_COLOR )
96 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA )
97 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_ALPHA )
98 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_ALPHA )
99 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_ALPHA )
100 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_COLOR )
101 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_COLOR )
102 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA_SATURATE )
103 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_COLOR )
104 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_COLOR )
105 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_ALPHA )
106 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_ALPHA )
107 DALI_ENUM_TO_STRING_TABLE_END( BLEND_FACTOR )
108
109 DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_WRITE_MODE )
110 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, OFF )
111 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, AUTO )
112 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, ON )
113 DALI_ENUM_TO_STRING_TABLE_END( DEPTH_WRITE_MODE )
114
115 DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_TEST_MODE )
116 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, OFF )
117 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, AUTO )
118 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, ON )
119 DALI_ENUM_TO_STRING_TABLE_END( DEPTH_TEST_MODE )
120
121 DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_FUNCTION )
122 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NEVER )
123 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, ALWAYS )
124 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS )
125 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER )
126 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, EQUAL )
127 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NOT_EQUAL )
128 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS_EQUAL )
129 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER_EQUAL )
130 DALI_ENUM_TO_STRING_TABLE_END( DEPTH_FUNCTION )
131
132 DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_FUNCTION )
133 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NEVER )
134 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS )
135 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, EQUAL )
136 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS_EQUAL )
137 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER )
138 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NOT_EQUAL )
139 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER_EQUAL )
140 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, ALWAYS )
141 DALI_ENUM_TO_STRING_TABLE_END( STENCIL_FUNCTION )
142
143 DALI_ENUM_TO_STRING_TABLE_BEGIN( RENDER_MODE )
144 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, NONE )
145 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, AUTO )
146 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR )
147 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, STENCIL )
148 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR_STENCIL )
149 DALI_ENUM_TO_STRING_TABLE_END( RENDER_MODE )
150
151 DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_OPERATION )
152 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, ZERO )
153 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, KEEP )
154 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, REPLACE )
155 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT )
156 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT )
157 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INVERT )
158 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT_WRAP )
159 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT_WRAP )
160 DALI_ENUM_TO_STRING_TABLE_END( STENCIL_OPERATION )
161
162 BaseHandle Create()
163 {
164   return Dali::BaseHandle();
165 }
166
167 TypeRegistration mType( typeid( Dali::Renderer ), typeid( Dali::Handle ), Create, RendererDefaultProperties );
168
169 } // unnamed namespace
170
171 RendererPtr Renderer::New()
172 {
173   // create scene object first so it's guaranteed to exist for the event side
174   auto sceneObject = SceneGraph::Renderer::New();
175   OwnerPointer< SceneGraph::Renderer > transferOwnership( sceneObject );
176   // pass the pointer to base for message passing
177   RendererPtr rendererPtr( new Renderer( sceneObject ) );
178   // transfer scene object ownership to update manager
179   EventThreadServices& eventThreadServices = rendererPtr->GetEventThreadServices();
180   SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
181   AddRendererMessage( updateManager, transferOwnership );
182
183   eventThreadServices.RegisterObject( rendererPtr.Get() );
184   return rendererPtr;
185 }
186
187 void Renderer::SetGeometry( Geometry& geometry )
188 {
189   mGeometry = &geometry;
190
191   const Render::Geometry* geometrySceneObject = geometry.GetRenderObject();
192   SetGeometryMessage( GetEventThreadServices(), GetRendererSceneObject(), *geometrySceneObject );
193 }
194
195 GeometryPtr Renderer::GetGeometry() const
196 {
197   return mGeometry;
198 }
199
200 void Renderer::SetTextures( TextureSet& textureSet )
201 {
202   mTextureSet = &textureSet;
203   const SceneGraph::TextureSet* textureSetSceneObject = textureSet.GetTextureSetSceneObject();
204   SetTexturesMessage( GetEventThreadServices(), GetRendererSceneObject(), *textureSetSceneObject );
205 }
206
207 TextureSetPtr Renderer::GetTextures() const
208 {
209   return mTextureSet;
210 }
211
212 void Renderer::SetShader( Shader& shader )
213 {
214   mShader = &shader;
215   const SceneGraph::Shader& sceneGraphShader = shader.GetShaderSceneObject();
216   SceneGraph::SetShaderMessage( GetEventThreadServices(), GetRendererSceneObject(), sceneGraphShader );
217 }
218
219 ShaderPtr Renderer::GetShader() const
220 {
221   return mShader;
222 }
223
224 void Renderer::SetDepthIndex( int32_t depthIndex )
225 {
226   if ( mDepthIndex != depthIndex )
227   {
228     mDepthIndex = depthIndex;
229     SetDepthIndexMessage( GetEventThreadServices(), GetRendererSceneObject(), depthIndex );
230   }
231 }
232
233 int32_t Renderer::GetDepthIndex() const
234 {
235   return mDepthIndex;
236 }
237
238 void Renderer::SetBlendMode( BlendMode::Type mode )
239 {
240   if( mBlendMode != mode )
241   {
242     mBlendMode = mode;
243
244     SetBlendModeMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendMode );
245   }
246 }
247
248 BlendMode::Type Renderer::GetBlendMode() const
249 {
250   return mBlendMode;
251 }
252
253 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba )
254 {
255   mBlendingOptions.SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
256   SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
257 }
258
259 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgb,
260                              BlendFactor::Type destFactorRgb,
261                              BlendFactor::Type srcFactorAlpha,
262                              BlendFactor::Type destFactorAlpha )
263 {
264   mBlendingOptions.SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
265   SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
266 }
267
268 void Renderer::GetBlendFunc( BlendFactor::Type& srcFactorRgb,
269                              BlendFactor::Type& destFactorRgb,
270                              BlendFactor::Type& srcFactorAlpha,
271                              BlendFactor::Type& destFactorAlpha ) const
272 {
273   srcFactorRgb    = mBlendingOptions.GetBlendSrcFactorRgb();
274   destFactorRgb   = mBlendingOptions.GetBlendDestFactorRgb();
275   srcFactorAlpha  = mBlendingOptions.GetBlendSrcFactorAlpha();
276   destFactorAlpha = mBlendingOptions.GetBlendDestFactorAlpha();
277 }
278
279 void Renderer::SetBlendEquation( BlendEquation::Type equationRgba )
280 {
281   mBlendingOptions.SetBlendEquation( equationRgba, equationRgba );
282   SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
283 }
284
285 void Renderer::SetBlendEquation( BlendEquation::Type equationRgb,
286                                  BlendEquation::Type equationAlpha )
287 {
288   mBlendingOptions.SetBlendEquation( equationRgb, equationAlpha );
289   SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
290 }
291
292 void Renderer::GetBlendEquation( BlendEquation::Type& equationRgb,
293                                  BlendEquation::Type& equationAlpha ) const
294 {
295   // These are not animatable, the cached values are up-to-date.
296   equationRgb   = mBlendingOptions.GetBlendEquationRgb();
297   equationAlpha = mBlendingOptions.GetBlendEquationAlpha();
298 }
299
300 void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement )
301 {
302   if( firstElement != mIndexedDrawFirstElement )
303   {
304     mIndexedDrawFirstElement = firstElement;
305     SetIndexedDrawFirstElementMessage( GetEventThreadServices(), GetRendererSceneObject(), mIndexedDrawFirstElement );
306   }
307 }
308
309 void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount )
310 {
311   if( elementsCount != mIndexedDrawElementCount )
312   {
313     mIndexedDrawElementCount = elementsCount;
314     SetIndexedDrawElementsCountMessage( GetEventThreadServices(), GetRendererSceneObject(), mIndexedDrawElementCount );
315   }
316 }
317
318
319 void Renderer::EnablePreMultipliedAlpha( bool preMultipled )
320 {
321   if(  mPremultipledAlphaEnabled != preMultipled )
322   {
323     if( preMultipled )
324     {
325       SetBlendFunc( BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA );
326     }
327     else
328     {
329       SetBlendFunc( BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA );
330     }
331     mPremultipledAlphaEnabled = preMultipled;
332     SetEnablePreMultipliedAlphaMessage( GetEventThreadServices(), GetRendererSceneObject(), mPremultipledAlphaEnabled );
333   }
334 }
335
336 bool Renderer::IsPreMultipliedAlphaEnabled() const
337 {
338   return mPremultipledAlphaEnabled;
339 }
340
341 const SceneGraph::Renderer& Renderer::GetRendererSceneObject() const
342 {
343   return static_cast<const SceneGraph::Renderer&>( GetSceneObject() );
344 }
345
346 void Renderer::SetDefaultProperty( Property::Index index,
347                                    const Property::Value& propertyValue )
348 {
349   switch( index )
350   {
351     case Dali::Renderer::Property::DEPTH_INDEX:
352     {
353       SetDepthIndex( propertyValue.Get<int32_t>() );
354       break;
355     }
356     case Dali::Renderer::Property::FACE_CULLING_MODE:
357     {
358       FaceCullingMode::Type convertedValue = mFaceCullingMode;
359       if( Scripting::GetEnumerationProperty< FaceCullingMode::Type >( propertyValue, FACE_CULLING_MODE_TABLE, FACE_CULLING_MODE_TABLE_COUNT, convertedValue ) )
360       {
361         mFaceCullingMode = convertedValue;
362         SetFaceCullingModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
363       }
364       break;
365     }
366     case Dali::Renderer::Property::BLEND_MODE:
367     {
368       BlendMode::Type convertedValue = mBlendMode;
369       if( Scripting::GetEnumerationProperty< BlendMode::Type >( propertyValue, BLEND_MODE_TABLE, BLEND_MODE_TABLE_COUNT, convertedValue ) )
370       {
371         SetBlendMode( convertedValue );
372       }
373       break;
374     }
375     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
376     {
377       BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
378
379       if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
380       {
381         BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
382         mBlendingOptions.SetBlendEquation( convertedValue, alphaEquation );
383         SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
384       }
385       break;
386     }
387     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
388     {
389       BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationAlpha();
390
391       if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
392       {
393         BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
394         mBlendingOptions.SetBlendEquation( rgbEquation, convertedValue );
395         SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
396       }
397       break;
398     }
399     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
400     {
401       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
402       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
403
404       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorRgb ) )
405       {
406         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
407       }
408       break;
409     }
410     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
411     {
412       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
413       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
414
415       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorRgb ) )
416       {
417         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
418       }
419       break;
420     }
421     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
422     {
423       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
424       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
425
426       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorAlpha ) )
427       {
428         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
429       }
430       break;
431     }
432     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
433     {
434       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
435       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
436
437       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorAlpha ) )
438       {
439         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
440       }
441       break;
442     }
443     case Dali::Renderer::Property::BLEND_COLOR:
444     {
445       Vector4 blendColor;
446       if( propertyValue.Get( blendColor ) )
447       {
448         SetBlendColor( blendColor );
449       }
450       break;
451     }
452     case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
453     {
454       bool preMultipled;
455       if( propertyValue.Get( preMultipled ) )
456       {
457         EnablePreMultipliedAlpha( preMultipled );
458       }
459       break;
460     }
461     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
462     {
463       int32_t firstElement;
464       if( propertyValue.Get( firstElement ) )
465       {
466         SetIndexedDrawFirstElement( firstElement );
467       }
468       break;
469     }
470     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
471     {
472       int32_t elementsCount;
473       if( propertyValue.Get( elementsCount ) )
474       {
475         SetIndexedDrawElementsCount( elementsCount );
476       }
477       break;
478     }
479     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
480     {
481       DepthWriteMode::Type convertedValue = mDepthWriteMode;
482       if( Scripting::GetEnumerationProperty< DepthWriteMode::Type >( propertyValue, DEPTH_WRITE_MODE_TABLE, DEPTH_WRITE_MODE_TABLE_COUNT, convertedValue ) )
483       {
484         mDepthWriteMode = convertedValue;
485         SetDepthWriteModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
486       }
487       break;
488     }
489     case Dali::Renderer::Property::DEPTH_FUNCTION:
490     {
491       DepthFunction::Type convertedValue = mDepthFunction;
492       if( Scripting::GetEnumerationProperty< DepthFunction::Type >( propertyValue, DEPTH_FUNCTION_TABLE, DEPTH_FUNCTION_TABLE_COUNT, convertedValue ) )
493       {
494         mDepthFunction = convertedValue;
495         SetDepthFunctionMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
496       }
497       break;
498     }
499     case Dali::Renderer::Property::DEPTH_TEST_MODE:
500     {
501       DepthTestMode::Type convertedValue = mDepthTestMode;
502       if( Scripting::GetEnumerationProperty< DepthTestMode::Type >( propertyValue, DEPTH_TEST_MODE_TABLE, DEPTH_TEST_MODE_TABLE_COUNT, convertedValue ) )
503       {
504         mDepthTestMode = convertedValue;
505         SetDepthTestModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
506       }
507       break;
508     }
509     case Dali::Renderer::Property::RENDER_MODE:
510     {
511       RenderMode::Type convertedValue = mStencilParameters.renderMode;
512       if( Scripting::GetEnumerationProperty< RenderMode::Type >( propertyValue, RENDER_MODE_TABLE, RENDER_MODE_TABLE_COUNT, convertedValue ) )
513       {
514         mStencilParameters.renderMode = convertedValue;
515         SetRenderModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
516       }
517       break;
518     }
519     case Dali::Renderer::Property::STENCIL_FUNCTION:
520     {
521       StencilFunction::Type convertedValue = mStencilParameters.stencilFunction;
522       if( Scripting::GetEnumerationProperty< StencilFunction::Type >( propertyValue, STENCIL_FUNCTION_TABLE, STENCIL_FUNCTION_TABLE_COUNT, convertedValue ) )
523       {
524         mStencilParameters.stencilFunction = convertedValue;
525         SetStencilFunctionMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
526       }
527       break;
528     }
529     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
530     {
531       int32_t stencilFunctionMask;
532       if( propertyValue.Get( stencilFunctionMask ) )
533       {
534         if( stencilFunctionMask != mStencilParameters.stencilFunctionMask )
535         {
536           mStencilParameters.stencilFunctionMask = stencilFunctionMask;
537           SetStencilFunctionMaskMessage( GetEventThreadServices(), GetRendererSceneObject(), stencilFunctionMask );
538         }
539       }
540       break;
541     }
542     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
543     {
544       int32_t stencilFunctionReference;
545       if( propertyValue.Get( stencilFunctionReference ) )
546       {
547         if( stencilFunctionReference != mStencilParameters.stencilFunctionReference )
548         {
549           mStencilParameters.stencilFunctionReference = stencilFunctionReference;
550           SetStencilFunctionReferenceMessage( GetEventThreadServices(), GetRendererSceneObject(), stencilFunctionReference );
551         }
552       }
553       break;
554     }
555     case Dali::Renderer::Property::STENCIL_MASK:
556     {
557       int32_t stencilMask;
558       if( propertyValue.Get( stencilMask ) )
559       {
560         if( stencilMask != mStencilParameters.stencilMask )
561         {
562           mStencilParameters.stencilMask = stencilMask;
563           SetStencilMaskMessage( GetEventThreadServices(), GetRendererSceneObject(), stencilMask );
564         }
565       }
566       break;
567     }
568     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
569     {
570       StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnFail;
571       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
572       {
573         mStencilParameters.stencilOperationOnFail = convertedValue;
574         SetStencilOperationOnFailMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
575       }
576       break;
577     }
578     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
579     {
580       StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZFail;
581       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
582       {
583         mStencilParameters.stencilOperationOnZFail = convertedValue;
584         SetStencilOperationOnZFailMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
585       }
586       break;
587     }
588     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
589     {
590       StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZPass;
591       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
592       {
593         mStencilParameters.stencilOperationOnZPass = convertedValue;
594         SetStencilOperationOnZPassMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
595       }
596       break;
597     }
598     case Dali::DevelRenderer::Property::OPACITY:
599     {
600       float opacity;
601       if( propertyValue.Get( opacity ) )
602       {
603         if( !Equals( mOpacity, opacity ) )
604         {
605           mOpacity = opacity;
606           BakeOpacityMessage( GetEventThreadServices(), GetRendererSceneObject(), mOpacity );
607         }
608       }
609       break;
610     }
611   }
612 }
613
614 Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
615 {
616   Property::Value value;
617
618   if( ! GetCachedPropertyValue( index, value ) )
619   {
620     // If property value is not stored in the event-side, then it must be a scene-graph only property
621     GetCurrentPropertyValue( index, value );
622   }
623
624   return value;
625 }
626
627 Property::Value Renderer::GetDefaultPropertyCurrentValue( Property::Index index ) const
628 {
629   Property::Value value;
630
631   if( ! GetCurrentPropertyValue( index, value ) )
632   {
633     // If unable to retrieve scene-graph property value, then it must be an event-side only property
634     GetCachedPropertyValue( index, value );
635   }
636
637   return value;
638 }
639
640 void Renderer::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
641 {
642   switch( animationType )
643   {
644     case Animation::TO:
645     case Animation::BETWEEN:
646     {
647       switch( index )
648       {
649         case Dali::DevelRenderer::Property::OPACITY:
650         {
651           value.Get( mOpacity );
652           break;
653         }
654       }
655       break;
656     }
657
658     case Animation::BY:
659     {
660       switch( index )
661       {
662         case Dali::DevelRenderer::Property::OPACITY:
663         {
664           AdjustValue< float >( mOpacity, value );
665           break;
666         }
667       }
668       break;
669     }
670   }
671 }
672
673 const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Property::Index index ) const
674 {
675   const SceneGraph::PropertyBase* property = NULL;
676
677   if( index == DevelRenderer::Property::OPACITY )
678   {
679     property = &GetRendererSceneObject().mOpacity;
680   }
681   if( !property )
682   {
683     // not our property, ask base
684     property = Object::GetSceneObjectAnimatableProperty( index );
685   }
686
687   return property;
688 }
689
690 const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index index ) const
691 {
692   // reuse animatable property getter, Object::GetSceneObjectInputProperty does the same so no need to call that0
693   return GetSceneObjectAnimatableProperty( index );
694 }
695
696 Renderer::Renderer( const SceneGraph::Renderer* sceneObject )
697 : Object( sceneObject ),
698   mDepthIndex( 0 ),
699   mIndexedDrawFirstElement( 0 ),
700   mIndexedDrawElementCount( 0 ),
701   mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
702   mBlendingOptions(),
703   mOpacity( 1.0f ),
704   mDepthFunction( DepthFunction::LESS ),
705   mFaceCullingMode( FaceCullingMode::NONE ),
706   mBlendMode( BlendMode::AUTO ),
707   mDepthWriteMode( DepthWriteMode::AUTO ),
708   mDepthTestMode( DepthTestMode::AUTO ),
709   mPremultipledAlphaEnabled( false )
710 {
711 }
712
713 void Renderer::SetBlendColor( const Vector4& blendColor )
714 {
715   mBlendingOptions.SetBlendColor( blendColor );
716   SetBlendColorMessage( GetEventThreadServices(), GetRendererSceneObject(), GetBlendColor() );
717 }
718
719 const Vector4& Renderer::GetBlendColor() const
720 {
721   const Vector4* blendColor = mBlendingOptions.GetBlendColor();
722   if( blendColor )
723   {
724     return *blendColor;
725   }
726   return Color::TRANSPARENT; // GL default
727 }
728
729 Renderer::~Renderer()
730 {
731   if( EventThreadServices::IsCoreRunning() )
732   {
733     EventThreadServices& eventThreadServices = GetEventThreadServices();
734     SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
735     RemoveRendererMessage( updateManager, GetRendererSceneObject() );
736
737     eventThreadServices.UnregisterObject( this );
738   }
739 }
740
741 bool Renderer::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
742 {
743   bool valueSet = true;
744
745   switch( index )
746   {
747     case Dali::Renderer::Property::DEPTH_INDEX:
748     {
749       value = GetDepthIndex();
750       break;
751     }
752     case Dali::Renderer::Property::FACE_CULLING_MODE:
753     {
754       value = mFaceCullingMode;
755       break;
756     }
757     case Dali::Renderer::Property::BLEND_MODE:
758     {
759       value = mBlendMode;
760       break;
761     }
762     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
763     {
764       value = static_cast<int32_t>( mBlendingOptions.GetBlendEquationRgb() );
765       break;
766     }
767     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
768     {
769       value = static_cast<int32_t>( mBlendingOptions.GetBlendEquationAlpha() );
770       break;
771     }
772     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
773     {
774       BlendFactor::Type srcFactorRgb;
775       BlendFactor::Type destFactorRgb;
776       BlendFactor::Type srcFactorAlpha;
777       BlendFactor::Type destFactorAlpha;
778       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
779       value = static_cast<int32_t>( srcFactorRgb );
780       break;
781     }
782     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
783     {
784       BlendFactor::Type srcFactorRgb;
785       BlendFactor::Type destFactorRgb;
786       BlendFactor::Type srcFactorAlpha;
787       BlendFactor::Type destFactorAlpha;
788       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
789       value = static_cast<int32_t>( destFactorRgb );
790       break;
791     }
792     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
793     {
794       BlendFactor::Type srcFactorRgb;
795       BlendFactor::Type destFactorRgb;
796       BlendFactor::Type srcFactorAlpha;
797       BlendFactor::Type destFactorAlpha;
798       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
799       value = static_cast<int32_t>( srcFactorAlpha );
800       break;
801     }
802     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
803     {
804       BlendFactor::Type srcFactorRgb;
805       BlendFactor::Type destFactorRgb;
806       BlendFactor::Type srcFactorAlpha;
807       BlendFactor::Type destFactorAlpha;
808       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
809       value = static_cast<int32_t>( destFactorAlpha );
810       break;
811     }
812     case Dali::Renderer::Property::BLEND_COLOR:
813     {
814       value = GetBlendColor();
815       break;
816     }
817     case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
818     {
819       value = IsPreMultipliedAlphaEnabled();
820       break;
821     }
822     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
823     {
824       value = static_cast<int32_t>( mIndexedDrawFirstElement );
825       break;
826     }
827     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
828     {
829       value = static_cast<int32_t>( mIndexedDrawElementCount );
830       break;
831     }
832     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
833     {
834       value = mDepthWriteMode;
835       break;
836     }
837     case Dali::Renderer::Property::DEPTH_FUNCTION:
838     {
839       value = mDepthFunction;
840       break;
841     }
842     case Dali::Renderer::Property::DEPTH_TEST_MODE:
843     {
844       value = mDepthTestMode;
845       break;
846     }
847     case Dali::Renderer::Property::STENCIL_FUNCTION:
848     {
849       value = mStencilParameters.stencilFunction;
850       break;
851     }
852     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
853     {
854       value = mStencilParameters.stencilFunctionMask;
855       break;
856     }
857     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
858     {
859       value = mStencilParameters.stencilFunctionReference;
860       break;
861     }
862     case Dali::Renderer::Property::STENCIL_MASK:
863     {
864       value = mStencilParameters.stencilMask;
865       break;
866     }
867     case Dali::Renderer::Property::RENDER_MODE:
868     {
869       value = mStencilParameters.renderMode;
870       break;
871     }
872     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
873     {
874       value = mStencilParameters.stencilOperationOnFail;
875       break;
876     }
877     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
878     {
879       value = mStencilParameters.stencilOperationOnZFail;
880       break;
881     }
882     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
883     {
884       value = mStencilParameters.stencilOperationOnZPass;
885       break;
886     }
887     case Dali::DevelRenderer::Property::OPACITY:
888     {
889       value = mOpacity;
890       break;
891     }
892     default:
893     {
894       // Must be a scene-graph only property
895       valueSet = false;
896       break;
897     }
898   }
899
900   return valueSet;
901 }
902
903 bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& value  ) const
904 {
905   bool valueSet = true;
906   const SceneGraph::Renderer& sceneObject = GetRendererSceneObject();
907
908   switch( index )
909   {
910     case Dali::Renderer::Property::DEPTH_INDEX:
911     {
912       value = sceneObject.GetDepthIndex();
913       break;
914     }
915     case Dali::Renderer::Property::FACE_CULLING_MODE:
916     {
917       value = sceneObject.GetFaceCullingMode();
918       break;
919     }
920     case Dali::Renderer::Property::BLEND_MODE:
921     {
922       value = sceneObject.GetBlendMode();
923       break;
924     }
925     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
926     {
927       uint32_t bitMask = sceneObject.GetBlendingOptions();
928       BlendingOptions blendingOptions;
929       blendingOptions.SetBitmask( bitMask );
930       value = static_cast<int32_t>( blendingOptions.GetBlendEquationRgb() );
931       break;
932     }
933     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
934     {
935       uint32_t bitMask = sceneObject.GetBlendingOptions();
936       BlendingOptions blendingOptions;
937       blendingOptions.SetBitmask( bitMask );
938       value = static_cast<int32_t>( blendingOptions.GetBlendEquationAlpha() );
939       break;
940     }
941     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
942     {
943       uint32_t bitMask = sceneObject.GetBlendingOptions();
944       BlendingOptions blendingOptions;
945       blendingOptions.SetBitmask( bitMask );
946       value = static_cast<int32_t>( blendingOptions.GetBlendSrcFactorRgb() );
947       break;
948     }
949     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
950     {
951       uint32_t bitMask = sceneObject.GetBlendingOptions();
952       BlendingOptions blendingOptions;
953       blendingOptions.SetBitmask( bitMask );
954       value = static_cast<int32_t>( blendingOptions.GetBlendDestFactorRgb() );
955       break;
956     }
957     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
958     {
959       uint32_t bitMask = sceneObject.GetBlendingOptions();
960       BlendingOptions blendingOptions;
961       blendingOptions.SetBitmask( bitMask );
962       value = static_cast<int32_t>( blendingOptions.GetBlendSrcFactorAlpha() );
963       break;
964     }
965     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
966     {
967       uint32_t bitMask = sceneObject.GetBlendingOptions();
968       BlendingOptions blendingOptions;
969       blendingOptions.SetBitmask( bitMask );
970       value = static_cast<int32_t>( blendingOptions.GetBlendDestFactorAlpha() );
971       break;
972     }
973     case Dali::Renderer::Property::BLEND_COLOR:
974     {
975       value = sceneObject.GetBlendColor();
976       break;
977     }
978     case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
979     {
980       value = sceneObject.IsPreMultipliedAlphaEnabled();
981       break;
982     }
983     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
984     {
985       value = static_cast<int32_t>( sceneObject.GetIndexedDrawFirstElement() );
986       break;
987     }
988     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
989     {
990       value = static_cast<int32_t>( sceneObject.GetIndexedDrawElementsCount() );
991       break;
992     }
993     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
994     {
995       value = sceneObject.GetDepthWriteMode();
996       break;
997     }
998     case Dali::Renderer::Property::DEPTH_FUNCTION:
999     {
1000       value = sceneObject.GetDepthFunction();
1001       break;
1002     }
1003     case Dali::Renderer::Property::DEPTH_TEST_MODE:
1004     {
1005       value = sceneObject.GetDepthTestMode();
1006       break;
1007     }
1008     case Dali::Renderer::Property::STENCIL_FUNCTION:
1009     {
1010       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1011       value = stencilParameters.stencilFunction;
1012       break;
1013     }
1014     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
1015     {
1016       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1017       value = stencilParameters.stencilFunctionMask;
1018       break;
1019     }
1020     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
1021     {
1022       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1023       value = stencilParameters.stencilFunctionReference;
1024       break;
1025     }
1026     case Dali::Renderer::Property::STENCIL_MASK:
1027     {
1028       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1029       value = stencilParameters.stencilMask;
1030       break;
1031     }
1032     case Dali::Renderer::Property::RENDER_MODE:
1033     {
1034       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1035       value = stencilParameters.renderMode;
1036       break;
1037     }
1038     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
1039     {
1040       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1041       value = stencilParameters.stencilOperationOnFail;
1042       break;
1043     }
1044     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
1045     {
1046       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1047       value = stencilParameters.stencilOperationOnZFail;
1048       break;
1049     }
1050     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
1051     {
1052       Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1053       value = stencilParameters.stencilOperationOnZPass;
1054       break;
1055     }
1056     case Dali::DevelRenderer::Property::OPACITY:
1057     {
1058       value = sceneObject.GetOpacity( GetEventThreadServices().GetEventBufferIndex() );
1059       break;
1060     }
1061     default:
1062     {
1063       // Must be an event-side only property
1064       valueSet = false;
1065       break;
1066     }
1067   }
1068
1069   return valueSet;
1070 }
1071
1072 } // namespace Internal
1073
1074 } // namespace Dali