1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-15 06:55:38 +02:00
Files
misskey/packages/frontend/src/utility/room/objects/cardboardBox.ts
syuilo 7f5858a66f wip
2026-03-26 20:26:27 +09:00

43 lines
1.3 KiB
TypeScript

/*
* 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 cardboardBox = defineObject({
id: 'cardboardBox',
name: 'Cardboard Box',
options: {
schema: {
variation: {
type: 'enum',
label: 'Variation',
enum: ['default', 'mikan', 'aizon'],
},
},
default: {
variation: 'default',
},
},
placement: 'top',
createInstance: ({ scene, options, root }) => {
return {
onInited: () => {
const boxMesh = root.getChildMeshes().find(m => m.name === 'Box') as BABYLON.Mesh;
if (options.variation === 'mikan') {
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/mikan.png', scene, false, false);
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
} else if (options.variation === 'aizon') {
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/aizon.png', scene, false, false);
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
}
},
interactions: {},
};
},
});