1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-19 01:55:27 +02:00
Files
misskey/packages/frontend/src/world/room/objects/monstera.ts
syuilo 52e9395fab wip
2026-04-29 09:40:12 +09:00

47 lines
911 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 monstera = defineObject({
id: 'monstera',
name: 'Monstera',
options: {
schema: {
potColor: {
type: 'color',
label: 'potColor',
},
},
default: {
potColor: [0.5, 0.5, 0.5],
},
},
placement: 'top',
hasCollisions: false,
hasTexture: true,
canPreMeshesMerging: true,
createInstance: ({ options, model }) => {
const potMaterial = model.findMaterial('__X_POT__');
const applyPotColor = () => {
const [r, g, b] = options.potColor;
potMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyPotColor();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
}
},
interactions: {},
};
},
});