vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
454 stars 72 forks source link

add cesium ext_mesh_features #199

Closed bertt closed 7 months ago

bertt commented 8 months ago

Adds Cesium EXT_Mesh_Features extension

Spec: https://github.com/CesiumGS/glTF/tree/proposal-EXT_mesh_features/extensions/2.0/Vendor/EXT_mesh_features

Sample using FeatureId's by custom vertex attribute see https://github.com/CesiumGS/3d-tiles-samples/blob/main/glTF/EXT_mesh_features/FeatureIdAttribute:

Sample using FeatureId's by texture see https://github.com/CesiumGS/3d-tiles-samples/blob/main/glTF/EXT_mesh_features/FeatureIdTexture

vpenades commented 8 months ago

I can't find the code that generates the ext.MeshFeaturesMesh.g.cs file.

Ideally, the PR should include the Build\ SharpGLTF.CodeGen code, so the generator and the generated code can be tracked to the same PR

It is fine to modify the codegen project to either:

bertt commented 7 months ago

Added the schemas (see https://github.com/bertt/SharpGLTF/tree/add_cesium_ext_mesh_features/src/SharpGLTF.Cesium/EXT_mesh_features/schema), next is generating the code.

vpenades commented 7 months ago

I've fixed the code generator, the field access was in the wrong method, and there's no good way of defining a default value, so I completely removed it (which I think it's the best choice)

I also changed the generated class names to something less generic as "FeatureID"

It's odd to me that these cesium extensions are "EXT" extensions, but I think that if they originated from Cesium they should be called something else, I don't know.

Anyway, I also dislike these alternate names, they're provisional until we settle on a better naming convention.