+void ModelPrimitive::UpdateShadowMapTexture()
+{
+ if(mRenderer && mMaterial)
+ {
+ Dali::TextureSet textures = mRenderer.GetTextures();
+ if(!textures)
+ {
+ return;
+ }
+
+ uint32_t textureCount = textures.GetTextureCount();
+ if(mShadowMapTexture &&
+ textureCount >= GetImplementation(mMaterial).GetShadowMapTextureOffset() &&
+ textures.GetTexture(textureCount - GetImplementation(mMaterial).GetShadowMapTextureOffset()) != mShadowMapTexture)
+ {
+ Dali::TextureSet newTextures = Dali::TextureSet::New();
+
+ for(uint32_t index = 0u; index < textureCount; ++index)
+ {
+ Dali::Texture texture = textures.GetTexture(index);
+ if(index == textureCount - GetImplementation(mMaterial).GetShadowMapTextureOffset())
+ {
+ texture = (!!mShadowMapTexture) ? mShadowMapTexture : MakeEmptyTexture();
+ }
+
+ newTextures.SetTexture(index, texture);
+ newTextures.SetSampler(index, textures.GetSampler(index));
+ }
+
+ mRenderer.SetTextures(newTextures);
+ }
+ }
+}
+