1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 08:45:34 +02:00
This commit is contained in:
syuilo
2026-02-21 18:09:37 +09:00
parent 8bdf773a2b
commit 402dd538bf
9 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
/*
* 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 a4Case = defineObject({
id: 'a4Case',
name: 'A4 Case',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
},
},
default: {
color: [0.9, 0.9, 0.9],
},
},
placement: 'top',
createInstance: ({ options, root }) => {
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyColor();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
},
interactions: {},
};
},
});