Beispiel #1
0
KX_LightObject::~KX_LightObject()
{
	GPULamp *lamp;

	if((lamp = GetGPULamp())) {
		float obmat[4][4] = {{0}};
		GPU_lamp_update(lamp, 0, 0, obmat);
	}

	m_rendertools->RemoveLight(&m_lightobj);
}
Beispiel #2
0
RAS_OpenGLLight::~RAS_OpenGLLight()
{
	GPULamp *lamp;
	KX_LightObject *kxlight = (KX_LightObject *)m_light;
	Lamp *la = (Lamp *)kxlight->GetBlenderObject()->data;

	if ((lamp = GetGPULamp())) {
		float obmat[4][4] = {{0}};
		GPU_lamp_update(lamp, 0, 0, obmat);
		GPU_lamp_update_distance(lamp, la->dist, la->att1, la->att2, la->coeff_const, la->coeff_lin, la->coeff_quad);
		GPU_lamp_update_spot(lamp, la->spotsize, la->spotblend);
	}
}
Beispiel #3
0
void KX_LightObject::Update()
{
	GPULamp *lamp;

	if((lamp = GetGPULamp()) != NULL && GetSGNode()) {
		float obmat[4][4];
		// lights don't get their openGL matrix updated, do it now
		if (GetSGNode()->IsDirty())
			GetOpenGLMatrix();
		double *dobmat = GetOpenGLMatrixPtr()->getPointer();

		for(int i=0; i<4; i++)
			for(int j=0; j<4; j++, dobmat++)
				obmat[i][j] = (float)*dobmat;

		GPU_lamp_update(lamp, m_lightobj.m_layer, 0, obmat);
		GPU_lamp_update_colors(lamp, m_lightobj.m_red, m_lightobj.m_green, 
			m_lightobj.m_blue, m_lightobj.m_energy);
	}
}
Beispiel #4
0
void RAS_OpenGLLight::Update()
{
	GPULamp *lamp;
	KX_LightObject *kxlight = (KX_LightObject *)m_light;

	if ((lamp = GetGPULamp()) != NULL && kxlight->GetSGNode()) {
		float obmat[4][4];
		// lights don't get their openGL matrix updated, do it now
		if (kxlight->GetSGNode()->IsDirty())
			kxlight->GetOpenGLMatrix();
		float *dobmat = kxlight->GetOpenGLMatrixPtr()->getPointer();

		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 4; j++, dobmat++)
				obmat[i][j] = (float)*dobmat;
		int hide = kxlight->GetVisible() ? 0 : 1;
		GPU_lamp_update(lamp, m_layer, hide, obmat);
		GPU_lamp_update_colors(lamp, m_color[0], m_color[1],
		                       m_color[2], m_energy);
		GPU_lamp_update_distance(lamp, m_distance, m_att1, m_att2, m_coeff_const, m_coeff_lin, m_coeff_quad);
		GPU_lamp_update_spot(lamp, m_spotsize, m_spotblend);
	}
}