This commit is contained in:
syuilo
2026-03-02 19:05:35 +09:00
parent 5175a1e193
commit 78bfcd71af
3 changed files with 9 additions and 1 deletions

View File

@@ -27,10 +27,11 @@ export const pictureFrame = defineObject({
}, },
}, },
placement: 'side', placement: 'side',
mergeMeshes: ['__X_FRAME__'],
createInstance: ({ room, root, options, findMaterial, findMesh }) => { createInstance: ({ room, root, options, findMaterial, findMesh }) => {
const frameMesh = findMesh('__X_FRAME__'); const frameMesh = findMesh('__X_FRAME__');
frameMesh.rotationQuaternion = null; frameMesh.rotationQuaternion = null;
const matMesh = findMesh('__X_MAT__');
matMesh.rotationQuaternion = null;
const coverMesh = findMesh('__X_COVER__'); const coverMesh = findMesh('__X_COVER__');
coverMesh.rotationQuaternion = null; coverMesh.rotationQuaternion = null;
const pictureMesh = findMesh('__X_PICTURE__'); const pictureMesh = findMesh('__X_PICTURE__');
@@ -50,6 +51,7 @@ export const pictureFrame = defineObject({
const applyDirection = () => { const applyDirection = () => {
if (options.direction === 'vertical') { if (options.direction === 'vertical') {
frameMesh.rotation.z = 0; frameMesh.rotation.z = 0;
matMesh.rotation.z = 0;
coverMesh.rotation.z = 0; coverMesh.rotation.z = 0;
pictureMesh.rotation.z = 0; pictureMesh.rotation.z = 0;
@@ -63,6 +65,7 @@ export const pictureFrame = defineObject({
uvs[1] = dy; uvs[1] = dy;
} else if (options.direction === 'horizontal') { } else if (options.direction === 'horizontal') {
frameMesh.rotation.z = -Math.PI / 2; frameMesh.rotation.z = -Math.PI / 2;
matMesh.rotation.z = -Math.PI / 2;
coverMesh.rotation.z = -Math.PI / 2; coverMesh.rotation.z = -Math.PI / 2;
pictureMesh.rotation.z = -Math.PI / 2; pictureMesh.rotation.z = -Math.PI / 2;
@@ -81,6 +84,11 @@ export const pictureFrame = defineObject({
applyDirection(); applyDirection();
console.log(matMesh.morphTargetManager!.getTargetByName('MatH')!, matMesh.morphTargetManager!.getTargetByName('MatV')!);
//matMesh.morphTargetManager!.getTargetByName('MatH')!.influence = 0.5;
//matMesh.morphTargetManager!.getTargetByName('MatV')!.influence = 0.5;
const tex = new BABYLON.Texture('http://syu-win.local:3000/files/b6cefaba-3093-4c57-a7f8-993dee62c6f7', room.scene, false, false); const tex = new BABYLON.Texture('http://syu-win.local:3000/files/b6cefaba-3093-4c57-a7f8-993dee62c6f7', room.scene, false, false);
const pictureMaterial = findMaterial('__X_PICTURE__'); const pictureMaterial = findMaterial('__X_PICTURE__');