forked from teamnwah/openmw-tes3coop
Utilize inventory character preview lighting color fallback settings
This commit is contained in:
parent
9b8c56761b
commit
b69e812a52
1 changed files with 11 additions and 3 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <osgUtil/IntersectionVisitor>
|
#include <osgUtil/IntersectionVisitor>
|
||||||
#include <osgUtil/LineSegmentIntersector>
|
#include <osgUtil/LineSegmentIntersector>
|
||||||
|
|
||||||
|
#include <components/fallback/fallback.hpp>
|
||||||
#include <components/sceneutil/lightmanager.hpp>
|
#include <components/sceneutil/lightmanager.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -161,11 +162,18 @@ namespace MWRender
|
||||||
lightmodel->setAmbientIntensity(osg::Vec4(0.25, 0.25, 0.25, 1.0));
|
lightmodel->setAmbientIntensity(osg::Vec4(0.25, 0.25, 0.25, 1.0));
|
||||||
stateset->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
|
||||||
|
|
||||||
/// \todo Read the fallback values from INIImporter (Inventory:Directional*) ?
|
|
||||||
osg::ref_ptr<osg::Light> light = new osg::Light;
|
osg::ref_ptr<osg::Light> light = new osg::Light;
|
||||||
|
const Fallback::Map* fallback = MWBase::Environment::get().getWorld()->getFallback();
|
||||||
|
float diffuseR = fallback->getFallbackFloat("Inventory_DirectionalDiffuseR");
|
||||||
|
float diffuseG = fallback->getFallbackFloat("Inventory_DirectionalDiffuseG");
|
||||||
|
float diffuseB = fallback->getFallbackFloat("Inventory_DirectionalDiffuseB");
|
||||||
|
float ambientR = fallback->getFallbackFloat("Inventory_DirectionalAmbientR");
|
||||||
|
float ambientG = fallback->getFallbackFloat("Inventory_DirectionalAmbientG");
|
||||||
|
float ambientB = fallback->getFallbackFloat("Inventory_DirectionalAmbientB");
|
||||||
|
/// \todo Read DirectionalRotationX/DirectionalRotationY
|
||||||
light->setPosition(osg::Vec4(-0.3,0.3,0.7, 0.0));
|
light->setPosition(osg::Vec4(-0.3,0.3,0.7, 0.0));
|
||||||
light->setDiffuse(osg::Vec4(1,1,1,1));
|
light->setDiffuse(osg::Vec4(diffuseR,diffuseG,diffuseB,1));
|
||||||
light->setAmbient(osg::Vec4(0,0,0,1));
|
light->setAmbient(osg::Vec4(ambientR,ambientG,ambientB,1));
|
||||||
light->setSpecular(osg::Vec4(0,0,0,0));
|
light->setSpecular(osg::Vec4(0,0,0,0));
|
||||||
light->setLightNum(0);
|
light->setLightNum(0);
|
||||||
light->setConstantAttenuation(1.f);
|
light->setConstantAttenuation(1.f);
|
||||||
|
|
Loading…
Reference in a new issue