🛰️航天仿真算法库 SpaceAST 0.3.1
载入中...
搜索中...
未找到
VisCelestialBody.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "VisObject.hpp"
25#include "AstCore/CelestialBody.hpp"
26#include "AstUtil/StringView.hpp"
27
28#include <string>
29
30AST_NAMESPACE_BEGIN
31
38class AST_VISUALIZATION_API VisCelestialBody: public VisObject
39{
40public:
41 VisCelestialBody() = default;
42 ~VisCelestialBody() = default;
43
45 void accept(VisVisitor& visitor) override;
46
48 Body* body() const { return body_.get(); }
49 void setBody(Body* body) { body_ = body; }
50
52 double radius() const { Body* b = body_.get(); return b ? b->getRadius() : 0.0; }
53
56 const std::string& texture() const { return texture_; }
57
60 void setTexture(StringView path) { texture_ = std::string(path); }
61
64 std::string effectiveTexture() const;
65
66private:
67 WeakPtr<Body> body_{};
68 std::string texture_{};
69};
70
71
76AST_VISUALIZATION_API std::string aFindBodyTexture(const Body* body);
77
80AST_NAMESPACE_END
天体
定义 CelestialBody.hpp:72
double getRadius() const
获取天体半径
定义 CelestialBody.hpp:112
定义 VisCelestialBody.hpp:39
const std::string & texture() const
显式纹理路径(空表示自动探测)
定义 VisCelestialBody.hpp:56
void setTexture(StringView path)
设置显式纹理路径
定义 VisCelestialBody.hpp:60
double radius() const
天体半径(米),无天体时返回 0
定义 VisCelestialBody.hpp:52
Body * body() const
获取天体指针
定义 VisCelestialBody.hpp:48
定义 VisObject.hpp:41
virtual void accept(VisVisitor &visitor)=0
访问者分派
可视化对象访问者
定义 VisVisitor.hpp:42
弱引用指针
定义 WeakPtr.hpp:35
std::string aFindBodyTexture(const Body *body)
自动探测天体纹理文件路径
定义 VisCelestialBody.cpp:40