public void Init() { renderedSectors = new List <WorldSector> (); initUpdateQueues(); rTerrain.Init(); rObject.Init(); gameCamera.Init(); }
/// <summary> /// Implementation of user interface. /// </summary> private void OnGUI() { int offset = 0; LoadDataArea = new Rect(3, offset += 0, position.width - 6, 120); RenderDataArea = new Rect(3, offset += 120, position.width - 6, 130); // fixed window size GUILayout.ExpandHeight(false); GUILayout.ExpandWidth(false); #region Load Data GUILayout.BeginArea(LoadDataArea); apiKey = EditorGUILayout.TextField("Api Key", apiKey); lat = EditorGUILayout.FloatField("Latitude", lat); lon = EditorGUILayout.FloatField("Longitude", lon); rad = EditorGUILayout.IntSlider("Radius", rad, 1000, 60000); level = EditorGUILayout.IntSlider("Level", level, 7, 15); if (GUILayout.Button("Load Data")) { generator = new TerrainLoader(apiKey); generator.Init(lat, lon, rad, level); generator.Generate(); } if (generator != null) { Progress = generator.GetProgressStatus(); } else { Progress = 0; } GUILayout.EndArea(); #endregion #region Render Data GUILayout.BeginArea(RenderDataArea); minIndex = EditorGUILayout.Vector2IntField("MinIndex", minIndex); maxIndex = EditorGUILayout.Vector2IntField("MaxIndex", maxIndex); Resolution = EditorGUILayout.IntSlider("Resolution", Resolution, 32, 1024); Height = EditorGUILayout.IntSlider("Height", Height, 1, 100); if (GUILayout.Button("Render Data")) { renderer = new TerrainRenderer(); renderer.Init(minIndex.x, minIndex.y, maxIndex.x, maxIndex.y, resolution, Height); renderer.Run(); } GUILayout.EndArea(); #endregion EditorGUI.ProgressBar(new Rect(3, position.height - 24, position.width - 6, 20), Progress, (Progress * 100).ToString()); }
public void Init(Dimension dimension) { this.dimension = dimension; terrainRenderer = new TerrainRenderer(dimension, gameObject, chunkPrefab); terrainRenderer.Init(); }