|
|
|
@ -17,7 +17,9 @@
|
|
|
|
|
#include "../../model/world/refidcollection.hpp"
|
|
|
|
|
|
|
|
|
|
#include <components/resource/scenemanager.hpp>
|
|
|
|
|
#include <components/sceneutil/clone.hpp>
|
|
|
|
|
#include <components/sceneutil/lightutil.hpp>
|
|
|
|
|
#include <components/sceneutil/lightmanager.hpp>
|
|
|
|
|
#include <components/fallback/fallback.hpp>
|
|
|
|
|
|
|
|
|
|
#include "mask.hpp"
|
|
|
|
|
|
|
|
|
@ -62,6 +64,7 @@ void CSVRender::Object::update()
|
|
|
|
|
const CSMWorld::RefIdCollection& referenceables = mData.getReferenceables();
|
|
|
|
|
|
|
|
|
|
int index = referenceables.searchId (mReferenceableId);
|
|
|
|
|
const ESM::Light* light = NULL;
|
|
|
|
|
|
|
|
|
|
if (index==-1)
|
|
|
|
|
error = 1;
|
|
|
|
@ -73,6 +76,14 @@ void CSVRender::Object::update()
|
|
|
|
|
referenceables.findColumnIndex (CSMWorld::Columns::ColumnId_Model)).
|
|
|
|
|
toString().toUtf8().constData();
|
|
|
|
|
|
|
|
|
|
int recordType =
|
|
|
|
|
referenceables.getData (index,
|
|
|
|
|
referenceables.findColumnIndex(CSMWorld::Columns::ColumnId_RecordType)).toInt();
|
|
|
|
|
if (recordType == CSMWorld::UniversalId::Type_Light)
|
|
|
|
|
{
|
|
|
|
|
light = &dynamic_cast<const CSMWorld::Record<ESM::Light>& >(referenceables.getRecord(index)).get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (model.empty())
|
|
|
|
|
error = 2;
|
|
|
|
|
}
|
|
|
|
@ -97,6 +108,21 @@ void CSVRender::Object::update()
|
|
|
|
|
std::cerr << e.what() << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (light)
|
|
|
|
|
{
|
|
|
|
|
const Fallback::Map* fallback = mData.getFallbackMap();
|
|
|
|
|
static bool outQuadInLin = fallback->getFallbackBool("LightAttenuation_OutQuadInLin");
|
|
|
|
|
static bool useQuadratic = fallback->getFallbackBool("LightAttenuation_UseQuadratic");
|
|
|
|
|
static float quadraticValue = fallback->getFallbackFloat("LightAttenuation_QuadraticValue");
|
|
|
|
|
static float quadraticRadiusMult = fallback->getFallbackFloat("LightAttenuation_QuadraticRadiusMult");
|
|
|
|
|
static bool useLinear = fallback->getFallbackBool("LightAttenuation_UseLinear");
|
|
|
|
|
static float linearRadiusMult = fallback->getFallbackFloat("LightAttenuation_LinearRadiusMult");
|
|
|
|
|
static float linearValue = fallback->getFallbackFloat("LightAttenuation_LinearValue");
|
|
|
|
|
bool isExterior = false; // FIXME
|
|
|
|
|
SceneUtil::addLight(mBaseNode, light, Mask_ParticleSystem, ~0u, isExterior, outQuadInLin, useQuadratic,
|
|
|
|
|
quadraticValue, quadraticRadiusMult, useLinear, linearRadiusMult, linearValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVRender::Object::adjustTransform()
|
|
|
|
@ -131,6 +157,8 @@ CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode,
|
|
|
|
|
: mData (data), mBaseNode(0), mSelected(false), mParentNode(parentNode), mResourceSystem(data.getResourceSystem().get()), mForceBaseToZero (forceBaseToZero)
|
|
|
|
|
{
|
|
|
|
|
mBaseNode = new osg::PositionAttitudeTransform;
|
|
|
|
|
mBaseNode->addCullCallback(new SceneUtil::LightListCallback);
|
|
|
|
|
|
|
|
|
|
mOutline = new osgFX::Scribe;
|
|
|
|
|
mOutline->addChild(mBaseNode);
|
|
|
|
|
|
|
|
|
|