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)
This commit is contained in:
Dalai Felinto
2009-05-22 06:12:18 +00:00
parent 612f3b3266
commit ec60c74f08
3 changed files with 5 additions and 15 deletions

View File

@@ -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)

View File

@@ -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);

View File

@@ -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;