DYTSrouce/src/effects/ConeWave.h

125 lines
3.1 KiB
C
Raw Normal View History

2025-01-04 04:12:51 +00:00
#pragma once
2025-06-19 14:05:52 +00:00
2025-01-04 04:12:51 +00:00
#include <osg/Matrix>
#include <osg/Array>
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/ShapeDrawable>
#include "effects/DrawDecorate.h"
#include "viewer/UpdateRenderStd.h"
class ConeWave : public osg::Geode
, public UpdateRenderStd {
public:
explicit ConeWave();
~ConeWave(void) override;
void Render(double dt) override;
void InitGeode();
void Destory();
2025-06-22 17:49:35 +00:00
// 雷达扫描波效果相关方法
void CreateRadarScanWave();
void CreateRadarShader();
void SetWaveRadius(float radius);
float GetWaveRadius() const { return waveRadius_; }
void SetWaveSpeed(float speed);
float GetWaveSpeed() const { return waveSpeed_; }
void SetWaveCount(int count);
int GetWaveCount() const { return waveCount_; }
void SetWaveColor(const osg::Vec4& color);
const osg::Vec4& GetWaveColor() const { return waveColor_; }
2025-01-04 04:12:51 +00:00
void SetHeight(float height);
float GetHeght() const {
return height_;
}
void SetRadius(float radius);
float GetRadius() const {
return radius_;
}
void SetBaseColor(const osg::Vec4& color);
const osg::Vec4 GetBaseColor() const {
return baseColor_;
}
void SetLevelCount(int count);
int GetLevelCount() const {
return levelCount_;
}
void SetLevelHeight(float height);
float GetLevelHeihgt() const {
return levelHeight_;
}
protected:
virtual void CreateTexturedCone(osg::Geode* geode);
private:
osg::ref_ptr<osg::Cone> cone_;
osg::ref_ptr<osg::ShapeDrawable> coneDrawable_;
osg::ref_ptr<osg::Uniform> baseColorUniform_;
osg::ref_ptr<osg::Uniform> levelCountUniform_;
int levelCount_{ 4 };
osg::ref_ptr<osg::Uniform> levelHeightUniform_;
float levelHeight_{ 500.0f };
2025-06-22 17:49:35 +00:00
float height_{ 6.0f };
2025-01-04 04:12:51 +00:00
float radius_{ 10.0f };
2025-06-22 17:49:35 +00:00
// 雷达扫描波效果相关成员变量
osg::ref_ptr<osg::Uniform> waveTimeUniform_;
osg::ref_ptr<osg::Uniform> waveRadiusUniform_;
osg::ref_ptr<osg::Uniform> waveSpeedUniform_;
osg::ref_ptr<osg::Uniform> waveCountUniform_;
osg::ref_ptr<osg::Uniform> waveColorUniform_;
float waveRadius_{ 100.0f }; // 扫描波最大半径
float waveSpeed_{ 20.0f }; // 扫描波速度
int waveCount_{ 30 }; // 同时存在的波纹数量
osg::Vec4 baseColor_{ 1.0f, 0.2f, 0.5f, 1.f };
osg::Vec4 waveColor_{ 0.0f, 0.5f, 1.0f, 0.8f }; // 扫描波颜色(蓝色)
double currentTime_{ 0.0 }; // 当前时间
2025-01-04 04:12:51 +00:00
};
2025-06-19 14:05:52 +00:00
/*
2025-02-22 15:16:54 +00:00
#pragma once
#include <osg/Node>
#include <osg/Geode>
#include <osg/MatrixTransform>
#include "viewer/UpdateRenderStd.h"
class ConeWave : public osg::Geode
, public UpdateRenderStd {
public:
ConeWave();
~ConeWave();
void clearSelf() ;
void Render(double dt) override;
void createWaveBeamCone(osg::MatrixTransform* node,double angle, double length, osg::Vec4 color, osg::Vec4 lineColor, double lineWidth);
2025-06-19 14:05:52 +00:00
void changeWaveBeamConeTarget(/*osg::MatrixTransform* mt, * / double latitude, double longitude, double height, bool ifDynamic);
2025-02-22 15:16:54 +00:00
void changeWaveBeamConeAppearance(osg::Vec4 color, osg::Vec4 lineColor, double lineWidth);
osg::ref_ptr<osg::MatrixTransform> getWaveBeamCone() {
return _waveBeamCone;
}
private:
osg::ref_ptr<osg::MatrixTransform> _waveBeamCone;
};
2025-06-19 14:05:52 +00:00
*/