javascript - Change the colors of a cube's faces -
javascript - Change the colors of a cube's faces -
i found this question, says material.color
doesn't exist. need know how alter colors of various faces of cube i'm drawing:
var newcube = new three.mesh(new three.cubegeometry(size, size, size), new three.meshnormalmaterial({ vertexcolors: three.facecolors }));
here how set , alter colors of cube's faces:
var geometry = new three.boxgeometry( size, size, size ); ( var = 0; < geometry.faces.length; ++ ) { geometry.faces[ ].color.sethex( math.random() * 0xffffff ); } var material = new three.meshbasicmaterial( { color: 0xffffff, vertexcolors: three.facecolors } );
if geometry.faces[i].color
changed, set geometry.colorsneedupdate = true
. ( not required canvasrenderer
. )
three.js r.71
javascript colors three.js mesh face
Comments
Post a Comment