mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 14:10:19 +00:00
d74533b407
# Objective The objective is to be able to load data from "application-specific" (see glTF spec 3.7.2.1.) vertex attribute semantics from glTF files into Bevy meshes. ## Solution Rather than probe the glTF for the specific attributes supported by Bevy, this PR changes the loader to iterate through all the attributes and map them onto `MeshVertexAttribute`s. This mapping includes all the previously supported attributes, plus it is now possible to add mappings using the `add_custom_vertex_attribute()` method on `GltfPlugin`. ## Changelog - Add support for loading custom vertex attributes from glTF files. - Add the `custom_gltf_vertex_attribute.rs` example to illustrate loading custom vertex attributes. ## Migration Guide - If you were instantiating `GltfPlugin` using the unit-like struct syntax, you must instead use `GltfPlugin::default()` as the type is no longer unit-like.
80 lines
No EOL
1.5 KiB
JSON
80 lines
No EOL
1.5 KiB
JSON
{
|
|
"accessors": [
|
|
{
|
|
"bufferView": 0,
|
|
"byteOffset": 0,
|
|
"count": 4,
|
|
"componentType": 5126,
|
|
"type": "VEC3",
|
|
"min": [
|
|
-1.0,
|
|
-1.0,
|
|
0.0
|
|
],
|
|
"max": [
|
|
1.0,
|
|
1.0,
|
|
0.0
|
|
]
|
|
},
|
|
{
|
|
"bufferView": 0,
|
|
"byteOffset": 12,
|
|
"count": 4,
|
|
"componentType": 5126,
|
|
"type": "VEC4"
|
|
},
|
|
{
|
|
"bufferView": 0,
|
|
"byteOffset": 28,
|
|
"count": 4,
|
|
"componentType": 5126,
|
|
"type": "VEC3"
|
|
},
|
|
{
|
|
"bufferView": 1,
|
|
"byteOffset": 0,
|
|
"count": 6,
|
|
"componentType": 5123,
|
|
"type": "SCALAR"
|
|
}
|
|
],
|
|
"asset": {
|
|
"version": "2.0"
|
|
},
|
|
"buffers": [
|
|
{
|
|
"byteLength": 172,
|
|
"uri": "data:application/gltf-buffer;base64,AACAvwAAgL8AAAAAAACAPwAAAAAAAAAAAACAPwAAgD8AAAAAAAAAAAAAgD8AAIC/AAAAAAAAAD8AAAA/AAAAAAAAgD8AAAAAAACAPwAAAAAAAIC/AACAPwAAAAAAAAA/AAAAPwAAAAAAAIA/AAAAAAAAAAAAAIA/AACAPwAAgD8AAAAAAAAAAAAAgD8AAAAAAACAPwAAgD8AAAAAAAAAAAAAAQACAAIAAQADAA=="
|
|
}
|
|
],
|
|
"bufferViews": [
|
|
{
|
|
"buffer": 0,
|
|
"byteLength": 160,
|
|
"byteOffset": 0,
|
|
"byteStride": 40,
|
|
"target": 34962
|
|
},
|
|
{
|
|
"buffer": 0,
|
|
"byteLength": 12,
|
|
"byteOffset": 160,
|
|
"target": 34962
|
|
}
|
|
],
|
|
"meshes": [
|
|
{
|
|
"primitives": [
|
|
{
|
|
"attributes": {
|
|
"POSITION": 0,
|
|
"COLOR_0": 1,
|
|
"__BARYCENTRIC": 2
|
|
},
|
|
"indices": 3
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |