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
Extract updateClouds method from updateFrame #13939
Merged
srifqi
merged 4 commits into
minetest:master
from
JosiahWI:refactor/extract-update-clouds
Nov 8, 2023
Merged
Extract updateClouds method from updateFrame #13939
srifqi
merged 4 commits into
minetest:master
from
JosiahWI:refactor/extract-update-clouds
Nov 8, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grorp
requested changes
Nov 4, 2023
grorp
added
the
Action / change needed
Code still needs changes (PR) / more information requested (Issues)
label
Nov 4, 2023
An automated formatter would help with these things. :) |
Co-authored-by: Gregor Parzefall <82708541+grorp@users.noreply.github.com>
Zughy
removed
the
Action / change needed
Code still needs changes (PR) / more information requested (Issues)
label
Nov 5, 2023
grorp
approved these changes
Nov 5, 2023
srifqi
requested changes
Nov 6, 2023
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.
When changing these lines/functions, it might be better to also improve the comments (in one go).
diff --git a/src/client/game.cpp b/src/client/game.cpp
index d6a5a5bb6..cc8891547 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -4198,7 +4198,7 @@ void Game::updateClouds(float dtime)
if (this->sky->getCloudsVisible()) {
this->clouds->setVisible(true);
this->clouds->step(dtime);
- // this->camera->getPosition is not enough for 3rd person views
+ // this->camera->getPosition is not enough for third-person camera.
v3f camera_node_position = this->camera->getCameraNode()->getPosition();
v3s16 camera_offset = this->camera->getOffset();
camera_node_position.X = camera_node_position.X + camera_offset.X * BS;
@@ -4206,14 +4206,13 @@ void Game::updateClouds(float dtime)
camera_node_position.Z = camera_node_position.Z + camera_offset.Z * BS;
this->clouds->update(camera_node_position, this->sky->getCloudColor());
if (this->clouds->isCameraInsideCloud() && this->m_cache_enable_fog) {
- // if inside clouds, and fog enabled, use that as sky
- // color(s)
+ // If camera is inside cloud and fog is enabled, use cloud's colors as sky colors.
video::SColor clouds_dark = this->clouds->getColor().getInterpolated(
video::SColor(255, 0, 0, 0), 0.9);
this->sky->overrideColors(clouds_dark, this->clouds->getColor());
this->sky->setInClouds(true);
this->runData.fog_range = std::fmin(this->runData.fog_range * 0.5f, 32.0f * BS);
- // do not draw clouds after all
+ // Clouds are not drawn in this case.
this->clouds->setVisible(false);
}
} else {
I found no changes/regressions from this PR.
srifqi
approved these changes
Nov 6, 2023
cx384
pushed a commit
to cx384/minetest
that referenced
this pull request
Dec 9, 2023
Co-authored-by: Gregor Parzefall <82708541+grorp@users.noreply.github.com>
kawogi
pushed a commit
to kawogi/minetest
that referenced
this pull request
Dec 19, 2023
Co-authored-by: Gregor Parzefall <82708541+grorp@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a code cleanup. Other than adding
this->
to member variables in the extracted method, no changes were made to the extracted code.To do
Ready for Review.
How to test
I compiled a Debug build and confirmed in devtest that the clouds move and have the same appearance they did before.