0
我嘗試在Three.js中做RGB立方體,但我必須使用頂點,沒有紋理。我看了一些教程,但我的代碼不起作用,我可以徵求建議嗎?謝謝。Three.js帶頂點的RGB立方體
https://jsfiddle.net/yjru14q3/
var geom = new THREE.Geometry();
geom.vertices = vertices;
geom.vertexColors = colors;
var colors = [];
colors[0] = new THREE.Color(0, 0, 0);
....
var vertices = [];
vertices[0] = new THREE.Vector3(0, 0, 0);
....
var material = new THREE.MeshBasicMaterial({
vertexColors: THREE.VertexColors,
side: THREE.DoubleSide, // in case we go inside the cube
});
var cube = new THREE.Mesh(geom, material);
scene.add(cube);
您可以使用盒體幾何形狀 - [鏈接到框幾何文檔](https://threejs.org/docs/#Reference/Geometries/BoxGeometry) – uhura