javascript - Three js merging Geometries and Mesh -
three js ver67 current code -
var materials = []; var totalgeom = new three.geometry(); var cubemat; (var = 0; < datasetarray.length; i++) { var ptcolor = datasetarray[i].color; var value = datasetarray[i].value; var position = latlongtovector3(datasetarray[i].y, datasetarray[i].x, 600, 1); var cubegeom = new three.boxgeometry(5, 5, 1 + value / 20); cubemat = new three.meshlambertmaterial({ color: new three.color(ptcolor), opacity: 0.6 }); materials.push(cubemat); // cubegeom.updatematrix(); var cubemesh = new three.mesh(cubegeom, cubemat); cubemesh.position = position; cubemesh.lookat(scene.position); // totalgeom.merge(cubemesh.geometry, cubemesh.geometry.matrix); //three.geometryutils.setmaterialindex(cubemesh.geometry, i); three.geometryutils.merge(totalgeom, cubemesh); } var total = new three.mesh(totalgeom, new three.meshfacematerial(materials)); scene.add(total);
however message
deprecated: geometryutils's .merge() has been moved geometry. use geometry.merge( geometry2, matrix, materialindexoffset ) instead.
in chrome dev tools.
when try - totalgeom.merge(cubemesh.geometry, cubemesh.geometry.matrix); instead of three.geometryutils.merge(totalgeom, cubemesh); exceptions.
how above merge? please help.
do this:
cubemesh.updatematrix(); totalgeom.merge( cubemesh.geometry, cubemesh.matrix );
for further understanding, see source code of three.geometry.merge()
.
three.js r.69
Comments
Post a Comment