DYTSrouce/src/effects/ConeWave.h
2025-01-04 12:12:51 +08:00

65 lines
1.3 KiB
C++

#pragma once
#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();
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::Vec4 baseColor_{ 0.0f, 0.2f, 0.5f, 0.2f };
osg::ref_ptr<osg::Uniform> levelCountUniform_;
int levelCount_{ 4 };
osg::ref_ptr<osg::Uniform> levelHeightUniform_;
float levelHeight_{ 500.0f };
float height_{ 60.0f };
float radius_{ 10.0f };
};