如何在 gltf 文件上添加元数据?
How to add metadata on a gltf file?
我有一个gltf,就是一套建筑。
我想为每个建筑物添加一些信息,为此,我需要为我的 gltf 模型添加一些属性。
但是,我尝试添加类似这样的内容
{
"accessors": [
{
"name": "object_1_1_0_positions",
"componentType": 5126,
"count": 4,
"min": [
-232.96347045898438,
3.5689821243286133,
-204.4241485595703
],
"max": [
-230.46347045898438,
35.427982330322266,
-204.4241485595703
],
"properties" : { "description" : "my description 1" }
"type": "VEC3",
"bufferView": 0,
"byteOffset": 0
},
{
"name": "object_1_1_0_normals",
"componentType": 5126,
"count": 4,
"min": [
-0.1212499663233757,
0,
0.9926220178604126
],
"max": [
-0.1212499663233757,
0,
0.9926220178604126
],
"properties" : { "description" : "my description 2" }
"type": "VEC3",
"bufferView": 1,
"byteOffset": 0
},
.....
}
但这破坏了 gltf。
如何向 gltf 添加一些元数据?
glTF 规范允许通过 extras
属性:
将元数据附加到对象
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#reference-extras
"extras" : { "description" : "my description 2" }
此外,不要忘记在 属性 之后添加一个逗号 – 此更改必须有效 JSON。
我有一个gltf,就是一套建筑。
我想为每个建筑物添加一些信息,为此,我需要为我的 gltf 模型添加一些属性。
但是,我尝试添加类似这样的内容
{
"accessors": [
{
"name": "object_1_1_0_positions",
"componentType": 5126,
"count": 4,
"min": [
-232.96347045898438,
3.5689821243286133,
-204.4241485595703
],
"max": [
-230.46347045898438,
35.427982330322266,
-204.4241485595703
],
"properties" : { "description" : "my description 1" }
"type": "VEC3",
"bufferView": 0,
"byteOffset": 0
},
{
"name": "object_1_1_0_normals",
"componentType": 5126,
"count": 4,
"min": [
-0.1212499663233757,
0,
0.9926220178604126
],
"max": [
-0.1212499663233757,
0,
0.9926220178604126
],
"properties" : { "description" : "my description 2" }
"type": "VEC3",
"bufferView": 1,
"byteOffset": 0
},
.....
}
但这破坏了 gltf。
如何向 gltf 添加一些元数据?
glTF 规范允许通过 extras
属性:
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#reference-extras
"extras" : { "description" : "my description 2" }
此外,不要忘记在 属性 之后添加一个逗号 – 此更改必须有效 JSON。