-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple-Objects Plugin #297
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 2889928608
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! This looks pretty good already. I'll do some thorough tests and report any issues I find. For now, I added some remarks to the code.
You should also run the tools/clang-format
script to apply some common formatting rules.
Edit: Make sure to unfold the hidden conversations below. GitHub does not like to show too many comments 😉.
Thank you!
@@ -0,0 +1 @@ | |||
*.drawio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file could be dropped.
@@ -0,0 +1,21 @@ | |||
MIT License |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file could be dropped as well :)
|
||
|
||
![](demo_image.png) | ||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here plenty of empty lines.
/*background-color: rgba(230, 230, 255, 0.1); | ||
border-bottom: 2px solid var(--cs-color-primary); | ||
box-shadow: none; | ||
color: var(--cs-color-text);*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed?
/*background-color: rgba(230, 230, 255, 0.1); | |
border-bottom: 2px solid var(--cs-color-primary); | |
box-shadow: none; | |
color: var(--cs-color-text);*/ |
* Funktionalität für rückwärts tabben durch prevDiv und this.tabRevMap, | ||
* aber rückwärts funktioniert nicht.. :( | ||
* | ||
* Weil: "shift+tab" triggert keypress event nicht. | ||
* -> nur "tab" (keyCodwe == 9) triggert keypress event. | ||
* | ||
* keydown wird durch "shift" getriggert, aber nicht durch "tab"?! | ||
* -> während shift gedrückt ist kommt auch kein keypress event von tab. WARUM?! | ||
* | ||
* Ist das irgendwo im code deaktiviert oder ist das hier eine ALTE VERSION? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you write this in english? 😉
glm::dquat qRot; | ||
glm::dvec3 lastSurfaceNormal; | ||
|
||
bool editEnabled = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool editEnabled = false; | |
bool mEditEnabled = false; |
|
||
|
||
/* | ||
/// A single satellite within the Solar System. | ||
class Satellite : public cs::scene::CelestialBody { | ||
public: | ||
Satellite(Plugin::Settings::SimpleObject const& config, std::string const& anchorName, | ||
VistaSceneGraph* sceneGraph, std::shared_ptr<cs::core::Settings> settings, | ||
std::shared_ptr<cs::core::SolarSystem> solarSystem); | ||
|
||
Satellite(Satellite const& other) = delete; | ||
Satellite(Satellite&& other) = default; | ||
|
||
Satellite& operator=(Satellite const& other) = delete; | ||
Satellite& operator=(Satellite&& other) = delete; | ||
|
||
~Satellite() override; | ||
|
||
void update(double tTime, cs::scene::CelestialObserver const& oObs) override; | ||
|
||
void setSun(std::shared_ptr<const cs::scene::CelestialObject> const& sun); | ||
|
||
// interface of scene::CelestialBody --------------------------------------- | ||
|
||
bool getIntersection( | ||
glm::dvec3 const& rayPos, glm::dvec3 const& rayDir, glm::dvec3& pos) const override; | ||
double getHeight(glm::dvec2 lngLat) const override; | ||
|
||
private: | ||
VistaSceneGraph* mSceneGraph; | ||
std::shared_ptr<cs::core::Settings> mSettings; | ||
std::shared_ptr<cs::core::SolarSystem> mSolarSystem; | ||
std::unique_ptr<VistaTransformNode> mAnchor; | ||
std::unique_ptr<cs::graphics::GltfLoader> mModel; | ||
std::shared_ptr<const cs::scene::CelestialObject> mSun; | ||
}; */ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | |
/// A single satellite within the Solar System. | |
class Satellite : public cs::scene::CelestialBody { | |
public: | |
Satellite(Plugin::Settings::SimpleObject const& config, std::string const& anchorName, | |
VistaSceneGraph* sceneGraph, std::shared_ptr<cs::core::Settings> settings, | |
std::shared_ptr<cs::core::SolarSystem> solarSystem); | |
Satellite(Satellite const& other) = delete; | |
Satellite(Satellite&& other) = default; | |
Satellite& operator=(Satellite const& other) = delete; | |
Satellite& operator=(Satellite&& other) = delete; | |
~Satellite() override; | |
void update(double tTime, cs::scene::CelestialObserver const& oObs) override; | |
void setSun(std::shared_ptr<const cs::scene::CelestialObject> const& sun); | |
// interface of scene::CelestialBody --------------------------------------- | |
bool getIntersection( | |
glm::dvec3 const& rayPos, glm::dvec3 const& rayDir, glm::dvec3& pos) const override; | |
double getHeight(glm::dvec2 lngLat) const override; | |
private: | |
VistaSceneGraph* mSceneGraph; | |
std::shared_ptr<cs::core::Settings> mSettings; | |
std::shared_ptr<cs::core::SolarSystem> mSolarSystem; | |
std::unique_ptr<VistaTransformNode> mAnchor; | |
std::unique_ptr<cs::graphics::GltfLoader> mModel; | |
std::shared_ptr<const cs::scene::CelestialObject> mSun; | |
}; */ |
namespace csp::simpleobjects { | ||
|
||
namespace utils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could be merged, I guess.
namespace csp::simpleobjects { | |
namespace utils { | |
namespace csp::simpleobjects::utils { |
} //namespace utils | ||
|
||
} // namespace csp::simplobjects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} //namespace utils | |
} // namespace csp::simplobjects | |
} // namespace csp::simplobjects::utils |
glm::dvec3 getSurfaceNormal(const glm::dvec2 &lngLat, std::shared_ptr<cs::scene::CelestialBody> &body, const double offset = 0.9F); | ||
|
||
// wrapper around cs::utils::convert::toCartesian for easier | ||
// access to position from getSurfaceNormal() | ||
glm::dvec3 getLngLatPositionOnBody(const glm::dvec2 &lngLat, std::shared_ptr<cs::scene::CelestialBody> &body); | ||
|
||
glm::dquat normalToRotation(const glm::dvec3 &normal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention, the const&
notation is used in CosmoScout. Also, the const
before the double
is not required and the shared_ptr
could be pass as const&
as well.
glm::dvec3 getSurfaceNormal(const glm::dvec2 &lngLat, std::shared_ptr<cs::scene::CelestialBody> &body, const double offset = 0.9F); | |
// wrapper around cs::utils::convert::toCartesian for easier | |
// access to position from getSurfaceNormal() | |
glm::dvec3 getLngLatPositionOnBody(const glm::dvec2 &lngLat, std::shared_ptr<cs::scene::CelestialBody> &body); | |
glm::dquat normalToRotation(const glm::dvec3 &normal); | |
glm::dvec3 getSurfaceNormal(glm::dvec2 const& lngLat, std::shared_ptr<cs::scene::CelestialBody> const& body, double offset = 0.9F); | |
// wrapper around cs::utils::convert::toCartesian for easier | |
// access to position from getSurfaceNormal() | |
glm::dvec3 getLngLatPositionOnBody(glm::dvec2 const& lngLat, std::shared_ptr<cs::scene::CelestialBody> const& body); | |
glm::dquat normalToRotation(glm::dvec3 const& normal); |
I played around with the plugin! Most of the time, it works flawlessly. However, in addition to the list of issues you posted above, I discovered some further things:
|
This pull request contains the new csp-simple-objects plugin with a readme.
With this it is possible to load glTF 3D models, place them on celestial bodies, rotate and move each object as desired.
Things that still need to be improved: