- route all glColor calls through render state.

- add sector links to dynamic lights.
This commit is contained in:
Christoph Oelckers 2014-05-11 22:57:42 +02:00
parent 978ace241c
commit c47c7421a3
19 changed files with 160 additions and 175 deletions

View file

@ -159,15 +159,13 @@ bool gl_GetLight(Plane & p, ADynamicLight * light, bool checkside, bool forceadd
}
//==========================================================================
//
// Sets up the parameters to render one dynamic light onto one plane
//
//==========================================================================
bool gl_SetupLight(Plane & p, ADynamicLight * light, Vector & nearPt, Vector & up, Vector & right,
float & scale, bool checkside, bool forceadditive)
float & scale, int desaturation, bool checkside, bool forceadditive)
{
Vector fn, pos;
@ -225,11 +223,45 @@ bool gl_SetupLight(Plane & p, ADynamicLight * light, Vector & nearPt, Vector & u
{
gl_RenderState.BlendEquation(GL_FUNC_ADD);
}
glColor3f(r,g,b);
gl_RenderState.SetColor(r, g, b, 1.f, desaturation);
return true;
}
//==========================================================================
//
//
//
//==========================================================================
#if 0
void gl_UploadLights(FDynLightData &data)
{
ParameterBufferElement *pptr;
int size0 = data.arrays[0].Size()/4;
int size1 = data.arrays[1].Size()/4;
int size2 = data.arrays[2].Size()/4;
if (size0 + size1 + size2 > 0)
{
int sizetotal = size0 + size1 + size2 + 1;
int index = GLRenderer->mParmBuffer->Reserve(sizetotal, &pptr);
float parmcnt[] = { index + 1, index + 1 + size0, index + 1 + size0 + size1, index + 1 + size0 + size1 + size2 };
memcpy(&pptr[0], parmcnt, 4 * sizeof(float));
memcpy(&pptr[1], &data.arrays[0][0], 4 * size0*sizeof(float));
memcpy(&pptr[1 + size0], &data.arrays[1][0], 4 * size1*sizeof(float));
memcpy(&pptr[1 + size0 + size1], &data.arrays[2][0], 4 * size2*sizeof(float));
gl_RenderState.SetDynLightIndex(index);
}
else
{
gl_RenderState.SetDynLightIndex(-1);
}
}
#endif
//==========================================================================
//
//