Threejs PlaneBufferGeometry:颜色属性不显示

时间:2016-12-27 03:39:05

标签: three.js

当我用:

创建PBG时
var geometry = new THREE.PlaneBufferGeometry(gs,gs, size - 1, size - 1);
        geometry.rotateX(-Math.PI / 2);
        var vertices = geometry.attributes.position.array;
        for (var i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) {
            vertices[j + 1] = data.map[0][i];
        }

我没有颜色属性:

enter image description here

不知道警告是否有事可做或我遗失了什么。对于我在代码中可以看到的内容,PlaneBufferGeometry从BufferAttribute扩展而且应该有颜色。

提示?

谢谢!

编辑:材料:

var material = new THREE.MeshPhongMaterial({
       color: 0xaaaaff,
       vertexColors: THREE.FaceColors,
       shading: THREE.FlatShading,
    side: THREE.DoubleSide
});

0 个答案:

没有答案