【问题标题】:Three.js redefine THREE.Line..etcThree.js 重新定义 THREE.Line..etc
【发布时间】:2012-02-10 03:32:13
【问题描述】:

我用 three.js 制作了一个图表,我想用 THREE.Line 连接节点。 在我用鼠标移动其中一个节点后,必须用节点的新坐标重新创建边缘(THREE.Line)。我怎样才能做到?

我的代码没有更新视图:

function render(){

    newEdge.vertices.push(new THREE.Vertex(inNode.position));
    newEdge.vertices.push(new THREE.Vertex(outNode.position));

    var newLine = new THREE.Line(newEdge, new THREE.LineBasicMaterial({
        color: 0xff0000,
        opacity: 0.9
    }));

    scene.objects[edgePos] = newLine;

    renderer.render(scene, camera);

}

非常感谢您的任何建议!

【问题讨论】:

    标签: webgl three.js


    【解决方案1】:

    当您像这样直接更改几何图形时,渲染循环不会接受它。您需要使用newEdge.__dirtyVertices = true; 将顶点标记为脏。您可能还需要newEdge.dynamic = true;。看第9节here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-17
      • 1970-01-01
      • 2013-02-25
      • 2014-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多