// INTERNAL INCLUDES
#include <dali/public-api/actors/renderer.h> // Dali::Renderer
+#include <dali/public-api/object/type-registry.h>
#include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
#include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
#include <dali/internal/event/common/property-input-impl.h>
* |name |type |writable|animatable|constraint-input|enum for index-checking|
*/
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "depth-index", INTEGER, true, true, true, Dali::Renderer::Property::DEPTH_INDEX )
+DALI_PROPERTY( "depth-index", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX )
DALI_PROPERTY_TABLE_END( DEFAULT_OBJECT_PROPERTY_START_INDEX )
const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
+BaseHandle Create()
+{
+ return Dali::BaseHandle();
+}
+
+TypeRegistration mType( typeid( Dali::Renderer ), typeid( Dali::Handle ), Create );
+
} // unnamed namespace
RendererPtr Renderer::New()
SetGeometryMessage( GetEventThreadServices(), *mSceneObject, *geometrySceneObject );
}
+Geometry* Renderer::GetGeometry() const
+{
+ return mGeometryConnector.Get().Get();
+}
+
void Renderer::SetMaterial( Material& material )
{
mMaterialConnector.Set( material, OnStage() );
SetMaterialMessage( GetEventThreadServices(), *mSceneObject, *materialSceneObject );
}
-void Renderer::SetDepthIndex( int depthIndex )
+Material* Renderer::GetMaterial() const
{
- SceneGraph::AnimatablePropertyMessage<int>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mDepthIndex, &SceneGraph::AnimatableProperty<int>::Bake, depthIndex );
+ return mMaterialConnector.Get().Get();
}
-int Renderer::GetCurrentDepthIndex() const
+void Renderer::SetDepthIndex( int depthIndex )
{
- int depthIndex = 0;
- if( mSceneObject )
+ if ( mDepthIndex != depthIndex )
{
- BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
- depthIndex = mSceneObject->mDepthIndex[bufferIndex];
+ mDepthIndex = depthIndex;
+ SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex );
}
- return depthIndex;
+}
+
+int Renderer::GetDepthIndex() const
+{
+ return mDepthIndex;
}
SceneGraph::RendererAttachment* Renderer::GetRendererSceneObject()
{
case Dali::Renderer::Property::DEPTH_INDEX:
{
- value = GetCurrentDepthIndex();
+ value = GetDepthIndex();
}
break;
}
&Renderer::FindAnimatableProperty,
&Renderer::FindCustomProperty,
index );
-
- if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
- {
- switch(index)
- {
- case Dali::Renderer::Property::DEPTH_INDEX:
- {
- property = &mSceneObject->mDepthIndex;
- }
- break;
- }
- }
}
return property;
&Renderer::FindCustomProperty,
index );
property = static_cast<const PropertyInputImpl*>( baseProperty );
-
- if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
- {
- switch(index)
- {
- case Dali::Renderer::Property::DEPTH_INDEX:
- {
- property = &mSceneObject->mDepthIndex;
- }
- break;
- }
- }
}
return property;
Renderer::Renderer()
: mSceneObject(NULL),
+ mDepthIndex(0),
mOnStage(false)
{
}
void Renderer::Initialize()
{
- DALI_ASSERT_ALWAYS( EventThreadServices::IsCoreRunning() && "Core is not running" );
EventThreadServices& eventThreadServices = GetEventThreadServices();
SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
// Send message to update to connect to scene graph:
AttachToSceneGraphMessage( updateManager, mSceneObject );
+
+ eventThreadServices.RegisterObject( this );
}
Renderer::~Renderer()
{
+ if( EventThreadServices::IsCoreRunning() )
+ {
+ EventThreadServices& eventThreadServices = GetEventThreadServices();
+ SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
+ RemoveObjectMessage( updateManager, mSceneObject );
+
+ eventThreadServices.UnregisterObject( this );
+ }
}
} // namespace Internal