Skip to content
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

Fix miscellaneous bugs with camera rotation #2398

Merged
merged 3 commits into from
Dec 12, 2019

Conversation

eggrobin
Copy link
Member

The EVE clouds were broken.

This is probably because the hemisphere on which clouds are drawn is chosen in the shader based on the position of the planet, which is computed with respect to the galaxy camera, rather than the scaled camera:
https://github.com/rbray89/EnvironmentalVisualEnhancements/blob/0c6fdac386c0fe6da20ddabea25f4fe60ca25b1b/Atmosphere/CloudsPQS.cs#L218-L224.
Normally, both cameras are at the origin, because ScaledSpace shifts positions accordingly, so this does not matter; since we adjusted the cameras after ScaledSpace ran, we moved the scaled space camera (but not the galaxy camera) away from the origin.
This may arguably be a bug in EVE (that position should be computed using the scaled space camera, since this is the one that renders), but it is probably a bad idea to violate the KSP invariant.

Run ScaledSpace.LateUpdate() by hand.

We were updating the scaled space orientation even outside map view.

I am not completely sure whether this had effects or whether the blinking that I experienced was from something else, but scaled space exists in the flight scene too (for distant planets), so we should not mess with it there.

plotting_frame_ is not GetPlottingFrame().

The C++ was using plotting_frame_, which is the last non-target plotting frame, instead of GetPlottingFrame(), which is the plotting frame; this meant that, when using the target frame, the camera was following a different frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants