moved light common to its own file

moved esm4light to it's own file
7220-lua-add-a-general-purpose-lexical-parser
florent.teppe 2 years ago
parent dc961e3189
commit 486d15b19e

@ -47,6 +47,7 @@
#include <components/esm/esmbridge.hpp> #include <components/esm/esmbridge.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/sceneutil/lightcommon.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/lightutil.hpp> #include <components/sceneutil/lightutil.hpp>
@ -168,7 +169,7 @@ void CSVRender::Object::update()
if (light) if (light)
{ {
bool isExterior = false; // FIXME bool isExterior = false; // FIXME
SceneUtil::addLight(mBaseNode, ESM::LightCommon(*light), Mask_Lighting, isExterior); SceneUtil::addLight(mBaseNode, SceneUtil::LightCommon(*light), Mask_Lighting, isExterior);
} }
} }

@ -90,6 +90,7 @@ add_openmw_dir (mwphysics
add_openmw_dir (mwclass add_openmw_dir (mwclass
classes activator creature npc weapon armor potion apparatus book clothing container door classes activator creature npc weapon armor potion apparatus book clothing container door
ingredient creaturelevlist itemlevlist light lockpick misc probe repair static actor bodypart ingredient creaturelevlist itemlevlist light lockpick misc probe repair static actor bodypart
light4
) )
add_openmw_dir (mwmechanics add_openmw_dir (mwmechanics

@ -13,6 +13,7 @@
#include "ingredient.hpp" #include "ingredient.hpp"
#include "itemlevlist.hpp" #include "itemlevlist.hpp"
#include "light.hpp" #include "light.hpp"
#include "light4.hpp"
#include "lockpick.hpp" #include "lockpick.hpp"
#include "misc.hpp" #include "misc.hpp"
#include "npc.hpp" #include "npc.hpp"

@ -244,52 +244,4 @@ namespace MWClass
return ptr.get<ESM::Light>()->mBase->mSound; return ptr.get<ESM::Light>()->mBase->mSound;
} }
ESM4Light::ESM4Light()
: MWWorld::RegisteredClass<ESM4Light>(ESM4::Light::sRecordId)
{
}
void ESM4Light ::insertObjectRendering(
const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
MWWorld::LiveCellRef<ESM4::Light>* ref = ptr.get<ESM4::Light>();
// Insert even if model is empty, so that the light is added
renderingInterface.getObjects().insertModel(ptr, model, !(ref->mBase->mData.flags & ESM4::Light::OffDefault));
}
void ESM4Light::insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const
{
insertObjectPhysics(ptr, model, rotation, physics);
}
void ESM4Light::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const
{
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
}
std::string ESM4Light::getModel(const MWWorld::ConstPtr& ptr) const
{
return getClassModel<ESM4::Light>(ptr);
}
std::string_view ESM4Light ::getName(const MWWorld::ConstPtr& ptr) const
{
return {};
}
bool ESM4Light::hasToolTip(const MWWorld::ConstPtr& ptr) const
{
return false;
}
MWWorld::Ptr ESM4Light::copyToCellImpl(const MWWorld::ConstPtr& ptr, MWWorld::CellStore& cell) const
{
const MWWorld::LiveCellRef<ESM4::Light>* ref = ptr.get<ESM4::Light>();
return MWWorld::Ptr(cell.insert(ref), &cell);
}
} }

@ -79,32 +79,6 @@ namespace MWClass
const ESM::RefId& getSound(const MWWorld::ConstPtr& ptr) const override; const ESM::RefId& getSound(const MWWorld::ConstPtr& ptr) const override;
}; };
class ESM4Light : public MWWorld::RegisteredClass<ESM4Light>
{
friend MWWorld::RegisteredClass<ESM4Light>;
ESM4Light();
MWWorld::Ptr copyToCellImpl(const MWWorld::ConstPtr& ptr, MWWorld::CellStore& cell) const override;
public:
void insertObjectRendering(const MWWorld::Ptr& ptr, const std::string& model,
MWRender::RenderingInterface& renderingInterface) const override;
///< Add reference into a cell for rendering
void insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const override;
void insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const override;
std::string_view getName(const MWWorld::ConstPtr& ptr) const override;
///< \return name or ID; can return an empty string.
bool hasToolTip(const MWWorld::ConstPtr& ptr) const override;
///< @return true if this object has a tooltip when focused (default implementation: true)
std::string getModel(const MWWorld::ConstPtr& ptr) const override;
};
} }
#endif #endif

@ -0,0 +1,61 @@
#include "light4.hpp"
#include "classmodel.hpp"
#include "../mwphysics/physicssystem.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/ptr.hpp"
#include <components/esm4/loadligh.hpp>
namespace MWClass
{
ESM4Light::ESM4Light()
: MWWorld::RegisteredClass<ESM4Light>(ESM4::Light::sRecordId)
{
}
void ESM4Light ::insertObjectRendering(
const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
MWWorld::LiveCellRef<ESM4::Light>* ref = ptr.get<ESM4::Light>();
// Insert even if model is empty, so that the light is added
renderingInterface.getObjects().insertModel(ptr, model, !(ref->mBase->mData.flags & ESM4::Light::OffDefault));
}
void ESM4Light::insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const
{
insertObjectPhysics(ptr, model, rotation, physics);
}
void ESM4Light::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const
{
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
}
std::string ESM4Light::getModel(const MWWorld::ConstPtr& ptr) const
{
return getClassModel<ESM4::Light>(ptr);
}
std::string_view ESM4Light ::getName(const MWWorld::ConstPtr& ptr) const
{
return {};
}
bool ESM4Light::hasToolTip(const MWWorld::ConstPtr& ptr) const
{
return false;
}
MWWorld::Ptr ESM4Light::copyToCellImpl(const MWWorld::ConstPtr& ptr, MWWorld::CellStore& cell) const
{
const MWWorld::LiveCellRef<ESM4::Light>* ref = ptr.get<ESM4::Light>();
return MWWorld::Ptr(cell.insert(ref), &cell);
}
}

@ -0,0 +1,34 @@
#ifndef OPENW_MWCLASS_LIGHT4
#define OPENW_MWCLASS_LIGHT4
#include "../mwworld/registeredclass.hpp"
namespace MWClass
{
class ESM4Light : public MWWorld::RegisteredClass<ESM4Light>
{
friend MWWorld::RegisteredClass<ESM4Light>;
ESM4Light();
MWWorld::Ptr copyToCellImpl(const MWWorld::ConstPtr& ptr, MWWorld::CellStore& cell) const override;
public:
void insertObjectRendering(const MWWorld::Ptr& ptr, const std::string& model,
MWRender::RenderingInterface& renderingInterface) const override;
///< Add reference into a cell for rendering
void insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const override;
void insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
MWPhysics::PhysicsSystem& physics) const override;
std::string_view getName(const MWWorld::ConstPtr& ptr) const override;
///< \return name or ID; can return an empty string.
bool hasToolTip(const MWWorld::ConstPtr& ptr) const override;
///< @return true if this object has a tooltip when focused (default implementation: true)
std::string getModel(const MWWorld::ConstPtr& ptr) const override;
};
}
#endif

@ -13,6 +13,7 @@
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/sceneutil/attach.hpp> #include <components/sceneutil/attach.hpp>
#include <components/sceneutil/lightcommon.hpp>
#include <components/sceneutil/lightmanager.hpp> #include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/lightutil.hpp> #include <components/sceneutil/lightutil.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
@ -557,7 +558,7 @@ namespace MWRender
osg::Vec4f ambient(1, 1, 1, 1); osg::Vec4f ambient(1, 1, 1, 1);
osg::ref_ptr<SceneUtil::LightSource> lightSource osg::ref_ptr<SceneUtil::LightSource> lightSource
= SceneUtil::createLightSource(ESM::LightCommon(*esmLight), Mask_Lighting, exterior, ambient); = SceneUtil::createLightSource(SceneUtil::LightCommon(*esmLight), Mask_Lighting, exterior, ambient);
mInsert->addChild(lightSource); mInsert->addChild(lightSource);

