gpt4 book ai didi

javascript - 在 Three.js 中,如何为我的形状提供自定义边缘颜色? (不只是设置线框 :true )

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:33:11 25 4
gpt4 key购买 nike

我正在制作 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 );

最佳答案

从 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 上的问题

关于javascript - 在 Three.js 中,如何为我的形状提供自定义边缘颜色? (不只是设置线框 :true ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27853253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com