问题
I am trying to add Lines of two different material i.e. LineDashedMaterial and LineBasicMaterial using Three.js in Forge viewer v7. LineDashedMaterial not showing dashed pattern and material color in scene and sceneAfter but working in overlays scene same for LineBasicMaterial. but my requirement is to add line in scene and sceneAfter. can anyone tell me solution for this. thanks in advance.
let geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(0, 0, 0),
new THREE.Vector3(0, 0, 100));
let material = new THREE.LineDashedMaterial({color: 0xFF0000,
dashSize: 3,
gapSize: 1});
geometry.computeLineDistances();
geometry.lineDistancesNeedUpdate = true;
viewer.impl.matman().addMaterial('material', material, true);
let line= new THREE.Line(geometry, material);
viewer.impl.sceneAfter.add(line);
回答1:
EDIT
Engineering has now been made aware of the issue and will fix this in upcoming releases.
For now as a workaround you can switch off the DepthTarget option for sceneAfter
to fix MRT support - see demo here:
NOP_VIEWER.impl.sceneAfter.skipDepthTarget = true;
NOP_VIEWER.impl.sceneAfter.skipIdTarget = true;
But I was able to render the dashed pattern with Viewer v7.11 with sceneAfter
(on Chrome v70 though)? Is the output in the screenshot what you are after? Here's my live demo...
来源:https://stackoverflow.com/questions/60167748/in-forge-viewer-autodesk-v7-linedashmaterial-and-color-for-linebasicmaterial-not