Something went wrong. Try again.
data endpoint for entity 90008 (aka. a website)
Something went wrong. Try again.
1234567891011121314151617// kit: static pieces merged per material so furniture costs a few draw calls. owner: cookimport * as THREE from 'three';import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';const M = new THREE.Matrix4(), Q = new THREE.Quaternion(), E = new THREE.Euler(), S = new THREE.Vector3(1, 1, 1), P = new THREE.Vector3();export function bag() { const by = {}; const api = { add(key, geo, x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0) { if (geo.index) geo = geo.toNonIndexed(); E.set(rx, ry, rz); Q.setFromEuler(E); M.compose(P.set(x, y, z), Q, S); (by[key] ||= []).push(geo.applyMatrix4(M)); return api; }, box(key, w, h, d, x, y, z, rx, ry, rz) { return api.add(key, new THREE.BoxGeometry(w, h, d), x, y, z, rx, ry, rz); }, build(parent, mats) { for (const k in by) { const m = new THREE.Mesh(mergeGeometries(by[k]), mats[k]); m.frustumCulled = false; parent.add(m); } } }; return api; }export const ctex = (c) => { const t = new THREE.CanvasTexture(c); t.magFilter = t.minFilter = THREE.NearestFilter; t.generateMipmaps = false; return t; };export const JP = '"Hiragino Mincho ProN","Yu Mincho","Noto Serif JP",serif';
// a thing on a leash can be swung and yanked but never lost: if its tie is torn, or it is left far behind its hook, it is tied back under it.// body.home is the hook it belongs to right now (set it when you move the thing to another hook).import { link } from './phys.js';export function leash(body, onFrame) { body.home = body.tie.a; body.tie.tear = 0; onFrame(() => { const p = body.point, h = body.home, l = body.tie.rest; if (p.held || !body.hang) return; if (body.tie.dead || p.p.distanceTo(h.p) > l * 1.7 + .6) { if (body.tie.dead) { body.tie = link(h, p, l, 1); body.hang = h; if (body.string) body.string.visible = true; } p.p.copy(h.p); p.p.y -= l; p.prev.copy(p.p); } }); return body; }