mirror of
https://github.com/IgorAherne/Spellcast3d.git
synced 2026-12-01 08:06:27 -10:00
Hiding a repaint, showing it again, its edge fade and taking one off write the one model the prop shows next instead of one for every later repaint, and the worker works the repaints out ahead on threads: about half a second for any repaint once it is ready, where the oldest of two dozen took up to 25 s. The models come out byte for byte as before. The worker is made ready as a result comes on screen and as the pointer comes to its pictures - not beside a job, nor when memory is short. A click anywhere on a picture hides it or shows it again; the edge fade is for the repaint clicked last. Settings has "Faster 3D view: no anti-aliasing", off unless chosen. The view stays on the material picked when "Render Masked" brings its model; a brush dab draws only the triangles under the stroke, the lights turn at 30 frames a second, and pictures pointed at no longer pile up on the graphics chip. xatlas 0.0.11+spellcast3d.2 and cumesh 0.0.1.post7 grow their charts faster; the atlases are unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
44 lines
1.8 KiB
JavaScript
44 lines
1.8 KiB
JavaScript
// How the browser draws the 3D view, as far as the artist chooses (static/js/shell/graphics.js): with
|
|
// anti-aliasing unless Settings' "Faster 3D view" is on. node --test code/tests/web/graphics.test.mjs
|
|
import assert from 'node:assert/strict';
|
|
import { test } from 'node:test';
|
|
|
|
const saved = new Map();
|
|
let storageWorks = true;
|
|
const storage = {
|
|
getItem: (k) => { if (!storageWorks) throw new Error('blocked'); return saved.get(k) ?? null; },
|
|
setItem: (k, v) => { if (!storageWorks) throw new Error('blocked'); saved.set(k, String(v)); },
|
|
removeItem: (k) => { if (!storageWorks) throw new Error('blocked'); saved.delete(k); },
|
|
};
|
|
Object.defineProperty(globalThis, 'localStorage', { value: storage, configurable: true });
|
|
|
|
const GRAPHICS = new URL('../../spellcast/static/js/shell/graphics.js', import.meta.url);
|
|
let loads = 0;
|
|
/** graphics.js as a page loading it afresh finds it (it reads the stored choice once). */
|
|
const freshPage = () => import(`${GRAPHICS.href}?page=${++loads}`);
|
|
|
|
test('the 3D view is anti-aliased unless the artist chose the faster one, which this browser remembers', async () => {
|
|
saved.clear();
|
|
const page = await freshPage();
|
|
assert.equal(page.plainEdges(), false);
|
|
page.setPlainEdges(true);
|
|
assert.equal(page.plainEdges(), true);
|
|
assert.equal((await freshPage()).plainEdges(), true, 'the next page load keeps it');
|
|
page.setPlainEdges(false);
|
|
assert.equal(saved.size, 0, 'anti-aliasing is the default: nothing is stored');
|
|
assert.equal((await freshPage()).plainEdges(), false);
|
|
});
|
|
|
|
test('a browser that keeps nothing still gets the choice for this page', async () => {
|
|
saved.clear();
|
|
storageWorks = false;
|
|
try {
|
|
const page = await freshPage();
|
|
assert.equal(page.plainEdges(), false);
|
|
page.setPlainEdges(true);
|
|
assert.equal(page.plainEdges(), true);
|
|
} finally {
|
|
storageWorks = true;
|
|
}
|
|
});
|