1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 18:45:35 +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
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js';
export const monstera = defineObject({
id: 'monstera',
name: 'Monstera',
options: {
schema: {},
default: {},
schema: {
potColor: {
type: 'color',
label: 'potColor',
},
},
default: {
potColor: [0.5, 0.5, 0.5],
},
},
placement: 'top',
hasCollisions: false,
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 {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
}
},
interactions: {},
};
},

View File

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