Files
wireless-docs/index.html
2026-07-04 18:07:55 -04:00

204 lines
6.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pipeline Test</title>
<style>
body {
background: #222;
color: #eee;
font-family: sans-serif;
}
main {
width: 80ch;
margin-inline: auto;
}
.figure {
width: 100%;
height: 20em;
}
</style>
</head>
<body>
<main>
<h1>Visualizer</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper ut mauris sed
tempor. Nunc
vehicula tempor purus, non vestibulum libero ornare non. Morbi fringilla sapien diam, sed
rhoncus lacus egestas
vel.
</p>
<div class="figure" id="demo-1"></div>
<p>
Curabitur vestibulum vitae orci ac laoreet. Donec vel imperdiet tortor. Vestibulum lobortis
aliquam tellus,
vitae viverra nisi porttitor quis. Pellentesque id efficitur arcu. Nunc laoreet pulvinar
ligula eu maximus.
Mauris ullamcorper accumsan dui vel pulvinar.
</p>
<div style="display: grid; grid-template-columns: 1fr 1fr;">
<div class="figure" id="demo-2"></div>
<div class="figure" id="demo-3"></div>
</div>
<p>
Curabitur tincidunt sapien et diam fringilla, eu accumsan odio faucibus. Orci varius natoque
penatibus et magnis
dis parturient montes, nascetur ridiculus mus.
</p>
<div id="atlas-container"
style="position: fixed; left: 0; top: 0; border: 1px solid white;"></div>
</main>
<script type="module">
import {Engine} from './engine.js';
import {Diorama} from './diorama.js';
import {World} from './world.js';
async function initDocument() {
try {
const engine = new Engine();
document.getElementById('atlas-container')?.appendChild(engine.atlas.canvas);
const world1 = new World();
world1.set('minecraft:redstone_wire', -1, 0, 0, {
east: 'side',
west: 'none',
north: 'none',
south: 'none',
power: '15'
});
world1.set('minecraft:repeater', 0, 0, 0, {
facing: 'east',
delay: '1',
locked: 'false',
powered: 'true'
});
world1.set('minecraft:oak_trapdoor', 2, 0, 0, {
facing: 'east',
half: 'bottom',
open: 'true'
});
world1.set('lodestone', 0, -1, 0);
world1.set('piston', 0, -2, 0, {facing: 'north', extended: 'false'});
const world2 = new World();
world2.set('minecraft:redstone_wire', 0, 0, 0, {
east: 'side',
west: 'none',
north: 'none',
south: 'none',
power: '0'
});
world2.set('minecraft:repeater', 1, 0, 0, {
facing: 'east',
delay: '4',
locked: 'false',
powered: 'false'
});
world2.set('minecraft:sticky_piston', 2, 0, 0, {facing: 'east', extended: 'false'});
world2.set('minecraft:sticky_piston', 2, 0, 1, {facing: 'east', extended: 'true'});
world2.set('minecraft:sticky_piston', 2, 0, 2, {facing: 'east', extended: 'true'});
world2.set('minecraft:piston_head', 2.5, 0, 1, {
facing: 'east',
short: 'true',
type: 'sticky'
});
world2.set('minecraft:piston_head', 3, 0, 2, {
facing: 'east',
short: 'false',
type: 'sticky'
});
world2.set('minecraft:glass', 3, 0, 0);
world2.set('minecraft:observer', 3.5, 0, 1, {facing: 'up', powered: 'true'});
world2.set('minecraft:redstone_block', 4, 0, 2);
const demo1 = new Diorama('demo-1', world1, () => engine.requestRender())
demo1.radius = 2;
demo1.phi = 10;
demo1.theta = -5;
demo1.target = [0.5, 0, 0.5]
demo1.saveState()
engine.addDiorama(demo1);
const demo2 = new Diorama('demo-2', world2, () => engine.requestRender())
demo2.radius = 4;
demo2.theta = 180;
demo2.phi = 90;
demo2.centerView()
demo2.saveState()
engine.addDiorama(demo2);
const demo3 = new Diorama('demo-3', world2, () => engine.requestRender())
demo3.radius = 4;
demo3.theta = 0;
demo3.phi = 0;
demo3.centerView()
demo3.saveState()
engine.addDiorama(demo3);
// Fetch and build everything concurrently!
await engine.updateAll();
function set0() {
world2.set('minecraft:sticky_piston', 2, 0, 2, {facing: 'east', extended: 'false'});
world2.set('minecraft:redstone_block', 3, 0, 2);
world2.del(2.5, 0, 2);
world2.del(3.5, 0, 2);
setTimeout(set1, 250)
}
function set1() {
world2.set('minecraft:sticky_piston', 2, 0, 2, {facing: 'east', extended: 'true'});
world2.del(3, 0, 2)
world2.set('minecraft:piston_head', 2.5, 0, 2, {
facing: 'east',
short: 'true',
type: 'sticky'
});
world2.set('minecraft:redstone_block', 3.5, 0, 2);
setTimeout(set2, 250)
}
function set2() {
world2.set('minecraft:piston_head', 3, 0, 2, {
facing: 'east',
short: 'false',
type: 'sticky'
});
world2.del(2.5, 0, 2);
world2.del(3.5, 0, 2);
world2.set('minecraft:redstone_block', 4, 0, 2);
setTimeout(set3, 250)
}
function set3() {
world2.del(4, 0, 2)
world2.del(3, 0, 2)
world2.set('minecraft:piston_head', 2.5, 0, 2, {
facing: 'east',
short: 'true',
type: 'sticky'
});
world2.set('minecraft:redstone_block', 3.5, 0, 2);
setTimeout(set0, 250)
}
setTimeout(set3, 1000)
} catch (err) {
console.error("Renderer Initialization Failed:", err);
}
}
initDocument();
</script>
</body>
</html>