Repository navigation
Calculate star opacity with ambientLight instead of dayCycle - #3045
Conversation
IntegratedQuantum
left a comment
There was a problem hiding this comment.
I don't like that this creates a dependence between the brightness of the blocks and the brightness of the stars (and you already feel the problems of it here, with the magic constant 0.9).
I think it would be better to have some struct that stores the time of day and has functions to query the brightness as well as other properties.
You mean something like removing dayNightLightFactor from World and placing it in another struct dedicated to day length, day cycle transitions and star opacity? Line 375 in 604ca82 |
|
Yeah, basically all functions that relate to the day-night cycle should be in one place. |
|
Quite some changes... The change to the star rotation makes it realistic, with a full rotation per day. But it does look faster. |
| ambientLight: f32 = 0, | ||
| dayTime: i64 = 0, | ||
|
|
||
| pub fn getNightStart() u63 { |
There was a problem hiding this comment.
Could be a constant.
Also, following the previous code, I think this should be midnight.
There was a problem hiding this comment.
I'd argue it's more useful for it to be the start of each day phase, someone who sets night probably wants it longer rather than shorter, name for day
There was a problem hiding this comment.
Then please introduce a dayStart constant that is used in the other case to make the /time command consistant.
(and also adjust the nightStart constant to actually be at night start)
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Please solve the night start/midnight inconsistency.
In preparation for an asymmetric day-night cycle (#1211), I think it makes more sense, is simpler and faster for star opacity to be based on ambient light. This way it's not coupled to the very specific transitions between times of day. I tested and it looks fine.
I checked and the
if (starOpacity != 0) {block is not entered during the day and at night starOpacity is 1. I usedstd.debug.print("{d}\n", .{starOpacity });(in case {d} does some FP rounding magic I should know).