Cloud Window

struct CloudWindow

Public Functions

CloudWindow()
const CloudWindow &operator=(const CloudWindow&)

assignment operator only copies properties, not state.

void Update(vec3 wind_spd_ms, float dt)
void Reset()

Reset offsets.

void SetDesiredCentrePos(vec3d pos_engine)

Set the position in Engine-space that we want for our.

void InitWindowCentre(platform::crossplatform::Quaterniond global_quat)

Initialize the window.

void InitWindowCentre(double lat_degrees, double long_degrees, double x_heading_degrees)

Initialize the window.

void UpdateWindowCentre(vec3d engine_pos_km)

Updates the origin if it is too far from the desired origin.

void UpdateWindowCentre(double lat_degrees, double long_degrees)

Updates the origin if it is too far from the desired origin.

void UpdateWindowCentre(platform::crossplatform::Quaterniond desired_origin)

Updates the origin if it is too far from the desired origin.

void MoveCloudWindowCentreTexel(int x, int y)

Translate the cloud window by the given x and y.

void MoveCloudWindowInitialTexel(int x, int y)

Move the initial generation position.

void CheckForOriginChange(platform::crossplatform::Quaterniond new_origin, const CloudRenderingOptions &opts)

Check if the cloud window origin has changed, and update values if it has.

void SetTrueWindOffset()
void SetAccumulatedWindOffsetKm(vec3 accumulatedWindOffset)
void GetLatitudeLongitudeHeadingDegrees(vec3 pos, double &lat, double &lon, double &head) const

Get the latitude/longitude referred to by the specified position value.

void GetOriginLatitudeLongitudeHeadingDegrees(double &lat_deg, double &lon_deg, double &head_deg) const

Get the latitude/longitude referred to by the specified quaternion in degrees.

void GetOriginLatitudeLongitudeHeadingRadians(double &lat_rad, double &lon_rad, double &head_rad) const

Get the latitude/longitude referred to by the specified quaternion in radians.

double GetOriginLatitudeDegrees() const

Get the latitude referred to by the origin quaternion.

double GetOriginLongitudeDegrees() const

Get the longitude referred to by the origin quaternion.

double GetOriginHeadingDegrees() const
vec3 GlobalQuaternionToLocalOffsetKm(platform::crossplatform::Quaterniond global_quat) const
vec3 WGS84PositionToLocal(vec3d pos_km) const

Convert the WGS84 position to local coordinates.

vec3 WGS84DirectionToLocal(vec3d dir) const

Convert the WGS84 direction to local coordinates.

vec3d OriginToWGS84(platform::crossplatform::Quaterniond q) const
vec3d LocalPositionToWGS84(vec3d pos) const

Convert the local direction to WGS84 coordinates.

vec3d LocalDirectionToWGS84(vec3d dir) const

Convert the local direction to WGS84 coordinates.

const mat4 &GetEngineToTrueSkyMatrixKm() const

The transform matrix from engine to trueSKY coords, all measured in km.

platform::crossplatform::posed ConvertWGSToTrueSKYPose(const platform::crossplatform::posed &pose_wgs) const
mat4 ConvertEngineToTrueSKYViewMatrix(const mat4d &engine_matrix) const

Convert an engine-space matrix to a trueSKY-space matrix via the WGS84 engine origin and the trueSKY Cloud Window origin. The input is the actual view matrix that your engine uses for rendering. Position is expected to be in metres.

int2 GetGridOffset(int2 old_ctr) const
void SaveToText(platform::crossplatform::TextOutput &output) const
void LoadFromText(platform::crossplatform::TextInput &input)

Public Members

platform::crossplatform::Quaterniond desired_origin = {0, 0, 0, 1.0}
float MinimumHeightKm
int3 VolumeTextureGrid
vec3 windOffsetKm
vec3 accumulatedWindOffsetKm
platform::crossplatform::Quaterniond origin = {0, 0, 0, 1.0}
int WindowGridX
int WindowGridZ
int PrecipitationGridDivisorX
int PrecipitationGridDivisorZ
vec3 WindowScaleKm
int2 initialCentreTexelPos = int2(0, 0)
int2 WindowGridCentreTexel
unsigned window_checksum
int cloudDetail
platform::crossplatform::Quaterniond last_origin
vec3 EdgeNoiseOffsetKm
vec3 WorleyOffsetKm
vec3 GridOriginKm
double planetRadiusKm
GeodeticPlanet geodeticPlanet
simul::clouds::GeoReferencingMode updateMode = simul::clouds::GeoReferencingMode::NONE
int sleepOnRecentreMs = 0
int sleepOnRecentreCounter = 0

Public Static Functions

static platform::crossplatform::Quaterniond XYZToQuaternion(vec3d pos)
struct GeodeticPlanet

Definitions of a planet’s shape: the defaults are the WGS84 Earth.

Public Functions

double GetLocalRadiusKm(double latitude_rads) const

Public Members

double semiMajorAxis = 6378.1370

Semi-major axis.

double inverseFlattening = 298.257223563

Flattening Factor of the Earth.

double w = 7292115 * 1e-11

Nominal Mean Angular Velocity.

double GM = 3986004.418108

Geocentric Gravitational Constant.