8bit good for lighting and such - 32bit view for pixel copy?
This may speed it up a little?
let ctx = c.getContext("2d"); let canvasDataWrapper = ctx.getImageData(0, 0, c.width, c.height); let canvasData = imageDataWrapper.data; // 8 bit ARGB let canvasData32 = new Uint32Array(canvasData.buffer); // 32 bit pixel
copyFnc = function(idxC, idxT){ canvasData[idxC + 0] = textureData[idxT + 0]; canvasData[idxC + 1] = textureData[idxT + 1]; canvasData[idxC + 2] = textureData[idxT + 2]; canvasData[idxC + 3] = 255; };
Vs
copyFnc = function(idxC, idxT){ canvasData32[idxC] = textureData32[idxT] };
Hi thanks for your interest and taking the time to post this. I might not have time to look at this for a couple of months but I've always been curious as to whether this could be speeded up so I'm sure I'll look at it at some point.
I'm a firm believer of "relaxation driven development." That's where you're relaxed and decide to do a little bit of a puzzle/code for fun. Not that much around these days! Catch up with you in a month or two!