1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 15:15:45 +02:00
This commit is contained in:
syuilo
2026-04-29 09:49:04 +09:00
parent 52e9395fab
commit 18a4da4ad7
3 changed files with 26 additions and 4 deletions

View File

@@ -3,21 +3,43 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js';
export const pachira = defineObject({
id: 'pachira',
name: 'Pachira',
options: {
schema: {},
default: {},
schema: {
potColor: {
type: 'color',
label: 'potColor',
},
},
default: {
potColor: [0.8, 0.8, 0.8],
},
},
placement: 'top',
hasCollisions: true,
hasCollisions: false,
hasTexture: true,
canPreMeshesMerging: true,
createInstance: () => {
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: {},
};
},