خرید بک لینک

Vote count: 0

Somewhat new to Three.js and 3d libraries in general.

I merged two geometries (a quarter cylinder and a plane) using this code:

  var planeGeo = new THREE.PlaneGeometry(planeW, planeD / 2, 199, 399);
  var planeMesh = new THREE.Mesh(planeGeo);
  planeMesh.updateMatrix();

  var cylinderGeo = new THREE.CylinderGeometry(100, 100, planeW, 199, 399, true, 0, Math.PI / 2);
  cylinderGeo.rotateZ(Math.PI / 2).translate(0, 200, -100);
  var cylinderMesh = new THREE.Mesh(cylinderGeo);
  cylinderMesh.updateMatrix();

  var singleGeometry = new THREE.Geometry();
  singleGeometry.merge(planeMesh.geometry, planeMesh.matrix);
  singleGeometry.merge(cylinderMesh.geometry, cylinderMesh.matrix);

  var testmaterial = new THREE.MeshPhongMaterial({ color: 0x666666 });
  mesh = new THREE.Mesh(singleGeometry, testmaterial);
  scene.add(mesh);

<a href='http://backsoft.niloblog.com/p/8918/'>Merge</a>d geometries

I then would like to use a single material (png) over the entire thing. This code doesn't work:

textureLoader.load('data/test.png', function (texture) {
  material = new THREE.MeshLambertMaterial({
    map: texture
  });
});

Later in the block with the merging...

mesh = new THREE.Mesh(singleGeometry, material);
scene.add(mesh);

This results in:

Merged geometries, but material doubled

I would like the end result to be a single draped png over the entire merged geometry, but I can't find anything that suggests this is a normal thing to do. Is there a better way to achieve that result than merging geometries? Or am I just looking in the wrong places?

asked 10 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 6 شهريور 1395 ساعت: 1:39

صفحه بندی