mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-28 00:24:36 +02:00
kakejiku
This commit is contained in:
@@ -4031,3 +4031,6 @@ _miRoom:
|
||||
frameMat: "フレームの素材"
|
||||
height: "段数"
|
||||
width: "幅"
|
||||
kakejiku: "掛軸"
|
||||
_kakejiku:
|
||||
image: "画像"
|
||||
|
||||
@@ -36,6 +36,7 @@ const driveFileReferencingOptions = {
|
||||
laptopPc: ['image'],
|
||||
handheldGameConsole: ['image'],
|
||||
largeMousepad: ['image'],
|
||||
kakejiku: ['image'],
|
||||
} as Record<string, string[]>;
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
BIN
packages/frontend/assets/world/objects/kakejiku/kakejiku.blend
Normal file
BIN
packages/frontend/assets/world/objects/kakejiku/kakejiku.blend
Normal file
Binary file not shown.
BIN
packages/frontend/assets/world/objects/kakejiku/kakejiku.glb
Normal file
BIN
packages/frontend/assets/world/objects/kakejiku/kakejiku.glb
Normal file
Binary file not shown.
BIN
packages/frontend/assets/world/objects/kakejiku/texture.af
Normal file
BIN
packages/frontend/assets/world/objects/kakejiku/texture.af
Normal file
Binary file not shown.
BIN
packages/frontend/assets/world/objects/kakejiku/texture.png
Normal file
BIN
packages/frontend/assets/world/objects/kakejiku/texture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -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 {
|
||||
|
||||
17
packages/frontend/src/world/room/furnitures/kakejiku.ui.ts
Normal file
17
packages/frontend/src/world/room/furnitures/kakejiku.ui.ts
Normal 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,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -14991,6 +14991,16 @@ export interface Locale extends ILocale {
|
||||
*/
|
||||
"width": string;
|
||||
};
|
||||
/**
|
||||
* 掛軸
|
||||
*/
|
||||
"kakejiku": string;
|
||||
"_kakejiku": {
|
||||
/**
|
||||
* 画像
|
||||
*/
|
||||
"image": string;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
Reference in New Issue
Block a user