线框扩展每次更新都会卸载线 [英] Wireframes extension unload lines on every update

查看:101
本文介绍了线框扩展每次更新都会卸载线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此线框扩展名 https://autodeskviewer.com/查看器/最新/扩展名/Wireframes/Wireframes.js 我稍微修改了它的颜色.

I'm using this wireframe extension https://autodeskviewer.com/viewers/latest/extensions/Wireframes/Wireframes.js which I slightly modified its colors.

如果我稍微移动相机,所有的行都会消失,并且由于我们的应用不断从传感器获取输入,因此最终导致行始终不显示.

If I slightly move the camera, all the lines disappear and since our app constantly get input from the sensor, we end up with the lines always not showing.

我找不到使这些线条消失的原因.我该如何使其始终可见?

I can't find what is making those lines disappear. How can I make those to always be visible?

在此示例中也会发生这种情况,您可以复制它:

It also happens in this example which you can reproduce:

推荐答案

研究后避免这种问题的另一种方法.可以不使用impl.sceneimpl.sceneAfter,而可以将这些线框几何形状添加到查看器叠加层中.以下是解决方法的摘要:

Another way to avoid this issue after my research. Instead of using impl.scene and impl.sceneAfter, you can add those wireframe geometries into the viewer overlay. Here are the snippets of a workaround:

//!-- 1. Add this two line in the `load` function.
if( this.viewer.impl.overlayScenes[this.overlayName] === undefined )
    this.viewer.impl.createOverlayScene( this.overlayName );

//!-- 2. Modified `addWireframes` with overlay functions
function addWireframes(viewer, overlayName, groups) {
    var groupsCount = groups.length;
    for (var i = 0; i < groupsCount; ++i) {
        viewer.impl.addOverlay( overlayName, groups[i] );
    }
    viewer.impl.invalidate(false, true, true);
}

//!-- 3. Modified `revertWireframes` with overlay functions
function revertWireframes(viewer, overlayName, groups) {
    var groupsCount = groups.length;
    for (var i = 0; i < groupsCount; ++i) {
        viewer.impl.removeOverlay( overlayName, groups[i] );
    }
    viewer.impl.invalidate(false, true, true);
}

//!-- 4 Update `impl.invalidate` function calls
viewer.impl.invalidate(false, true, true);

//!-- 5. Update function calls of both `addWireframes` and `revertWireframes`, for example:
addWireframes(this.viewer, this.overlayName, this.groups);
revertWireframes(this.viewer, this.overlayName, this.groups);

P.S.由于这只是一种解决方法,而不是正式的解决方案.使用它需要您自担风险.

===旧答案

这可能是由渐进式渲染引起的,您可以通过viewer.setProgressiveRendering( false )将其关闭.但是在Forge Viewer中查看大型模型时,会损害性能.

This might caused by the progressive rendering, you can turn it off via viewer.setProgressiveRendering( false ). But it will hurt the performance while viewing a large model in the Forge Viewer.

渐进式渲染是查看器渲染大型模型的方式.不幸的是,这是无法预防和修复的方法.

Progressive rendering is the way how the viewer render large models. And it's no way to prevent and be fixed now unfortunately.

这是我这边的样子:

https://imgur.com/a/TnlzW

这篇关于线框扩展每次更新都会卸载线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