We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Scene.toJSON
image
If the original image is large enough, currently Scene.toJSON will generate a huge image (starting with "data:").
This will cause a perceptible delay.
The calling chain is as follows: Scene.toJSON -> Texture.toJSON -> Source.serializeImage -> ImageUtils.getDataURL
Texture.toJSON
Source.serializeImage
ImageUtils.getDataURL
According to the annotation, ImageUtils.getDataURL will return a URI instead of a URL (even though the name is getDataURL).
On modern platform, images will almost certainly be placed on the canvas, and turn into base64.
In this case, it still works well with ObjectLoader.parse
ObjectLoader.parse
class ImageUtils { static enableNetworkURL = false; // added static getDataURL( image ) { if ( /^data:/i.test( image.src ) ) { return image.src; } // add begin if ( ImageUtils.enableNetworkURL ) { if ( image instanceof HTMLImageElement ) return image.src; } // add end if ( typeof HTMLCanvasElement === 'undefined' ) { return image.src; } // ... } }
I think the natural way should be to pass some flags in the meta to control this behavior, but such a change would be too big.
meta
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
If the original image is large enough, currently
Scene.toJSON
will generate a huge image (starting with "data:").This will cause a perceptible delay.
The calling chain is as follows:
Scene.toJSON
->Texture.toJSON
->Source.serializeImage
->ImageUtils.getDataURL
According to the annotation,
ImageUtils.getDataURL
will return a URI instead of a URL (even though the name is getDataURL).On modern platform, images will almost certainly be placed on the canvas, and turn into base64.
Solution
In this case, it still works well with
ObjectLoader.parse
Alternatives
I think the natural way should be to pass some flags in the
meta
to control this behavior, but such a change would be too big.Additional context
No response
The text was updated successfully, but these errors were encountered: