我想在非WebGL浏览器和其他WebGL上使用Canvas渲染器。
我的代码在webGL渲染器中工作正常,但在画布渲染器中,THREE.Line不显示。

//Edges
var edgeMat = new THREE.LineBasicMaterial({
    color: 0x000000,
    opacity: 0.6
} );

for (var edgeId in graph.edgesl) {

    var nodeInId = graph.edgesl[edgeId];
    var nodeOutId = graph.edgesr[edgeId];

    var edgeGeom = new THREE.Geometry();
    edgeGeom.vertices.push(new THREE.Vertex(nodes[nodeInId].position));
    edgeGeom.vertices.push(new THREE.Vertex(nodes[nodeOutId].position));

    var drawingLine = new THREE.Line( edgeGeom , edgeMat );

    //Store In, Out node ID
    drawingLine.inNodeId = nodeInId;
    drawingLine.outNodeId = nodeOutId;

    nodes[nodeInId].edges.push(drawingLine);
    nodes[nodeOutId].edges.push(drawingLine);

    //Meshes additionally need also dynamic flag enabled (to keep internal typed arrays).
    drawingLine.dynamic = true;

    scene.addObject(drawingLine );

    edges.push(drawingLine);

}


有人对此有任何想法吗?

谢谢!

最佳答案

从r45开始,scene.addObject(drawingLine);现在必须为scene.add(drawingLine);

同样的问题在这里:

Three.js not scaling or rotating Mesh on render()

09-25 16:18