OpenCS: add lighting mask

coverity_scan
scrawl 9 years ago
parent e1c7165bfb
commit 458a305bff

@ -20,6 +20,8 @@ namespace CSVRender
// used within models // used within models
Mask_ParticleSystem = 0x100, Mask_ParticleSystem = 0x100,
Mask_Lighting = 0x200,
// control elements // control elements
Mask_CellMarker = 0x10000, Mask_CellMarker = 0x10000,
Mask_CellArrow = 0x20000, Mask_CellArrow = 0x20000,

@ -120,7 +120,7 @@ void CSVRender::Object::update()
static float linearRadiusMult = fallback->getFallbackFloat("LightAttenuation_LinearRadiusMult"); static float linearRadiusMult = fallback->getFallbackFloat("LightAttenuation_LinearRadiusMult");
static float linearValue = fallback->getFallbackFloat("LightAttenuation_LinearValue"); static float linearValue = fallback->getFallbackFloat("LightAttenuation_LinearValue");
bool isExterior = false; // FIXME bool isExterior = false; // FIXME
SceneUtil::addLight(mBaseNode, light, Mask_ParticleSystem, ~0u, isExterior, outQuadInLin, useQuadratic, SceneUtil::addLight(mBaseNode, light, Mask_ParticleSystem, Mask_Lighting, isExterior, outQuadInLin, useQuadratic,
quadraticValue, quadraticRadiusMult, useLinear, linearRadiusMult, linearValue); quadraticValue, quadraticRadiusMult, useLinear, linearRadiusMult, linearValue);
} }
} }

@ -67,6 +67,7 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
SceneUtil::LightManager* lightMgr = new SceneUtil::LightManager; SceneUtil::LightManager* lightMgr = new SceneUtil::LightManager;
lightMgr->setStartLight(1); lightMgr->setStartLight(1);
lightMgr->setLightingMask(Mask_Lighting);
mRootNode = lightMgr; mRootNode = lightMgr;
mView->getCamera()->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON); mView->getCamera()->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
@ -96,7 +97,7 @@ void RenderWidget::flagAsModified()
void RenderWidget::setVisibilityMask(int mask) void RenderWidget::setVisibilityMask(int mask)
{ {
mView->getCamera()->setCullMask(mask | Mask_ParticleSystem); mView->getCamera()->setCullMask(mask | Mask_ParticleSystem | Mask_Lighting);
} }
bool RenderWidget::eventFilter(QObject* obj, QEvent* event) bool RenderWidget::eventFilter(QObject* obj, QEvent* event)

@ -39,7 +39,7 @@ namespace SceneUtil
} }
void addLight (osg::Group* node, const ESM::Light* esmLight, int partsysMask, int lightMask, bool isExterior, bool outQuadInLin, bool useQuadratic, void addLight (osg::Group* node, const ESM::Light* esmLight, unsigned int partsysMask, unsigned int lightMask, bool isExterior, bool outQuadInLin, bool useQuadratic,
float quadraticValue, float quadraticRadiusMult, bool useLinear, float linearRadiusMult, float quadraticValue, float quadraticRadiusMult, bool useLinear, float linearRadiusMult,
float linearValue) float linearValue)
{ {

@ -23,7 +23,7 @@ namespace SceneUtil
/// @param lightMask Mask to assign to the newly created LightSource. /// @param lightMask Mask to assign to the newly created LightSource.
/// @param isExterior Is the light outside? May be used for deciding which attenuation settings to use. /// @param isExterior Is the light outside? May be used for deciding which attenuation settings to use.
/// @par Attenuation parameters come from the game INI file. /// @par Attenuation parameters come from the game INI file.
void addLight (osg::Group* node, const ESM::Light* esmLight, int partsysMask, int lightMask, bool isExterior, bool outQuadInLin, bool useQuadratic, void addLight (osg::Group* node, const ESM::Light* esmLight, unsigned int partsysMask, unsigned int lightMask, bool isExterior, bool outQuadInLin, bool useQuadratic,
float quadraticValue, float quadraticRadiusMult, bool useLinear, float linearRadiusMult, float quadraticValue, float quadraticRadiusMult, bool useLinear, float linearRadiusMult,
float linearValue); float linearValue);

Loading…
Cancel
Save