mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-25 17:10:43 +00:00
ceilingFan
This commit is contained in:
parent
cc8e6a2e92
commit
d59afb5a29
10 changed files with 134 additions and 0 deletions
|
|
@ -3701,6 +3701,10 @@ _miRoom:
|
|||
_ceilingFanLight:
|
||||
shadeMat: "シェードの素材"
|
||||
bodyMat: "本体の素材"
|
||||
ceilingFan: "シーリングファン"
|
||||
_ceilingFan:
|
||||
shadeMat: "シェードの素材"
|
||||
bodyMat: "本体の素材"
|
||||
chair: "椅子"
|
||||
_chair:
|
||||
primaryMat: "メインの素材"
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ import { woodRingFloorLamp } from './furnitures/woodRingFloorLamp.js';
|
|||
import { woodRingsPendantLight } from './furnitures/woodRingsPendantLight.js';
|
||||
import { woodSoundAbsorbingPanel } from './furnitures/woodSoundAbsorbingPanel.js';
|
||||
import { haniwa } from './furnitures/haniwa.js';
|
||||
import { ceilingFan } from './furnitures/ceilingFan.js';
|
||||
|
||||
export const FUNITURE_DEFS = [
|
||||
a4Case,
|
||||
|
|
@ -131,6 +132,7 @@ export const FUNITURE_DEFS = [
|
|||
cactusS,
|
||||
cardboardBox,
|
||||
ceilingFanLight,
|
||||
ceilingFan,
|
||||
chair,
|
||||
coffeeCup,
|
||||
colorBox,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as BABYLON from '@babylonjs/core/pure.js';
|
||||
import { ceilingFan_schema } from 'misskey-world/src/room/furnitures/ceilingFan.schema.js';
|
||||
import { defineFuniture } from '../furniture.js';
|
||||
|
||||
export const ceilingFan = defineFuniture(ceilingFan_schema, {
|
||||
createInstance: ({ options, sr, scene, model }) => {
|
||||
const shadeMaterial = model.findMaterial('__X_SHADE__');
|
||||
|
||||
const applyShadeMat = () => {
|
||||
shadeMaterial.albedoColor = new BABYLON.Color3(options.shadeMat.color[0], options.shadeMat.color[1], options.shadeMat.color[2]);
|
||||
shadeMaterial.roughness = options.shadeMat.roughness;
|
||||
shadeMaterial.metallic = options.shadeMat.metallic;
|
||||
};
|
||||
|
||||
applyShadeMat();
|
||||
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
bodyMaterial.roughness = options.bodyMat.roughness;
|
||||
bodyMaterial.metallic = options.bodyMat.metallic;
|
||||
};
|
||||
|
||||
applyBodyMat();
|
||||
|
||||
const rotor = model.findMesh('__X_ROTOR__');
|
||||
model.bakeExcludeMeshes = [rotor, ...rotor.getChildMeshes()];
|
||||
|
||||
let animationObserver: BABYLON.Observer<BABYLON.Scene>;
|
||||
|
||||
return {
|
||||
onInited: () => {
|
||||
rotor.rotation = rotor.rotationQuaternion != null ? rotor.rotationQuaternion.toEulerAngles() : rotor.rotation;
|
||||
const anim = new BABYLON.Animation('', 'rotation.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
|
||||
anim.setKeys([
|
||||
{ frame: 0, value: 0 },
|
||||
{ frame: 100, value: Math.PI * 2 },
|
||||
]);
|
||||
rotor.animations = [anim];
|
||||
animationObserver = scene.onAfterAnimationsObservable.add(() => {
|
||||
sr.updateMesh([rotor, ...rotor.getChildMeshes()], false);
|
||||
});
|
||||
scene.beginAnimation(rotor, 0, 100, true);
|
||||
},
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
switch (k) {
|
||||
case 'shadeMat': applyShadeMat(); break;
|
||||
case 'bodyMat': applyBodyMat(); break;
|
||||
}
|
||||
},
|
||||
interactions: {},
|
||||
dispose: () => {
|
||||
if (animationObserver != null) {
|
||||
scene.onAfterAnimationsObservable.remove(animationObserver);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -113,6 +113,7 @@ import { woodRingFloorLamp_ui } from './furnitures/woodRingFloorLamp.ui.js';
|
|||
import { woodRingsPendantLight_ui } from './furnitures/woodRingsPendantLight.ui.js';
|
||||
import { woodSoundAbsorbingPanel_ui } from './furnitures/woodSoundAbsorbingPanel.ui.js';
|
||||
import { haniwa_ui } from './furnitures/haniwa.ui.js';
|
||||
import { ceilingFan_ui } from './furnitures/ceilingFan.ui.js';
|
||||
import type { FurnitureUiDef } from './defineFurnitureUi.js';
|
||||
|
||||
export const FURNITURE_UI_DEFS = {
|
||||
|
|
@ -130,6 +131,7 @@ export const FURNITURE_UI_DEFS = {
|
|||
cactusS: cactusS_ui,
|
||||
cardboardBox: cardboardBox_ui,
|
||||
ceilingFanLight: ceilingFanLight_ui,
|
||||
ceilingFan: ceilingFan_ui,
|
||||
chair: chair_ui,
|
||||
coffeeCup: coffeeCup_ui,
|
||||
colorBox: colorBox_ui,
|
||||
|
|
|
|||
20
packages/frontend/src/world/room/furnitures/ceilingFan.ui.ts
Normal file
20
packages/frontend/src/world/room/furnitures/ceilingFan.ui.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { defineFurnitureUi } from '../defineFurnitureUi.js';
|
||||
import type { ceilingFan_schema } from 'misskey-world/src/room/furnitures/ceilingFan.schema.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
export const ceilingFan_ui = defineFurnitureUi<typeof ceilingFan_schema>({
|
||||
name: i18n.ts._miRoom._furnitures.ceilingFan,
|
||||
options: {
|
||||
shadeMat: {
|
||||
label: i18n.ts._miRoom._furnitures._ceilingFan.shadeMat,
|
||||
},
|
||||
bodyMat: {
|
||||
label: i18n.ts._miRoom._furnitures._ceilingFan.bodyMat,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -13787,6 +13787,20 @@ export interface Locale extends ILocale {
|
|||
*/
|
||||
"bodyMat": string;
|
||||
};
|
||||
/**
|
||||
* シーリングファン
|
||||
*/
|
||||
"ceilingFan": string;
|
||||
"_ceilingFan": {
|
||||
/**
|
||||
* シェードの素材
|
||||
*/
|
||||
"shadeMat": string;
|
||||
/**
|
||||
* 本体の素材
|
||||
*/
|
||||
"bodyMat": string;
|
||||
};
|
||||
/**
|
||||
* 椅子
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ import { woodRingFloorLamp_schema } from './furnitures/woodRingFloorLamp.schema.
|
|||
import { woodRingsPendantLight_schema } from './furnitures/woodRingsPendantLight.schema.js';
|
||||
import { woodSoundAbsorbingPanel_schema } from './furnitures/woodSoundAbsorbingPanel.schema.js';
|
||||
import { haniwa_schema } from './furnitures/haniwa.schema.js';
|
||||
import { ceilingFan_schema } from './furnitures/ceilingFan.schema.js';
|
||||
import type { FurnitureSchemaDef } from './furniture.js';
|
||||
|
||||
export const FURNITURE_SCHEMA_DEFS = {
|
||||
|
|
@ -130,6 +131,7 @@ export const FURNITURE_SCHEMA_DEFS = {
|
|||
cactusS: cactusS_schema,
|
||||
cardboardBox: cardboardBox_schema,
|
||||
ceilingFanLight: ceilingFanLight_schema,
|
||||
ceilingFan: ceilingFan_schema,
|
||||
chair: chair_schema,
|
||||
coffeeCup: coffeeCup_schema,
|
||||
colorBox: colorBox_schema,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { defineFurnitureSchema } from '../furniture.js';
|
||||
export const ceilingFan_schema = defineFurnitureSchema({
|
||||
id: 'ceilingFan',
|
||||
options: {
|
||||
schema: {
|
||||
shadeMat: {
|
||||
type: 'material',
|
||||
},
|
||||
bodyMat: {
|
||||
type: 'material',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
shadeMat: { color: [0.8, 0.19, 0], roughness: 0.5, metallic: 0 },
|
||||
bodyMat: { color: [0.9, 0.9, 0.9], roughness: 0, metallic: 1 },
|
||||
},
|
||||
},
|
||||
placement: 'ceiling',
|
||||
hasCollisions: false,
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue