Fixed: Delay CDecal init as it depends on Scene object

develop
Nimetu 4 years ago
parent 4fd3f59b9a
commit 5e3cd0321a

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

Loading…
Cancel
Save