perf(editor): 轻微降低内存占用;
This commit is contained in:
parent
fed4277a7c
commit
1f810ef5e2
@ -9,7 +9,7 @@
|
||||
"docs:build": "pnpm run -C packages/docs docs:build",
|
||||
"docs:preview": "pnpm run -C packages/docs docs:preview",
|
||||
"editor:dev": "pnpm run -C packages/editor dev",
|
||||
"editor:build": "pnpm run -C packages/editor build",
|
||||
"editor:build": "pnpm run sdk:build && pnpm run -C packages/editor build",
|
||||
"editor:tsc": "pnpm run -C packages/editor tsc",
|
||||
"editor:preview": "pnpm run -C packages/editor preview",
|
||||
"sdk:dev": "pnpm run -C packages/sdk dev",
|
||||
|
||||
@ -11,4 +11,4 @@ VITE_GLOB_AUTHOR='ErSan'
|
||||
VITE_GLOB_VERSION='1.0.0'
|
||||
|
||||
# 备案号
|
||||
VITE_GLOB_BEIAN='滇ICP备2022001592号-2'
|
||||
VITE_GLOB_BEIAN='滇ICP备XXXXXX号'
|
||||
@ -19,4 +19,4 @@ VITE_ENABLE_CONFIG_GENERATE=true
|
||||
VITE_GLOB_ORIGIN=https://editor.astraljs.com/
|
||||
|
||||
#ws接口
|
||||
VITE_GLOB_SOCKET_URL=wss://editor.astraljs.com/api/sys/ws
|
||||
VITE_GLOB_SOCKET_URL=wss://editor.astraljs.com/socket
|
||||
BIN
packages/editor/public/wasm/Astral3DEditor.wasm
Normal file
BIN
packages/editor/public/wasm/Astral3DEditor.wasm
Normal file
Binary file not shown.
Binary file not shown.
8
packages/editor/src/utils/wasm/optimize.ts
Normal file
8
packages/editor/src/utils/wasm/optimize.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { injectWasm } from "@/utils/wasm/inject";
|
||||
|
||||
export function clearBuffer() {
|
||||
injectWasm({ wasmUrl: "/wasm/Astral3DEditor.wasm" }).then(() => {
|
||||
// 加载完wasm后自动注册了清除缓存的函数调用
|
||||
window.clearBuffer();
|
||||
});
|
||||
}
|
||||
@ -18,12 +18,13 @@
|
||||
import {onMounted, ref, nextTick, onBeforeUnmount} from 'vue';
|
||||
import {App,Viewer,Hooks} from "@astral3d/engine";
|
||||
import Toolbar from "./Toolbar.vue";
|
||||
import ViewportInfo from "./ViewportInfo.vue";
|
||||
import BIMProperties from "./BIMProperties.vue";
|
||||
import IFCProperties from "./IFCProperties.vue";
|
||||
import {useGlobalConfigStore} from "@/store/modules/globalConfig";
|
||||
import {usePluginStore} from "@/store/modules/plugin";
|
||||
import {installBuiltinPlugin} from "@/plugin";
|
||||
import { clearBuffer } from "@/utils/wasm/optimize";
|
||||
import ViewportInfo from "./ViewportInfo.vue";
|
||||
import BIMProperties from "./BIMProperties.vue";
|
||||
import IFCProperties from "./IFCProperties.vue";
|
||||
|
||||
const globalStore = useGlobalConfigStore();
|
||||
const pluginStore = usePluginStore();
|
||||
@ -55,6 +56,9 @@ onMounted(async () => {
|
||||
|
||||
// 注册astral editor内置插件
|
||||
installBuiltinPlugin(window.viewer);
|
||||
|
||||
// 清理wasm缓存
|
||||
clearBuffer();
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
1
packages/editor/types/window.d.ts
vendored
1
packages/editor/types/window.d.ts
vendored
@ -12,6 +12,7 @@ declare interface Window {
|
||||
VRButton: any;
|
||||
log: import('loglevel').RootLogger;
|
||||
// wasm
|
||||
clearBuffer: () => void
|
||||
glTFHandlerEncodeGLB: (u: Uint8Array, jsonStr: string) => Uint8Array
|
||||
glTFHandlerEncodePNG: (png: Uint8Array) => Uint8Array
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user