I am new to three.js(10 days) and I'm trying to replicate this codepen project:
(我是three.js(10天)的新手,我正在尝试复制此Codepen项目:)
https://codepen.io/zadvorsky/pen/PNXbGo
(https://codepen.io/zadvorsky/pen/PNXbGo)
but I get this error :
(但我得到这个错误:)
script.js:140 Uncaught TypeError: Cannot read property 'ModelBufferGeometry' of undefined
(script.js:140未捕获的TypeError:无法读取未定义的属性“ ModelBufferGeometry”)
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:
(ps:这是我的codepen:)
https://codepen.io/MedicM91/pen/LYEPErG
(https://codepen.io/MedicM91/pen/LYEPErG)
ask by MarioM91 translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…