1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 13:25:48 +02:00
Files
misskey/packages/frontend/src/utility/room/objects/bed.ts
syuilo a8456a45ab wip
2026-02-25 19:15:26 +09:00

43 lines
817 B
TypeScript

/*
* 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 bed = defineObject({
id: 'bed',
name: 'Bed',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
},
},
default: {
color: [0.2, 0.1, 0.02],
},
},
placement: 'floor',
createInstance: ({ options, findMesh }) => {
const bodyMesh = findMesh('__X_BODY__');
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: {},
};
},
});