In my Geometry code, I am dynamically editing the data using an object called newData. This object contains arrays of face indexes and vertex indexes that have the same length as the original arrays but hold a certain form like [null, null, null, "4", "5", null, null...].
By iterating through all the faces and vertices, I split the data into two groups and update the pointers on the faces accordingly.
Although I know that I have correctly updated the geometry, the changes are not being displayed. I have tried using .elementsNeedUpdate which results in an error stating 'no property 'a' of undefined in InitWebGlObjects...' I couldn't find any references to 'a' in there.
I've attempted using vertices need update, but it doesn't do anything. Similarly, updateCentroids combined with the previous tool also has no effect.
I have heard about not being able to resize the buffer. Could someone explain what the buffer is and its length? Is it related to the number of vertices added to a model?
Someone suggested "You can emulate resizing by pre-allocating larger buffer and then keeping unneeded vertices collapsed / hidden." Does this mean I might be doing this unintentionally? How can I collapse or hide a vertex? I haven't come across any references for that.
Thank you for your assistance!
var oldVertices = this.vertices;
var oldFaces = this.faces;
var newVertices = [];
var newFaces = [];
var verticeChanges = [];
this.vertices = [];
this.faces = [];
for(var i in oldVertices){
var curAr = ((newData.vertices[i]) ? (newVertices) : (this.vertices));
curAr.push(oldVertices[i]);
verticeChanges[i] = curAr.length - 1;
}
for(var i in oldFaces){
var curAr = ((newData.faces[i]) ? (newFaces) : (this.faces));
oldFaces[i].a = verticeChanges[oldFaces[i].a];
oldFaces[i].b = verticeChanges[oldFaces[i].b];
oldFaces[i].c = verticeChanges[oldFaces[i].c];
}
console.log('Vertices Cut from', oldVertices.length, "to:", newVertices.length, 'and', this.vertices.length);
console.log('Faces Cut from', oldFaces.length, "to:", newFaces.length, 'and', this.faces.length);