如何在锻造查看器中激活"Autodesk.MemoryLimited"扩展?



在本地环境forge查看器中加载大型模型时遇到问题。

我已经查阅了Autodesk Forge Viewer Guide";为大型模型分配内存";(https://forge.autodesk.com/en/docs/viewer/v7/developers_guide/viewer_basics/memory-limit/)

并且我申请";Autodesk.MemoryLimited;查看器配置中的扩展,但没有发生任何事情。指南文档说,开发人员和用户可以通过验证左下角的加载栏是否显示为蓝色而不是绿色来验证该功能是否有效,但加载栏没有更改(仍然是绿色(。

并且我加载";Autodesk.Viewing.MemoryLimitedDebug"扩大

你有激活";Autodesk.MemoryLimited;扩大

内存管理器

遗憾的是,文档缺少一小段信息。当使用Autodesk.Viewing.MemoryLimited扩展时,您必须配置想要施加的实际内存限制,例如:

const config = {
loaderExtensions: { svf: 'Autodesk.MemoryLimited' },
memory: {
limit: 1024
}
};
const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('preview'), config);

此外,请注意,只有当您的型号大于配置的阈值时,才会启用内存限制加载。如果你想强制内存限制加载,即使是较小的型号,也可以试试这个:

const config = {
loaderExtensions: { svf: 'Autodesk.MemoryLimited' },
memory: {
limit: 1024,
debug: {
force: true
}
}
};
const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('preview'), config);

编辑

memory.debug对象可以包含自定义内存受限加载行为的附加属性。这些是内部使用的,但你也可以试用它们:

options.debug = {
// Increase the max page out size. On slow (mobile) devices the scene
// traversal is a bottle neck and making this larger helps load more
// pack files earlier in the load.
maxPageOutSize: 195,                                // Max we will page out in one go
pixelCullingEnable: this.options.onDemandLoading,   // Useful with on demand loading
pixelCullingThreshold: avp.PIXEL_CULLING_THRESHOLD,
occlusionThreshold: 1,
occlusionTestThreshold: 1,
startOcclusionTestingPackCount: 8,
testPackfileCount: 4,
useOcclusionInstancing: true,
automaticRefresh: true,
boxProxyMaxCount: 0, // show this many boxes during a render
boxProxyMinScreen: 0.4 // if entire render batch is >= 1/10 of the screen in area
};

最新更新