【问题标题】:Wireframe cube geometry线框立方体几何
【发布时间】:2017-05-02 20:13:22
【问题描述】:

我刚刚从r59 升级到r62 并注意到线框CubeGeometry 现在在每个面上都渲染了一条额外的对角线。有没有办法解决这个问题?

volumeGeometry = new THREE.CubeGeometry(w, h, depth);
volumeMaterial = new THREE.MeshBasicMaterial({
      color : 0x0099ff,
      wireframe : true
    });
volumeMesh = new THREE.Mesh(volumeGeometry, volumeMaterial);
scene.add(volumeMesh);

【问题讨论】:

    标签: javascript three.js


    【解决方案1】:

    如果你想要一个简单的线框立方体,你可以这样做:

    var cube = new THREE.BoxHelper();
    cube.material.color.setRGB( 1, 0, 0 );
    cube.scale.set( 10, 10, 10 );
    scene.add( cube );
    

    【讨论】:

    • @Dan 作为附加说明,您看到额外的行可能是因为从 Three.js 中删除了 Face4(四边形),而 CubeGeometry 现在每边使用两个 Face3(三角形)。我认为 BoxHelper 使用线几何,这就是它没有这个问题的原因。
    • cube.scale.set(width/2, height/2, depth/2);
    • 为什么 BoxHelper 不在文档中?它会被弃用吗?
    【解决方案2】:

    来自shape example

    var points = shape.createPointsGeometry();
    var line = new THREE.Line( points, new THREE.LineBasicMaterial({
                color: 0xffffff
            }));
    scene.add(line);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-19
      • 2016-02-08
      相关资源
      最近更新 更多