From 7546bf7dc2e71d845f64e027ef2dff11225706da Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Mon, 25 May 2026 10:53:47 +0900 Subject: [PATCH] wip --- .../frontend/src/world/room/objects/bed.ts | 21 ++++----- .../src/world/room/objects/hangingDuctRail.ts | 5 +-- .../src/world/room/objects/lowPartitionBar.ts | 5 +-- .../frontend/src/world/room/objects/pc.ts | 45 ------------------- .../frontend/src/world/room/objects/piano.ts | 5 +-- .../frontend/src/world/room/objects/sofa.ts | 5 +-- .../src/world/room/objects/speakerStand.ts | 5 +-- .../src/world/room/objects/spotLight.ts | 5 +-- .../src/world/room/objects/stanchionPole.ts | 8 ++-- .../world/room/objects/wallMountSpotLight.ts | 2 +- .../src/world/room/objects/wireBasket.ts | 5 +-- .../src/world/room/objects/wireNet.ts | 5 +-- 12 files changed, 31 insertions(+), 85 deletions(-) delete mode 100644 packages/frontend/src/world/room/objects/pc.ts diff --git a/packages/frontend/src/world/room/objects/bed.ts b/packages/frontend/src/world/room/objects/bed.ts index b4a1b74313..b197694ee0 100644 --- a/packages/frontend/src/world/room/objects/bed.ts +++ b/packages/frontend/src/world/room/objects/bed.ts @@ -11,13 +11,13 @@ export const bed = defineObject({ name: 'Bed', options: { schema: { - mat: { + frameMat: { type: 'material', - label: 'Material', + label: 'Frame material', }, }, default: { - mat: { color: [0.2, 0.1, 0.02], roughness: -1, metallic: -1 }, + frameMat: { color: [0.2, 0.1, 0.02], roughness: 0.5, metallic: 0 }, }, }, placement: 'floor', @@ -26,19 +26,20 @@ export const bed = defineObject({ createInstance: ({ options, model }) => { const bodyMesh = model.findMesh('__X_BODY__'); const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial; - console.log('bed', bodyMaterial.roughness, bodyMaterial.metallic); - const applyMat = () => { - bodyMaterial.albedoColor = new BABYLON.Color3(options.mat.color[0], options.mat.color[1], options.mat.color[2]); - bodyMaterial.roughness = options.mat.roughness; - bodyMaterial.metallic = options.mat.metallic; + const applyFrameMat = () => { + bodyMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]); + bodyMaterial.roughness = options.frameMat.roughness; + bodyMaterial.metallic = options.frameMat.metallic; }; - applyMat(); + applyFrameMat(); return { onOptionsUpdated: ([k, v]) => { - applyMat(); + switch (k) { + case 'frameMat': applyFrameMat(); break; + } }, interactions: {}, dispose: () => {}, diff --git a/packages/frontend/src/world/room/objects/hangingDuctRail.ts b/packages/frontend/src/world/room/objects/hangingDuctRail.ts index fc73b27af7..1dabd7a097 100644 --- a/packages/frontend/src/world/room/objects/hangingDuctRail.ts +++ b/packages/frontend/src/world/room/objects/hangingDuctRail.ts @@ -33,14 +33,13 @@ export const hangingDuctRail = defineObject({ default: { width: 0.2, height: 0.2, - bodyMat: { color: [0.05, 0.05, 0.05], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 }, }, }, placement: 'ceiling', hasCollisions: false, - createInstance: async ({ options, model, id }) => { + createInstance: async ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applySize = () => { for (const mesh of model.root.getChildMeshes()) { diff --git a/packages/frontend/src/world/room/objects/lowPartitionBar.ts b/packages/frontend/src/world/room/objects/lowPartitionBar.ts index 432980fcdd..0d0ff4893f 100644 --- a/packages/frontend/src/world/room/objects/lowPartitionBar.ts +++ b/packages/frontend/src/world/room/objects/lowPartitionBar.ts @@ -24,15 +24,14 @@ export const lowPartitionBar = defineObject({ }, }, default: { - bodyMat: { color: [0.8, 0.8, 0.8], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.8, 0.8, 0.8], roughness: 0.1, metallic: 1 }, width: 0.5, }, }, placement: 'top', //hasCollisions: true, - createInstance: ({ options, model, id }) => { + createInstance: ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]); diff --git a/packages/frontend/src/world/room/objects/pc.ts b/packages/frontend/src/world/room/objects/pc.ts deleted file mode 100644 index ab1fdbdb91..0000000000 --- a/packages/frontend/src/world/room/objects/pc.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and misskey-project - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import * as BABYLON from '@babylonjs/core'; -import { defineObject } from '../object.js'; - -export const pc = defineObject({ - id: 'pc', - name: 'PC', - options: { - schema: { - mat: { - type: 'material', - label: 'Material', - }, - }, - default: { - mat: { color: [0, 0, 0], roughness: -1, metallic: -1 }, - }, - }, - placement: 'top', - createInstance: ({ options, root, id }) => { - const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh; - const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial; - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); - - const applyMat = () => { - bodyMaterial.albedoColor = new BABYLON.Color3(options.mat.color[0], options.mat.color[1], options.mat.color[2]); - bodyMaterial.roughness = options.mat.roughness; - bodyMaterial.metallic = options.mat.metallic; - }; - - applyMat(); - - return { - onOptionsUpdated: ([k, v]) => { - applyMat(); - }, - interactions: {}, - dispose: () => {}, - }; - }, -}); diff --git a/packages/frontend/src/world/room/objects/piano.ts b/packages/frontend/src/world/room/objects/piano.ts index ddeb16a51e..1f9829c1aa 100644 --- a/packages/frontend/src/world/room/objects/piano.ts +++ b/packages/frontend/src/world/room/objects/piano.ts @@ -17,15 +17,14 @@ export const piano = defineObject({ }, }, default: { - bodyMat: { color: [0, 0, 0], roughness: -1, metallic: -1 }, + bodyMat: { color: [0, 0, 0], roughness: 0.5, metallic: 0 }, }, }, placement: 'floor', hasCollisions: true, canPreMeshesMerging: true, - createInstance: ({ options, model, id }) => { + createInstance: ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]); diff --git a/packages/frontend/src/world/room/objects/sofa.ts b/packages/frontend/src/world/room/objects/sofa.ts index 9c7e146826..eb89dea1dd 100644 --- a/packages/frontend/src/world/room/objects/sofa.ts +++ b/packages/frontend/src/world/room/objects/sofa.ts @@ -17,16 +17,15 @@ export const sofa = defineObject({ }, }, default: { - bodyMat: { color: [0.4, 0.4, 0.4], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.4, 0.4, 0.4], roughness: 0.5, metallic: 0 }, }, }, placement: 'floor', hasCollisions: true, canPreMeshesMerging: true, hasTexture: false, - createInstance: ({ options, model, id }) => { + createInstance: ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]); diff --git a/packages/frontend/src/world/room/objects/speakerStand.ts b/packages/frontend/src/world/room/objects/speakerStand.ts index 2ebb3c95fd..6e5b592009 100644 --- a/packages/frontend/src/world/room/objects/speakerStand.ts +++ b/packages/frontend/src/world/room/objects/speakerStand.ts @@ -24,16 +24,15 @@ export const speakerStand = defineObject({ }, }, default: { - bodyMat: { color: [0.2, 0.2, 0.2], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.2, 0.2, 0.2], roughness: 0.5, metallic: 0.8 }, height: 0.1, }, }, placement: 'top', hasCollisions: false, hasTexture: false, - createInstance: ({ options, model, id }) => { + createInstance: ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]); diff --git a/packages/frontend/src/world/room/objects/spotLight.ts b/packages/frontend/src/world/room/objects/spotLight.ts index 3be681cbad..2e88c42517 100644 --- a/packages/frontend/src/world/room/objects/spotLight.ts +++ b/packages/frontend/src/world/room/objects/spotLight.ts @@ -37,7 +37,7 @@ export const spotLight = defineObject({ }, }, default: { - bodyMat: { color: [0.05, 0.05, 0.05], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 }, light: { color: [1, 0.5, 0.2], brightness: 0.2, @@ -48,9 +48,8 @@ export const spotLight = defineObject({ }, placement: 'bottom', hasCollisions: false, - createInstance: ({ lc, scene, options, model, graphicsQuality, id }) => { + createInstance: ({ lc, scene, options, model, graphicsQuality }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]); diff --git a/packages/frontend/src/world/room/objects/stanchionPole.ts b/packages/frontend/src/world/room/objects/stanchionPole.ts index 04f1f57cee..42057a9fbb 100644 --- a/packages/frontend/src/world/room/objects/stanchionPole.ts +++ b/packages/frontend/src/world/room/objects/stanchionPole.ts @@ -21,16 +21,15 @@ export const stanchionPole = defineObject({ }, }, default: { - bodyMat: { color: [0.8, 0.39, 0.1], roughness: -1, metallic: -1 }, - ropeMat: { color: [0.21, 0.0, 0.0], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.8, 0.39, 0.1], roughness: 0.2, metallic: 1 }, + ropeMat: { color: [0.21, 0.0, 0.0], roughness: 0.7, metallic: 0 }, }, }, placement: 'floor', hasCollisions: true, hasTexture: false, - createInstance: ({ options, model, id }) => { + createInstance: ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]); @@ -41,7 +40,6 @@ export const stanchionPole = defineObject({ applyBodyMat(); const ropeMaterial = model.findMaterial('__X_ROPE__'); - console.log(id, ropeMaterial.roughness, ropeMaterial.metallic); const applyRopeMat = () => { ropeMaterial.albedoColor = new BABYLON.Color3(options.ropeMat.color[0], options.ropeMat.color[1], options.ropeMat.color[2]); diff --git a/packages/frontend/src/world/room/objects/wallMountSpotLight.ts b/packages/frontend/src/world/room/objects/wallMountSpotLight.ts index 4432261586..efae67af54 100644 --- a/packages/frontend/src/world/room/objects/wallMountSpotLight.ts +++ b/packages/frontend/src/world/room/objects/wallMountSpotLight.ts @@ -37,7 +37,7 @@ export const wallMountSpotLight = defineObject({ }, }, default: { - bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0 }, + bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 }, light: { color: [1, 0.5, 0.2], brightness: 0.5, diff --git a/packages/frontend/src/world/room/objects/wireBasket.ts b/packages/frontend/src/world/room/objects/wireBasket.ts index d7ae0241a2..9421eb5a10 100644 --- a/packages/frontend/src/world/room/objects/wireBasket.ts +++ b/packages/frontend/src/world/room/objects/wireBasket.ts @@ -17,16 +17,15 @@ export const wireBasket = defineObject({ }, }, default: { - bodyMat: { color: [0.03, 0.03, 0.03], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.03, 0.03, 0.03], roughness: 0.5, metallic: 0.5 }, }, }, placement: 'side', hasCollisions: false, canPreMeshesMerging: true, hasTexture: false, - createInstance: ({ options, model, id }) => { + createInstance: ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]); diff --git a/packages/frontend/src/world/room/objects/wireNet.ts b/packages/frontend/src/world/room/objects/wireNet.ts index 269ac2a36c..fff5de6282 100644 --- a/packages/frontend/src/world/room/objects/wireNet.ts +++ b/packages/frontend/src/world/room/objects/wireNet.ts @@ -17,16 +17,15 @@ export const wireNet = defineObject({ }, }, default: { - bodyMat: { color: [0.03, 0.03, 0.03], roughness: -1, metallic: -1 }, + bodyMat: { color: [0.03, 0.03, 0.03], roughness: 0.5, metallic: 0.5 }, }, }, placement: 'side', hasCollisions: false, canPreMeshesMerging: true, hasTexture: false, - createInstance: ({ options, model, id }) => { + createInstance: ({ options, model }) => { const bodyMaterial = model.findMaterial('__X_BODY__'); - console.log(id, bodyMaterial.roughness, bodyMaterial.metallic); const applyBodyMat = () => { bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);