mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-22 09:24:22 +02:00
44 lines
840 B
TypeScript
44 lines
840 B
TypeScript
/*
|
|
* 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 piano = defineObject({
|
|
id: 'piano',
|
|
name: 'Piano',
|
|
options: {
|
|
schema: {
|
|
bodyColor: {
|
|
type: 'color',
|
|
label: 'bodyColor',
|
|
},
|
|
},
|
|
default: {
|
|
bodyColor: [0, 0, 0],
|
|
},
|
|
},
|
|
placement: 'floor',
|
|
hasCollisions: true,
|
|
canPreMeshesMerging: true,
|
|
createInstance: ({ options, model }) => {
|
|
const bodyMaterial = model.findMaterial('__X_BODY__');
|
|
|
|
const applyBodyColor = () => {
|
|
const [r, g, b] = options.bodyColor;
|
|
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
|
};
|
|
|
|
applyBodyColor();
|
|
|
|
return {
|
|
onOptionsUpdated: ([k, v]) => {
|
|
applyBodyColor();
|
|
},
|
|
interactions: {},
|
|
};
|
|
},
|
|
});
|