summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XEditor/SceneConfig.cs
blob: aa3c2075af92959527f01e5ad39c1428533c7601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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> lodArea;
        public List<Vector4> 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>();
            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