Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTFModel needlessly caches typed arrays for glTF buffer views #288

Open
xeolabs opened this issue Oct 24, 2018 · 0 comments
Open

GLTFModel needlessly caches typed arrays for glTF buffer views #288

xeolabs opened this issue Oct 24, 2018 · 0 comments
Assignees

Comments

@xeolabs
Copy link
Owner

xeolabs commented Oct 24, 2018

Describe the bug
GLTFModel caches some typed array data for buffer views, which is never used.

Within GLTFModel's loadBufferView() function we need to remove the lines between the REMOVE comments below:

function loadBufferView(ctx, bufferViewInfo) {

            var buffer = ctx.json.buffers[bufferViewInfo.buffer];

            bufferViewInfo._typedArray = null;

            var byteLength = bufferViewInfo.byteLength || 0;
            var byteOffset = bufferViewInfo.byteOffset || 0;

            bufferViewInfo._buffer = buffer._buffer.slice(byteOffset, byteOffset + byteLength);

            // REMOVE
            if (bufferViewInfo.target === 34963) {
                 bufferViewInfo._typedArray = new Uint16Array(bufferViewInfo._buffer);          
            } else if (bufferViewInfo.target == 34962) {
                bufferViewInfo._typedArray = new Float32Array(bufferViewInfo._buffer);            /
            } else {           
             }
            // REMOVE
        }

Expected behavior
Less memory used while loading glTF files.

@xeolabs xeolabs self-assigned this Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant