feat: integrate the cinematic nightdrive scene
This commit is contained in:
@@ -15,6 +15,7 @@ import { createAtmosphere } from '@/scene/world/atmosphere';
|
||||
import { createPostProcessor } from '@/scene/post-processing';
|
||||
import { createCar } from '@/scene/world/car';
|
||||
import { createChaseCamera } from '@/scene/world/environment';
|
||||
import { createSign, routeLabelFor } from '@/scene/world/sign';
|
||||
|
||||
describe('procedural world models', () => {
|
||||
it('scales geometry and atmosphere work monotonically by live quality tier', () => {
|
||||
@@ -299,6 +300,61 @@ describe('procedural world models', () => {
|
||||
expect(resources.snapshot()).toEqual(allocation);
|
||||
resources.dispose();
|
||||
});
|
||||
|
||||
it('renders one physical roadside sign and updates its plain label once per target', () => {
|
||||
const resources = new SceneResourceBag();
|
||||
const sign = createSign(resources);
|
||||
for (const name of [
|
||||
'sign-backplate',
|
||||
'sign-face',
|
||||
'sign-frame',
|
||||
'sign-post-left',
|
||||
'sign-post-right',
|
||||
]) {
|
||||
expect(sign.group.getObjectByName(name), name).toBeDefined();
|
||||
}
|
||||
const face = sign.group.getObjectByName('sign-face') as {
|
||||
userData: { textureUpdateCount: number };
|
||||
material: { opacity: number };
|
||||
};
|
||||
const allocation = resources.snapshot();
|
||||
|
||||
sign.update(null);
|
||||
expect((sign.group as { visible: boolean }).visible).toBe(false);
|
||||
sign.update({
|
||||
targetId: 'infrastructure',
|
||||
phase: 'anticipate',
|
||||
progress: 0,
|
||||
opacity: 0,
|
||||
});
|
||||
expect((sign.group as { visible: boolean }).visible).toBe(false);
|
||||
expect(face.userData.textureUpdateCount).toBe(1);
|
||||
expect(routeLabelFor('infrastructure')).toBe('Infrastructure');
|
||||
|
||||
sign.update({
|
||||
targetId: 'infrastructure',
|
||||
phase: 'approach',
|
||||
progress: 0.5,
|
||||
opacity: 0.7,
|
||||
});
|
||||
expect((sign.group as { visible: boolean }).visible).toBe(true);
|
||||
expect(face.userData.textureUpdateCount).toBe(1);
|
||||
expect(face.material.opacity).toBeCloseTo(0.7, 6);
|
||||
|
||||
const desktopX = (sign.group as { position: { x: number } }).position.x;
|
||||
sign.setViewportAspect(0.6);
|
||||
sign.update({
|
||||
targetId: 'selected-builds',
|
||||
phase: 'dwell',
|
||||
progress: 1,
|
||||
opacity: 1,
|
||||
});
|
||||
expect(face.userData.textureUpdateCount).toBe(2);
|
||||
expect(routeLabelFor('selected-builds')).toBe('Selected builds');
|
||||
expect((sign.group as { position: { x: number } }).position.x).toBeLessThan(desktopX);
|
||||
expect(resources.snapshot()).toEqual(allocation);
|
||||
resources.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
function paletteSnapshot(palette: ReturnType<typeof createMutableChapterPalette>) {
|
||||
|
||||
Reference in New Issue
Block a user