mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-13 18:45:35 +02:00
heya -> env
This commit is contained in:
|
Before Width: | Height: | Size: 626 KiB After Width: | Height: | Size: 626 KiB |
@@ -97,10 +97,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue';
|
||||
import XWallOption from './room.default-heya-wall-options.vue';
|
||||
import XPillarOption from './room.default-heya-pillar-options.vue';
|
||||
import XWallOption from './room.default-env-wall-options.vue';
|
||||
import XPillarOption from './room.default-env-pillar-options.vue';
|
||||
import type { ObjectDef } from '@/world/room/object.js';
|
||||
import type { SimpleHeyaOptions } from '@/world/room/heya.js';
|
||||
import type { SimpleEnvOptions } from '@/world/room/env.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
@@ -112,14 +112,14 @@ import { getHex, getRgb } from '@/world/utility.js';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
options: SimpleHeyaOptions;
|
||||
options: SimpleEnvOptions;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'update', v: SimpleHeyaOptions): void;
|
||||
(ev: 'update', v: SimpleEnvOptions): void;
|
||||
}>();
|
||||
|
||||
function update(v: Partial<SimpleHeyaOptions>) {
|
||||
function update(v: Partial<SimpleEnvOptions>) {
|
||||
emit('update', { ...props.options, ...v });
|
||||
}
|
||||
</script>
|
||||
@@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue';
|
||||
import type { ObjectDef } from '@/world/room/object.js';
|
||||
import type { SimpleHeyaOptions } from '@/world/room/heya.js';
|
||||
import type { SimpleEnvOptions } from '@/world/room/env.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
@@ -40,14 +40,14 @@ import MkRange from '@/components/MkRange.vue';
|
||||
import { getHex, getRgb } from '@/world/utility.js';
|
||||
|
||||
const props = defineProps<{
|
||||
options: SimpleHeyaOptions['pillars']['nw' | 'ne' | 'sw' | 'se'];
|
||||
options: SimpleEnvOptions['pillars']['nw' | 'ne' | 'sw' | 'se'];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'update', v: SimpleHeyaOptions['pillars']['nw' | 'ne' | 'sw' | 'se']): void;
|
||||
(ev: 'update', v: SimpleEnvOptions['pillars']['nw' | 'ne' | 'sw' | 'se']): void;
|
||||
}>();
|
||||
|
||||
function update(v: Partial<SimpleHeyaOptions['pillars']['nw' | 'ne' | 'sw' | 'se']>) {
|
||||
function update(v: Partial<SimpleEnvOptions['pillars']['nw' | 'ne' | 'sw' | 'se']>) {
|
||||
emit('update', { ...props.options, ...v });
|
||||
}
|
||||
</script>
|
||||
@@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue';
|
||||
import type { ObjectDef } from '@/world/room/object.js';
|
||||
import type { SimpleHeyaOptions } from '@/world/room/heya.js';
|
||||
import type { SimpleEnvOptions } from '@/world/room/env.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
@@ -58,14 +58,14 @@ import MkRange from '@/components/MkRange.vue';
|
||||
import { getHex, getRgb } from '@/world/utility.js';
|
||||
|
||||
const props = defineProps<{
|
||||
options: SimpleHeyaOptions['walls']['n' | 's' | 'w' | 'e'];
|
||||
options: SimpleEnvOptions['walls']['n' | 's' | 'w' | 'e'];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'update', v: SimpleHeyaOptions['walls']['n' | 's' | 'w' | 'e']): void;
|
||||
(ev: 'update', v: SimpleEnvOptions['walls']['n' | 's' | 'w' | 'e']): void;
|
||||
}>();
|
||||
|
||||
function update(v: Partial<SimpleHeyaOptions['walls']['n' | 's' | 'w' | 'e']>) {
|
||||
function update(v: Partial<SimpleEnvOptions['walls']['n' | 's' | 'w' | 'e']>) {
|
||||
emit('update', { ...props.options, ...v });
|
||||
}
|
||||
</script>
|
||||
@@ -9,9 +9,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<MkSelect
|
||||
:items="[
|
||||
{ label: 'Simple', value: 'simple' },
|
||||
]" :modelValue="controller.roomState.value.heya.type" @update:modelValue="v => controller.changeHeyaType(v)"
|
||||
]" :modelValue="controller.roomState.value.env.type" @update:modelValue="v => controller.changeEnvType(v)"
|
||||
>
|
||||
<template #label>Heya type</template>
|
||||
<template #label>Env type</template>
|
||||
</MkSelect>
|
||||
|
||||
<!-- debounceしないとカラーピッカー上で高速でなぞったときになぜか無限ループになる。ワーカーとの間でラグがあるため、少し前の値がまたmodelValueとしてフィードバックされてしまうためだと思われる -->
|
||||
@@ -19,8 +19,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template #label>light color</template>
|
||||
</MkInput>
|
||||
|
||||
<template v-if="controller.roomState.value.heya.type === 'simple'">
|
||||
<XDefaultHeyaOptions :options="controller.roomState.value.heya.options" @update="v => controller.updateHeyaOptions(v)"></XDefaultHeyaOptions>
|
||||
<template v-if="controller.roomState.value.env.type === 'simple'">
|
||||
<XDefaultEnvOptions :options="controller.roomState.value.env.options" @update="v => controller.updateEnvOptions(v)"></XDefaultEnvOptions>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,11 +28,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue';
|
||||
import XWallOption from './room.default-heya-wall-options.vue';
|
||||
import XPillarOption from './room.default-heya-pillar-options.vue';
|
||||
import XDefaultHeyaOptions from './room.default-heya-options.vue';
|
||||
import XWallOption from './room.default-env-wall-options.vue';
|
||||
import XPillarOption from './room.default-env-pillar-options.vue';
|
||||
import XDefaultEnvOptions from './room.default-env-options.vue';
|
||||
import type { ObjectDef } from '@/world/room/object.js';
|
||||
import type { SimpleHeyaOptions } from '@/world/room/heya.js';
|
||||
import type { SimpleEnvOptions } from '@/world/room/env.js';
|
||||
import type { RoomState } from '@/world/room/engine.js';
|
||||
import type { RoomController } from '@/world/room/controller.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
@@ -72,7 +72,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</div>
|
||||
|
||||
<div v-if="isRoomSettingsOpen && controller.isEditMode.value" class="_panel" :class="$style.overlayObjectInfoPanel">
|
||||
<XHeyaOptions :controller="controller"/>
|
||||
<XEnvOptions :controller="controller"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -86,7 +86,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
import { computed, defineAsyncComponent, markRaw, nextTick, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue';
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import XObjectCustomizeForm from './room.object-customize-form.vue';
|
||||
import XHeyaOptions from './room.heya-options.vue';
|
||||
import XEnvOptions from './room.env-options.vue';
|
||||
import type { RoomControllerOptions } from '@/world/room/controller.js';
|
||||
import { definePage } from '@/page.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
@@ -164,7 +164,7 @@ const joyStickVec = ref({ x: 0, y: 0 });
|
||||
const joyStickStartPos = ref<{ x: number; y: number } | null>(null);
|
||||
|
||||
const data = localStorage.getItem('roomData') != null ? JSON.parse(localStorage.getItem('roomData')!) : {
|
||||
heya: {
|
||||
env: {
|
||||
type: 'simple',
|
||||
options: {
|
||||
dimension: [300, 300],
|
||||
@@ -244,6 +244,8 @@ const data = localStorage.getItem('roomData') != null ? JSON.parse(localStorage.
|
||||
if (data.worldScale == null) {
|
||||
data.worldScale = 1;
|
||||
}
|
||||
delete data.heya;
|
||||
}
|
||||
|
||||
console.log('installedObjects:', data.installedObjects.length);
|
||||
|
||||
@@ -255,7 +257,7 @@ const roomControllerOptions = computed<RoomControllerOptions>(() => ({
|
||||
resolution: resolution.value,
|
||||
antialias: antialias.value,
|
||||
useVirtualJoystick,
|
||||
workerMode: true,
|
||||
workerMode: false,
|
||||
}));
|
||||
|
||||
const controller = markRaw(new RoomController(data, roomControllerOptions.value));
|
||||
|
||||
@@ -339,12 +339,12 @@ export class RoomController {
|
||||
this.call('updateObjectOption', [objectId, key, value]);
|
||||
}
|
||||
|
||||
public changeHeyaType(type: RoomState['heya']['type']) {
|
||||
this.call('changeHeyaType', [type]);
|
||||
public changeEnvType(type: RoomState['env']['type']) {
|
||||
this.call('changeEnvType', [type]);
|
||||
}
|
||||
|
||||
public updateHeyaOptions(options: RoomState['heya']['options']) {
|
||||
this.call('updateHeyaOptions', [options]);
|
||||
public updateEnvOptions(options: RoomState['env']['options']) {
|
||||
this.call('updateEnvOptions', [options]);
|
||||
}
|
||||
|
||||
public updateRoomLightColor(color: [number, number, number]) {
|
||||
|
||||
@@ -18,9 +18,9 @@ import { EventEmitter } from 'eventemitter3';
|
||||
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 { MuseumHeyaManager, SimpleHeyaManager } from './heya.js';
|
||||
import { MuseumEnvManager, SimpleEnvManager } from './env.js';
|
||||
import type { GridMaterial } from '@babylonjs/materials';
|
||||
import type { HeyaManager, JapaneseHeyaOptions, SimpleHeyaOptions } from './heya.js';
|
||||
import type { EnvManager, JapaneseEnvOptions, SimpleEnvOptions } from './env.js';
|
||||
import type { ObjectDef, RoomObjectInstance, RoomStateObject } from './object.js';
|
||||
import { genId } from '@/utility/id.js';
|
||||
import { deepClone } from '@/utility/clone.js';
|
||||
@@ -31,12 +31,12 @@ const RENDER_OUTDOOR_ENV = false;
|
||||
const IN_WEB_WORKER = typeof window === 'undefined';
|
||||
|
||||
export type RoomState = {
|
||||
heya: {
|
||||
env: {
|
||||
type: 'simple';
|
||||
options: SimpleHeyaOptions;
|
||||
options: SimpleEnvOptions;
|
||||
} | {
|
||||
type: 'japanese';
|
||||
options: JapaneseHeyaOptions;
|
||||
options: JapaneseEnvOptions;
|
||||
};
|
||||
roomLightColor: [number, number, number];
|
||||
installedObjects: RoomStateObject<any>[];
|
||||
@@ -133,7 +133,7 @@ export class RoomEngine extends EventEmitter {
|
||||
instance: RoomObjectInstance;
|
||||
model: ModelManager;
|
||||
}> = new Map();
|
||||
private heyaManager: HeyaManager | null = null;
|
||||
private envManager: EnvManager | null = null;
|
||||
|
||||
// TODO: たぶんオブジェクト内の値のmutateはsetで検知できないので、そのような操作を実際に行うようになった & それを検知する必要性が出てきたら専用の設定関数などを新設してそれを使わせる
|
||||
private _grabbingCtx: {
|
||||
@@ -430,7 +430,7 @@ export class RoomEngine extends EventEmitter {
|
||||
}
|
||||
|
||||
public async init() {
|
||||
await this.loadHeya();
|
||||
await this.loadEnv();
|
||||
|
||||
const objects = this.roomState.installedObjects.filter(o => !IGNORE_OBJECTS.includes(o.type));
|
||||
let loadedCount = 0;
|
||||
@@ -825,11 +825,11 @@ export class RoomEngine extends EventEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
public async changeHeyaType(type: RoomState['heya']['type'], forInit = false) {
|
||||
this.roomState.heya.type = type;
|
||||
public async changeEnvType(type: RoomState['env']['type'], forInit = false) {
|
||||
this.roomState.env.type = type;
|
||||
|
||||
if (this.heyaManager != null) {
|
||||
this.heyaManager.dispose();
|
||||
if (this.envManager != null) {
|
||||
this.envManager.dispose();
|
||||
}
|
||||
|
||||
const onMeshUpdatedCallback = (meshes: BABYLON.AbstractMesh[]) => {
|
||||
@@ -856,16 +856,16 @@ export class RoomEngine extends EventEmitter {
|
||||
}
|
||||
};
|
||||
|
||||
if (this.roomState.heya.type === 'simple') {
|
||||
const heyaManager = new SimpleHeyaManager(onMeshUpdatedCallback);
|
||||
await heyaManager.load(this.roomState.heya.options, this.scene);
|
||||
this.heyaManager = heyaManager;
|
||||
} else if (this.roomState.heya.type === 'japanese') {
|
||||
if (this.roomState.env.type === 'simple') {
|
||||
const envManager = new SimpleEnvManager(onMeshUpdatedCallback);
|
||||
await envManager.load(this.roomState.env.options, this.scene);
|
||||
this.envManager = envManager;
|
||||
} else if (this.roomState.env.type === 'japanese') {
|
||||
// TODO
|
||||
} else if (this.roomState.heya.type === 'museum') {
|
||||
const heyaManager = new MuseumHeyaManager(onMeshUpdatedCallback);
|
||||
await heyaManager.load(this.roomState.heya.options, this.scene);
|
||||
this.heyaManager = heyaManager;
|
||||
} else if (this.roomState.env.type === 'museum') {
|
||||
const envManager = new MuseumEnvManager(onMeshUpdatedCallback);
|
||||
await envManager.load(this.roomState.env.options, this.scene);
|
||||
this.envManager = envManager;
|
||||
}
|
||||
|
||||
if (!forInit) {
|
||||
@@ -873,8 +873,8 @@ export class RoomEngine extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
private async loadHeya() {
|
||||
await this.changeHeyaType(this.roomState.heya.type, true);
|
||||
private async loadEnv() {
|
||||
await this.changeEnvType(this.roomState.env.type, true);
|
||||
}
|
||||
|
||||
private async loadObject(args: {
|
||||
@@ -1117,7 +1117,7 @@ export class RoomEngine extends EventEmitter {
|
||||
(subMat as BABYLON.PBRMaterial).subSurface.isRefractionEnabled = false; // 有効にするとドローコールが激増する(babylonのバグか仕様かは不明)
|
||||
(subMat as BABYLON.PBRMaterial).transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHABLEND;
|
||||
}
|
||||
(subMat as BABYLON.PBRMaterial).reflectionTexture = this.heyaManager?.envMapIndoor;
|
||||
(subMat as BABYLON.PBRMaterial).reflectionTexture = this.envManager?.envMapIndoor;
|
||||
(subMat as BABYLON.PBRMaterial).useGLTFLightFalloff = true; // Clustered Lightingではphysical falloffを持つマテリアルはアーチファクトが発生する https://doc.babylonjs.com/features/featuresDeepDive/lights/clusteredLighting/#materials-with-a-physical-falloff-may-cause-artefacts
|
||||
(subMat as BABYLON.PBRMaterial).anisotropy.isEnabled = false; // なんかきれいにレンダリングされないため
|
||||
}
|
||||
@@ -1126,7 +1126,7 @@ export class RoomEngine extends EventEmitter {
|
||||
(mesh.material as BABYLON.PBRMaterial).subSurface.isRefractionEnabled = false; // 有効にするとドローコールが激増する(babylonのバグか仕様かは不明)
|
||||
(mesh.material as BABYLON.PBRMaterial).transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHABLEND;
|
||||
}
|
||||
(mesh.material as BABYLON.PBRMaterial).reflectionTexture = this.heyaManager?.envMapIndoor;
|
||||
(mesh.material as BABYLON.PBRMaterial).reflectionTexture = this.envManager?.envMapIndoor;
|
||||
(mesh.material as BABYLON.PBRMaterial).useGLTFLightFalloff = true; // Clustered Lightingではphysical falloffを持つマテリアルはアーチファクトが発生する https://doc.babylonjs.com/features/featuresDeepDive/lights/clusteredLighting/#materials-with-a-physical-falloff-may-cause-artefacts
|
||||
(mesh.material as BABYLON.PBRMaterial).anisotropy.isEnabled = false; // なんかきれいにレンダリングされないため
|
||||
}
|
||||
@@ -1420,7 +1420,7 @@ export class RoomEngine extends EventEmitter {
|
||||
private turnOnRoomLight(forInit = false) {
|
||||
if (!forInit) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
||||
this.roomLight.intensity = 18 * WORLD_SCALE * WORLD_SCALE;
|
||||
if (this.heyaManager?.envMapIndoor != null) this.heyaManager.envMapIndoor.level = 0.6;
|
||||
if (this.envManager?.envMapIndoor != null) this.envManager.envMapIndoor.level = 0.6;
|
||||
for (const m of this.scene.materials) {
|
||||
if (m.metadata?.disableEnvMap) {
|
||||
m.ambientColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||
@@ -1438,7 +1438,7 @@ export class RoomEngine extends EventEmitter {
|
||||
private turnOffRoomLight() {
|
||||
this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
||||
this.roomLight.intensity = 0;
|
||||
if (this.heyaManager?.envMapIndoor != null) this.heyaManager.envMapIndoor.level = 0.025;
|
||||
if (this.envManager?.envMapIndoor != null) this.envManager.envMapIndoor.level = 0.025;
|
||||
for (const m of this.scene.materials) {
|
||||
if (m.metadata?.disableEnvMap) {
|
||||
m.ambientColor = new BABYLON.Color3(0.025, 0.025, 0.025);
|
||||
@@ -1747,9 +1747,9 @@ export class RoomEngine extends EventEmitter {
|
||||
entity.instance.onOptionsUpdated?.([key, value]);
|
||||
}
|
||||
|
||||
public updateHeyaOptions(options: RoomState['heya']['options']) {
|
||||
this.roomState.heya.options = options;
|
||||
this.heyaManager.applyOptions(options);
|
||||
public updateEnvOptions(options: RoomState['env']['options']) {
|
||||
this.roomState.env.options = options;
|
||||
this.envManager.applyOptions(options);
|
||||
this.ev('changeRoomState', { roomState: this.roomState });
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ import * as BABYLON from '@babylonjs/core';
|
||||
import { cm, WORLD_SCALE } from '../utility.js';
|
||||
import { findMaterial } from './utility.js';
|
||||
|
||||
//export interface HeyaManager<T = any> {
|
||||
//export interface EnvManager<T = any> {
|
||||
// constructor(onMeshUpdatedCallback?: ((meshes: BABYLON.AbstractMesh[]) => void) | null): void;
|
||||
// load: (options: T, scene: BABYLON.Scene) => Promise<void>;
|
||||
// applyOptions: (options: T) => void;
|
||||
// dispose: () => void;
|
||||
//}
|
||||
|
||||
export abstract class HeyaManager<T = any> {
|
||||
export abstract class EnvManager<T = any> {
|
||||
protected onMeshUpdatedCallback: ((meshes: BABYLON.AbstractMesh[]) => void) | null = null;
|
||||
abstract envMapIndoor: BABYLON.CubeTexture | null;
|
||||
|
||||
@@ -28,7 +28,7 @@ export abstract class HeyaManager<T = any> {
|
||||
abstract dispose(): void;
|
||||
}
|
||||
|
||||
export type SimpleHeyaOptions = {
|
||||
export type SimpleEnvOptions = {
|
||||
dimension: [number, number];
|
||||
window: 'none' | 'kosidakamado' | 'demado' | 'hakidasimado';
|
||||
walls: Record<'n' | 's' | 'w' | 'e', {
|
||||
@@ -54,13 +54,13 @@ export type SimpleHeyaOptions = {
|
||||
};
|
||||
};
|
||||
|
||||
export type JapaneseHeyaOptions = {
|
||||
export type JapaneseEnvOptions = {
|
||||
window: 'none' | 'kosidakamado' | 'demado' | 'hakidasimado';
|
||||
};
|
||||
|
||||
// TODO: マテリアルは必要になるまで作成しないようにする
|
||||
|
||||
export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
||||
export class SimpleEnvManager extends EnvManager<SimpleEnvOptions> {
|
||||
private loaderResult: BABYLON.ISceneLoaderAsyncResult | null = null;
|
||||
private meshes: BABYLON.Mesh[] = [];
|
||||
private wallRoots: Record<'n' | 's' | 'w' | 'e', BABYLON.TransformNode> = null as any;
|
||||
@@ -75,8 +75,8 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
||||
super(onMeshUpdatedCallback);
|
||||
}
|
||||
|
||||
public async load(options: SimpleHeyaOptions, scene: BABYLON.Scene) {
|
||||
this.loaderResult = await BABYLON.ImportMeshAsync('/client-assets/room/rooms/default/300.glb', scene);
|
||||
public async load(options: SimpleEnvOptions, scene: BABYLON.Scene) {
|
||||
this.loaderResult = await BABYLON.ImportMeshAsync('/client-assets/room/envs/default/300.glb', scene);
|
||||
|
||||
this.envMapIndoor = BABYLON.CubeTexture.CreateFromPrefilteredData('/client-assets/room/indoor.env', scene);
|
||||
this.envMapIndoor.boundingBoxSize = new BABYLON.Vector3(cm(500), cm(500), cm(500));
|
||||
@@ -172,7 +172,7 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
||||
await this.applyOptions(options);
|
||||
}
|
||||
|
||||
public applyOptions(options: SimpleHeyaOptions) {
|
||||
public applyOptions(options: SimpleEnvOptions) {
|
||||
// TODO: 返り値をpromiseにしてちゃんとテクスチャが読み終わってからresolveする
|
||||
|
||||
for (const type of ['n', 's', 'w', 'e'] as const) {
|
||||
@@ -339,9 +339,9 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
||||
}
|
||||
}
|
||||
|
||||
export type MuseumHeyaOptions = any;
|
||||
export type MuseumEnvOptions = any;
|
||||
|
||||
export class MuseumHeyaManager extends HeyaManager<MuseumHeyaOptions> {
|
||||
export class MuseumEnvManager extends EnvManager<MuseumEnvOptions> {
|
||||
private loaderResult: BABYLON.ISceneLoaderAsyncResult | null = null;
|
||||
private meshes: BABYLON.Mesh[] = [];
|
||||
|
||||
@@ -349,8 +349,8 @@ export class MuseumHeyaManager extends HeyaManager<MuseumHeyaOptions> {
|
||||
super(onMeshUpdatedCallback);
|
||||
}
|
||||
|
||||
public async load(options: MuseumHeyaOptions, scene: BABYLON.Scene) {
|
||||
this.loaderResult = await BABYLON.ImportMeshAsync('/client-assets/room/rooms/default/300.glb', scene);
|
||||
public async load(options: MuseumEnvOptions, scene: BABYLON.Scene) {
|
||||
this.loaderResult = await BABYLON.ImportMeshAsync('/client-assets/room/envs/museum/museum.glb', scene);
|
||||
|
||||
this.meshes = this.loaderResult.meshes.filter(m => m instanceof BABYLON.Mesh);
|
||||
this.meshes[0].scaling = this.meshes[0].scaling.scale(WORLD_SCALE);
|
||||
@@ -380,7 +380,7 @@ export class MuseumHeyaManager extends HeyaManager<MuseumHeyaOptions> {
|
||||
await this.applyOptions(options);
|
||||
}
|
||||
|
||||
public applyOptions(options: MuseumHeyaOptions) {
|
||||
public applyOptions(options: MuseumEnvOptions) {
|
||||
this.onMeshUpdatedCallback?.(this.meshes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user