'model.setThemingColor(dbId,color,true)之后的圆形对象的阴影'

问题描述 投票:0回答:1

我在模型中有一些圆形元素。当尝试用model.setThemingColor(dbId, color, true);给那些元素上色时,元素的阴影变得很糟糕,并且对象难以理解。Objects with standard colorObjects after setThemingColor

我要解决的问题是2个不同的问题:

  • 是否有可能使用model.setThemingColor(dbId, color, true);顶部的对象的正常阴影仍然留下阴影等?
  • 是否可以设置何时在面之间绘制边缘的公差?我认为这是基于som角公差,以避免模型中的边缘过多。

我已经尝试过同时使用加载选项isAEC: trueviewer.setDisplayEdges(true),但不走运。

[我感谢任何可能将我推向正确方向的建议。

three.js autodesk-forge autodesk-viewer
1个回答
0
投票

我相信setThemingColor与自定义的网格设置一起使用,该设置忽略了轮廓效果。我认为setMaterial可能有用。实际上,它通常用于定义自定义纹理或透明度。

我认为下面的代码可能是一种解决方法,但是在我的测试中,它不适用于某些模型。当它起作用时,效果就像附加的图像。我正在与小组联系,并将相应地更新答案。

//select an object
var sel = NOP_VIEWER.getSelection()
console.log('sel Id:'+sel[0])  
var tree = NOP_VIEWER.model.getInstanceTree()
tree.enumNodeFragments(sel[0], (fragId) =>{ 
console.log('fragId:'+fragId) 

var updatedM = null
var cloneM_name = 'model:'+ NOP_VIEWER.model.id.toString() + '|frag:' + fragId.toString();
console.log('cloneM_name:'+ cloneM_name) 

if(cloneM_name in NOP_VIEWER.impl.matman()._materials)
{  
    updatedM = NOP_VIEWER.impl.matman()._materials[cloneM_name]
    updatedM.color = new THREE.Color(1,1,0) //my color  
    updatedM.needsUpdate = true; 
}else{
     console.log('add new material:'+ cloneM_name) 
     updatedM = NOP_VIEWER.model.getFragmentList().getMaterial(fragId).clone(); 
     updatedM.color = new THREE.Color(1,1,0) //my color   
     updatedM.needsUpdate = true;
     //add new material for this fragment
     NOP_VIEWER.impl.matman().addMaterial(cloneM_name,updatedM,true) 
}  
NOP_VIEWER.model.getFragmentList().setMaterial(fragId,updatedM) 
NOP_VIEWER.impl.invalidate(true,true,false)
 })

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.