1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-13 07:34:16 +02:00
This commit is contained in:
syuilo
2026-04-12 21:30:47 +09:00
parent abe22da9ed
commit 7f46bd4928
5 changed files with 11 additions and 8 deletions

View File

@@ -0,0 +1,105 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const ironFrameShelfH = defineObject({
id: 'ironFrameShelfH',
name: 'ironFrameShelf H',
path: 'iron-frame-shelf/iron-frame-shelf-h',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
},
boardColor: {
type: 'color',
label: 'Board color',
},
},
default: {
frameColor: [0.2, 0.2, 0.2],
boardColor: [0.8, 0.4, 0.1],
},
},
placement: 'floor',
createInstance: ({ options, model }) => {
const frameMaterial = model.findMaterial('__X_FRAME__');
const boardMaterial = model.findMaterial('__X_BOARD__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyFrameColor();
const applyBoardColor = () => {
const [r, g, b] = options.boardColor;
boardMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyBoardColor();
return {
onOptionsUpdated: ([k, v]) => {
applyFrameColor();
applyBoardColor();
},
interactions: {},
};
},
});
export const ironFrameShelfV = defineObject({
id: 'ironFrameShelfV',
name: 'ironFrameShelf V',
path: 'iron-frame-shelf/iron-frame-shelf-v',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
},
boardColor: {
type: 'color',
label: 'Board color',
},
},
default: {
frameColor: [0.2, 0.2, 0.2],
boardColor: [0.8, 0.4, 0.1],
},
},
placement: 'floor',
createInstance: ({ options, model }) => {
const frameMaterial = model.findMaterial('__X_FRAME__');
const boardMaterial = model.findMaterial('__X_BOARD__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyFrameColor();
const applyBoardColor = () => {
const [r, g, b] = options.boardColor;
boardMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyBoardColor();
return {
onOptionsUpdated: ([k, v]) => {
applyFrameColor();
applyBoardColor();
},
interactions: {},
};
},
});