From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XEditor/SceneConfig.cs | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Client/Assets/Scripts/XEditor/SceneConfig.cs (limited to 'Client/Assets/Scripts/XEditor/SceneConfig.cs') diff --git a/Client/Assets/Scripts/XEditor/SceneConfig.cs b/Client/Assets/Scripts/XEditor/SceneConfig.cs new file mode 100644 index 00000000..aa3c2075 --- /dev/null +++ b/Client/Assets/Scripts/XEditor/SceneConfig.cs @@ -0,0 +1,62 @@ +#if UNITY_EDITOR +using UnityEngine; +using System.Collections.Generic; +using UnityEditor; +public class SceneConfig : MonoBehaviour +{ + [System.Serializable] + public class TerrainMeshInfo + { + public bool enable = true; + public int lod = 1; + public List lodArea; + public List excludeArea; + public Vector4 area; + public TerrainMeshInfo(float widthPerBlockLod0, float lengthPerBlockLod0, int index,int terrainBlock) + { + int i = index % terrainBlock; + int j = index / terrainBlock; + + float widthPerBlock = widthPerBlockLod0; + float lengthPerBlock = lengthPerBlockLod0; + int startX = i * 32; + int startZ = j * 32; + int endX = startX + 32; + int endZ = startZ + 32; + + area.x = startX * widthPerBlockLod0; + area.y = startZ * lengthPerBlockLod0; + + area.z = endX * widthPerBlockLod0; + area.w = endZ * lengthPerBlockLod0; + + } + public void AddLodArea() + { + if (lodArea == null) + lodArea = new List(); + lodArea.Add(new LodArea(area)); + } + public void RemoveLodArea(int i) + { + if (lodArea != null) + { + lodArea.RemoveAt(i); + } + } + } + [System.Serializable] + public class LodArea + { + public Vector4 area; + public int lod = 1; + public LodArea(Vector4 a) + { + area = a; + } + } + public int terrainBlock; + public TerrainMeshInfo[] terrainMeshInfo; + public Vector4 terrainLightmapScaleOffset; +} +#endif \ No newline at end of file -- cgit v1.1-26-g67d0