DYTSrouce/src/entities/PathComponent.h

35 lines
802 B
C++

#pragma once
#include "entities/SceneComponent.h"
#include <osg/AnimationPath>
class PathComponent : public SceneComponent {
Q_OBJECT
public:
explicit PathComponent(SceneComponent* parent = nullptr);
~PathComponent();
static std::string GetTypeName();
std::string GetSelfTypeName() const override {
return PathComponent::GetTypeName();
}
bool SetAttribute(const char* name, const char* value) override;
bool SaveAttribute(tinyxml2::XMLElement* element) override;
void Begin() override;
void Update(double dt) override;
void SetPath(const QString& path);
const QString& GetPath() const;
protected:
class TransformPath* transformPath_{nullptr};
double deltaTime_{ 0.0 };
class Timestep* timeStep_{ nullptr };
osg::ref_ptr<osg::AnimationPath> animationPath_;
QString path_;
};