如何使用相同的缩放比例在查看器中使用HTML?

时间:2018-03-16 05:21:58

标签: autodesk-forge autodesk-viewer

所以,我试图采用不同的方法,通过使用HTML将文本添加到查看器中。我目前的方法是将元素追加到查看器容器中,但问题在于位置是绝对的。它总是粘在屏幕/画布上,所以当我在场景中移动时,它不会随之移动。我想要的是将元素粘贴到场景中,因此当相机移动时,它会随着场景一起移动,因为它会粘在场景上。 我尝试过以下方法:

      this.viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function(event){
    console.log(event.target);
    event.target.impl.createOverlayScene('test');
    event.target.impl.addOverlay('test');
    var node = document.createElement("LI");                 // Create a <li> node
    var textnode = document.createTextNode("Water");         // Create a text node
    node.appendChild(textnode);  
                                // Append the text to <li>
    event.target.clientContainer.appendChild(node)


  });

我已经搞乱了叠加场景,但似乎它们只适用于WebGL。那么,向观众添加共享相同比例的元素的正确方法是什么,并且像元素是场景的一部分那样会随着相机移动?

1 个答案:

答案 0 :(得分:0)

我可以在Viewing.Extension.Markup3D找到该方法的大量演示。有关详细信息,请参阅the article

请记住,与使用PointCloud +自定义着色器相比,处理大量标记时将采用低性能方法:

High-Performance 3D markups with PointCloud in the Forge Viewer