[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20334] trunk/blender/source: Fix for: energy IPO not supported in glsl mode (reported in the forum).

Dalai Felinto dfelinto at gmail.com
Fri May 22 08:12:18 CEST 2009


Revision: 20334
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20334
Author:   dfelinto
Date:     2009-05-22 08:12:18 +0200 (Fri, 22 May 2009)

Log Message:
-----------
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)

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_material.c
    trunk/blender/source/gameengine/Ketsji/KX_Light.cpp
    trunk/blender/source/gameengine/Ketsji/KX_Light.h

Modified: trunk/blender/source/blender/gpu/intern/gpu_material.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_material.c	2009-05-22 03:45:46 UTC (rev 20333)
+++ trunk/blender/source/blender/gpu/intern/gpu_material.c	2009-05-22 06:12:18 UTC (rev 20334)
@@ -1308,14 +1308,12 @@
 
 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)

Modified: trunk/blender/source/gameengine/Ketsji/KX_Light.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_Light.cpp	2009-05-22 03:45:46 UTC (rev 20333)
+++ trunk/blender/source/gameengine/Ketsji/KX_Light.cpp	2009-05-22 06:12:18 UTC (rev 20334)
@@ -61,11 +61,6 @@
 	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 @@
 	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);

Modified: trunk/blender/source/gameengine/Ketsji/KX_Light.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_Light.h	2009-05-22 03:45:46 UTC (rev 20333)
+++ trunk/blender/source/gameengine/Ketsji/KX_Light.h	2009-05-22 06:12:18 UTC (rev 20334)
@@ -44,7 +44,6 @@
 	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;





More information about the Bf-blender-cvs mailing list