/// <inheritdoc /> public void BuildMesh(Tile tile, Mesh mesh) { var gameObject = new GameObject(mesh.Name); var uMesh = new UnityEngine.Mesh(); uMesh.vertices = mesh.Vertices; uMesh.triangles = mesh.Triangles; uMesh.colors = mesh.Colors; uMesh.uv = mesh.Uvs; uMesh.uv2 = mesh.Uvs2; uMesh.uv3 = mesh.Uvs3; uMesh.RecalculateNormals(); gameObject.isStatic = true; gameObject.AddComponent <MeshFilter>().mesh = uMesh; // TODO use TextureIndex to select proper material. string texture = tile.QuadKey.LevelOfDetail == 16 ? @"Materials/SurfaceTexturedColored" : @"Materials/SurfaceColored"; gameObject.AddComponent <MeshRenderer>().sharedMaterial = _materialProvider.GetSharedMaterial(texture); gameObject.transform.parent = tile.GameObject.transform; }
protected override void OnEnter(GeoCoordinate coordinate, bool isFromTop) { Camera.GetComponent <Skybox>().material = MaterialProvider.GetSharedMaterial(@"Skyboxes/Space/Skybox"); Pivot.rotation = Quaternion.Euler(new Vector3((float)coordinate.Latitude, 270 - (float)coordinate.Longitude, 0)); Camera.transform.localPosition = new Vector3(0, 0, isFromTop ? -TileController.HeightRange.Maximum : -TileController.HeightRange.Minimum); TileController.Update(Target); }
protected override void OnEnter(GeoCoordinate coordinate, bool isFromTop) { Camera.GetComponent <Skybox>().material = MaterialProvider.GetSharedMaterial(@"Skyboxes/Surface/Skybox"); Camera.transform.localRotation = Quaternion.Euler(90, 0, 0); Light.transform.localRotation = Quaternion.Euler(90, 0, 0); Pivot.localPosition = new Vector3(0, isFromTop ? TileController.HeightRange.Maximum : TileController.HeightRange.Minimum, 0); // surface specific _tileController.MoveGeoOrigin(coordinate); TileController.Update(Target); }
private Material GetMaterial(Element element) { return(_materialProvider.GetSharedMaterial("Materials/" + element.Styles["material"])); }