MapTile

Map Tile handles level of detail for maps separately from the terrain level of detail.

Constructor

new MapTile(properties)

Parameters:
NameTypeDescription
propertiesObject
Properties
NameTypeDescription
referenceObjectunused, only EPSG:4326 is supported
boundsTHREE.Box2this tile's bounds
parentMapTilethis tile's direct parent
fetchTileTextureFunctionfetchTileFunctiona function that fetches a tile texture through a CancellableTextureLoader and takes this MapTile's bounds and a callback as argument.
maxLODmaxLODa maximum recursion depth
lodlodthis tile's lod (optional)

Methods

detach(requestor, texture)

detach a requestor that was using this tile's texture. If children have no users, they'll be garbage collected. If this tile has no more users, texture will be disposed and ongoing texture requests will be cancelled.
Parameters:
NameTypeDescription
requestorObjectthe requestor using the tile's texture
textureTHREE.Texture(optional) the requestor will be removed from the user set ONLY if the texture matches this tile's texture when one is provided
Returns:
true if there are no users left for this tile or any children tile

getBestTextureAndUVBounds(requestor, requestBounds)

If this tile has a loaded texture, returns it with uv bounds that match the requested bounds, else, forwards the request to it's parent. if no parent is present, returns a default texture.
Parameters:
NameTypeDescription
requestorObject
requestBoundsTHREE.Box2

getTextureAndUVBounds(requestor, requestBounds, callback)

Request a texture and UVBounds from this tile. the request fits this tile if the requestBounds width and height are equal to the tile bounds or smalle but bigger than half of the tile bounds If the request fits the tile: - When a texture is already loaded, it is immediately returned with matching uv bounds. The callback will never be called. - when a texture is not yet loaded, a texture will be requested from the parent and the texture for this level will be requested. The callback will then be called if the requestor hasn't called the detach method in the meantime. If the request does not fit the tile because the tile is too large. - If the tile already has children, the request will be forwarded. - If the tile does not have children, children are generated and the request is forwarded down. If the request does not fit the tile because the tile bounds doesn't contain the request bounds, an error will be thrown.
Parameters:
NameTypeDescription
requestorObject
requestBoundsTHREE.Box2
callbackfunctiona callback function called when the texture is loaded

split()

Split this tile in four and populate this.children with them.