Constructor
new MapTile(properties)
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
properties | Object | Properties
|
- Source
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:
Name | Type | Description |
---|---|---|
requestor | Object | the requestor using the tile's texture |
texture | THREE. | (optional) the requestor will be removed from the user set ONLY if the texture matches this tile's texture when one is provided |
- Source
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:
Name | Type | Description |
---|---|---|
requestor | Object | |
requestBounds | THREE. |
- Source
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:
Name | Type | Description |
---|---|---|
requestor | Object | |
requestBounds | THREE. | |
callback | function | a callback function called when the texture is loaded |
- Source
split()
Split this tile in four and populate this.children with them.
- Source