javascript - How to reverse the direction of applying texture in the object CylinderGeometry? -
how reverse direction of applying texture in object cylindergeometry?
var obj = new three.mesh( new three.cylindergeometry(20, 15, 1, 20), new three.meshlambertmaterial({color: 0x000000}) //the material later changed correct );
thank in advance :)
this function works:
var inverttextureoncylindergeometry = function(obj) { var facevertexes = obj.geometry.facevertexuvs[0]; var facevertexeslength = facevertexes.length; var divisiont = 1 / (facevertexeslength * 0.25); facevertexes.map(function(face, index) { if (index < 0.5*facevertexeslength) { var thisindexdivision = [ math.floor(index/2) * divisiont, math.ceil((index+divisiont)/2) * divisiont ]; if (index % 2) { face[0].set(1, thisindexdivision[0]); face[1].set(1, thisindexdivision[1]); face[2].set(0, thisindexdivision[1]); } else { face[0].set(0, thisindexdivision[0]); face[1].set(1, thisindexdivision[0]); face[2].set(0, thisindexdivision[1]); } } }); obj.geometry.uvsneedupdate = true; };