2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/event/rendering/renderer-impl.h> // Dali::Internal::Renderer
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
24 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
25 #include <dali/internal/event/common/property-input-impl.h>
26 #include <dali/internal/update/rendering/scene-graph-renderer.h>
27 #include <dali/internal/update/manager/update-manager.h>
28 #include <dali/internal/render/renderers/render-geometry.h>
39 * |name |type |writable|animatable|constraint-input|enum for index-checking|
41 DALI_PROPERTY_TABLE_BEGIN
42 DALI_PROPERTY( "depthIndex", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX )
43 DALI_PROPERTY( "faceCullingMode", INTEGER, true, false, false, Dali::Renderer::Property::FACE_CULLING_MODE )
44 DALI_PROPERTY( "blendMode", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_MODE )
45 DALI_PROPERTY( "blendEquationRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_RGB )
46 DALI_PROPERTY( "blendEquationAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_ALPHA )
47 DALI_PROPERTY( "blendFactorSrcRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB )
48 DALI_PROPERTY( "blendFactorDestRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB )
49 DALI_PROPERTY( "blendFactorSrcAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA )
50 DALI_PROPERTY( "blendFactorDestAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA )
51 DALI_PROPERTY( "blendColor", VECTOR4, true, false, false, Dali::Renderer::Property::BLEND_COLOR )
52 DALI_PROPERTY( "blendPreMultipliedAlpha", BOOLEAN, true, false, false, Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA )
53 DALI_PROPERTY( "indexRangeFirst", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_FIRST )
54 DALI_PROPERTY( "indexRangeCount", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_COUNT )
55 DALI_PROPERTY( "depthWriteMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
56 DALI_PROPERTY( "depthFunction", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_FUNCTION )
57 DALI_PROPERTY( "depthTestMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_TEST_MODE )
58 DALI_PROPERTY( "stencilFunction", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION )
59 DALI_PROPERTY( "stencilFunctionMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
60 DALI_PROPERTY( "stencilFunctionReference", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
61 DALI_PROPERTY( "stencilMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MASK )
62 DALI_PROPERTY( "stencilMode", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MODE )
63 DALI_PROPERTY( "stencilOperationOnFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
64 DALI_PROPERTY( "stencilOperationOnZFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
65 DALI_PROPERTY( "stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
66 DALI_PROPERTY( "writeToColorBuffer", BOOLEAN, true, false, false, Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER )
67 DALI_PROPERTY_TABLE_END( DEFAULT_OBJECT_PROPERTY_START_INDEX )
69 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
73 return Dali::BaseHandle();
76 TypeRegistration mType( typeid( Dali::Renderer ), typeid( Dali::Handle ), Create );
78 } // unnamed namespace
80 RendererPtr Renderer::New()
82 RendererPtr rendererPtr( new Renderer() );
83 rendererPtr->Initialize();
87 void Renderer::SetGeometry( Geometry& geometry )
89 mGeometry = &geometry;
91 const Render::Geometry* geometrySceneObject = geometry.GetRenderObject();
92 SetGeometryMessage( GetEventThreadServices(), *mSceneObject, *geometrySceneObject );
95 Geometry* Renderer::GetGeometry() const
97 return mGeometry.Get();
100 void Renderer::SetTextures( TextureSet& textureSet )
102 mTextureSetConnector.Set( textureSet, OnStage() );
103 const SceneGraph::TextureSet* textureSetSceneObject = textureSet.GetTextureSetSceneObject();
104 SetTexturesMessage( GetEventThreadServices(), *mSceneObject, *textureSetSceneObject );
107 TextureSet* Renderer::GetTextures() const
109 return mTextureSetConnector.Get().Get();
112 void Renderer::SetShader( Shader& shader )
115 SceneGraph::Shader& sceneGraphShader = *shader.GetShaderSceneObject();
116 SceneGraph::SetShaderMessage( GetEventThreadServices(), *mSceneObject, sceneGraphShader );
119 Shader* Renderer::GetShader() const
121 return mShader.Get();
124 void Renderer::SetDepthIndex( int depthIndex )
126 if ( mDepthIndex != depthIndex )
128 mDepthIndex = depthIndex;
129 SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex );
133 int Renderer::GetDepthIndex() const
138 void Renderer::SetFaceCullingMode( FaceCullingMode::Type cullingMode )
140 if( mFaceCullingMode != cullingMode )
142 mFaceCullingMode = cullingMode;
144 SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, mFaceCullingMode );
148 FaceCullingMode::Type Renderer::GetFaceCullingMode()
150 return mFaceCullingMode;
153 void Renderer::SetBlendMode( BlendMode::Type mode )
155 if( mBlendMode != mode )
159 SetBlendModeMessage( GetEventThreadServices(), *mSceneObject, mBlendMode );
163 BlendMode::Type Renderer::GetBlendMode() const
168 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba )
170 mBlendingOptions.SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
171 SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
174 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgb,
175 BlendFactor::Type destFactorRgb,
176 BlendFactor::Type srcFactorAlpha,
177 BlendFactor::Type destFactorAlpha )
179 mBlendingOptions.SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
180 SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
183 void Renderer::GetBlendFunc( BlendFactor::Type& srcFactorRgb,
184 BlendFactor::Type& destFactorRgb,
185 BlendFactor::Type& srcFactorAlpha,
186 BlendFactor::Type& destFactorAlpha ) const
188 srcFactorRgb = mBlendingOptions.GetBlendSrcFactorRgb();
189 destFactorRgb = mBlendingOptions.GetBlendDestFactorRgb();
190 srcFactorAlpha = mBlendingOptions.GetBlendSrcFactorAlpha();
191 destFactorAlpha = mBlendingOptions.GetBlendDestFactorAlpha();
194 void Renderer::SetBlendEquation( BlendEquation::Type equationRgba )
196 mBlendingOptions.SetBlendEquation( equationRgba, equationRgba );
197 SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
200 void Renderer::SetBlendEquation( BlendEquation::Type equationRgb,
201 BlendEquation::Type equationAlpha )
203 mBlendingOptions.SetBlendEquation( equationRgb, equationAlpha );
204 SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
207 void Renderer::GetBlendEquation( BlendEquation::Type& equationRgb,
208 BlendEquation::Type& equationAlpha ) const
210 // These are not animatable, the cached values are up-to-date.
211 equationRgb = mBlendingOptions.GetBlendEquationRgb();
212 equationAlpha = mBlendingOptions.GetBlendEquationAlpha();
215 void Renderer::SetBlendColor( const Vector4& color )
219 mBlendColor = new Vector4();
221 if( *mBlendColor != color )
223 *mBlendColor = color;
224 SetBlendColorMessage( GetEventThreadServices(), *mSceneObject, *mBlendColor );
228 Vector4 Renderer::GetBlendColor() const
234 return Color::TRANSPARENT; // GL default
237 void Renderer::SetIndexedDrawFirstElement( size_t firstElement )
239 if( firstElement != mIndexedDrawFirstElement )
241 mIndexedDrawFirstElement = firstElement;
242 SetIndexedDrawFirstElementMessage( GetEventThreadServices(), *mSceneObject, mIndexedDrawFirstElement );
246 void Renderer::SetIndexedDrawElementsCount( size_t elementsCount )
248 if( elementsCount != mIndexedDrawElementCount )
250 mIndexedDrawElementCount = elementsCount;
251 SetIndexedDrawElementsCountMessage( GetEventThreadServices(), *mSceneObject, mIndexedDrawElementCount );
256 void Renderer::EnablePreMultipliedAlpha( bool preMultipled )
258 if( mPremultipledAlphaEnabled != preMultipled )
262 SetBlendFunc( BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE );
264 mPremultipledAlphaEnabled = preMultipled;
265 SetEnablePreMultipliedAlphaMessage( GetEventThreadServices(), *mSceneObject, mPremultipledAlphaEnabled );
269 bool Renderer::IsPreMultipliedAlphaEnabled() const
271 return mPremultipledAlphaEnabled;
274 SceneGraph::Renderer* Renderer::GetRendererSceneObject()
279 unsigned int Renderer::GetDefaultPropertyCount() const
281 return RENDERER_IMPL.GetDefaultPropertyCount();
284 void Renderer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
286 RENDERER_IMPL.GetDefaultPropertyIndices( indices );
289 const char* Renderer::GetDefaultPropertyName(Property::Index index) const
291 return RENDERER_IMPL.GetDefaultPropertyName( index );
294 Property::Index Renderer::GetDefaultPropertyIndex( const std::string& name ) const
296 return RENDERER_IMPL.GetDefaultPropertyIndex( name );
299 bool Renderer::IsDefaultPropertyWritable( Property::Index index ) const
301 return RENDERER_IMPL.IsDefaultPropertyWritable( index );
304 bool Renderer::IsDefaultPropertyAnimatable( Property::Index index ) const
306 return RENDERER_IMPL.IsDefaultPropertyAnimatable( index );
309 bool Renderer::IsDefaultPropertyAConstraintInput( Property::Index index ) const
311 return RENDERER_IMPL.IsDefaultPropertyAConstraintInput( index );
314 Property::Type Renderer::GetDefaultPropertyType( Property::Index index ) const
316 return RENDERER_IMPL.GetDefaultPropertyType( index );
319 void Renderer::SetDefaultProperty( Property::Index index,
320 const Property::Value& propertyValue )
324 case Dali::Renderer::Property::DEPTH_INDEX:
326 SetDepthIndex( propertyValue.Get<int>() );
329 case Dali::Renderer::Property::FACE_CULLING_MODE:
332 if( propertyValue.Get( faceCullingMode ) )
334 SetFaceCullingMode( FaceCullingMode::Type( faceCullingMode ) );
338 case Dali::Renderer::Property::BLEND_MODE:
341 if( propertyValue.Get( blendingMode ) )
343 SetBlendMode( BlendMode::Type( blendingMode ) );
347 case Dali::Renderer::Property::BLEND_EQUATION_RGB:
349 int blendingEquation;
350 if( propertyValue.Get( blendingEquation ) )
352 BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
353 mBlendingOptions.SetBlendEquation( static_cast<BlendEquation::Type>( blendingEquation ), alphaEquation );
354 SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
358 case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
360 int blendingEquation;
361 if( propertyValue.Get( blendingEquation ) )
363 BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
364 mBlendingOptions.SetBlendEquation( rgbEquation, static_cast<BlendEquation::Type>( blendingEquation ) );
365 SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
369 case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
372 if( propertyValue.Get( blendingFactor ) )
374 BlendFactor::Type srcFactorRgb;
375 BlendFactor::Type destFactorRgb;
376 BlendFactor::Type srcFactorAlpha;
377 BlendFactor::Type destFactorAlpha;
378 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
379 SetBlendFunc( static_cast<BlendFactor::Type>( blendingFactor ),
386 case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
389 if( propertyValue.Get( blendingFactor ) )
391 BlendFactor::Type srcFactorRgb;
392 BlendFactor::Type destFactorRgb;
393 BlendFactor::Type srcFactorAlpha;
394 BlendFactor::Type destFactorAlpha;
395 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
396 SetBlendFunc( srcFactorRgb,
397 static_cast<BlendFactor::Type>( blendingFactor ),
403 case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
406 if( propertyValue.Get( blendingFactor ) )
408 BlendFactor::Type srcFactorRgb;
409 BlendFactor::Type destFactorRgb;
410 BlendFactor::Type srcFactorAlpha;
411 BlendFactor::Type destFactorAlpha;
412 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
413 SetBlendFunc( srcFactorRgb,
415 static_cast<BlendFactor::Type>( blendingFactor ),
420 case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
423 if( propertyValue.Get( blendingFactor ) )
425 BlendFactor::Type srcFactorRgb;
426 BlendFactor::Type destFactorRgb;
427 BlendFactor::Type srcFactorAlpha;
428 BlendFactor::Type destFactorAlpha;
429 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
430 SetBlendFunc( srcFactorRgb,
433 static_cast<BlendFactor::Type>( blendingFactor ) );
437 case Dali::Renderer::Property::BLEND_COLOR:
440 if( propertyValue.Get( blendColor ) )
442 SetBlendColor( blendColor );
446 case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
449 if( propertyValue.Get( preMultipled ) )
451 EnablePreMultipliedAlpha( preMultipled );
455 case Dali::Renderer::Property::INDEX_RANGE_FIRST:
458 if( propertyValue.Get( firstElement ) )
460 SetIndexedDrawFirstElement( firstElement );
464 case Dali::Renderer::Property::INDEX_RANGE_COUNT:
467 if( propertyValue.Get( elementsCount ) )
469 SetIndexedDrawElementsCount( elementsCount );
473 case Dali::Renderer::Property::DEPTH_WRITE_MODE:
476 propertyValue.Get( value );
477 DepthWriteMode::Type mode = static_cast<DepthWriteMode::Type>(value);
478 if( mode != mDepthWriteMode )
480 mDepthWriteMode = mode;
481 SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, mode );
485 case Dali::Renderer::Property::DEPTH_FUNCTION:
488 propertyValue.Get( value );
489 DepthFunction::Type depthFunction = static_cast<DepthFunction::Type>(value);
490 if( depthFunction != mDepthFunction )
492 mDepthFunction = depthFunction;
493 SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, depthFunction );
497 case Dali::Renderer::Property::DEPTH_TEST_MODE:
500 propertyValue.Get( value );
501 DepthTestMode::Type mode = static_cast<DepthTestMode::Type>(value);
502 if( mode != mDepthTestMode )
504 mDepthTestMode = mode;
505 SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, mode );
516 void Renderer::SetSceneGraphProperty( Property::Index index,
517 const PropertyMetadata& entry,
518 const Property::Value& value )
520 RENDERER_IMPL.SetSceneGraphProperty( GetEventThreadServices(), this, index, entry, value );
521 OnPropertySet(index, value);
524 Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
526 Property::Value value;
529 case Dali::Renderer::Property::DEPTH_INDEX:
531 value = GetDepthIndex();
534 case Dali::Renderer::Property::FACE_CULLING_MODE:
536 value = mFaceCullingMode;
539 case Dali::Renderer::Property::BLEND_MODE:
544 case Dali::Renderer::Property::BLEND_EQUATION_RGB:
546 value = static_cast<int>( mBlendingOptions.GetBlendEquationRgb() );
549 case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
551 value = static_cast<int>( mBlendingOptions.GetBlendEquationAlpha() );
554 case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
556 BlendFactor::Type srcFactorRgb;
557 BlendFactor::Type destFactorRgb;
558 BlendFactor::Type srcFactorAlpha;
559 BlendFactor::Type destFactorAlpha;
560 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
561 value = static_cast<int>( srcFactorRgb );
564 case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
566 BlendFactor::Type srcFactorRgb;
567 BlendFactor::Type destFactorRgb;
568 BlendFactor::Type srcFactorAlpha;
569 BlendFactor::Type destFactorAlpha;
570 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
571 value = static_cast<int>( destFactorRgb );
574 case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
576 BlendFactor::Type srcFactorRgb;
577 BlendFactor::Type destFactorRgb;
578 BlendFactor::Type srcFactorAlpha;
579 BlendFactor::Type destFactorAlpha;
580 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
581 value = static_cast<int>( srcFactorAlpha );
584 case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
586 BlendFactor::Type srcFactorRgb;
587 BlendFactor::Type destFactorRgb;
588 BlendFactor::Type srcFactorAlpha;
589 BlendFactor::Type destFactorAlpha;
590 GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
591 value = static_cast<int>( destFactorAlpha );
594 case Dali::Renderer::Property::BLEND_COLOR:
598 value = *mBlendColor;
602 value = Color::TRANSPARENT;
606 case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
608 value = IsPreMultipliedAlphaEnabled();
611 case Dali::Renderer::Property::INDEX_RANGE_FIRST:
613 value = static_cast<int>( mIndexedDrawFirstElement );
616 case Dali::Renderer::Property::INDEX_RANGE_COUNT:
618 value = static_cast<int>( mIndexedDrawElementCount );
621 case Dali::Renderer::Property::DEPTH_WRITE_MODE:
623 value = mDepthWriteMode;
626 case Dali::Renderer::Property::DEPTH_FUNCTION:
628 value = mDepthFunction;
631 case Dali::Renderer::Property::DEPTH_TEST_MODE:
633 value = mDepthTestMode;
640 const SceneGraph::PropertyOwner* Renderer::GetPropertyOwner() const
645 const SceneGraph::PropertyOwner* Renderer::GetSceneObject() const
650 const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Property::Index index ) const
652 DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
653 const SceneGraph::PropertyBase* property = NULL;
657 property = RENDERER_IMPL.GetRegisteredSceneGraphProperty(
659 &Renderer::FindAnimatableProperty,
660 &Renderer::FindCustomProperty,
667 const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index index ) const
669 const PropertyInputImpl* property = NULL;
673 const SceneGraph::PropertyBase* baseProperty =
674 RENDERER_IMPL.GetRegisteredSceneGraphProperty( this,
675 &Renderer::FindAnimatableProperty,
676 &Renderer::FindCustomProperty,
678 property = static_cast<const PropertyInputImpl*>( baseProperty );
684 int Renderer::GetPropertyComponentIndex( Property::Index index ) const
686 return Property::INVALID_COMPONENT_INDEX;
689 bool Renderer::OnStage() const
691 return mOnStageCount > 0;
694 void Renderer::Connect()
696 if( mOnStageCount == 0 )
698 OnStageConnectMessage( GetEventThreadServices(), *mSceneObject );
699 mTextureSetConnector.OnStageConnect();
704 void Renderer::Disconnect()
707 if( mOnStageCount == 0 )
709 OnStageDisconnectMessage( GetEventThreadServices(), *mSceneObject);
710 mTextureSetConnector.OnStageDisconnect();
715 : mSceneObject (NULL ),
719 mIndexedDrawFirstElement( 0 ),
720 mIndexedDrawElementCount( 0 ),
721 mFaceCullingMode( FaceCullingMode::NONE ),
722 mBlendMode( BlendMode::AUTO ),
724 mDepthWriteMode( DepthWriteMode::AUTO ),
725 mDepthFunction( DepthFunction::LESS ),
726 mDepthTestMode( DepthTestMode::AUTO ),
727 mPremultipledAlphaEnabled( false )
731 void Renderer::Initialize()
733 EventThreadServices& eventThreadServices = GetEventThreadServices();
734 SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
736 mSceneObject = SceneGraph::Renderer::New();
737 AddMessage( updateManager, updateManager.GetRendererOwner(), *mSceneObject );
739 eventThreadServices.RegisterObject( this );
742 Renderer::~Renderer()
744 if( EventThreadServices::IsCoreRunning() )
746 EventThreadServices& eventThreadServices = GetEventThreadServices();
747 SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
748 RemoveMessage( updateManager, updateManager.GetRendererOwner(), *mSceneObject );
750 eventThreadServices.UnregisterObject( this );
754 } // namespace Internal