1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-15 04:35:34 +02:00
This commit is contained in:
syuilo
2026-03-27 14:19:59 +09:00
parent 8619d0156e
commit b2eed6b82a
3 changed files with 38 additions and 3 deletions

View File

@@ -3,18 +3,53 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const woodRingFloorLamp = defineObject({
id: 'woodRingFloorLamp',
name: 'Wood Ring Floor Lamp',
options: {
schema: {},
default: {},
schema: {
shadeColor: {
type: 'color',
label: 'Shade color',
},
bodyColor: {
type: 'color',
label: 'Body color',
},
},
default: {
shadeColor: [0.21, 0.04, 0],
bodyColor: [0.05, 0.05, 0.05],
},
},
placement: 'floor',
createInstance: () => {
createInstance: ({ options, findMaterial }) => {
const shadeMaterial = findMaterial('__X_SHADE__');
const applyShadeColor = () => {
const [r, g, b] = options.shadeColor;
shadeMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyShadeColor();
const bodyMaterial = findMaterial('__X_BODY__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyBodyColor();
return {
onOptionsUpdated: ([k, v]) => {
applyShadeColor();
applyBodyColor();
},
interactions: {},
};
},