When utilizing the ExplodeModifier to duplicate vertices for individual control over Face3
objects, I encountered a visual issue and decided to add 3 extra faces per existing face to create a pyramid shape pointing inwards the geometry.
Although I successfully modified the ExplodeModifier to generate the additional faces, I am encountering multiple errors:
THREE.DirectGeometry.fromGeometry(): Undefined vertexUv and THREE.BufferAttribute.copyVector3sArray(): vector is undefined
To address the fact that there are now 9 extra vertices per face, I attempted to duplicate the UV coordinates even though I do not require textures. This resolved one warning but I am still struggling with the copyVector2sArray
error...
Pseudo code snippet:
var geometry = new THREE.IcosahedronGeometry(200, 1);
var material = new THREE.MeshPhongMaterial({ shading: THREE.FlatShading });
var explodeModifier = new THREE.ExplodeModifier();
explodeModifier.modify(geometry);
var mesh = new THREE.Mesh(geometry, material);
scene.addChild(mesh);
The pseudo code for the Explode Modifier is as follows:
var vertices = [];
var faces = [];
for (var i = 0, il = geometry.faces.length; i < il; i++) {
(...)
var extraFace1 = new THREE.Face3().copy(face)
extraFace1.c = geometry.vertices[0]
var extraFace2 = new THREE.Face3().copy(face)
extraFace2.b = geometry.vertices[0]
var extraFace3 = new THREE.Face3().copy(face)
extraFace3.a = geometry.vertices[0]
faces.push(extraFace1);
faces.push(extraFace2);
faces.push(extraFace3);
}
geometry.vertices = vertices;
geometry.faces = faces;
I have included an example HERE. It functions properly, but my goal is to eliminate the console warnings...