mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
added lighting configuration
This commit is contained in:
parent
12427b1f3e
commit
264bab806b
@ -10,6 +10,21 @@ using namespace MWRender;
|
||||
using namespace Ogre;
|
||||
using namespace ESMS;
|
||||
|
||||
bool InteriorCellRender::lightConst = false;
|
||||
float InteriorCellRender::lightConstValue = 0.0;
|
||||
|
||||
bool InteriorCellRender::lightLinear = true;
|
||||
int InteriorCellRender::lightLinearMethod = 1;
|
||||
float InteriorCellRender::lightLinearValue = 3;
|
||||
float InteriorCellRender::lightLinearRadiusMult = 1;
|
||||
|
||||
bool InteriorCellRender::lightQuadratic = false;
|
||||
int InteriorCellRender::lightQuadraticMethod = 2;
|
||||
float InteriorCellRender::lightQuadraticValue = 16;
|
||||
float InteriorCellRender::lightQuadraticRadiusMult = 1;
|
||||
|
||||
bool InteriorCellRender::lightOutQuadInLin = false;
|
||||
|
||||
// start inserting a new reference.
|
||||
|
||||
void InteriorCellRender::insertBegin (const ESM::CellRef &ref)
|
||||
@ -60,6 +75,27 @@ void InteriorCellRender::insertLight(float r, float g, float b, float radius)
|
||||
|
||||
float cval=0.0f, lval=0.0f, qval=0.0f;
|
||||
|
||||
if(lightConst)
|
||||
cval = lightConstValue;
|
||||
if(!lightOutQuadInLin)
|
||||
{
|
||||
if(lightLinear)
|
||||
radius *= lightLinearRadiusMult;
|
||||
if(lightQuadratic)
|
||||
radius *= lightQuadraticRadiusMult;
|
||||
|
||||
if(lightLinear)
|
||||
lval = lightLinearValue / pow(radius, lightLinearMethod);
|
||||
if(lightQuadratic)
|
||||
qval = lightQuadraticValue / pow(radius, lightQuadraticMethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME:
|
||||
// Do quadratic or linear, depending if we're in an exterior or interior
|
||||
// cell, respectively. Ignore lightLinear and lightQuadratic.
|
||||
}
|
||||
|
||||
light->setAttenuation(10*radius, cval, lval, qval);
|
||||
|
||||
insert->attachObject(light);
|
||||
|
@ -25,6 +25,22 @@ namespace MWRender
|
||||
|
||||
class InteriorCellRender : private CellRender
|
||||
{
|
||||
|
||||
static bool lightConst;
|
||||
static float lightConstValue;
|
||||
|
||||
static bool lightLinear;
|
||||
static int lightLinearMethod;
|
||||
static float lightLinearValue;
|
||||
static float lightLinearRadiusMult;
|
||||
|
||||
static bool lightQuadratic;
|
||||
static int lightQuadraticMethod;
|
||||
static float lightQuadraticValue;
|
||||
static float lightQuadraticRadiusMult;
|
||||
|
||||
static bool lightOutQuadInLin;
|
||||
|
||||
const ESMS::CellStore &cell;
|
||||
MWScene &scene;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user