Entourage parts into the model
64-bitConverts each part's triangles from millimeters to meters.
p (m) = p (mm) ÷ 1000
Each coordinate is divided by 1000, which is correctly rounded. A scale, when given, is placed in the part's placement matrix and not multiplied into the points.
/** One entourage item's parts into component c; `recolor` {part name: '#rrggbb'} and `omit` [part names] are how a scene changes the season (0.8 EG.61). */
function entourageParts(m, c, e, recolor = {}, omit = [], scale = null) {
for (const p of e.parts) {
if (omit.includes(p.name)) continue;
const polys = [], color = p.alpha < 1 ? 'mat:glass-tinted' : (recolor[p.name] || p.color);
for (let i = 0; i < p.I.length; i += 3) {
const v = (k) => [p.P[p.I[i + k] * 3] / 1000, p.P[p.I[i + k] * 3 + 1] / 1000, p.P[p.I[i + k] * 3 + 2] / 1000];
polys.push({ loops: [[v(0), v(1), v(2)]], color });
}
const d = meshDef(m, polys, part(p.name), 'group');
softenEdges(d, [...d.edges.keys()], e.cat === 'site/vehicles' ? 25 : 75);
m.place(c, d.id, scale ? [scale[0], 0, 0, 0, 0, scale[1], 0, 0, 0, 0, scale[2], 0, 0, 0, 0, 1] : ident());
}
}