Skip to content

Refresh Vector Lines Cache on each draw - #429

Open
ballisticfox wants to merge 2 commits into
KSPModdingLibs:masterfrom
ballisticfox:bugfix/FixStaleVectorlineProjectionCache
Open

Refresh Vector Lines Cache on each draw#429
ballisticfox wants to merge 2 commits into
KSPModdingLibs:masterfrom
ballisticfox:bugfix/FixStaleVectorlineProjectionCache

Conversation

@ballisticfox

Copy link
Copy Markdown

VectorLineCameraProjection caches projectionMatrix * worldToCameraMatrix once per frame, and is filled by whatever line projection happens to run first that frame. Every Vectrosity consumer draws from its own LateUpdate and the cameras also move during LateUpdate, with no defined order among components.

When a draw is issued before the camera moves, it fills the cache with the pose the camera is about to leave. The frame key is then current, so every line drawn afterwards reuses that pose, including the orbit lines. They end up projected from a camera pose up to a frame's worth of movement out of date while the bodies render from the real one.

Fixed by scoping the cache to a draw rather than a frame.

This bug is easiest to see continuously with a mod that reorients the map camera each frame (i.e. Tilt'em Continued).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants