mirror of
https://github.com/IgorAherne/Spellcast3d.git
synced 2026-12-01 08:06:27 -10:00
- Move / Rotate handles on Retopo and Export: where the prop stands in its saved files (GLB, FBX and OBJ hold it in their vertices), with "stand it on the floor" - the retopology method picked last is the default for new props, in every project - the release zip holds one folder, spellcast3d - the hub frees the graphics card of its own tools before the calibration measures it - install lines show a step's clock; a finished download no longer shows its size - Projection shows the clean mesh's vertex count, and the files' beside it - update.bat no longer prints "Skipping submodule 'code/triflow'" - wording: Import folder, Hi3D's download, the sizes in models/README.txt Co-Authored-By: Claude Fable 5.2 <[email protected]>
30 lines
2.1 KiB
JavaScript
30 lines
2.1 KiB
JavaScript
// The Projection panel's numbers (no browser): the model the bake made first, then how the projection went.
|
||
// node --test code/tests/web/projection.test.mjs
|
||
import assert from 'node:assert/strict';
|
||
import { test } from 'node:test';
|
||
|
||
globalThis.addEventListener ??= () => {};
|
||
globalThis.document ??= { addEventListener() {}, removeEventListener() {}, createElement: () => ({}) };
|
||
const { bakeFacts } = await import(new URL('../../spellcast/static/js/stages/projection.js', import.meta.url));
|
||
|
||
test('a bake\'s numbers: the model\'s vertices and texture, then the projection\'s own', () => {
|
||
const stats = {
|
||
render_vertices: 10511, triangles: 9064, resolution: 2048, coverage: 0.4579, miss_fraction: 0.0000537,
|
||
ray_distance_percent: 1.1394, seconds: 15.36, warnings: ['A chart is small'],
|
||
};
|
||
const facts = bakeFacts({ projection: { glb: 'projection/bake_001/projection.glb', stats, settings: { ray_distance: null } } });
|
||
// A bake made before the clean mesh's own count was kept: the files' vertices alone.
|
||
assert.deepEqual(facts.model, [['Vertices', '10,511'], ['Split at UV seams', null], ['Texture', '2048 × 2048 px']]);
|
||
// The count Retopo shows first, then what the files hold of it (a seam's points are a vertex per side).
|
||
const counted = bakeFacts({ projection: { glb: 'p.glb', stats: { ...stats, vertices: 2160, render_vertices: 3079 } } });
|
||
assert.deepEqual(counted.model.slice(0, 2), [['Vertices', '2,160'], ['Split at UV seams', '3,079 in the saved files']]);
|
||
const whole = bakeFacts({ projection: { glb: 'p.glb', stats: { ...stats, vertices: 500, render_vertices: 500 } } });
|
||
assert.deepEqual(whole.model.slice(0, 2), [['Vertices', '500'], ['Split at UV seams', null]]);
|
||
assert.deepEqual(facts.projection, [['Covered', '46 %'], ['Missed', '0.01 %'],
|
||
['Ray distance', '1.14 % of the size (automatic)'], ['Time', '15.4 s']]);
|
||
assert.deepEqual(facts.warnings, ['A chart is small']);
|
||
// No bake yet: nothing to say.
|
||
const none = bakeFacts({ projection: { glb: null, stats } });
|
||
assert.ok([...none.model, ...none.projection].every(([, v]) => v == null) && none.warnings.length === 0);
|
||
});
|