mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Merge pull request #414 from OpenMW/master
Add OpenMW commits up to 29 Apr 2018
This commit is contained in:
commit
273179fd5a
5 changed files with 42 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "characterpreview.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
#include <osg/Material>
|
||||
|
@ -13,6 +14,7 @@
|
|||
#include <osgUtil/IntersectionVisitor>
|
||||
#include <osgUtil/LineSegmentIntersector>
|
||||
|
||||
#include <components/fallback/fallback.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -158,14 +160,25 @@ namespace MWRender
|
|||
stateset->setAttributeAndModes(fog, osg::StateAttribute::OFF|osg::StateAttribute::OVERRIDE);
|
||||
|
||||
osg::ref_ptr<osg::LightModel> lightmodel = new osg::LightModel;
|
||||
lightmodel->setAmbientIntensity(osg::Vec4(0.25, 0.25, 0.25, 1.0));
|
||||
lightmodel->setAmbientIntensity(osg::Vec4(0.0, 0.0, 0.0, 1.0));
|
||||
stateset->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
|
||||
|
||||
/// \todo Read the fallback values from INIImporter (Inventory:Directional*) ?
|
||||
osg::ref_ptr<osg::Light> light = new osg::Light;
|
||||
light->setPosition(osg::Vec4(-0.3,0.3,0.7, 0.0));
|
||||
light->setDiffuse(osg::Vec4(1,1,1,1));
|
||||
light->setAmbient(osg::Vec4(0,0,0,1));
|
||||
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");
|
||||
float azimuth = osg::DegreesToRadians(180.f - fallback->getFallbackFloat("Inventory_DirectionalRotationX"));
|
||||
float altitude = osg::DegreesToRadians(fallback->getFallbackFloat("Inventory_DirectionalRotationY"));
|
||||
float positionX = std::cos(azimuth) * std::sin(altitude);
|
||||
float positionY = std::sin(azimuth) * std::sin(altitude);
|
||||
float positionZ = std::cos(altitude);
|
||||
light->setPosition(osg::Vec4(positionX,positionY,positionZ, 0.0));
|
||||
light->setDiffuse(osg::Vec4(diffuseR,diffuseG,diffuseB,1));
|
||||
light->setAmbient(osg::Vec4(ambientR,ambientG,ambientB,1));
|
||||
light->setSpecular(osg::Vec4(0,0,0,0));
|
||||
light->setLightNum(0);
|
||||
light->setConstantAttenuation(1.f);
|
||||
|
|
|
@ -101,6 +101,18 @@ namespace Nif
|
|||
data.post(nif);
|
||||
}
|
||||
|
||||
void NiLookAtController::read(NIFStream *nif)
|
||||
{
|
||||
Controller::read(nif);
|
||||
data.read(nif);
|
||||
}
|
||||
|
||||
void NiLookAtController::post(NIFFile *nif)
|
||||
{
|
||||
Controller::post(nif);
|
||||
data.post(nif);
|
||||
}
|
||||
|
||||
void NiPathController::read(NIFStream *nif)
|
||||
{
|
||||
Controller::read(nif);
|
||||
|
|
|
@ -99,6 +99,15 @@ public:
|
|||
void post(NIFFile *nif);
|
||||
};
|
||||
|
||||
class NiLookAtController : public Controller
|
||||
{
|
||||
public:
|
||||
NiKeyframeDataPtr data;
|
||||
|
||||
void read(NIFStream *nif);
|
||||
void post(NIFFile *nif);
|
||||
};
|
||||
|
||||
class NiUVController : public Controller
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -108,6 +108,7 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
|
|||
newFactory.insert(makeEntry("NiSequenceStreamHelper", &construct <NiSequenceStreamHelper> , RC_NiSequenceStreamHelper ));
|
||||
newFactory.insert(makeEntry("NiSourceTexture", &construct <NiSourceTexture> , RC_NiSourceTexture ));
|
||||
newFactory.insert(makeEntry("NiSkinInstance", &construct <NiSkinInstance> , RC_NiSkinInstance ));
|
||||
newFactory.insert(makeEntry("NiLookAtController", &construct <NiLookAtController> , RC_NiLookAtController ));
|
||||
return newFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ enum RecordType
|
|||
RC_NiSourceTexture,
|
||||
RC_NiSkinInstance,
|
||||
RC_RootCollisionNode,
|
||||
RC_NiSphericalCollider
|
||||
RC_NiSphericalCollider,
|
||||
RC_NiLookAtController
|
||||
};
|
||||
|
||||
/// Base class for all records
|
||||
|
|
Loading…
Reference in a new issue