1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-26 16:04:24 +02:00
This commit is contained in:
syuilo
2026-04-29 09:40:12 +09:00
parent d05d7938a4
commit 52e9395fab
6 changed files with 52 additions and 6 deletions

View File

@@ -3,20 +3,43 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js'; import { defineObject } from '../object.js';
export const monstera = defineObject({ export const monstera = defineObject({
id: 'monstera', id: 'monstera',
name: 'Monstera', name: 'Monstera',
options: { options: {
schema: {}, schema: {
default: {}, potColor: {
type: 'color',
label: 'potColor',
},
},
default: {
potColor: [0.5, 0.5, 0.5],
},
}, },
placement: 'top', placement: 'top',
hasCollisions: false, hasCollisions: false,
hasTexture: true, hasTexture: true,
createInstance: () => { 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 { return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
}
},
interactions: {}, interactions: {},
}; };
}, },

View File

@@ -3,20 +3,43 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js'; import { defineObject } from '../object.js';
export const snakeplant = defineObject({ export const snakeplant = defineObject({
id: 'snakeplant', id: 'snakeplant',
name: 'Snake Plant', name: 'Snake Plant',
options: { options: {
schema: {}, schema: {
default: {}, potColor: {
type: 'color',
label: 'potColor',
},
},
default: {
potColor: [0.7, 0.7, 0.7],
},
}, },
placement: 'top', placement: 'top',
hasCollisions: false, hasCollisions: false,
hasTexture: true, hasTexture: true,
createInstance: () => { 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 { return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
}
},
interactions: {}, interactions: {},
}; };
}, },