93 lines
1.9 KiB
C#
93 lines
1.9 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class TerrainDetail : MonoBehaviour
|
|
{
|
|
public int heightmapMaximumLOD;
|
|
|
|
public float heightmapPixelError;
|
|
|
|
public bool basemapDistanceRelief;
|
|
|
|
public bool basemapDistanceUpdate;
|
|
|
|
public float basemapDistance;
|
|
|
|
public bool castShadows;
|
|
|
|
public bool draw;
|
|
|
|
public float treeDistance;
|
|
|
|
public bool detailObjectDistanceUpdate;
|
|
|
|
public float detailObjectDistance;
|
|
|
|
public float detailObjectDensity;
|
|
|
|
public float treeBillboardDistance;
|
|
|
|
public float treeCrossFadeLength;
|
|
|
|
public int treeMaximumFullLODCount;
|
|
|
|
public Terrain terrain;
|
|
|
|
public TerrainDetail()
|
|
{
|
|
heightmapPixelError = 5f;
|
|
basemapDistance = 5000f;
|
|
draw = true;
|
|
treeDistance = 20000f;
|
|
detailObjectDistance = 250f;
|
|
detailObjectDensity = 1f;
|
|
treeBillboardDistance = 200f;
|
|
treeCrossFadeLength = 50f;
|
|
treeMaximumFullLODCount = 50;
|
|
}
|
|
|
|
public virtual void Start()
|
|
{
|
|
terrain = (Terrain)GetComponent(typeof(Terrain));
|
|
terrain.heightmapPixelError = heightmapPixelError;
|
|
terrain.heightmapMaximumLOD = heightmapMaximumLOD;
|
|
if (terrain.GetComponent("ReliefTerrain") == null || basemapDistanceRelief)
|
|
{
|
|
terrain.basemapDistance = basemapDistance;
|
|
}
|
|
terrain.castShadows = castShadows;
|
|
if (draw)
|
|
{
|
|
terrain.treeDistance = treeDistance;
|
|
terrain.detailObjectDistance = detailObjectDistance;
|
|
}
|
|
else
|
|
{
|
|
terrain.treeDistance = 0f;
|
|
terrain.detailObjectDistance = 0f;
|
|
}
|
|
terrain.detailObjectDensity = detailObjectDensity;
|
|
terrain.treeMaximumFullLODCount = treeMaximumFullLODCount;
|
|
terrain.treeBillboardDistance = treeBillboardDistance;
|
|
terrain.treeCrossFadeLength = treeCrossFadeLength;
|
|
terrain.treeMaximumFullLODCount = treeMaximumFullLODCount;
|
|
}
|
|
|
|
public virtual void Update()
|
|
{
|
|
if (basemapDistanceUpdate)
|
|
{
|
|
terrain.basemapDistance = basemapDistance;
|
|
}
|
|
if (detailObjectDistanceUpdate)
|
|
{
|
|
terrain.detailObjectDistance = detailObjectDistance;
|
|
}
|
|
}
|
|
|
|
public virtual void Main()
|
|
{
|
|
}
|
|
}
|