@ -27,6 +27,7 @@
#include <components/misc/constants.hpp> #include <components/misc/constants.hpp>
#include <components/misc/pathhelpers.hpp> #include <components/misc/pathhelpers.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/sceneutil/lightcommon.hpp>
#include <components/sceneutil/keyframe.hpp> #include <components/sceneutil/keyframe.hpp>
@ -1511,7 +1512,7 @@ namespace MWRender
} }
} }
void Animation::addExtraLight(osg::ref_ptr<osg::Group> parent, const ESM::LightCommon& esmLight) void Animation::addExtraLight(osg::ref_ptr<osg::Group> parent, const SceneUtil::LightCommon& esmLight)
{ {
bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior(); bool exterior = mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior();
@ -1855,9 +1856,9 @@ namespace MWRender
mObjectRoot, mResourceSystem, ptr.getClass().getEnchantmentColor(ptr)); mObjectRoot, mResourceSystem, ptr.getClass().getEnchantmentColor(ptr));
} }
if (ptr.getType() == ESM::Light::sRecordId && allowLight) if (ptr.getType() == ESM::Light::sRecordId && allowLight)
addExtraLight(getOrCreateObjectRoot(), ESM::LightCommon(*ptr.get<ESM::Light>()->mBase)); addExtraLight(getOrCreateObjectRoot(), SceneUtil::LightCommon(*ptr.get<ESM::Light>()->mBase));
if (ptr.getType() == ESM4::Light::sRecordId && allowLight) if (ptr.getType() == ESM4::Light::sRecordId && allowLight)
addExtraLight(getOrCreateObjectRoot(), ESM::LightCommon(*ptr.get<ESM4::Light>()->mBase)); addExtraLight(getOrCreateObjectRoot(), SceneUtil::LightCommon(*ptr.get<ESM4::Light>()->mBase));
if (!allowLight && mObjectRoot) if (!allowLight && mObjectRoot)
{ {

@ -30,6 +30,7 @@ namespace SceneUtil
class LightSource; class LightSource;
class LightListCallback; class LightListCallback;
class Skeleton; class Skeleton;
struct LightCommon;
} }
namespace MWRender namespace MWRender
@ -333,7 +334,7 @@ namespace MWRender
void addSingleAnimSource(const std::string& model, const std::string& baseModel); void addSingleAnimSource(const std::string& model, const std::string& baseModel);
/** Adds an additional light to the given node using the specified ESM record. */ /** Adds an additional light to the given node using the specified ESM record. */
void addExtraLight(osg::ref_ptr<osg::Group> parent, const ESM::LightCommon& light); void addExtraLight(osg::ref_ptr<osg::Group> parent, const SceneUtil::LightCommon& light);
void clearAnimSources(); void clearAnimSources();

@ -13,7 +13,6 @@
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/esm/esmbridge.hpp>
#include <components/esm3/loadbody.hpp> #include <components/esm3/loadbody.hpp>
#include <components/esm3/loadmgef.hpp> #include <components/esm3/loadmgef.hpp>
#include <components/esm3/loadrace.hpp> #include <components/esm3/loadrace.hpp>
@ -22,6 +21,7 @@
#include <components/sceneutil/actorutil.hpp> #include <components/sceneutil/actorutil.hpp>
#include <components/sceneutil/depth.hpp> #include <components/sceneutil/depth.hpp>
#include <components/sceneutil/keyframe.hpp> #include <components/sceneutil/keyframe.hpp>
#include <components/sceneutil/lightcommon.hpp>
#include <components/sceneutil/visitor.hpp> #include <components/sceneutil/visitor.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
@ -665,7 +665,7 @@ namespace MWRender
addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1, addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1,
Misc::ResourceHelpers::correctMeshPath(light->mModel, vfs), false, nullptr, true); Misc::ResourceHelpers::correctMeshPath(light->mModel, vfs), false, nullptr, true);
if (mObjectParts[ESM::PRT_Shield]) if (mObjectParts[ESM::PRT_Shield])
addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), ESM::LightCommon(*light)); addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), SceneUtil::LightCommon(*light));
} }
} }
@ -1043,7 +1043,7 @@ namespace MWRender
reserveIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1); reserveIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1);
if (iter->getType() == ESM::Light::sRecordId && mObjectParts[ESM::PRT_Shield]) if (iter->getType() == ESM::Light::sRecordId && mObjectParts[ESM::PRT_Shield])
addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(),
ESM::LightCommon(*iter->get<ESM::Light>()->mBase)); SceneUtil::LightCommon(*iter->get<ESM::Light>()->mBase));
} }
} }
else else

