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