DALI_ASSERT_DEBUG( mSceneObject )
mShader = &shader;
- const SceneGraph::Shader& sceneGraphShader = dynamic_cast<const SceneGraph::Shader&>( *shader.GetSceneObject() );
+ SceneGraph::Shader& sceneGraphShader = *shader.GetShaderSceneObject();
SceneGraph::SetShaderMessage( GetEventThreadServices(), *mSceneObject, sceneGraphShader );
}
connector.Set( sampler, OnStage() );
mSamplerConnectors.push_back( connector );
- const SceneGraph::Sampler& sceneGraphSampler = dynamic_cast<const SceneGraph::Sampler&>( *sampler.GetSceneObject() );
+ SceneGraph::Sampler& sceneGraphSampler = *sampler.GetSamplerSceneObject();
SceneGraph::AddSamplerMessage( GetEventThreadServices(), *mSceneObject, sceneGraphSampler );
}
void Material::RemoveSampler( std::size_t index )
{
- mSamplerConnectors.erase( mSamplerConnectors.begin() + index );
+ if( index < mSamplerConnectors.size() )
+ {
+ SamplerConnectorContainer::iterator iter = mSamplerConnectors.begin() + index;
+ SceneGraph::Sampler& sceneGraphSampler = *iter->Get()->GetSamplerSceneObject();
+ SceneGraph::RemoveSamplerMessage( GetEventThreadServices(), *mSceneObject, sceneGraphSampler );
+ mSamplerConnectors.erase( iter );
+ }
}
Sampler* Material::GetSamplerAt( unsigned int index ) const
BlendPolicy mBlendPolicy; ///< The blend policy as determined by PrepareRender
};
-inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Material& material, const Shader& shader )
+inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Material& material, Shader& shader )
{
typedef MessageValue1< Material, Shader* > LocalType;
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &material, &Material::SetShader, const_cast<Shader*>(&shader) );
+ new (slot) LocalType( &material, &Material::SetShader, &shader );
}
-inline void AddSamplerMessage( EventThreadServices& eventThreadServices, const Material& material, const Sampler& sampler )
+inline void AddSamplerMessage( EventThreadServices& eventThreadServices, const Material& material, Sampler& sampler )
{
typedef MessageValue1< Material, Sampler* > LocalType;
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &material, &Material::AddSampler, const_cast<Sampler*>(&sampler) );
+ new (slot) LocalType( &material, &Material::AddSampler, &sampler );
}
inline void RemoveSamplerMessage( EventThreadServices& eventThreadServices, const Material& material, Sampler& sampler )
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &material, &Material::RemoveSampler, const_cast<Sampler*>(&sampler) );
+ new (slot) LocalType( &material, &Material::RemoveSampler, &sampler );
}
inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Material& material, unsigned int options )