-
Notifications
You must be signed in to change notification settings - Fork 143
Description
Incorrect Callback Input Parameter in glTFLoader.getBufferViewData Function
In the glTFLoader.prototype._getBufferViewData function, when bufferViewData is not found (i.e., it is null or undefined) and the bufferData has already been loaded, the callback function incorrectly receives the bufferViewData. This leads to an erroneous result.
I believe the callback function should retrieve the correct bufferViewData from this._bufferViews[bufferViewID].
Here’s the relevant section of the code:
glTFLoader.prototype._getBufferViewData = function(json, bufferViewID, callback) {
var bufferViewData = this._bufferViews[bufferViewID];
if (!bufferViewData) {
var bufferView = json.bufferViews[bufferViewID];
var bufferData = this._buffers[bufferView.buffer];
if (bufferData) {
this._bufferViews[bufferViewID] = bufferData.slice(bufferView.byteOffset, bufferView.byteOffset + bufferView.byteLength);
// This callback should be updated to use the newly created this._bufferViews[bufferViewID]
callback(this._bufferViews[bufferViewID]);
}
}
};
Source: