Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Driven by the deprecation of
RGBFormat
#962 and the optimisation of the BGR flip.An RGB image is represented as an array of size
[rows, cols, 3]
, where the three values in the last dimension are for the red, green and blue channels (or blue, green and red). There's no alpha values, so if we want to use the typed array returned by the back-end provider as is, without looping through it (for performance reasons), we can't just switch toRGBAFormat
.So instead, we use a 3D texture with
REDFormat
and access each color component in a custom fragment shader with thetexture()
function. Three'sDataTexture3D
is still under development, so we have to set the format and type manually: https://github.com/mrdoob/three.js/blob/master/src/textures/DataTexture3D.jsThe cast/conversion to a compatible texture type remains the same as before.
The BGR flip is now done in the shader -- we no longer call
createArrayFromView
.