示例#1
0
        public void setup(int seed, MeshBuilder.Graph graph, short[] peaks_index, Float spacing)
        {
            var g2 = new DualMesh.Graph()
            {
                numBoundaryRegions = graph.numBoundaryRegions,
                numSolidSides      = graph.numSolidSides,
                _halfedges         = graph._halfedges,
                _r_vertex          = graph._r_vertex.ToArray(),
                _triangles         = graph._triangles,
            };

            mapJobs  = new _MapJobs(g2, peaks_index, spacing);
            painting = new MapPaint(mapJobs.elevation);

            var cfg = mapJobs.config;

            cfg.seed             = seed;
            cfg.spacing          = spacing;
            cfg.island           = 0.5f;
            cfg.mountain_jagged  = 0;
            cfg.noisy_coastlines = 0.01f;
            cfg.hill_height      = 0.02f;
            cfg.ocean_depth      = 1.5f;
            cfg.wind_angle_deg   = 0;
            cfg.raininess        = 0.9f;
            cfg.rain_shadow      = 0.5f;
            cfg.evaporation      = 0.5f;
            cfg.lg_min_flow      = 2.7f;
            cfg.lg_river_width   = -2.7f;
            cfg.flow             = 0.2f;

            setConfig(cfg);
        }
示例#2
0
        public _MapJobs(DualMesh.Graph graph, short[] peaks_index, Float spacing)
        {
            mesh     = new DualMesh(graph);
            riverTex = RiverTexture.createDefault();

            peaks_t = createPeaks(peaks_index, mesh.numBoundaryRegions);

            config = new Config()
            {
                seed            = -1,
                island          = -1,
                mountain_jagged = -1,
                wind_angle_deg  = -1,
            };

            elevation = new NativeArray <Float>(CANVAS_SIZE * CANVAS_SIZE, Allocator.Persistent);
            preNoise  = new PreNoise();

            t_elevation         = new NativeArray <Float>(mesh.numTriangles, Allocator.Persistent);
            t_mountain_distance = new NativeArray <Float>(mesh.numTriangles, Allocator.Persistent);

            r_elevation = new NativeArray <Float>(mesh.numRegions, Allocator.Persistent);

            r_wind_sort  = new NativeArray <Float>(mesh.numRegions, Allocator.Persistent);
            wind_order_r = new NativeArray <int>(mesh.numRegions, Allocator.Persistent);
            r_rainfall   = new NativeArray <Float>(mesh.numRegions, Allocator.Persistent);
            r_humidity   = new NativeArray <Float>(mesh.numRegions, Allocator.Persistent);
            t_moisture   = new NativeArray <Float>(mesh.numTriangles, Allocator.Persistent);

            order_t       = new NativeArray <int>(mesh.numTriangles + 1, Allocator.Persistent);
            t_downslope_s = new NativeArray <int>(mesh.numTriangles, Allocator.Persistent);
            t_flow        = new NativeArray <Float>(mesh.numTriangles, Allocator.Persistent);
            s_flow        = new NativeArray <Float>(mesh.numSides, Allocator.Persistent);

            rivers_v3 = new NativeArray <Vector3>(mesh.numSides, Allocator.Persistent);
            rivers_uv = new NativeArray <Vector2>(mesh.numSides, Allocator.Persistent);
            land_v3   = new NativeArray <Vector3>(mesh.numRegions + mesh.numTriangles, Allocator.Persistent);
            land_uv   = new NativeArray <Vector2>(mesh.numRegions + mesh.numTriangles, Allocator.Persistent);
            land_i    = new NativeArray <int>(mesh.numSolidSides * 3, Allocator.Persistent);
        }