icosahedron

This commit is contained in:
syuilo 2026-05-25 13:48:08 +09:00
commit 2c8abf8239
4 changed files with 34 additions and 3 deletions

View file

@ -3717,6 +3717,8 @@ _miRoom:
width: "幅"
hangingTShirt: "吊り下げTシャツ"
icosahedron: "正二十面体"
_icosahedron:
mat: "素材"
ironFrameShelf3: "アイアンフレームシェルフ 3段"
ironFrameShelf4: "アイアンフレームシェルフ 4段"
ironFrameShelf5: "アイアンフレームシェルフ 5段"

View file

@ -3,6 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js';
import { i18n } from '@/i18n.js';
@ -10,13 +11,35 @@ export const icosahedron = defineObject({
id: 'icosahedron',
name: i18n.ts._miRoom._objects.icosahedron,
options: {
schema: {},
default: {},
schema: {
mat: {
type: 'material',
label: i18n.ts._miRoom._objects._icosahedron.mat,
},
},
default: {
mat: { color: [0.32, 0.12, 0.05], metallic: 1, roughness: 0.5 },
},
},
placement: 'top',
hasCollisions: false,
createInstance: () => {
createInstance: ({ options, model }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.mat.color[0], options.mat.color[1], options.mat.color[2]);
bodyMaterial.roughness = options.mat.roughness;
bodyMaterial.metallic = options.mat.metallic;
};
applyMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'mat': applyMat(); break;
}
},
interactions: {},
dispose: () => {},
};

View file

@ -13853,6 +13853,12 @@ export interface Locale extends ILocale {
*
*/
"icosahedron": string;
"_icosahedron": {
/**
*
*/
"mat": string;
};
/**
* 3
*/