1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-28 00:24:36 +02:00
This commit is contained in:
syuilo
2026-06-10 20:51:41 +09:00
parent 923d95d078
commit e1290584f2
13 changed files with 110 additions and 0 deletions

View File

@@ -4031,3 +4031,6 @@ _miRoom:
frameMat: "フレームの素材"
height: "段数"
width: "幅"
kakejiku: "掛軸"
_kakejiku:
image: "画像"

View File

@@ -36,6 +36,7 @@ const driveFileReferencingOptions = {
laptopPc: ['image'],
handheldGameConsole: ['image'],
largeMousepad: ['image'],
kakejiku: ['image'],
} as Record<string, string[]>;
@Injectable()

View File

@@ -117,6 +117,7 @@ import { woodSoundAbsorbingPanel } from './furnitures/woodSoundAbsorbingPanel.js
import { haniwa } from './furnitures/haniwa.js';
import { ceilingFan } from './furnitures/ceilingFan.js';
import { downlight } from './furnitures/downlight.js';
import { kakejiku } from './furnitures/kakejiku.js';
import type { FurnitureDef } from './furniture.js';
export const FUNITURE_DEFS = [
@@ -232,6 +233,7 @@ export const FUNITURE_DEFS = [
wireBasket,
haniwa,
downlight,
kakejiku,
] as FurnitureDef[];
export function getFurnitureDef(type: string): FurnitureDef {

View File

@@ -0,0 +1,50 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core/pure.js';
import { kakejiku_schema } from 'misskey-world/src/room/furnitures/kakejiku.schema.js';
import { createTextureManager, defineFuniture } from '../furniture.js';
export const kakejiku = defineFuniture(kakejiku_schema, {
createInstance: async ({ scene, options, model }) => {
const imageMesh = model.findMesh('__X_IMAGE__');
imageMesh.rotationQuaternion = null;
const imageMaterial = model.findMaterial('__X_IMAGE__');
imageMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
const textureManager = createTextureManager(imageMesh, () => 33.5 / 88, scene);
const applyImage = () => {
imageMaterial.unfreeze();
let url: string | null = null;
if (options.image.type === '_custom_') {
url = options.image.custom?.url ?? null;
}
return textureManager.change(url, options.image.fit, options.image.rotation).then((tex) => {
imageMaterial.albedoTexture = tex;
});
};
await applyImage();
return {
onInited: () => {
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'image':
applyImage();
break;
}
},
interactions: {},
dispose: () => {
textureManager.dispose();
},
};
},
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -115,6 +115,7 @@ import { woodSoundAbsorbingPanel_ui } from './furnitures/woodSoundAbsorbingPanel
import { haniwa_ui } from './furnitures/haniwa.ui.js';
import { ceilingFan_ui } from './furnitures/ceilingFan.ui.js';
import { downlight_ui } from './furnitures/downlight.ui.js';
import { kakejiku_ui } from './furnitures/kakejiku.ui.js';
import type { FurnitureUiDef } from './defineFurnitureUi.js';
export const FURNITURE_UI_DEFS = {
@@ -229,6 +230,7 @@ export const FURNITURE_UI_DEFS = {
wireBasket: wireBasket_ui,
haniwa: haniwa_ui,
downlight: downlight_ui,
kakejiku: kakejiku_ui,
} as Record<string, FurnitureUiDef>;
export function getFurnitureUiDef(type: string): FurnitureUiDef {

View File

@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineFurnitureUi } from '../defineFurnitureUi.js';
import type { kakejiku_schema } from 'misskey-world/src/room/furnitures/kakejiku.schema.js';
import { i18n } from '@/i18n.js';
export const kakejiku_ui = defineFurnitureUi<typeof kakejiku_schema>({
name: i18n.ts._miRoom._furnitures.kakejiku,
options: {
image: {
label: i18n.ts._miRoom._furnitures._kakejiku.image,
},
},
});

View File

@@ -14991,6 +14991,16 @@ export interface Locale extends ILocale {
*/
"width": string;
};
/**
* 掛軸
*/
"kakejiku": string;
"_kakejiku": {
/**
* 画像
*/
"image": string;
};
};
};
}

View File

@@ -115,6 +115,7 @@ import { woodSoundAbsorbingPanel_schema } from './furnitures/woodSoundAbsorbingP
import { haniwa_schema } from './furnitures/haniwa.schema.js';
import { ceilingFan_schema } from './furnitures/ceilingFan.schema.js';
import { downlight_schema } from './furnitures/downlight.schema.js';
import { kakejiku_schema } from './furnitures/kakejiku.schema.js';
import type { FurnitureSchemaDef } from './furniture.js';
export const FURNITURE_SCHEMA_DEFS = {
@@ -229,6 +230,7 @@ export const FURNITURE_SCHEMA_DEFS = {
wireBasket: wireBasket_schema,
haniwa: haniwa_schema,
downlight: downlight_schema,
kakejiku: kakejiku_schema,
} as Record<string, FurnitureSchemaDef<any>>;
export function getFurnitureSchemaDef(type: string): FurnitureSchemaDef {

View File

@@ -0,0 +1,23 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { defineFurnitureSchema } from '../furniture.js';
export const kakejiku_schema = defineFurnitureSchema({
id: 'kakejiku',
options: {
schema: {
image: {
type: 'image',
presets: [],
},
},
default: {
image: { type: null },
},
},
placement: 'side',
hasCollisions: false,
hasTexture: true,
});