perf(editor): 轻微降低内存占用;
This commit is contained in:
@@ -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
|
||||
Binary file not shown.
Binary file not shown.
@@ -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(() => {
|
||||
|
||||
Vendored
+1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user