2015-04-22 15:34:39 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_SCENEUTIL_LIGHTCONTROLLER_H
|
|
|
|
#define OPENMW_COMPONENTS_SCENEUTIL_LIGHTCONTROLLER_H
|
|
|
|
|
2021-10-05 12:21:12 +00:00
|
|
|
#include <components/sceneutil/nodecallback.hpp>
|
2015-04-22 15:34:39 +00:00
|
|
|
#include <osg/Vec4f>
|
|
|
|
|
|
|
|
namespace SceneUtil
|
|
|
|
{
|
|
|
|
|
2021-10-05 12:21:12 +00:00
|
|
|
class LightSource;
|
|
|
|
|
2015-04-22 15:34:39 +00:00
|
|
|
/// @brief Controller class to handle a pulsing and/or flickering light
|
2021-10-05 12:21:12 +00:00
|
|
|
class LightController : public SceneUtil::NodeCallback<LightController, SceneUtil::LightSource*>
|
2015-04-22 15:34:39 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum LightType {
|
|
|
|
LT_Normal,
|
|
|
|
LT_Flicker,
|
|
|
|
LT_FlickerSlow,
|
|
|
|
LT_Pulse,
|
|
|
|
LT_PulseSlow
|
|
|
|
};
|
|
|
|
|
|
|
|
LightController();
|
|
|
|
|
|
|
|
void setType(LightType type);
|
|
|
|
|
2016-01-03 15:43:20 +00:00
|
|
|
void setDiffuse(const osg::Vec4f& color);
|
2015-04-22 15:34:39 +00:00
|
|
|
|
2021-10-05 12:21:12 +00:00
|
|
|
void operator()(SceneUtil::LightSource* node, osg::NodeVisitor* nv);
|
2015-04-22 15:34:39 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
LightType mType;
|
|
|
|
osg::Vec4f mDiffuseColor;
|
|
|
|
float mPhase;
|
2019-08-10 12:52:05 +00:00
|
|
|
float mBrightness;
|
|
|
|
double mStartTime;
|
2015-04-22 15:34:39 +00:00
|
|
|
double mLastTime;
|
2019-08-10 12:52:05 +00:00
|
|
|
float mTicksToAdvance;
|
2015-04-22 15:34:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|