Skip to content
Snippets Groups Projects
Commit b22fc8a6 authored by Knuiman, Bart's avatar Knuiman, Bart
Browse files

Removed _11 from TerrainGenerator.prefab.

parent 982509c6
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ GameObject:
- component: {fileID: 8981884769106181493}
- component: {fileID: 4806176523509582529}
m_Layer: 0
m_Name: TerrainGenerator_11
m_Name: TerrainGenerator
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......
......@@ -67,7 +67,6 @@ namespace Wander
public bool runOnStart = false;
public string prefix = "Terrain";
public float pixelError = 2;
public string areaName = "Steenbergen";
public Vector2 originWGS84 = new Vector2(51.985365f, 5.664941f); // Copy directly from Google maps. This is Forum on Campus WUR.
public int numRings = 1;
public int zoom = 12;
......@@ -166,7 +165,6 @@ namespace Wander
boundsSize = (numRings*2+1)*tileSize; // (NumRings*2+1) is nTiles wide.
boundaryData["boundsSize"] = boundsSize.ToString();
boundaryData["areaName"] = areaName;
foreach ( var sceneObject in sceneObjects )
{
......@@ -542,6 +540,7 @@ namespace Wander
return 0; // Only build missing tiles.
if (!overwriteExistingTiles)
{
var areaName = SceneManager.GetActiveScene().name;
var tilePath = Path.Combine( Application.dataPath, $"{areaName}/tiles_{zoom}", $"tile_{coord.x}_{coord.y}").FS();
if (Directory.Exists( tilePath ))
{
......@@ -735,9 +734,6 @@ namespace Wander
[InitializeOnLoad]
public class TerrainBuilderEditor : Editor
{
bool toggle;
// bool terrainDependenciesLoaded;
public override void OnInspectorGUI()
{
TerrainBuilder builder = (TerrainBuilder)target;
......@@ -755,15 +751,10 @@ namespace Wander
GUILayout.BeginHorizontal();
{
if (toggle = GUILayout.Toggle( toggle, "Checked Area name" ))
if (GUILayout.Button( "Build" ))
{
toggle = true;
if (GUILayout.Button( "Build" ))
{
toggle=false;
builder.issuedSyncCoords = true;
builder.issuedBuild = true;
}
builder.issuedSyncCoords = true;
builder.issuedBuild = true;
}
if (GUILayout.Button( "Sync coords" ))
{
......
......@@ -8,6 +8,8 @@ using System.Threading.Tasks;
using UnityEngine;
using System.Threading;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
......@@ -1170,7 +1172,8 @@ namespace Wander
return;
}
var dirPath = Path.Combine( Application.dataPath, builder.areaName, $"tiles_{builder.zoom}", $"tile_{tileOrigin.x}_{tileOrigin.y}").FS();
var areaName = SceneManager.GetActiveScene().name;
var dirPath = Path.Combine( Application.dataPath, areaName, $"tiles_{builder.zoom}", $"tile_{tileOrigin.x}_{tileOrigin.y}").FS();
if (!Directory.Exists( dirPath ) )
{
Directory.CreateDirectory( dirPath );
......
using UnityEngine;
//using UnityEngine.Addressables;
#if UNITY_EDITOR
namespace Wander
{
public class TileEnabler : MonoBehaviour
{
public float maxViewDistance = 2000;
public float minViewDistance = 0.1f;
public Camera cam;
float tileSize;
float halfHeight;
private void Start()
{
if ( cam == null )
{
cam = Camera.main;
}
var builder = FindFirstObjectByType<TerrainBuilder>();
halfHeight = builder.terrainHeight/2;
tileSize = (float)builder.tileSize;
}
private void Update()
{
if (cam == null)
{
return;
}
Camera c = new Camera();
c.CopyFrom( cam );
c.nearClipPlane = minViewDistance;
c.farClipPlane = maxViewDistance;
var planes = GeometryUtility.CalculateFrustumPlanes( c );
for (int i = 0; i < transform.childCount; i++)
{
var tile = transform.GetChild(i);
var bounds = new Bounds(tile.transform.position + new Vector3(tileSize, halfHeight, tileSize)/2, new Vector3(tileSize, halfHeight*2, tileSize));
if (i == 0)
{
MiscUtils.DrawBox( bounds.center, Quaternion.identity, bounds.size, Color.blue );
}
tile.gameObject.SetActive( GeometryUtility.TestPlanesAABB( planes, bounds ) );
}
}
}
}
#endif
\ No newline at end of file
fileFormatVersion: 2
guid: 39bfd911c0de22340b7b3990638e8177
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment