-
Notifications
You must be signed in to change notification settings - Fork 29
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
Refactor Celestial Anchors #298
Conversation
…ad of inheritance for celestial anchors
A tip for testing this: The DLR-internal configuration repository also contains a |
The csp-satellites plugin throws the following OpenGL errors:
|
This is true, but it should be a separate issue, as it also happens on the current |
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.
Amazing work! The performance improvements are incredible. I couldn't find any major problems in the changes, I just have some minor suggestions for improvements.
Co-authored-by: Jonas Gilg <[email protected]>
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.
Just some final adjustments.
Co-authored-by: Jonas Gilg <[email protected]>
Co-authored-by: Jonas Gilg <[email protected]>
This major refactoring reduces the CPU load of scenes containing many celestial bodies significantly. The primary change is a shift from inheritance to composition when it comes to the celestial anchors. For the default scene, the time to update the
SolarSystem
has been reduced by more than 50% (on my machine from 11 ms to 5 ms).Primary Changes
Settings
class now has a map of immutableCelestialObject
s which are instantiated when CosmoScout is started. Before it used to have a list of anchor configurations which could be used to initializeCelestialObject
s.CelestialObject
s now have four new properties:bodyCullingRadius
: This can be used to determine the visiblity of an object. If the object is too far away to be seen, plugins may want to skip updating or drawing attached things.orbitCullingRadius
:This can be used to determine the visiblity of an object's trajectory. If the object is really far away, plugins may want to skip updating or drawing attached things (like trajectories or anchor labels).trackable
: If set tofalse
, the observer will not automatically follow this object.collidable
: If set tofalse
, the observer can travel through the object.CelestialObject
is updated once each frame by theSolarSystem
.CelestialAnchor
,CelestialObject
, orCelestialBody
now get the observer-relative transformation from theCelestialObject
s in theSettings
.CelestialBody
now have to derive from the new classCelestialSurface
. ACelestialSurface
can then be assigned to aCelestialObject
.CelestialAnchorNode
s do not exist anymore. Classes which used to use these, now have to use aVistaTransformNode
instead and update its transformation once each frame with the observer-relative transformation from the respectiveCelestialObject
.CelestialObject::update()
. This method does not exist any more; plugins now need to update their objects manually.clcache
anymore. See Use buildcache instead of clcache #299.Other Changes
COSMOSCOUT_UNIT_TESTS
is set totrue
.csp-anchor-labels
orbitCullingRadius
of the object for deciding whether they should be shown or not.csp-measurement-tools
cs::core::tools::Tool
andcs::core::tools::Mark
. This simplifies some code in the measurement tools.csp-satellites
csp-wms-overlays
Future Work
SolarSystem::getObject()
is called pretty frequently. Performance-wise it could be better to storeweak_ptr
s to theCelestialObject
s instead of calling this method every frame. For now, most objects only store the name of theCelestialObject
they are attached to and get the correspondingCelestialObject
from the settings each frame.CelestialObject
s at run-time could work now (like adding a completely new planet at run-time), but has not been tested. Plugins may need some tweaking to properly respond to this.