This commit is contained in:
syuilo
2026-02-20 21:02:28 +09:00
parent 998f85b260
commit 460f79d5cf
11 changed files with 44 additions and 0 deletions

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -34,6 +34,7 @@ import { powerStrip } from './objects/powerStrip.js';
import { rolledUpPoster } from './objects/rolledUpPoster.js';
import { roundRug } from './objects/roundRug.js';
import { snakeplant } from './objects/snakeplant.js';
import { speaker } from './objects/speaker.js';
import { steelRack } from './objects/steelRack.js';
import { tabletopCalendar } from './objects/tabletopCalendar.js';
import { tabletopDigitalClock } from './objects/tabletopDigitalClock.js';
@@ -74,6 +75,7 @@ export const OBJECT_DEFS = [
rolledUpPoster,
roundRug,
snakeplant,
speaker,
steelRack,
tabletopCalendar,
tabletopDigitalClock,

View File

@@ -0,0 +1,42 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const speaker = defineObject({
id: 'speaker',
name: 'Speaker',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
},
},
default: {
color: [0, 0, 0],
},
},
placement: 'top',
createInstance: ({ options, root }) => {
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyColor();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
},
interactions: {},
};
},
});