86 lines
2.4 KiB
HTML
86 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>WFC with Web Workers</title>
|
|
<style>
|
|
body {
|
|
font-family: sans-serif;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 20px;
|
|
}
|
|
canvas {
|
|
border: 1px solid black;
|
|
image-rendering: pixelated;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
#sourceCanvas {
|
|
border: 1px solid #ccc;
|
|
margin-top: 5px;
|
|
image-rendering: pixelated; /* Maintain pixelated look when scaled by CSS */
|
|
}
|
|
#outputCanvas {
|
|
border: 1px solid #ccc;
|
|
margin-top: 5px;
|
|
width: 512px; /* Display size - 4x the drawing width */
|
|
height: 512px; /* Display size - 4x the drawing height */
|
|
image-rendering: pixelated; /* Keeps pixels sharp when scaled */
|
|
}
|
|
#controls {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
min-width: 250px;
|
|
}
|
|
#statsContainer {
|
|
font-size: 0.9em;
|
|
white-space: pre-wrap;
|
|
background-color: #f0f0f0;
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
min-width: 300px;
|
|
max-height: 80vh;
|
|
overflow-y: auto;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="controls">
|
|
<label for="imageUrlInput">Image URL:</label>
|
|
<input
|
|
type="text"
|
|
id="imageUrlInput"
|
|
value="https://raw.githubusercontent.com/mxgmn/WaveFunctionCollapse/master/samples/Flowers.png"
|
|
style="width: 100%"
|
|
/>
|
|
<label for="patternSizeSelect">Pattern Size (N):</label>
|
|
<select id="patternSizeSelect">
|
|
<option value="2">2</option>
|
|
<option value="3" selected>3</option>
|
|
<option value="4">4</option>
|
|
</select>
|
|
<label
|
|
><input type="checkbox" id="randomSelectionCheckbox" checked="true" />
|
|
Random Selection for Collapse</label
|
|
>
|
|
<label
|
|
><input type="checkbox" id="enableRotationsCheckbox" /> Enable
|
|
Rotations</label
|
|
>
|
|
<button id="restartButton">Load Image & Run WFC</button>
|
|
<p id="status">Loading...</p>
|
|
</div>
|
|
<div>
|
|
<h3>Source Image (scaled)</h3>
|
|
<canvas id="sourceCanvas"></canvas>
|
|
</div>
|
|
<div>
|
|
<h3>Output</h3>
|
|
<canvas id="outputCanvas"></canvas>
|
|
</div>
|
|
<div id="statsContainer">WFC Statistics will appear here.</div>
|
|
<script src="script.js"></script>
|
|
</body>
|
|
</html>
|