コード例 #1
0
    private void OnTerrainsGUI()
    {
        EditorGUILayout.BeginVertical(GUI.skin.box);
        showTerrains = Foldout(showTerrains, "Terrains: ");
        if (showTerrains)
        {
            terrainType = (MeshToTerrainSelectTerrainType)EditorGUILayout.EnumPopup("Type", terrainType);
            if (terrainType == MeshToTerrainSelectTerrainType.existTerrains)
            {
                OnTerrainsGUIExists();
            }
            else
            {
                OnTerrainsGUINew();
            }
            useHeightmapSmoothing = GUILayout.Toggle(useHeightmapSmoothing, "Use smoothing of height maps.");

            if (useHeightmapSmoothing)
            {
                smoothingFactor = EditorGUILayout.IntField("Smoothing factor", smoothingFactor);
                if (smoothingFactor < 1)
                {
                    smoothingFactor = 1;
                }
                else if (smoothingFactor > 128)
                {
                    smoothingFactor = 128;
                }
            }

            holes = (MeshToTerrainHoles)EditorGUILayout.EnumPopup("Holes", holes);
        }
        EditorGUILayout.EndVertical();
    }
コード例 #2
0
 private void Load()
 {
     baseMapResolution = LoadPref("BaseMapRes", 1024);
     boundsGameObject  = LoadPrefGameObject("BoundsGameObject", null);
     boundsType        = (MeshToTerrainBounds)LoadPref("BoundsType", (int)MeshToTerrainBounds.autoDetect);
     if (boundsType == MeshToTerrainBounds.selectBounds)
     {
         bounds = LoadPref("Bounds", new Bounds(Vector3.zero, Vector3.one));
     }
     detailResolution    = LoadPref("DetailMapRes", 1024);
     direction           = (MeshToTerrainDirection)LoadPref("Direction", (int)MeshToTerrainDirection.normal);
     generateTextures    = LoadPref("GenerateTextures", false);
     heightmapResolution = LoadPref("HeightMapRes", 129);
     meshes                = LoadPref("Meshes", new List <GameObject>());
     holes                 = (MeshToTerrainHoles)LoadPref("Holes", (int)MeshToTerrainHoles.minimumValue);
     meshFindType          = (MeshToTerrainFindType)LoadPref("MeshFindType", (int)MeshToTerrainFindType.gameObjects);
     meshLayer             = LoadPref("MeshLayer", 31);
     newTerrainCountX      = LoadPref("CountX", 1);
     newTerrainCountY      = LoadPref("CountY", 1);
     resolutionPerPatch    = LoadPref("ResPerPath", 16);
     showMeshes            = LoadPref("ShowMeshes", true);
     showTerrains          = LoadPref("ShowTerrains", true);
     showTextures          = LoadPref("ShowTextures", true);
     smoothingFactor       = LoadPref("SmoothingFactor", 1);
     terrains              = LoadPref("Terrains", new List <Terrain>());
     terrainType           = (MeshToTerrainSelectTerrainType)LoadPref("TerrainType", (int)MeshToTerrainSelectTerrainType.newTerrains);
     textureEmptyColor     = LoadPref("TextureEmptyColor", Color.white);
     textureHeight         = LoadPref("TextureHeight", 1024);
     textureResolution     = LoadPref("TextureResolution", 1024);
     textureWidth          = LoadPref("TextureWidth", 1024);
     useHeightmapSmoothing = LoadPref("UseHeightmapSmoothing", true);
     yRange                = (MeshToTerrainYRange)LoadPref("YRange", 0);
     yRangeValue           = LoadPref("YRangeValue", yRangeValue);
     adjustMeshSize        = LoadPref("AdjustMeshSize", true);
     textureCaptureMode    = (MeshToTerrainTextureCaptureMode)LoadPref("TextureCaptureMode", (int)MeshToTerrainTextureCaptureMode.camera);
 }