क्या मौजूदा इंडेक्स के चेहरे पर सामग्री इंडेक्स को बदलने का कोई तरीका है? How to Update Things दस्तावेज़ीकरण में इस पर चर्चा नहीं की गई है, इसलिए मुझे यकीन नहीं है कि यह संभव है या नहीं। मैं इसके लिए एक वेबGLRenderer संदर्भ का उपयोग कर रहा हूँ।तीन.जेएस ज्यामिति चेहरे को अद्यतन करना materialindex
यह मूलतः मैं क्या करने की कोशिश कर रहा हूँ है:
// Make a mesh with two materials
var texture = THREE.ImageUtils.loadTexture(IMAGE_URL);
var geometry = new THREE.Geometry();
geometry.materials.push(new THREE.MeshBasicMaterial({ wireframe: true, vertexColors: THREE.FaceColors}));
geometry.materials.push(new THREE.MeshBasicMaterial({ map: texture, overdraw: true}));
whatever.forEach(function(w, i) {
geometry.vertices.push(makeVerts(w));
var materialIndex = 0;
var color = new THREE.Color(i);
geometry.faces.push(new THREE.Face4(i*4+0, i*4+1, i*4+2, i*4+3,
null, color, materialIndex));
});
var mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial());
scene.add(mesh)
// Later on, change some faces to a different material
geometry.faces.filter(someFilter).forEach(function(face) {
face.color = someOtherColor;
face.materialIndex = 1;
}
geometry.colorsNeedUpdate = true; // This is how to update the color, and it works.
//geometry.materialsNeedUpdate = true; // This isn't a thing, is it?
आह, यह समझ में आता है। व्यवहार के पीछे कारण बताते हुए धन्यवाद। – JDS