diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_Light.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Light.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index a8f309cc592..0e4db0d351e 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -48,6 +48,9 @@ #include "DNA_scene_types.h" #include "DNA_lamp_types.h" #include "GPU_material.h" + +#include "BKE_scene.h" +#include "MEM_guardedalloc.h" KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks, class RAS_IRenderTools* rendertools, @@ -62,6 +65,7 @@ KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks, m_rendertools->AddLight(&m_lightobj); m_glsl = glsl; m_blenderscene = ((KX_Scene*)sgReplicationInfo)->GetBlenderScene(); + m_base = NULL; }; @@ -78,6 +82,11 @@ KX_LightObject::~KX_LightObject() } m_rendertools->RemoveLight(&m_lightobj); + + if (m_base) { + BKE_scene_base_unlink(m_blenderscene, m_base); + MEM_freeN(m_base); + } } @@ -216,6 +225,13 @@ void KX_LightObject::Update() } } +void KX_LightObject::UpdateScene(KX_Scene *kxscene) +{ + m_lightobj.m_scene = (void*)kxscene; + m_blenderscene = kxscene->GetBlenderScene(); + m_base = BKE_scene_base_add(m_blenderscene, GetBlenderObject()); +} + bool KX_LightObject::HasShadowBuffer() { GPULamp *lamp; |