Display wireframe and solid color

后端 未结 4 678
清歌不尽
清歌不尽 2020-11-27 17:56

Is it possible to display the wireframe of the object and also the solid color of its faces on the same object? I found a way using a clone of the object and assign differen

4条回答
  •  再見小時候
    2020-11-27 18:48

    This can also be achieved with WireframeGeometry: https://threejs.org/docs/#api/en/geometries/WireframeGeometry. (and give plane and line the same position, you can also play with opacity see the docs).

    let geometryWithFillAndWireFrame = () => {
    
        let geometry = new THREE.PlaneGeometry(250, 250, 10, 10);
        let material = new THREE.MeshBasicMaterial( { color: 0xd3d3d3} );
        let plane = new THREE.Mesh(geometry, material);
    
        scene.add(plane);
    
        let wireframe = new THREE.WireframeGeometry( geometry );
    
        let line = new THREE.LineSegments( wireframe );
    
        line.material.color.setHex(0x000000);
    
        scene.add(line);
    
    };
    

提交回复
热议问题