#pragma once #include #include #include #include #include "effects/DrawDecorate.h" #include "viewer/UpdateRenderStd.h" class DashedLine : public osg::PositionAttitudeTransform , public UpdateRenderStd { public: explicit DashedLine(const std::string& path); ~DashedLine(void) override; void Render(double dt) override; void InitGeode(); void Destory(); void SetStart(const osg::Vec3& start); void SetEnd(const osg::Vec3& end); void SetForward(const osg::Vec3& start, const osg::Vec3& end); void SetRadius(float radius); float GetRadius() const { return radius_; } void SetBaseColor(const osg::Vec4& color); const osg::Vec4 GetBaseColor() const { return baseColor_; } protected: virtual void CreateTexturedCone(osg::Geode* geode); private: void UpdateRotaion(); private: std::string txturePath_; osg::ref_ptr timeUniform_; osg::ref_ptr baseColorUniform_; osg::Vec3 start_{ 20.f, 30.0, 0.0f }; osg::Vec3 end_{ 10.f, 0.0, 0.0f }; osg::ref_ptr cylinder_; osg::ref_ptr cylinderDrawable_; osg::Vec4 baseColor_{ 0.0, 0.2, 0.5, 0.2 }; float radius_{ 0.20f }; };