Skip to content

Single place to convert your 2D floor plans to 3d model (no LLM)

Python
5.9 KB
Raw Blame
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>3D Walkthrough</title>
<link rel="stylesheet" href="style.css?v=2">
<style>
  html, body { margin: 0; height: 100%; overflow: hidden; background: #111; touch-action: none; }
  canvas { display: block; }
  #overlay { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
             background: rgba(10, 12, 16, .7); color: #f2efe8; text-align: center; cursor: pointer; padding: 16px; }
  #overlay h1 { font-weight: 600; margin: 0 0 8px; font-size: 24px; }
  #overlay p { margin: 4px; opacity: .85; }
  kbd { background: #2b2f36; border-radius: 4px; padding: 1px 7px; font-family: inherit; }
  #room { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(0,0,0,.45);
          padding: 6px 14px; border-radius: 18px; font-size: 14px; pointer-events: none; white-space: nowrap; }
  #room:empty { display: none; }
  #old { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff;
         padding: 6px 8px 6px 14px; border-radius: 18px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
  #old[hidden] { display: none; }
  #old a { color: #ffc89e; }
  #old button { background: none; border: 0; color: #ccc; cursor: pointer; font-size: 15px; padding: 0 4px; }
  #cross { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%;
           background: rgba(255,255,255,.7); pointer-events: none; }
  #bar { position: fixed; bottom: 12px; left: 12px; right: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  #bar button { background: rgba(20,22,26,.75); color: #eee; border: 1px solid #444; border-radius: 6px; padding: 7px 11px; font-size: 13px; }
  #bar button.on { background: #e8e1d3; color: #111; }
  #bar button.live { background: #b3261e; border-color: #b3261e; color: #fff; }
  #fps { color: #bbb; font-size: 12px; margin-left: auto; background: rgba(0,0,0,.4); padding: 4px 8px; border-radius: 6px; }
  #floors { display: contents; }
  #map { position: fixed; right: 12px; bottom: 58px; width: 220px; height: 220px; border-radius: 12px; cursor: pointer;
         background: rgba(14, 16, 20, .78); border: 1px solid rgba(255, 255, 255, .18); }
  #map.big { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(88vw, 88vh, 900px); height: min(88vw, 88vh, 900px);
             background: rgba(14, 16, 20, .92); }
  .mapbig #room, .mapbig #cross { visibility: hidden; }      /* the large map shows the room itself */
  .measure canvas:not(#map) { cursor: crosshair; }
  .measure #cross { visibility: hidden; }                    /* the mouse pointer aims instead */
  #fin { position: fixed; left: 12px; bottom: 58px; width: 230px; padding: 10px 12px; border-radius: 10px; color: #eee; font-size: 13px;
         background: rgba(14, 16, 20, .85); border: 1px solid rgba(255, 255, 255, .18); }
  #fin .r { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
  #fin select, #fin button { font: inherit; }
  #fin [hidden] { display: none; }
  #fin p { margin: 0; color: #aaa; font-size: 12px; }
  #fwall { width: 40px; height: 26px; padding: 0; border: 0; background: none; }
  @media (max-width: 600px) { #map:not(.big) { width: 130px; height: 130px; bottom: 100px; } }
  @media (pointer: coarse) { .desk { display: none; } }
  @media (pointer: fine) { .touch { display: none; } }
</style>
<script type="importmap">
{ "imports": { "three": "/three/build/three.module.js", "three/addons/": "/three/examples/jsm/" } }
</script>
</head>
<body>
<canvas id="map" title="Map: click or press M to enlarge"></canvas>
<div id="overlay">
  <h1>3D walkthrough</h1>
  <p id="status">Loading…</p>
  <p class="desk"><kbd>W A S D</kbd> walk · <kbd>Mouse</kbd> look · <kbd>Shift</kbd> run · <kbd>T</kbd> top view · <kbd>Esc</kbd> pause</p>
  <p class="desk"><kbd>P</kbd> screenshot · <kbd>R</kbd> start / stop recording · <kbd>M</kbd> map · <kbd>N</kbd> measure · <kbd>F</kbd> finishes · <kbd>G</kbd> guided tour (recorded)</p>
  <p class="touch">Left thumb: move · right thumb: look</p>
</div>
<div id="room"></div>
<div id="old" hidden>Built before the latest fixes. <a id="oldlink">Rebuild it</a><button id="oldx" title="Hide" aria-label="Hide">×</button></div>
<div id="cross"></div>
<div id="bar"><button id="topbtn">Top view</button><span id="floors"></span><button id="measure" title="Measure a distance: click two points (N)">Measure</button><button id="vr" hidden title="Walk through in a VR headset: left stick walks, right stick turns">VR</button><button id="finbtn" title="Try another wall colour, or another floor in this room (F)">Finishes</button><button id="shot" title="Save a picture of this view (P)">Screenshot</button><button id="rec" title="Record a video of your walk (R)">Record</button><button id="tour" title="Walk through every room by itself and record it as a video where this browser can record (G); any key or click stops">Tour</button><button id="blend" title="Download this house as a Blender file (.zip)">Blender file</button><button id="qty" title="Floor areas, wall paint and tiles, doors, windows and furniture of this plan">Quantities</button><button id="site" title="Download this walkthrough as a website for any web host (.zip)">Website</button><a href="/" id="newplan" style="color:#ccc;font-size:13px">Home</a><span id="fps"></span></div>
<div id="fin" hidden>
  <div class="r" id="fwrow"><span>Wall colour</span><input type="color" id="fwall"></div>
  <div class="r" id="frow" hidden><span>Floor · <b id="froom"></b></span><select id="ffloor"></select></div>
  <div class="r"><button id="fsave">Save for the next build</button></div>
  <p id="fmsg">The light stays as built until the next build.</p>
</div>
<script type="module" src="view.js"></script>
</body>
</html>