1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 20:25:39 +02:00
Files
misskey/packages/frontend/src/utility/room/objects/a4Case.ts
syuilo ea8df304c9 wip
2026-04-02 14:15:52 +09:00

43 lines
827 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 a4Case = defineObject({
id: 'a4Case',
name: 'A4 Case',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
},
},
default: {
color: [0.9, 0.9, 0.9],
},
},
placement: 'top',
createInstance: ({ options, model }) => {
const bodyMesh = model.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: {},
};
},
});