Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -106,6 +106,50 @@ function buildSteps(): Step[] {
|
|||||||
return location.protocol;
|
return location.protocol;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'reparent preserva world-transform (Object3D.attach)',
|
||||||
|
run: async () => {
|
||||||
|
const scene = new THREE.Scene();
|
||||||
|
const parent = new THREE.Group();
|
||||||
|
parent.position.set(1, 2, 3);
|
||||||
|
parent.rotation.set(0, Math.PI / 4, 0);
|
||||||
|
scene.add(parent);
|
||||||
|
const child = new THREE.Group();
|
||||||
|
child.position.set(0.5, 0, 0);
|
||||||
|
parent.add(child);
|
||||||
|
scene.updateMatrixWorld(true);
|
||||||
|
const beforeWorld = child.matrixWorld.clone();
|
||||||
|
scene.attach(child);
|
||||||
|
scene.updateMatrixWorld(true);
|
||||||
|
const afterWorld = child.matrixWorld.clone();
|
||||||
|
for (let i = 0; i < 16; i++) {
|
||||||
|
if (Math.abs(beforeWorld.elements[i] - afterWorld.elements[i]) > 1e-5) {
|
||||||
|
throw new Error(`world drift no índice ${i}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// re-attach back
|
||||||
|
parent.attach(child);
|
||||||
|
scene.updateMatrixWorld(true);
|
||||||
|
const restored = child.matrixWorld.clone();
|
||||||
|
for (let i = 0; i < 16; i++) {
|
||||||
|
if (Math.abs(beforeWorld.elements[i] - restored.elements[i]) > 1e-5) {
|
||||||
|
throw new Error(`world drift restore ${i}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'world preserved';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'lock toggle persiste no store',
|
||||||
|
run: async () => {
|
||||||
|
store().setLocked(false);
|
||||||
|
if (store().isLocked) throw new Error('isLocked deveria ser false');
|
||||||
|
store().setLocked(true);
|
||||||
|
if (!store().isLocked) throw new Error('setLocked(true) falhou');
|
||||||
|
store().setLocked(false);
|
||||||
|
return 'ok';
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user