I am new to three.js(10 days) and I'm trying to replicate this codepen project:
https://codepen.io/zadvorsky/pen/PNXbGo
but I get this error :
script.js:140 Uncaught TypeError: Cannot read property 'ModelBufferGeometry' of undefined
function SlideGeometry(model) {
THREE.BAS.ModelBuffergeometry.call(this, model);
}
SlideGeometry.prototype = Object.create(THREE.BAS.ModelBufferGeometry.prototype);
SlideGeometry.prototype.constructor = SlideGeometry;
SlideGeometry.prototype.bufferPositions = function() {
var positionBuffer = this.createAttribute('position', 3).array;
for (var i = 0; i < this.faceCount; i++) {
var face = this.ModelGeometry.faces[i];
var centroid = THREE.BAS.Utils.computeCentroid(this.modelGeometry, face);
var a = this.modelgeometry.vertices[faces.a];
var b = this.modelgeometry.vertices[faces.b];
var c = this.modelgeometry.vertices[faces.c];
positionBuffer[face.a * 3] = a.x - centroid.x;
positionBuffer[face.a * 3 + 1] = a.y - centroid.y;
positionBuffer[face.a * 3 + 2] = a.z - centroid.z;
positionBuffer[face.b * 3] = b.x - centroid.x;
positionBuffer[face.b * 3 + 1] = b.y - centroid.y;
positionBuffer[face.b * 3 + 2] = b.z - centroid.z;
positionBuffer[face.c * 3] = c.x - centroid.x;
positionBuffer[face.c * 3 + 1] = c.y - centroid.y;
positionBuffer[face.c * 3 + 2] = c.z - centroid.z;
}
};
what am I doing wrong? Can someone explain me?
ps: this is my codepen: