我尝试绘制THREE.mesh的几行,其几何图形使用SphereGeometry
,材质采用MeshBasicMaterial
。
为实现这一目标,我使用了以下代码段:
var segments = 32
var geometry = new THREE.SphereGeometry(3, segments, segments, 0, Math.PI * 2, 0, Math.PI * 2);
var material = new THREE.MeshBasicMaterial({color: 0x900000});
var sphere = new THREE.Mesh(geometry, material);
scene.add(sphere);
此代码段不会产生预期的行。
而不是上面的代码,我也尝试过:
var sphere = new THREE.Object3D();
sphere.add( new THREE.LineSegments(
new THREE.Geometry(),
new THREE.LineBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.5
})
));
sphere.add( new THREE.Mesh(
new THREE.Geometry(),
new THREE.MeshPhongMaterial({
color: 0x156289,
emissive: 0x072534,
side: THREE.DoubleSide,
shading: THREE.FlatShading
})
));
scene.add(sphere);
也不会显示网格线。
我使用three.min.js版本74。
答案 0 :(得分:0)
使用THREE.WireframeHelper类。
var wireframe = new THREE.WireframeHelper( sphere, 0x00ff00 );
scene.add( wireframe );
http://threejs.org/docs/#Reference/Extras.Helpers/WireframeHelper