Babylon.js
Babylon.js copied to clipboard
Add support for draco compression to Core
This PR add support for draco compression to the Core lib. For the purpose, we divided the DracoCompression class into an Encoder and a Decoder, keeping the old API with a deprecated flag. We now have a
- DracoCommons file which encompass all the standard declarations and interfaces
- DracoEncoder for encoding purpose
- DracoDecoder for decoding purpose.
- DracoCompression has been kept for backward compatibility, but greatly reduced as kind of decorator.
NO regression has been observed using GLTF Loader with KHR_draco_mesh_compression Test has been Also conducted by compressing and decompressing mesh on the fly using
// encode the mesh
var encoder = new BABYLON.DracoEncoder();
return encoder.encodeMeshAsync(mesh).then((encoded)=> {
// once done decode the mesh
var decoder = new BABYLON.DracoDecoder();
return decoder
.decodeMeshAsync(encoded.data, encoded.attributes)
.then((babylonVertexData) => {
// and apply the geometry to new mesh
const name = mesh.Name + "Dracoized"
const babylonMesh = new BABYLON.Mesh(name, scene);
babylonVertexData.applyToMesh(babylonMesh)
// finally return the mesh
return babylonMesh;
})
.catch((error) => {
throw new Error(`${error.message}`);
});
from playground Note the above playround will not be functional until the PR will be merge. Test has been conducted changing the Draco wasm configuration to local
let baseEncoderUrl = "http://localhost:1337/";
const codecConfiguration = {
decoder: {
wasmUrl: baseEncoderUrl + "draco_wasm_wrapper_gltf.js",
wasmBinaryUrl: baseEncoderUrl + "draco_decoder_gltf.wasm",
fallbackUrl: baseEncoderUrl + "draco_decoder_gltf.js",
},
encoder: {
wasmUrl: baseEncoderUrl + "draco_encoder_wrapper.js",
wasmBinaryUrl: baseEncoderUrl + "draco_encoder.wasm",
fallbackUrl: baseEncoderUrl + "draco_encoder.js",
},
};
BABYLON.DracoEncoder.Configuration = codecConfiguration.encoder;
BABYLON.DracoDecoder.Configuration = codecConfiguration.decoder;
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Snapshot stored with reference name: refs/pull/12628/merge
Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html
To test a playground add it to the URL, for example:
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html#WGZLGJ#4600
Links to test babylon tools with this snapshot:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/12628/merge https://gui.babylonjs.com/?snapshot=refs/pull/12628/merge https://nme.babylonjs.com/?snapshot=refs/pull/12628/merge
To test the snapshot in the playground with a playground ID add it after the snapshot query string:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge#BCU1XR#0
Visualization tests for webgl1 have failed. If some tests failed because the snapshots do not match, the report can be found at
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/testResults/webgl1/index.html
If tests were successful afterwards, this report might not be available anymore.
Visualization tests for webgl2 have failed. If some tests failed because the snapshots do not match, the report can be found at
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/testResults/webgl2/index.html
If tests were successful afterwards, this report might not be available anymore.
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Snapshot stored with reference name: refs/pull/12628/merge
Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html
To test a playground add it to the URL, for example:
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html#WGZLGJ#4600
Links to test babylon tools with this snapshot:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/12628/merge https://gui.babylonjs.com/?snapshot=refs/pull/12628/merge https://nme.babylonjs.com/?snapshot=refs/pull/12628/merge
To test the snapshot in the playground with a playground ID add it after the snapshot query string:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge#BCU1XR#0
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Snapshot stored with reference name: refs/pull/12628/merge
Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html
To test a playground add it to the URL, for example:
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html#WGZLGJ#4600
Links to test babylon tools with this snapshot:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/12628/merge https://gui.babylonjs.com/?snapshot=refs/pull/12628/merge https://nme.babylonjs.com/?snapshot=refs/pull/12628/merge
To test the snapshot in the playground with a playground ID add it after the snapshot query string:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge#BCU1XR#0
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Snapshot stored with reference name: refs/pull/12628/merge
Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html
To test a playground add it to the URL, for example:
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12628/merge/index.html#WGZLGJ#4600
Links to test babylon tools with this snapshot:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/12628/merge https://gui.babylonjs.com/?snapshot=refs/pull/12628/merge https://nme.babylonjs.com/?snapshot=refs/pull/12628/merge
To test the snapshot in the playground with a playground ID add it after the snapshot query string:
https://playground.babylonjs.com/?snapshot=refs/pull/12628/merge#BCU1XR#0
cc @pandaGaume to see if he has a few cycles to finish this one? Thanks a million!
@pandaGaume, do you think you ll be able to finish this one ? or should we flag as draft until someone can pick up where it is ?
@pandaGaume I'm closing this PR for now. We can reopen if it becomes active again.