1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 16:25:44 +02:00
This commit is contained in:
syuilo
2026-04-20 20:47:31 +09:00
parent 2b456fec47
commit 2040827615
7 changed files with 46 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -69,6 +69,7 @@ import { roundRug } from './objects/roundRug.js';
import { router } from './objects/router.js';
import { siphon } from './objects/siphon.js';
import { snakeplant } from './objects/snakeplant.js';
import { sofa } from './objects/sofa.js';
import { speaker } from './objects/speaker.js';
import { speakerStand } from './objects/speakerStand.js';
import { sprayer } from './objects/sprayer.js';
@@ -160,6 +161,7 @@ export const OBJECT_DEFS = [
router,
siphon,
snakeplant,
sofa,
speaker,
speakerStand,
sprayer,

View File

@@ -0,0 +1,44 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js';
export const sofa = defineObject({
id: 'sofa',
name: 'Sofa',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'bodyColor',
},
},
default: {
bodyColor: [0.4, 0.4, 0.4],
},
},
placement: 'floor',
hasCollisions: true,
canPreMeshesMerging: true,
hasTexture: false,
createInstance: ({ options, model }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyBodyColor();
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
},
interactions: {},
};
},
});