DYTSrouce/src/effects/ConeWave.h

93 lines
2.3 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();
2025-06-27 00:29:36 +00:00
void CreateConeGeometry();
2025-06-22 17:49:35 +00:00
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 SetBaseColor(const osg::Vec4& color);
const osg::Vec4 GetBaseColor() const {
return baseColor_;
}
2025-06-24 15:40:11 +00:00
void SetRingBrightAlpha(float alpha);
float GetRingBrightAlpha() const { return ringBrightAlpha_; }
void SetRingDarkAlpha(float alpha);
float GetRingDarkAlpha() const { return ringDarkAlpha_; }
void SetConeAlpha(float alpha);
float GetConeAlpha() const { return coneAlpha_; }
2025-06-27 00:29:36 +00:00
protected:
void Clear();
void Rebuild();
2025-01-04 04:12:51 +00:00
private:
2025-06-27 00:29:36 +00:00
osg::ref_ptr<osg::Geometry> coneGeometry_;
osg::ref_ptr<osg::Drawable> coneDrawable_;
osg::ref_ptr<osg::NodeCallback> coneCallback_;
2025-01-04 04:12:51 +00:00
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_;
2025-06-25 00:10:01 +00:00
osg::ref_ptr<osg::Uniform> baseColorUniform_;
2025-06-22 17:49:35 +00:00
osg::ref_ptr<osg::Uniform> waveColorUniform_;
2025-06-25 00:10:01 +00:00
osg::ref_ptr<osg::Uniform> levelHeightUniform_;
2025-06-22 17:49:35 +00:00
2025-06-24 15:40:11 +00:00
osg::ref_ptr<osg::Uniform> ringBrightAlphaUniform_;
osg::ref_ptr<osg::Uniform> ringDarkAlphaUniform_;
osg::ref_ptr<osg::Uniform> coneAlphaUniform_;
2025-07-02 23:53:32 +00:00
float waveRadius_{ 100.0f };
float waveSpeed_{ 20.0f };
int waveCount_{ 30 };
2025-06-22 17:49:35 +00:00
osg::Vec4 baseColor_{ 1.0f, 0.2f, 0.5f, 1.f };
2025-07-02 23:53:32 +00:00
osg::Vec4 waveColor_{ 0.0f, 0.5f, 1.0f, 0.8f };
double currentTime_{ 0.0 };
2025-06-24 15:40:11 +00:00
2025-07-02 23:53:32 +00:00
float ringBrightAlpha_{ 0.8f };
float ringDarkAlpha_{ 0.3f };
float coneAlpha_{ 0.7f };
2025-01-04 04:12:51 +00:00
};