mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-13 16:25:44 +02:00
wip
This commit is contained in:
BIN
packages/frontend/assets/room/object-thumbs/sofa.png
Normal file
BIN
packages/frontend/assets/room/object-thumbs/sofa.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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,
|
||||
|
||||
44
packages/frontend/src/world/room/objects/sofa.ts
Normal file
44
packages/frontend/src/world/room/objects/sofa.ts
Normal 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: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user