From ec60c74f081b006a6e8aebefe930a37aac95b865 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 22 May 2009 06:12:18 +0000 Subject: [PATCH] Fix for: energy IPO not supported in glsl mode (reported in the forum). in fact I redid part of the last "fix", making it working properly now. Before we were changing Lamp->la . This is the Blender Lamp, we shouldn't touch it. So this part of the code is correct now. Things that could be tackled: - color attribute is returning negative values when NEGATIVE is toggled - objects with no material (default gray one) still don't support lamp spots (not spot lamp but the spot of the lamps) --- source/blender/gpu/intern/gpu_material.c | 12 +++++------- source/gameengine/Ketsji/KX_Light.cpp | 7 ------- source/gameengine/Ketsji/KX_Light.h | 1 - 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 93604e76527..818b67170c7 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1308,14 +1308,12 @@ void GPU_lamp_update(GPULamp *lamp, int lay, float obmat[][4]) void GPU_lamp_update_colors(GPULamp *lamp, float r, float g, float b, float energy) { - lamp->la->energy = energy; - lamp->la->r = fabs(r); - lamp->la->g = fabs(g); - lamp->la->b = fabs(b); + lamp->energy = energy; + if(lamp->mode & LA_NEG) lamp->energy= -lamp->energy; - lamp->col[0]= lamp->la->r*lamp->energy; - lamp->col[1]= lamp->la->g*lamp->energy; - lamp->col[2]= lamp->la->b*lamp->energy; + lamp->col[0]= r* lamp->energy; + lamp->col[1]= g* lamp->energy; + lamp->col[2]= b* lamp->energy; } static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *la, GPULamp *lamp) diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 1496f34c5f2..fe575384a35 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -61,11 +61,6 @@ KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks, m_rendertools->AddLight(&m_lightobj); m_glsl = glsl; m_blenderscene = ((KX_Scene*)sgReplicationInfo)->GetBlenderScene(); - - m_initialvalues[0] = lightobj.m_red; - m_initialvalues[1] = lightobj.m_green; - m_initialvalues[2] = lightobj.m_blue; - m_initialvalues[3] = lightobj.m_energy; }; @@ -76,8 +71,6 @@ KX_LightObject::~KX_LightObject() if((lamp = GetGPULamp())) { float obmat[4][4] = {{0}}; GPU_lamp_update(lamp, 0, obmat); - GPU_lamp_update_colors(lamp, m_initialvalues[0], m_initialvalues[1], - m_initialvalues[2], m_initialvalues[3]); } m_rendertools->RemoveLight(&m_lightobj); diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h index 690231ff090..35f25515e3b 100644 --- a/source/gameengine/Ketsji/KX_Light.h +++ b/source/gameengine/Ketsji/KX_Light.h @@ -44,7 +44,6 @@ class KX_LightObject : public KX_GameObject Py_Header; protected: RAS_LightObject m_lightobj; - float m_initialvalues [4]; class RAS_IRenderTools* m_rendertools; //needed for registering and replication of lightobj bool m_glsl; Scene* m_blenderscene;