QtCraft API C++ classes QML types Handbook

QcDayCycle Namespace

Day and night as a pure function of world time (seconds). More...

Header: #include <common/world/QcDayCycle.h>

Variables

const double dayLength
const double minimumDaylight
const double startTime

Functions

double daylight(double worldTime)
bool isNight(double worldTime)
double phase(double worldTime)
double sunHeight(double worldTime)

Detailed Description

Phase 0 is sunrise, 0.25 noon, 0.5 sunset and 0.75 midnight.

Variable Documentation

const double QcDayCycle::dayLength

Seconds of a full day.

const double QcDayCycle::minimumDaylight

The lowest brightness factor of sky light (at night).

const double QcDayCycle::startTime

New worlds start in the morning, once the sky is fully bright.

Function Documentation

double QcDayCycle::daylight(double worldTime)

Returns the brightness factor for sky light at worldTime, in [minimumDaylight, 1].

bool QcDayCycle::isNight(double worldTime)

Returns whether it is night at worldTime (the sun more than a little below the horizon).

double QcDayCycle::phase(double worldTime)

Returns the phase of the day at worldTime, in [0, 1).

double QcDayCycle::sunHeight(double worldTime)

Returns the height of the sun at worldTime, in [-1, 1].