mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-13 07:34:16 +02:00
rename
This commit is contained in:
105
packages/frontend/src/utility/room/objects/ironFrameShelf.ts
Normal file
105
packages/frontend/src/utility/room/objects/ironFrameShelf.ts
Normal 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: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user