@ -61,7 +61,7 @@ add_component_dir (sceneutil
clone attach visitor util statesetupdater controller skeleton riggeometry morphgeometry lightcontroller clone attach visitor util statesetupdater controller skeleton riggeometry morphgeometry lightcontroller
lightmanager lightutil positionattitudetransform workqueue pathgridutil waterutil writescene serialize optimizer lightmanager lightutil positionattitudetransform workqueue pathgridutil waterutil writescene serialize optimizer
actorutil detourdebugdraw navmesh agentpath shadow mwshadowtechnique recastmesh shadowsbin osgacontroller rtt actorutil detourdebugdraw navmesh agentpath shadow mwshadowtechnique recastmesh shadowsbin osgacontroller rtt
screencapture depth color riggeometryosgaextension extradata unrefqueue screencapture depth color riggeometryosgaextension extradata unrefqueue lightcommon
) )
add_component_dir (nif add_component_dir (nif

@ -1,9 +1,6 @@
#include <components/esm/esmbridge.hpp> #include <components/esm/esmbridge.hpp>
#include <components/esm3/loadcell.hpp> #include <components/esm3/loadcell.hpp>
#include <components/esm3/loadligh.hpp>
#include <components/esm4/loadcell.hpp> #include <components/esm4/loadcell.hpp>
#include <components/esm4/loadligh.hpp>
#include <components/sceneutil/util.hpp>
namespace ESM namespace ESM
{ {
@ -18,29 +15,4 @@ namespace ESM
auto cell = std::get<const ESM::Cell*>(mVariant); auto cell = std::get<const ESM::Cell*>(mVariant);
return *cell; return *cell;
} }
LightCommon::LightCommon(const ESM::Light& light)
: mFlicker(light.mData.mFlags & ESM::Light::Flicker)
, mFlickerSlow(light.mData.mFlags & ESM::Light::FlickerSlow)
, mNegative(light.mData.mFlags & ESM::Light::Negative)
, mPulse(light.mData.mFlags & ESM::Light::Pulse)
, mPulseSlow(light.mData.mFlags & ESM::Light::PulseSlow)
, mOffDefault(light.mData.mFlags & ESM::Light::OffDefault)
, mColor(SceneUtil::colourFromRGB(light.mData.mColor))
, mRadius(light.mData.mRadius)
{
}
LightCommon::LightCommon(const ESM4::Light& light)
: mFlicker(light.mData.flags & ESM4::Light::Flicker)
, mFlickerSlow(light.mData.flags & ESM4::Light::FlickerSlow)
, mNegative(light.mData.flags & ESM::Light::Negative)
, mPulse(light.mData.flags & ESM4::Light::Pulse)
, mPulseSlow(light.mData.flags & ESM4::Light::PulseSlow)
, mOffDefault(light.mData.flags & ESM4::Light::OffDefault)
, mColor(SceneUtil::colourFromRGB(light.mData.colour))
, mRadius(light.mData.radius)
{
}
} }

