mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
day-night loop, dynamic skybox, clock on debug panel
This commit is contained in:
parent
4a9a4ddd14
commit
c08c31b0ad
24 changed files with 599 additions and 48 deletions
14
src/util/timeutil.cpp
Normal file
14
src/util/timeutil.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#include "timeutil.h"
|
||||
|
||||
float timeutil::time_value(float hour, float minute, float second) {
|
||||
return (hour + (minute + second / 60.0f) / 60.0f) / 24.0f;
|
||||
}
|
||||
|
||||
void timeutil::from_value(float value, int& hour, int& minute, int& second) {
|
||||
value *= 24;
|
||||
hour = value;
|
||||
value *= 60;
|
||||
minute = int(value) % 60;
|
||||
value *= 60;
|
||||
second = int(value) % 60;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue