Segment

Source: Segment.js:67

Planet segment Web Mercator tile class that stored and rendered with quad tree.


Constructor

new Segment( node: quadTree.Node, planet: Planet, tileZoom: Number, extent: Extent, ): Segment

Parameters

  • node (quadTree.Node) — Segment node.
  • planet (Planet) — Current planet scene.
  • tileZoom (Number) — Zoom index.
  • extent (Extent) — Segment extent.

Instance Methods

acceptForRendering(camera: Camera): boolean

Returns that segment good for rendering with camera by current lod ratio.

Parameters

  • camera (Camera) — Camera object.

Returns

  • boolean

getEntityTerrainPoint( entity: Entity, res: Vec3, normal?: Vec3, ): Vec3

Returns entity terrain point.

Parameters

  • entity (Entity) — Entity.
  • res (Vec3) — Point coordinates.
  • normal (Vec3, optional) — Terrain point normal.

Returns

getTerrainPoint( xyz: Vec3, insideSegmentPosition: LonLat, res?: Vec3, normal?: Vec3, ): number

Returns distance from object to terrain coordinates and terrain point that calculates out in the res parameter.

Parameters

  • xyz (Vec3) — Cartesian object position.
  • insideSegmentPosition (LonLat) — Geodetic object position.
  • res (Vec3, optional) — Result cartesian coordinates on the terrain.
  • normal (Vec3, optional) — Terrain point normal.

Returns

  • number

projectNative(lonlat: LonLat): LonLat

Project wgs86 to segment native projection.

Parameters

  • lonlat (LonLat) — Coordinates to project.

Returns

loadTerrain(forceLoading: boolean)

Parameters

  • forceLoading (boolean)

elevationsExists(elevations: Float32Array)

Terrain obtained from server.

Parameters

  • elevations (Float32Array) — Elevation data.

elevationsNotExists()

Terrain is not obtained or not exists on the server.

deleteBuffers()

Delete segment gl buffers.

deleteMaterials()

Delete materials.

deleteElevations()

Delete elevation data.

clearSegment()

Clear but not destroy segment data.

_freeCache()

Removes cache records.

destroySegment()

Clear and destroy all segment data.

createBoundsByExtent()

Creates bound volumes by segment geographical extent.

getMaterialByLayer(layer: Layer): planetSegment.Material

Gets specific layer material.

Parameters

  • layer (Layer) — Layer object.

Returns

  • planetSegment.Material

getEntityTerrainPoint(entity: Entity, res: Vec3): Vec3

Returns entity terrain point.

Parameters

  • entity (Entity) — Entity.
  • res (Vec3) — Point coordinates.

Returns

getTerrainPoint( xyz: Vec3, insideSegmentPosition: LonLat, res?: Vec3, ): number

Returns distance from object to terrain coordinates and terrain point that calculates out in the res parameter.

Parameters

  • xyz (Vec3) — Cartesian object position.
  • insideSegmentPosition (LonLat) — Geodetic object position.
  • res (Vec3, optional) — Result cartesian coordinates on the terrain.

Returns

  • number

projectNative(lonlat: LonLat): LonLat

Project wgs86 to segment native projection.

Parameters

  • lonlat (LonLat) — Coordinates to project.

Returns

elevationsExists(elevations: Float32Array)

Terrain obtained from server.

Parameters

  • elevations (Float32Array) — Elevation data.

elevationsNotExists()

Keep plain elevation segment for rendering

'this.tileZoom <= this.planet.terrain.maxZoom' it means, that the segment is plain

_setExtentLonLat()

getMaterialByLayer(layer: Layer): Material | undefined

Gets specific layer material.

Parameters

  • layer (Layer) — Layer object.

Returns

_getCyclicLonShift( sourceExtent: Extent, targetExtent: Extent, worldWidth: number, ): number

Computes cyclic longitude shift for sourceExtent to align it with targetExtent in wrapped horizontal coordinate space (for example, Web Mercator world copies).

Parameters

  • sourceExtent (Extent) — Source extent to shift along longitude.
  • targetExtent (Extent) — Target extent used as alignment reference.
  • worldWidth (number) — Full world width in projection units.

Returns

  • number — Longitude shift to apply to sourceExtent.

Instance Fields

node: quadTree.Node

Quad tree node of the segment.

planet: Planet

Planet pointer.

handler: Handler

WebGl handler pointer.

bsphere: Sphere

Segment bounding sphere

bbox: Box

Segment bounding box.

_extent: Extent

Geographical extent.

gridSize: number

Vertices grid size.

tileZoom: number

Tile zoom index.

tileX: number

Horizontal tile index.

tileY: number

Vertical tile index.

materials: Array.<planetSegment.Material>

Texture materials array.

plainReady: boolean

Plain segment vertices was created.

initialized: boolean

Segment is ready to create plain vertices.

normalMapReady: boolean

Normal map is allready made.

parentNormalMapReady: boolean

Parent normal map is made allready(optimization parameter).

terrainReady: boolean

Terrain is allready applied flag.

terrainIsLoading: boolean

Terrain is loading now flag.

terrainExists: boolean

Terrain existing flag.

materials