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