mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-04 17:41:23 +01:00
Merge branch 'refactor/migrate-modules' of github.com:SheepFromHeaven/Fantasy-Map-Generator into refactor/migrate-modules
This commit is contained in:
commit
8d2a8e7626
2 changed files with 3 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import Alea from "alea";
|
||||
import { range as d3Range, leastIndex, mean } from "d3";
|
||||
import { createTypedArray, byId,findGridCell,getNumberInRange,lim,minmax,P,rand } from "../utils";
|
||||
import { createTypedArray, byId, findGridCell, getNumberInRange, lim, minmax, P, rand } from "../utils";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
|
@ -546,7 +546,7 @@ class HeightmapGenerator {
|
|||
|
||||
fromPrecreated(graph: any, id: string): Promise<Uint8Array> {
|
||||
return new Promise(resolve => {
|
||||
// create canvas where 1px corresponts to a cell
|
||||
// create canvas where 1px corresponds to a cell
|
||||
const canvas = document.createElement("canvas");
|
||||
const ctx = canvas.getContext("2d") as CanvasRenderingContext2D;
|
||||
const {cellsX, cellsY} = graph;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export const calculateVoronoi = (points: Point[], boundary: Point[]): {cells: Ce
|
|||
const voronoi = new Voronoi(delaunay, allPoints, points.length);
|
||||
|
||||
const cells = voronoi.cells;
|
||||
cells.i = createTypedArray({maxValue: points.length, length: points.length}).map((_, i) => i) as Uint32Array<ArrayBufferLike>; // array of indexes
|
||||
cells.i = createTypedArray({maxValue: points.length, length: points.length}).map((_, i) => i) as Uint32Array; // array of indexes
|
||||
const vertices = voronoi.vertices;
|
||||
TIME && console.timeEnd("calculateVoronoi");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue