我正在制作一个3d条形图,我希望我的条形图有自定义颜色的边缘。有人有主意吗?我的形状像这样创建
var threeWidth = 400,
threeHeight = 300;
var viewAngle = 45,
aspect = threeWidth / threeHeight,
near = 0.1,
far = 10000;
var $chart = $('#chart');
var renderer = new THREE.WebGLRenderer();
var camera = new THREE.PerspectiveCamera(viewAngle, aspect, near, far);
var scene = new THREE.Scene();
scene.add(camera);
renderer.setSize(threeWidth, threeHeight);
$chart.append(renderer.domElement);
var geometry = new THREE.BoxGeometry( 10, 100, 10 );
var material = new THREE.MeshBasicMaterial( {color: 0xCC0000} );
var cube = new THREE.Mesh( geometry, material );
scene.add( cube );
答案 0 :(得分:2)
这是相当古老的,但我偶然发现了这个......
var edges = new THREE.EdgesHelper( cube, 0x0000ff);
edges.material.linewidth = 2;
scene.add(edges);
答案 1 :(得分:2)
自r81起,EdgesHelper
已被弃用,赞成:
// edges geometry
var geometry = new THREE.EdgesGeometry( mesh.geometry ); // or WireframeGeometry
var material = new THREE.LineBasicMaterial( { color: 0xffff00, linewidth: 2 } );
var edges = new THREE.LineSegments( geometry, material );
mesh.add( edges ); // add wireframe as a child of the parent mesh
请参阅Github
上的问题