new Vector(name, options)
Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | "noname" | optional Layer name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
optional
Layer options:
|
Fires:
- entitymove
- draw - Triggered when entity has moved.
- add
- remove
- entityadd - Triggered when new entity added to the layer.
- entityremove - Triggered when entity removes from the collection.
- visibilitychange
Extends
- Layer
Members
-
asyncboolean
-
Asynchronous data handling before rendering.
-
clampToGroundboolean
-
Vector data clamp to ground flag.
-
pickingEnabled
-
Set layer picking events active.
-
polygonOffsetFactorNumber
-
Specifies the scale factor for gl.polygonOffset function to calculate depth values, 0.0 is default.
-
polygonOffsetUnitsNumber
-
Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.
-
relativeToGroundboolean
-
Sets vector data relative to the ground relief.
-
scaleByDistanceArray.<number>
-
First index - near distance to the entity, after that entity becomes full scale. Second index - far distance to the entity, when entity becomes zero scale. Third index - far distance to the entity, when entity becomes invisible.
Methods
-
_reindexEntitiesArray(startIndex)
-
Refresh collected entities indexes from startIndex entitytes collection array position.
Name Type Description startIndex
number Entity array index. -
abortMaterialLoading(material)
-
Abort exact material loading.
Name Type Description material
Material Segment material. -
add(entity, rightNow){layer.Vector}
-
Adds entity to the layer.
Name Type Description entity
Entity Entity. rightNow
boolean optional Entity insertion option. False is deafult. Returns:
Type Description layer.Vector - Returns this layer. -
addEntities(entities, rightNow){layer.Vector}
-
Adds entity array to the layer.
Name Type Description entities
Array.<Entity> Entities array. rightNow
boolean optional Entity insertion option. False is deafult. Returns:
Type Description layer.Vector - Returns this layer. -
addTo(planet){layer.Vector}
-
Adds layer to the planet.
Name Type Description planet
Planet Planet scene object. Returns:
Type Description layer.Vector - -
clear()
-
TODO: Clear the layer.
-
each(callback)
-
Safety entities loop.
Name Type Description callback
callback Entity callback. -
getEntities(){Array.<Entity>}
-
Returns stored entities.
Returns:
Type Description Array.<Entity> - -
insert(entity, index, rightNow){layer.Vector}
-
Adds entity to the layer in the index position.
Name Type Description entity
Entity Entity. index
Number Index position. rightNow
boolean optional Entity insertion option. False is deafult. Returns:
Type Description layer.Vector - Returns this layer. -
abstractloadMaterial(material)
-
Start to load tile material.
Name Type Description material
Segment.Material Current material. -
removeEntities(entities){layer.Vector}
-
Removes entities from layer.
Name Type Description entities
Array.<Entity> Entity array. Returns:
Type Description layer.Vector - Returns this layer. -
removeEntity(entity){layer.Vector}
-
Remove entity from layer. TODO: memory leaks.
Name Type Description entity
Entity Entity to remove. Returns:
Type Description layer.Vector - Returns this layer. -
setEntities(entities){layer.Vector}
-
Removes current entities from layer and adds new entities.
Name Type Description entities
Array.<Entity> New entity array. Returns:
Type Description layer.Vector - Returns layer instance. -
setScaleByDistance(near, far, farInvisible){layer.Vector}
-
Sets scale by distance parameters.
Name Type Description near
number Full scale entity distance. far
number Zerol scale entity distance. farInvisible
number optional Entity visibility distance. Returns:
Type Description layer.Vector -