-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Implement support for KHR_mesh_quantization #7157
Conversation
This change advertises support for KHR_quantized_geometry and allows to specify it as part of required extensions when loading glTF files. The reason why the actual extension class is empty is that the extension doesn't define any new JSON metadata, and merely allows the use of various quantized attributes in glTF file - and as far as I can tell Babylon.js already supports these quantized formats either by directly using the encoded data, or by decoding it into floating-point arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good. Some minor comments. We can merge after all the naming changes, etc.
*/ | ||
public enabled: boolean; | ||
|
||
private _loader: GLTFLoader; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to save the loader since it's only used in the constructor.
/** @hidden */ | ||
public dispose() { | ||
delete this._loader; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed once the private _loader field is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to remove this actually and I can't - the TypeScript compiler (iirc) requires that there's an implementation of dispose. It can be empty though, I'll fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, yes, the interface function is required.
const NAME = "KHR_quantized_geometry"; | ||
|
||
/** | ||
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_quantized_geometry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't verify since the spec hasn't been merged.
Also clean up unnecessary member variable
This change advertises support for
KHR_quantized_geometryKHR_mesh_quantizationand allows to specify it as part of required extensions when loading glTF files.
The reason why the actual extension class is empty is that the extension
doesn't define any new JSON metadata, and merely allows the use of
various quantized attributes in glTF file - and as far as I can tell
Babylon.js already supports these quantized formats either by directly
using the encoded data, or by decoding it into floating-point arrays.
Extension spec: KhronosGroup/glTF#1673
Validator support: KhronosGroup/glTF-Validator#124
Example model: BrainStem.glb.zip
Note that based on prior testing, Babylon.js de-facto supports this. This change is required because the extension is non-optional and Babylon.js refuses to load files with required extensions that aren't explicitly supported.