@ -4,15 +4,12 @@
#include <string_view> #include <string_view>
#include <variant> #include <variant>
#include <osg/Vec4>
#include <components/esm3/cellref.hpp> #include <components/esm3/cellref.hpp>
#include <components/esm4/loadrefr.hpp> #include <components/esm4/loadrefr.hpp>
namespace ESM4 namespace ESM4
{ {
struct Cell; struct Cell;
struct Light;
} }
namespace ESM namespace ESM
@ -20,7 +17,6 @@ namespace ESM
struct Cell; struct Cell;
struct CellId; struct CellId;
struct RefId; struct RefId;
struct Light;
class CellVariant class CellVariant
{ {
@ -69,22 +65,6 @@ namespace ESM
ESM4::Reference& getEsm4() { return std::get<ESM4::Reference>(mVariant); } ESM4::Reference& getEsm4() { return std::get<ESM4::Reference>(mVariant); }
}; };
struct LightCommon
{
explicit LightCommon(const ESM::Light& light);
explicit LightCommon(const ESM4::Light& light);
bool mFlicker;
bool mFlickerSlow;
bool mNegative;
bool mPulse;
bool mPulseSlow;
bool mOffDefault;
osg::Vec4 mColor;
float mRadius;
};
template <class F, class... T> template <class F, class... T>
auto visit(F&& f, T&&... v) auto visit(F&& f, T&&... v)
{ {

@ -0,0 +1,33 @@
#include "lightcommon.hpp"
#include <components/esm3/loadligh.hpp>
#include <components/esm4/loadligh.hpp>
#include <components/sceneutil/util.hpp>
namespace SceneUtil
{
LightCommon::LightCommon(const ESM::Light& light)
: mFlicker(light.mData.mFlags & ESM::Light::Flicker)
, mFlickerSlow(light.mData.mFlags & ESM::Light::FlickerSlow)
, mNegative(light.mData.mFlags & ESM::Light::Negative)
, mPulse(light.mData.mFlags & ESM::Light::Pulse)
, mPulseSlow(light.mData.mFlags & ESM::Light::PulseSlow)
, mOffDefault(light.mData.mFlags & ESM::Light::OffDefault)
, mColor(SceneUtil::colourFromRGB(light.mData.mColor))
, mRadius(light.mData.mRadius)
{
}
LightCommon::LightCommon(const ESM4::Light& light)
: mFlicker(light.mData.flags & ESM4::Light::Flicker)
, mFlickerSlow(light.mData.flags & ESM4::Light::FlickerSlow)
, mNegative(light.mData.flags & ESM::Light::Negative)
, mPulse(light.mData.flags & ESM4::Light::Pulse)
, mPulseSlow(light.mData.flags & ESM4::Light::PulseSlow)
, mOffDefault(light.mData.flags & ESM4::Light::OffDefault)
, mColor(SceneUtil::colourFromRGB(light.mData.colour))
, mRadius(light.mData.radius)
{
}
}

@ -0,0 +1,38 @@
#ifndef COMPONENTS_SCENEUTIL_LIGHTCOMMON
#define COMPONENTS_SCENEUTIL_LIGHTCOMMON
#include <string_view>
#include <variant>
#include <osg/Vec4>
namespace ESM4
{
struct Light;
}
namespace ESM
{
struct Light;
}
namespace SceneUtil
{
struct LightCommon
{
explicit LightCommon(const ESM::Light& light);
explicit LightCommon(const ESM4::Light& light);
bool mFlicker;
bool mFlickerSlow;
bool mNegative;
bool mPulse;
bool mPulseSlow;
bool mOffDefault;
osg::Vec4 mColor;
float mRadius;
};
}
#endif

@ -5,9 +5,9 @@
#include <osgParticle/ParticleSystem> #include <osgParticle/ParticleSystem>
#include <components/esm/esmbridge.hpp>
#include <components/esm3/loadligh.hpp> #include <components/esm3/loadligh.hpp>
#include <components/fallback/fallback.hpp> #include <components/fallback/fallback.hpp>
#include <components/sceneutil/lightcommon.hpp>
#include "lightcontroller.hpp" #include "lightcontroller.hpp"
#include "lightmanager.hpp" #include "lightmanager.hpp"
@ -87,7 +87,7 @@ namespace SceneUtil
} }
osg::ref_ptr<LightSource> addLight( osg::ref_ptr<LightSource> addLight(
osg::Group* node, const ESM::LightCommon& esmLight, unsigned int lightMask, bool isExterior) osg::Group* node, const SceneUtil::LightCommon& esmLight, unsigned int lightMask, bool isExterior)
{ {
SceneUtil::FindByNameVisitor visitor("AttachLight"); SceneUtil::FindByNameVisitor visitor("AttachLight");
node->accept(visitor); node->accept(visitor);
@ -106,7 +106,7 @@ namespace SceneUtil
} }
osg::ref_ptr<LightSource> createLightSource( osg::ref_ptr<LightSource> createLightSource(
const ESM::LightCommon& esmLight, unsigned int lightMask, bool isExterior, const osg::Vec4f& ambient) const SceneUtil::LightCommon& esmLight, unsigned int lightMask, bool isExterior, const osg::Vec4f& ambient)
{ {
osg::ref_ptr<SceneUtil::LightSource> lightSource(new SceneUtil::LightSource); osg::ref_ptr<SceneUtil::LightSource> lightSource(new SceneUtil::LightSource);
osg::ref_ptr<osg::Light> light(new osg::Light); osg::ref_ptr<osg::Light> light(new osg::Light);

@ -13,12 +13,12 @@ namespace osg
namespace ESM namespace ESM
{ {
struct Light; struct Light;
struct LightCommon;
} }
namespace SceneUtil namespace SceneUtil
{ {
class LightSource; class LightSource;
struct LightCommon;
/// @brief Set up global attenuation settings for an osg::Light. /// @brief Set up global attenuation settings for an osg::Light.
/// @param radius The radius of the light source. /// @param radius The radius of the light source.
@ -33,14 +33,14 @@ 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.
osg::ref_ptr<LightSource> addLight( osg::ref_ptr<LightSource> addLight(
osg::Group* node, const ESM::LightCommon& esmLight, unsigned int lightMask, bool isExterior); osg::Group* node, const SceneUtil::LightCommon& esmLight, unsigned int lightMask, bool isExterior);
/// @brief Convert an ESM::Light to a SceneUtil::LightSource, and return it. /// @brief Convert an ESM::Light to a SceneUtil::LightSource, and return it.
/// @param esmLight The light definition coming from the game files containing radius, color, flicker, etc. /// @param esmLight The light definition coming from the game files containing radius, color, flicker, etc.
/// @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.
/// @param ambient Ambient component of the light. /// @param ambient Ambient component of the light.
osg::ref_ptr<LightSource> createLightSource(const ESM::LightCommon& esmLight, unsigned int lightMask, osg::ref_ptr<LightSource> createLightSource(const SceneUtil::LightCommon& esmLight, unsigned int lightMask,
bool isExterior, const osg::Vec4f& ambient = osg::Vec4f(0, 0, 0, 1)); bool isExterior, const osg::Vec4f& ambient = osg::Vec4f(0, 0, 0, 1));
} }

Loading…
Cancel
Save