CloudsLayer

Base class for clouds layer.

Constructor

new CloudsLayer(properties)

A volumetric clouds layer that allows specifying custom code to compute cloud opacity per sample. See {@class NOAAGFSCloudsLayer} or {@class RandomCloudsLayer} for directly useable implementations. The given shader glsl code {@param properties.sampleDensityFunction} will be inserted in the clouds shader and used to compute volume sample densities. It must implement a function "float sampleDensity(vec3 samplePosition, float lod)". The lod shall be a value between 0 and 4 where 0 indicates samples closer to the camera and 4 indicates samples further away. Extra uniforms can be specified through the @param{properties.extraUniforms} and will be available in the shader by their key. Only the following types are allowed: number, boolean, THREE.Vector2, THREE.Vector3, THREE.Vector4, THREE.Matrix3, THREE.Matrix4, THREE.Data3DTexture, THREE.DataArrayTexture, THREE.DataTexture and THREE.Texture Only one visible CloudsLayer (first in layer list) will be taken into account at a time.
Parameters:
NameTypeDescription
propertiesObject
Properties
NameTypeAttributesDefaultDescription
idString | Numberlayer id should be unique
nameStringthe name can be anything you want and is intended for labeling
sampleDensityFunctionString<optional>
shader function that returns the cloud density given a point in cartesian coordinates and a level of detail.
extraUniformsObject<optional>
a key value pair of uniforms for the shader. The uniforms will be available with the given keys in the shader.
qualityNumber<optional>
0.5a quality that affects the resolution and number of samples for volumetric clouds
minHeightNumber<optional>
500clouds min height in meters above ellipsoid
maxHeightNumber<optional>
12000clouds max height in meters above ellipsoid
densityNumber<optional>
0.5cloud density multiplier
luminanceNumber<optional>
1sun intensity multiplier
windSpeedNumber<optional>
0.05wind speed
windDirectionNumber<optional>
new THREE.Vector2(1.0,0.0)wind direction
debugBoolean<optional>
falsewind direction
colorTHREE.Vector3<optional>
new THREE.Vector3(1.0,1.0,1.0)base cloud color.
visibleBoolean<optional>
truelayer will be rendered if true (true by default)

Extends

Methods

addListener(key, listener)

Adds a listener for layer events
Parameters:
NameTypeDescription
key*can be anything but should be unique
listenerfunctiona function : (layer, eventType)=>{}

dispose()

disposes of any resources used by this layer

getBounds() → {THREE.Box2}

Returns:
bounds in longitude latitude (degrees)
Type: 
THREE.Box2

getCenter(sfct) → {THREE.Vector3}

Moves a given point to this layer's center in degree longitude/latitude
Parameters:
NameTypeDescription
sfctTHREE.Vector3a point to move
Returns:
the input point
Type: 
THREE.Vector3

getID()

Returns:
layer id

getName()

Returns:
layer name

getSelectableObjects()

Get all the selectable objects of this layer.
Returns:
an array of ray-castable objects with a property "layer" pointing to this layer.

removeListener(key)

Removes the listener associated to the given key
Parameters:
NameTypeDescription
key*can be anything but should be unique

select(objectsToSelect) → {Boolean}

selects an object from this layer
Parameters:
NameTypeDescription
objectsToSelectObject
Returns:
true if the object was selected, false otherwise
Type: 
Boolean

setName(name)

change the layer name
Parameters:
NameTypeDescription
nameString

setVisible(visible)

Modifies the layer visibility
Parameters:
NameTypeDescription
visibleBoolean

unselect(objectsToUnselect) → {Boolean}

un-selects an object from this layer
Parameters:
NameTypeDescription
objectsToUnselectObject
Returns:
true if the object was un-selected, false otherwise
Type: 
Boolean