1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 00:35:52 +02:00
This commit is contained in:
syuilo
2026-04-23 11:57:53 +09:00
parent fab7667b0a
commit 4e4b56699b
6 changed files with 7 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ export const ceilingFanLight = defineObject({
]); ]);
rotor.animations = [anim]; rotor.animations = [anim];
animationObserver = scene.onAfterAnimationsObservable.add(() => { animationObserver = scene.onAfterAnimationsObservable.add(() => {
room?.sr.updateMesh([rotor, ...rotor.getChildMeshes()]); room?.sr.updateMesh([rotor, ...rotor.getChildMeshes()], false);
}); });
scene.beginAnimation(rotor, 0, 100, true); scene.beginAnimation(rotor, 0, 100, true);
}, },

View File

@@ -31,7 +31,7 @@ export const radiometer = defineObject({
]); ]);
vanes.animations = [anim]; vanes.animations = [anim];
animationObserver = scene.onAfterAnimationsObservable.add(() => { animationObserver = scene.onAfterAnimationsObservable.add(() => {
room?.sr.updateMesh([...vanes.getChildMeshes()]); room?.sr.updateMesh([...vanes.getChildMeshes()], true);
}); });
scene.beginAnimation(vanes, 0, 240, true); scene.beginAnimation(vanes, 0, 240, true);
}, },

View File

@@ -34,6 +34,7 @@ export const tabletopDigitalClock = defineObject({
}, },
placement: 'top', placement: 'top',
hasCollisions: false, hasCollisions: false,
canPreMeshesMerging: false,
createInstance: ({ root, room, options, model, scene, timer }) => { createInstance: ({ root, room, options, model, scene, timer }) => {
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0, cm(3), cm(1)), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null); const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0, cm(3), cm(1)), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
light.parent = root; light.parent = root;
@@ -106,18 +107,15 @@ export const tabletopDigitalClock = defineObject({
for (const mesh of Object.values(segmentMeshes)) { for (const mesh of Object.values(segmentMeshes)) {
const isVisible = onMeshes.includes(mesh); const isVisible = onMeshes.includes(mesh);
// 本当ならisVisibleで制御したいが、snapshot renderingではvisibilityはupdateMeshを呼んだとしても反映されないので、メッシュをめっちゃ縮めることで非表示を実現する(メッシュをめっちゃ遠くに飛ばすことも試みたけど、シーン全体の影のレンダリングがおかしくなるため断念。あとバウンディングボックスが大きくなるから不都合が出そう) mesh.isVisible = isVisible;
//mesh.isVisible = isVisible;
mesh.scaling.y = isVisible ? 1 : 0;
} }
for (const mesh of colonMeshes) { for (const mesh of colonMeshes) {
const isVisible = Date.now() % 2000 < 1000; const isVisible = Date.now() % 2000 < 1000;
// 本当ならisVisibleで制御したいが、snapshot renderingではvisibilityはupdateMeshを呼んだとしても反映されないので、メッシュをめっちゃ縮めることで非表示を実現する(メッシュをめっちゃ遠くに飛ばすことも試みたけど、シーン全体の影のレンダリングがおかしくなるため断念。あとバウンディングボックスが大きくなるから不都合が出そう) mesh.isVisible = isVisible;
//mesh.isVisible = isVisible;
mesh.scaling.y = isVisible ? 1 : 0;
} }
// なぜか反映されない。バグ? https://forum.babylonjs.com/t/visibility-of-instancedmesh-is-not-reflected-under-fast-snapshot-rendering/63251
room?.sr.updateMesh([...Object.values(segmentMeshes), ...colonMeshes]); room?.sr.updateMesh([...Object.values(segmentMeshes), ...colonMeshes]);
}, 1000); }, 1000);
}, },

View File

@@ -48,7 +48,7 @@ export const wallClock = defineObject({
const mAngle = -(minutes / 60) * Math.PI * 2; const mAngle = -(minutes / 60) * Math.PI * 2;
hourHand.rotation = new BABYLON.Vector3(0, 0, hAngle); hourHand.rotation = new BABYLON.Vector3(0, 0, hAngle);
minuteHand.rotation = new BABYLON.Vector3(0, 0, mAngle); minuteHand.rotation = new BABYLON.Vector3(0, 0, mAngle);
room?.sr.updateMesh([hourHand, minuteHand]); room?.sr.updateMesh([hourHand, minuteHand], false);
}, 1000); }, 1000);
}, },
onOptionsUpdated: ([k, v]) => { onOptionsUpdated: ([k, v]) => {