// Превью любого генератора без Blockbench: node tools/bbshop/preview.js [scratch] [yaw] [pitch] // Генератор пересобирает свои файлы как обычно; все его модели рисуются в ряд. const path = require('path'); const [gen, out, scratch = require('os').tmpdir(), yaw = 30, pitch = 25] = process.argv.slice(2); process.argv[2] = scratch; const { Model } = require('./lib'); const { render } = require('./render'); require(path.resolve(gen)); let x = 0; const items = []; for (const m of Model.all) { let mn = 1e9, mx = -1e9; for (const c of m.cubes) { mn = Math.min(mn, c.from[0]); mx = Math.max(mx, c.to[0]); } items.push({ model: m, offset: [x - mn, 0, 0] }); x += mx - mn + 1.5; } render(items, out, { yaw: +yaw, pitch: +pitch }); console.log('preview:', out);