mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-13 14:05:35 +02:00
wip
This commit is contained in:
@@ -94,7 +94,7 @@ import { ensureSignin } from '@/i';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import * as os from '@/os.js';
|
||||
import { RoomController } from '@/world/room/controller.js';
|
||||
import { cm, getHex, getRgb } from '@/world/utility.js';
|
||||
import { cm, getHex, getRgb, WORLD_SCALE } from '@/world/utility.js';
|
||||
import { deepClone } from '@/utility/clone.js';
|
||||
import { GRAPHICS_QUALITY_HIGH, GRAPHICS_QUALITY_LOW, GRAPHICS_QUALITY_MEDIUM } from '@/world/room/engine.js';
|
||||
import { deviceKind } from '@/utility/device-kind.js';
|
||||
@@ -224,8 +224,14 @@ const data = localStorage.getItem('roomData') != null ? JSON.parse(localStorage.
|
||||
},
|
||||
roomLightColor: [1.0, 0.9, 0.8],
|
||||
installedObjects: [],
|
||||
worldScale: WORLD_SCALE,
|
||||
};
|
||||
|
||||
// 後方互換性のため
|
||||
if (data.worldScale == null) {
|
||||
data.worldScale = 1;
|
||||
}
|
||||
|
||||
console.log('installedObjects:', data.installedObjects.length);
|
||||
|
||||
let latestData = deepClone(data);
|
||||
@@ -270,6 +276,7 @@ onMounted(async () => {
|
||||
window.addEventListener('resize', resize);
|
||||
|
||||
watch(controller.roomState, () => {
|
||||
controller.roomState.value.worldScale = WORLD_SCALE;
|
||||
isModified.value = true;
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic';
|
||||
import { EventEmitter } from 'eventemitter3';
|
||||
import { TIME_MAP, scaleMorph, camelToKebab, cm, WORLD_SCALE, getMeshesBoundingBox, Timer, getYRotationDirection, FreeCameraManualInput } from '../utility.js';
|
||||
import { TIME_MAP, scaleMorph, camelToKebab, cm, WORLD_SCALE, getMeshesBoundingBox, Timer, getYRotationDirection, FreeCameraManualInput, remap } from '../utility.js';
|
||||
import { getObjectDef } from './object-defs.js';
|
||||
import { findMaterial, ModelManager, SYSTEM_HEYA_MESH_NAMES, SYSTEM_MESH_NAMES } from './utility.js';
|
||||
import { SimpleHeyaManager } from './heya.js';
|
||||
@@ -40,6 +40,7 @@ export type RoomState = {
|
||||
};
|
||||
roomLightColor: [number, number, number];
|
||||
installedObjects: RoomStateObject<any>[];
|
||||
worldScale: number;
|
||||
};
|
||||
|
||||
function mergeMeshes(meshes: BABYLON.Mesh[], root: BABYLON.Mesh, hasTexture: boolean) {
|
||||
@@ -454,7 +455,7 @@ export class RoomEngine extends EventEmitter {
|
||||
await Promise.all(objects.map(o => this.loadObject({
|
||||
id: o.id,
|
||||
type: o.type,
|
||||
position: new BABYLON.Vector3(...o.position),
|
||||
position: this.roomState.worldScale !== WORLD_SCALE ? new BABYLON.Vector3(remap(o.position[0], 0, this.roomState.worldScale, 0, WORLD_SCALE), remap(o.position[1], 0, this.roomState.worldScale, 0, WORLD_SCALE), remap(o.position[2], 0, this.roomState.worldScale, 0, WORLD_SCALE)) : new BABYLON.Vector3(...o.position),
|
||||
rotation: new BABYLON.Vector3(o.rotation[0], o.rotation[1], o.rotation[2]),
|
||||
options: o.options,
|
||||
}).then(() => {
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
|
||||
export const WORLD_SCALE = 1;
|
||||
// ベクトルが小さいと動きが不自然になったりするので大きくする
|
||||
// https://forum.babylonjs.com/t/the-camera-isnt-moving-correctly-in-my-custom-input/63286/2
|
||||
export const WORLD_SCALE = 100;
|
||||
|
||||
// cm to meter. 二重に適用しないように注意すること。
|
||||
export const cm = (value: number) => value / 100;
|
||||
//// cm to meter. 二重に適用しないように注意すること。
|
||||
//export const cm = (value: number) => value / 100;
|
||||
export const cm = (value: number) => value;
|
||||
|
||||
export const TIME_MAP = {
|
||||
0: 2,
|
||||
|
||||
Reference in New Issue
Block a user