MCPcopy Create free account

hub / github.com/Fennec-hub/three-wfc / functions

Functions99 in github.com/Fennec-hub/three-wfc

↓ 26 callersFunctionsetStatus
Sets the status message in the control panel
live/src/main.ts:208
↓ 13 callersMethodpush
* Adds a key with a given entropy to the heap or updates it if it exists. * Throws an error if the heap is full and the key is new. * * @para
lib/WFCMinHeap.ts:54
↓ 12 callersFunctioncopyReverse
(array: T[])
lib/utils/copyReverse.ts:1
↓ 9 callersFunctionsetControlsDisabled
Toggles the disabled state of control buttons
live/src/main.ts:264
↓ 7 callersFunctionimgLoaderBatch
(srcs: string[])
lib/utils/imgLoader.ts:9
↓ 6 callersMethoddraw
* Draws the current state of the WFC grid onto the canvas. * Applies transformations (rotation, reflection) dynamically for debugging.
lib/WFC2D.ts:100
↓ 5 callersFunctionannotateTiles2DEdges
( tiles: WFCTile2D[], tolerance: number = 0.05, sobelThreshold: number = 30 )
lib/utils/annotateTiles2DEdges.ts:14
↓ 5 callersFunctiondrawOverlayMessage
Draws a message overlay on the canvas
live/src/main.ts:249
↓ 4 callersFunctionextractEdgeLine
(direction: "top" | "bottom" | "left" | "right")
lib/utils/annotateTiles2DEdges.ts:167
↓ 4 callersFunctionquantizeChannel
(value: number, tolerance: number)
lib/utils/annotateTiles2DEdges.ts:89
↓ 4 callersFunctionupdateCellsCount
()
live/src/main.ts:226
↓ 3 callersMethodbubbleDown
Bubble an item down until its heap property is satisfied.
lib/WFCMinHeap.ts:231
↓ 3 callersMethodbubbleUp
Bubble an item up until its heap property is satisfied.
lib/WFCMinHeap.ts:214
↓ 3 callersMethodcollapse
* * @returns
lib/WFC2DBuffer.ts:73
↓ 3 callersFunctioncountSetBits
(bitmask: number)
lib/utils/countSetBits.ts:4
↓ 3 callersFunctiongenerateTimeSeed
()
lib/utils/prngSeedGenerators.ts:30
↓ 3 callersMethodgetWeight
(index: number)
lib/WFCTileBuffer.ts:70
↓ 3 callersMethodindices
* Gets the indices of all set bits in the given mask. * @param index The index of the mask to check * @returns Array of indices of set bits, or
lib/WFCOptionsBuffer.ts:274
↓ 3 callersMethodisEmpty
Is the heap empty?
lib/WFCMinHeap.ts:31
↓ 3 callersMethodupdate
* Explicitly updates the entropy of an existing key. Does nothing if the key isn't present. * * @param key The key whose entropy to update. *
lib/WFCMinHeap.ts:81
↓ 2 callersMethod_collapseCell
* Internal helper to perform the collapse logic for a specific cell index. * * @param index The index of the cell to collapse. * @returns `tr
lib/WFC2DBuffer.ts:136
↓ 2 callersMethod_extractSetBits
* Helper method to extract set bit indices from a single chunk. * Uses bitwise operations for reliability and performance. * * @param chunk T
lib/WFCOptionsBuffer.ts:327
↓ 2 callersMethod_reflect
* Creates a new WFCTile instance reflected across the specified axis. * Updates the edge tags accordingly. * @param axis - The axis of reflectio
lib/WFCTile2D.ts:195
↓ 2 callersFunctionclearPerfLog
Clears the performance log display
live/src/main.ts:213
↓ 2 callersMethodclone
* Creates a new WFCTile instance that is a deep copy of this one. * @returns A new WFCTile instance.
lib/WFCTile2D.ts:144
↓ 2 callersMethodcollapse
()
lib/WFC2D.ts:80
↓ 2 callersMethodcollapseAll
* Repeatedly calls `collapse()` until all cells are collapsed or a contradiction occurs. * @returns `true` if the entire grid was successfully coll
lib/WFC2DBuffer.ts:82
↓ 2 callersMethodcollapsedTile
* Returns the collapsed cell tile's index, or `-1` if un-collapsed * * @param index * @returns The collapsed cell tile's index, `-1` if un-co
lib/WFC2DBuffer.ts:125
↓ 2 callersFunctiongetAverageColor
(data: Uint8ClampedArray, tolerance = 0)
lib/utils/annotateTiles2DEdges.ts:99
↓ 2 callersMethodmask
Returns a view (subarray) of the mask.
lib/WFCOptionsBuffer.ts:223
↓ 2 callersMethodpop
* Removes and returns the key with the minimum entropy. * Returns undefined if the heap is empty. * * @returns The key with the minimum entro
lib/WFCMinHeap.ts:103
↓ 2 callersMethodremove
* Removes an element associated with a specific key from the heap. * Returns true if the key was found and removed, false otherwise. * * @par
lib/WFCMinHeap.ts:153
↓ 2 callersMethodsize
Number of elements currently in the heap.
lib/WFCMinHeap.ts:26
↓ 2 callersMethodswap
Swaps two elements in the heap arrays and updates the map
lib/WFCMinHeap.ts:194
↓ 2 callersFunctionupdateStepLog
Updates the performance log for a single step
live/src/main.ts:233
↓ 1 callersMethod_computeEntropy
Recomputes the Shannon entropy for a given cell
lib/WFC2DBuffer.ts:248
↓ 1 callersMethod_initialize
()
lib/WFCTileBuffer.ts:30
↓ 1 callersMethod_propagate
* Propagates constraints starting from a cell whose options have been reduced. * Uses an iterative approach with a stack and a Set to track items c
lib/WFC2DBuffer.ts:180
↓ 1 callersMethod_rotate
* Creates a new WFCTile instance rotated clockwise by the specified amount. * Updates the edge tags accordingly. * @param rotation - The rotatio
lib/WFCTile2D.ts:155
↓ 1 callersMethodaddTile
(...tiles: WFCTile2D[])
lib/WFC2D.ts:45
↓ 1 callersMethodclear
()
lib/WFC2D.ts:57
↓ 1 callersMethodcollapseCell
(index: number)
lib/WFC2D.ts:88
↓ 1 callersFunctioncomputeSobelMagnitude
( ctx: CanvasRenderingContext2D, w: number, h: number )
lib/utils/annotateTiles2DEdges.ts:124
↓ 1 callersMethodcopy
* Performs a deep copy of properties from a source tile into this tile. * Ensures arrays and Color objects are cloned, not just referenced. * @p
lib/WFCTile2D.ts:127
↓ 1 callersFunctiondefineTiles
()
live/src/main.ts:132
↓ 1 callersFunctiondisplayPerformanceResults
(summary: PerformanceSummary)
live/src/performance.ts:313
↓ 1 callersMethodenableAll
Enables all possible states (bits) for an item.
lib/WFCOptionsBuffer.ts:60
↓ 1 callersFunctiongenerateSeed
(input: string)
lib/utils/prngSeedGenerators.ts:8
↓ 1 callersMethodgetEdgeMask
(edge: number, index: number)
lib/WFCTileBuffer.ts:74
↓ 1 callersFunctionhashArray
(array: (string | number)[])
lib/utils/hashArray.ts:7
↓ 1 callersFunctionimgLoader
(src: string)
lib/utils/imgLoader.ts:1
↓ 1 callersFunctionindexedPrng
(seed: number)
lib/utils/prng.ts:26
↓ 1 callersMethodinit
()
lib/WFC2D.ts:61
↓ 1 callersFunctioninitializeWFC
Initializes or re-initializes the WFC grid based on UI settings
live/src/main.ts:280
↓ 1 callersMethodintersect
* Performs bitwise AND intersection between the mask at the given index * and the provided mask. Modifies the internal mask in place. * * @pa
lib/WFCOptionsBuffer.ts:157
↓ 1 callersFunctionloadTiles
( tileSet: "circuit" | "rail" | "road" )
live/src/performance.ts:32
↓ 1 callersMethodpeek
* Returns the minimum entropy without removing the element. * Returns undefined if the heap is empty.
lib/WFCMinHeap.ts:134
↓ 1 callersMethodpropagate
* Sets up a cell's neighboring constraints based on the current state of another cell. * * @param cellIdx The index of the reference cell * @
lib/WFCOptionsBuffer.ts:109
↓ 1 callersMethodread
* Reads the current entropy associated with a given key. * Returns Positive Infinity if the key is not in the heap or out of range. * * @para
lib/WFCMinHeap.ts:42
↓ 1 callersMethodreset
()
lib/WFCStackBuffer.ts:33
↓ 1 callersFunctionrgbaToHex
(r: number, g: number, b: number, a: number)
lib/utils/annotateTiles2DEdges.ts:93
↓ 1 callersFunctionrunPerformanceTest
( tiles: WFCTile2D[], gridSize: number, numRuns: number, tileSetName: string )
live/src/performance.ts:139
↓ 1 callersFunctionsegmentFromGradient
( line: Float32Array, threshold: number )
lib/utils/annotateTiles2DEdges.ts:61
↓ 1 callersMethodsetBit
* Sets a specific bit. * @param index The index of the cell * @param position The position of the bit to set/clear
lib/WFCOptionsBuffer.ts:46
↓ 1 callersMethodsize
Counts the number of enabled states (set bits).
lib/WFCOptionsBuffer.ts:203
↓ 1 callersMethodtransformClones
* Generates all unique transformed versions (clones) of this tile * based on the allowed rotations and reflections defined in its properties. *
lib/WFCTile2D.ts:108
↓ 1 callersFunctionupdateCollapseAllLog
Updates the performance log after collapseAll
live/src/main.ts:238
↓ 1 callersFunctionupdateTilesCount
(count: number)
live/src/main.ts:222
Methodclear
()
lib/WFCMinHeap.ts:188
Methodcollapse
* Collapse the cell's option to a single * * @param index * @param position
lib/WFCOptionsBuffer.ts:77
FunctioncollapseAll
()
live/src/main.ts:416
MethodcollapseAll
()
lib/WFC2D.ts:71
MethodcollapseCell
* Collapses a specific cell to a randomly chosen valid tile based on current options * and propagates the constraints. * * @param index - The
lib/WFC2DBuffer.ts:100
FunctioncollapseStep
()
live/src/main.ts:376
FunctioncombineSeedValues
(values: (number | string)[])
lib/utils/prngSeedGenerators.ts:41
Methodconstructor
( tiles: WFCTile2D[], cols: number, rows: number, seed?: number, noise: number = 0.00001
lib/WFC2DBuffer.ts:30
Methodconstructor
(count: number)
lib/WFCStackBuffer.ts:7
Methodconstructor
* Creates a new optimized Min Heap with a key-to-position map. * Assumes keys will be integers in the range [0, maxElements - 1]. * @param count
lib/WFCMinHeap.ts:16
Methodconstructor
* Creates a new WFCTile instance. * @param config - Configuration object for the tile.
lib/WFCTile2D.ts:51
Methodconstructor
(count: number, tiles: WFCTileBuffer)
lib/WFCOptionsBuffer.ts:22
Methodconstructor
(tiles: WFCTile2D[], is2D: boolean = true)
lib/WFCTileBuffer.ts:12
Methodconstructor
({ canvas, width, height, cellSize, seed, drawGrid, }: { canvas: HTMLCanvasEleme
lib/WFC2D.ts:17
FunctiondrawImage
( ctx: CanvasRenderingContext2D, img: HTMLImageElement, x: number, y: number, size: number, scale:
lib/utils/drawImage.ts:1
FunctiondrawRect
( ctx: CanvasRenderingContext2D, x: number, y: number, size: number, scale: number )
lib/utils/drawImage.ts:12
MethodedgeKey
(tile: number, edge: number)
lib/WFCTileBuffer.ts:36
FunctionhandleCanvasClick
(event: MouseEvent)
live/src/main.ts:497
MethodisCompleted
()
lib/WFC2DBuffer.ts:61
Functionmain
()
live/src/performance.ts:357
MethodpeekKey
* Returns the key with the minimum entropy without removing it. * Returns undefined if the heap is empty.
lib/WFCMinHeap.ts:142
Methodpop
()
lib/WFCStackBuffer.ts:24
Functionprng
(seed: number)
lib/utils/prng.ts:9
Functionprng2D
( seed: number, cols: number, origin: { x: number; y: number } )
lib/utils/prng2D.ts:10
Functionprng3D
( seed: number, width: number, height: number, origin: { x: number; y: number; z: number } )
lib/utils/prng3D.ts:11
Methodpush
(value: number)
lib/WFCStackBuffer.ts:15
Methodput
* Adds a key with a given entropy to the heap or updates it if it exists. * Throws an error if the heap is full and the key is new. * * @para
lib/WFCMinHeap.ts:71
MethodremainingCells
()
lib/WFC2DBuffer.ts:65
MethodremoveTile
(...tiles: WFCTile2D[])
lib/WFC2D.ts:49
Methodtile
* Gets the index of the single set bit, assuming the mask at 'index' * represents a collapsed state with exactly one option enabled. * Uses a fa
lib/WFCOptionsBuffer.ts:239
Methodweight
()
lib/WFCTile2D.ts:94