예제 #1
0
    public Mesh CreateTerrain(Vector3 origin)
    {
        Mesh mesh = new Mesh();

        mesh.Clear();

        if (meshType == SphereMeshType.Icosphere)
        {
            mesh = IcoSphere.GetIcosphereMesh(resolution);
        }
        else
        {
            mesh = CubicSphere.GetSphereMesh(resolution);
        }

        if (hasCraters)
        {
            GenerateCraters(mesh, nrOfCraters);
        }

        AddMeshDetail(mesh, origin, terrainRadius, true);
        UpdateTerrainMinMax(mesh);

        mesh.RecalculateNormals();
        mesh.colors = GetColors(mesh.vertices, mesh.normals);
        mesh.bounds = new Bounds(origin, new Vector3(float.MaxValue, float.MaxValue, float.MaxValue));

        return(mesh);
    }
예제 #2
0
    public Mesh CreateAtmosphere(Vector3 origin)
    {
        Mesh mesh = new Mesh();

        mesh.Clear();

        mesh = CubicSphere.GetSphereMesh(resolution);
        //AddMeshDetail(mesh, origin, terrainRadius * 1.15F, false);
        AddMeshDetail(mesh, origin, maxTerrainValue * 1.01F, false);

        mesh.RecalculateNormals();
        mesh.bounds = new Bounds(origin, new Vector3(float.MaxValue, float.MaxValue, float.MaxValue));

        return(mesh);
    }