diff --git a/ryzom/client/src/decal.cpp b/ryzom/client/src/decal.cpp index e270a7c29..a16cb93bf 100644 --- a/ryzom/client/src/decal.cpp +++ b/ryzom/client/src/decal.cpp @@ -162,7 +162,9 @@ CDecal::CDecal() { DecalAttenuationVertexProgram = new CVertexProgramDecalAttenuation(); } - _ShadowMap = new CShadowMap(&(((CSceneUser *) Scene)->getScene().getRenderTrav().getShadowMapManager())); + + // initialized in render() as depends on scene + _ShadowMap = NULL; _Material.initUnlit(); _Diffuse = CRGBA::White; _Emissive = CRGBA::Black; @@ -251,7 +253,11 @@ CRGBA CDecal::getDiffuse() const // **************************************************************************** CDecal::~CDecal() { - delete _ShadowMap; + if (_ShadowMap) + { + delete _ShadowMap; + _ShadowMap = NULL; + } } // **************************************************************************** @@ -527,7 +533,12 @@ void CDecal::render(NL3D::UDriver &/* drv */, // float tileNear = Landscape->getTileNear(); // - nlassert(_ShadowMap); + if (!_ShadowMap) + { + _ShadowMap = new CShadowMap(&(((CSceneUser *) Scene)->getScene().getRenderTrav().getShadowMapManager())); + nlassert(_ShadowMap); + } + _ShadowMap->LocalClipPlanes.resize(4); CVector corners[4] = {