Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class Sky

  1. Object
  2. Sky

Sky domes: draw an inside-out sphere (Primitives.sphere(r, 24, 32, true)) around the camera with a Material.Type.UNLIT material and setFogged(false). The colour depends only on the direction from the camera, so the dome’s size and position do not matter. The sun follows the scene’s light.

For the sky to light the scene as well, give the Environment matching hemisphere colours; ScenePresets does both.

Fields

public static final String ZENITH = "skyZenith"VEC3 the colour straight up.
public static final String HORIZON = "skyHorizon"VEC3 the colour at the horizon.
public static final String GROUND = "skyGround"VEC3 the colour below the horizon.
public static final String GLOW = "skyGlow"VEC3 the glow around the sun, scattered into the haze.
public static final String CLOUDS = "skyClouds"FLOAT cloud cover, 0 to 1.
public static final String STARS = "skyStars"FLOAT star brightness, 0 for none.

Methods

public static ShaderMaterial gradient()A clear or hazy sky with a sun disc, a wide glow around it, the horizon band and drifting clouds.
public static ShaderMaterial day(ShaderMaterial sky)Sets a gradient sky to a clear midday.
public static ShaderMaterial dusk(ShaderMaterial sky)Sets a gradient sky to a warm dusk: deep blue overhead, apricot at the horizon, a big rose glow around a low sun, first stars.
public static ShaderMaterial night(ShaderMaterial sky)Sets a gradient sky to night: dark blue, a cold moon glow, stars.
public static ShaderMaterial overcast(ShaderMaterial sky)Sets a gradient sky to a grey overcast.

Inherited methods

Field details

ZENITH

public static final String ZENITH = "skyZenith"
VEC3 the colour straight up.

HORIZON

public static final String HORIZON = "skyHorizon"
VEC3 the colour at the horizon.

GROUND

public static final String GROUND = "skyGround"
VEC3 the colour below the horizon.

GLOW

public static final String GLOW = "skyGlow"
VEC3 the glow around the sun, scattered into the haze.

CLOUDS

public static final String CLOUDS = "skyClouds"
FLOAT cloud cover, 0 to 1.

STARS

public static final String STARS = "skyStars"
FLOAT star brightness, 0 for none.

Method details

gradient

public static ShaderMaterial gradient()
A clear or hazy sky with a sun disc, a wide glow around it, the horizon band and drifting clouds.

Returns

a new shader material

day

public static ShaderMaterial day(ShaderMaterial sky)
Sets a gradient sky to a clear midday.

Parameters

sky ShaderMaterial
a material from gradient

Returns

the material

dusk

public static ShaderMaterial dusk(ShaderMaterial sky)
Sets a gradient sky to a warm dusk: deep blue overhead, apricot at the horizon, a big rose glow around a low sun, first stars.

Parameters

sky ShaderMaterial
a material from gradient

Returns

the material

night

public static ShaderMaterial night(ShaderMaterial sky)
Sets a gradient sky to night: dark blue, a cold moon glow, stars.

Parameters

sky ShaderMaterial
a material from gradient

Returns

the material

overcast

public static ShaderMaterial overcast(ShaderMaterial sky)
Sets a gradient sky to a grey overcast.

Parameters

sky ShaderMaterial
a material from gradient

Returns

the material