Thanks for the input! And yes, I’m happy to hear from you guys. I missed you.
Given the example, I may easily make it work using the following code:
/**
* @internal
*/
public _loadVertexDataAsync(
context: string,
primitive: IMeshPrimitive,
babylonMesh: Mesh
): Nullable<Promise<Geometry>> {
this._assignFeatureIds(babylonMesh, primitive.extensions?.EXT_mesh_features);
return null;
}
private _assignFeatureIds(babylonObject: any, gltfProp: IProperty): void {
if (HasFeatureIds(gltfProp)) {
babylonObject.featureIds = babylonObject.featureIds ?? [];
for (const i of gltfProp.featureIds) {
babylonObject.featureIds.push(i);
}
}
}
However, the unknown attributes are not loaded. Even when returning null
to allow the default behavior, the list of attributes is already defined.
In the context of the following glTF :
[
{
"primitives": [
{
"extensions": {
"EXT_mesh_features": {
"featureIds": [
{
"featureCount": 4,
"attribute": 0
}
]
}
},
"attributes": {
"POSITION": 1,
"NORMAL": 2,
"_FEATURE_ID_0": 3
},
"indices": 0,
"material": 0,
"mode": 4
}
]
}
]
The _FEATURE_ID_0
attribute is not loaded.
Moreover, when dealing with extensions for textures ids in a glTF model like:
[
{
"primitives": [
{
"extensions": {
"EXT_mesh_features": {
"featureIds": [
{
"featureCount": 4,
"texture": {
"index": 1,
"texCoord": 0,
"channels": [0]
}
}
]
}
},
"attributes": {
"POSITION": 1,
"NORMAL": 2,
"TEXCOORD_0": 3
},
"indices": 0,
"material": 0,
"mode": 4
}
]
}
]
You can spot a TEXCOORD_0
attribute, which collides with the standard GLTF and Babylon.js TEXCOORD_0
kind in this line
So what would be the best way to handle the loading of attributes without needing to rewrite the entire function? work arround with the TEXCOORD_xxxx
duplicate ? I believe I might have to duplicate the entire function, but you may have a better idea, because many private or internal types are involved. …
**** EDIT ****
In the meantime, I duplicated the _loadVertexDataAsync
function with a proper type workaround, and that did the job. However, I haven’t handled the TEXCOORD_xxx
duplication yet.
**** EDIT ****
done the duplicate… will test and post the code tomorrow… late in Paris now…