[Bf-codereview] BGE Harmony Branch (issue 5491068)

mogurijin at gmail.com mogurijin at gmail.com
Tue Mar 6 04:58:36 CET 2012


Here is my current solution, which I think should do the trick:
if(material->dynproperty & DYN_LAMP_PERSMAT)
{
	if (!GPU_lamp_has_shadow_buffer(lamp)) /* The lamp matrices are already
updated if we're using shadow buffers */
		GPU_lamp_update_buffer_mats(lamp);
	mult_m4_m4m4(lamp->dynpersmat, lamp->persmat, viewinv);
}

Any objections to this? It avoids multiple calls to
GPU_lamp_update_buffer_mats(), but it seems to avoid the actual problem:
the matrix data is needed in two different places (camera setup and
shaders).

On 2012/03/06 03:53:36, Moguri wrote:
> Okay, so I was looking into fixing up the lamp texture code. This was
previously
> trying to mimic Unity's light "cookies", which alter shadows, but then
the
> feature expanded to just light textures in general. So, I cleaned it
up to not
> depend on shadow code. Instead now, it modifies the light's color
value. The
> downside to this is that a lamp's dynpersmat was only properly updated
when
> shadow buffers were bound (persmat was updated, which allowed
dynpersmat to be
> calculated correctly), which made the feature not work with shadows
disabled. I
> moved the matrix update code into another function that is now also
called in
> GPU_material_bind_uniforms(), but now the matrix updates (moved to
> GPU_lamp_update_buffer_mats()) are called twice for shadow buffer
updates
> (binding shadow buffers and then binding uniforms).

> Here's a patch of gpu_material.c against the Harmony branch:
> http://www.pasteall.org/29768/diff

> Any thoughts?


https://codereview.appspot.com/5491068/


More information about the Bf-codereview mailing list