66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
|
#pragma once
|
||
|
|
||
|
#include <unordered_map>
|
||
|
|
||
|
#include "entities/SceneComponent.h"
|
||
|
|
||
|
#include "osg/Vec3"
|
||
|
#include "osg/Transform"
|
||
|
|
||
|
class ConeWaveComponent : public SceneComponent {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit ConeWaveComponent(SceneComponent* parent = nullptr);
|
||
|
~ConeWaveComponent();
|
||
|
|
||
|
static std::string GetTypeName();
|
||
|
std::string GetSelfTypeName() override {
|
||
|
return ConeWaveComponent::GetTypeName();
|
||
|
}
|
||
|
|
||
|
bool SetAttribute(const char* name, const char* value) override;
|
||
|
bool SaveAttribute(tinyxml2::XMLElement* element) override;
|
||
|
|
||
|
void Begin() override;
|
||
|
void Update(double dt);
|
||
|
|
||
|
void SetHeight(float height);
|
||
|
float GetHeight() const;
|
||
|
|
||
|
void SetRadius(float radius);
|
||
|
float GetRadius() const;
|
||
|
|
||
|
void SetLevelCount(int count);
|
||
|
float GetLevelCount() const;
|
||
|
|
||
|
void SetLevelHeight(float height);
|
||
|
float GetLevelHeight() const;
|
||
|
|
||
|
void SetBaseColor(const osg::Vec4& color);
|
||
|
const osg::Vec4 GetBaseColor() const;
|
||
|
|
||
|
void SetColor1(const osg::Vec4& color);
|
||
|
const osg::Vec4 GetColor1() const;
|
||
|
|
||
|
void SetColor2(const osg::Vec4& color);
|
||
|
const osg::Vec4 GetColor2() const;
|
||
|
|
||
|
void SetColor3(const osg::Vec4& color);
|
||
|
const osg::Vec4 GetColor3() const;
|
||
|
|
||
|
void SetTimeAction(const QString& path);
|
||
|
|
||
|
protected:
|
||
|
void AddToRender() override;
|
||
|
void Initialize();
|
||
|
void UpdateEvent();
|
||
|
void AddColor(int32_t status, const osg::Vec4& color);
|
||
|
|
||
|
protected:
|
||
|
osg::ref_ptr<class ConeWave> coneWave_;
|
||
|
std::unordered_map<int32_t, osg::Vec4> colorMap_;
|
||
|
class TimeAction* timeAction_{ nullptr };
|
||
|
int currentStatus_{ 0 };
|
||
|
};
|