Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 11118x 11118x 10890x 10890x 9179x 1939x | import numberOfComponentsForType from "./numberOfComponentsForType.js";
import ComponentDatatype from "../../Core/ComponentDatatype.js";
import defined from "../../Core/defined.js";
/**
* Returns the byte stride of the provided accessor.
* If the byteStride is 0, it is calculated based on type and componentType
*
* @param {object} gltf A javascript object containing a glTF asset.
* @param {object} accessor The accessor.
* @returns {number} The byte stride of the accessor.
*
* @private
*/
function getAccessorByteStride(gltf, accessor) {
const bufferViewId = accessor.bufferView;
if (defined(bufferViewId)) {
const bufferView = gltf.bufferViews[bufferViewId];
if (defined(bufferView.byteStride) && bufferView.byteStride > 0) {
return bufferView.byteStride;
}
}
return (
ComponentDatatype.getSizeInBytes(accessor.componentType) *
numberOfComponentsForType(accessor.type)
);
}
export default getAccessorByteStride;
|