private void UpdateTileAndChildren(GlobeTile tile) { tile.UpdateStoredVisibility(); tile.UpdateAppearance(); UpdateChildren(tile); }
public void AddChild(GlobeTile tile) { if (children == null) { children = new GlobeTile[4]; } children[childCount] = tile; childCount += 1; }
private void UpdateChildren(GlobeTile tile) { Transform tileTf = tile.transform; for (int childIdx = 0; childIdx < tileTf.childCount; childIdx++) { GlobeTile childTile = tileTf.GetChild(childIdx).GetComponent <GlobeTile>(); childTile.UpdateStoredVisibility(); childTile.UpdateAppearance(); UpdateChildren(childTile); } }
// TODO should use TileFactory private GlobeTile CreateTile(Transform parent, Wmts coords) { GameObject tileGo = Instantiate(tileTemplate); // high level tile mesh needs to be scaled for radius of globe -pete tileGo.transform.SetParentClearRelativeTransform(parent.transform, Vector3.zero, Quaternion.identity, Vector3.one * 0.5f); tileGo.name = coords.ToString(); GlobeTile tile = tileGo.GetComponent <GlobeTile>(); tile.coords = coords; tile.globe = this; tile.bBox = CurrentLayer.Wmts2Bbox(coords); return(tile); }
private void CreateGeometry(GlobeTile tile) { int tessellation = Globe.TessellationDivisions(coords.zoom); Mesh tileMesh = tile.globe.tessellator.GenerateSector(tile.FullBoundingBox, Ellipsoid.ScaledWgs84, tessellation, tessellation); gameObject.GetComponent <MeshFilter>().mesh = tileMesh; cullingBounds = tileMesh.bounds; Vector3 tileCenter = GeographicGridTessellator.LatLonToPosition(tile.bBox.Center, Ellipsoid.ScaledWgs84); Vector3 normal = Ellipsoid.ScaledWgs84.GeodeticSurfaceNormal(tileCenter); Vector3 normalWs = globe.transform.TransformDirection(normal); surfaceNormal = transform.InverseTransformDirection(normalWs); // Store in local space }