Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2013-08-17 08:37:25 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-08-17 08:37:25 +0400
commit82c845425f0a5e2805ed7e9f6cb74920fa96229f (patch)
tree04d6b5fe7db2952b1a402aa2219637b2f4b810f6 /source/gameengine/Ketsji/KX_Light.cpp
parent51bca0d7dc8fb5033778796e14dd01c1c7f4355a (diff)
BGE: Adding partial support for LibLoaded lights with GLSL materials.
Any GLSL materials loaded after lights are LibLoaded will now use the lights in heir shaders. This includes materials loaded from the same scene as the LibLoaded lights. We could later add a new flag to LibLoad to recompile all existing shaders, but this commit should offer a lot more flexibility as is.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Light.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp16
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;