-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TinyGltfImporter: support custom attributes.
- Loading branch information
Showing
13 changed files
with
389 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
40 changes: 40 additions & 0 deletions
40
src/MagnumPlugins/TinyGltfImporter/Test/mesh-custom-attributes.bin.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
type = '<' | ||
input = [] | ||
|
||
# _TBN as bytes, there has to be padding | ||
type += '3bx3bx3bx' | ||
input += [ | ||
1, 2, 3, | ||
4, 5, 6, | ||
7, 8, 9 | ||
] | ||
|
||
# _UV_ROTATION as bytes, again with padding | ||
type += '2bxx2bxx' | ||
input += [ | ||
10, 11, | ||
12, 13 | ||
] | ||
|
||
# _TBN_PRECISER as shorts, again padding | ||
type += '3hxx3hxx3hxx' | ||
input += [ | ||
-1, -2, -3, | ||
-4, -5, -6, | ||
-7, -8, -9 | ||
] | ||
|
||
# _DOUBLE_SHOT, _OBJECT_ID, _NEGATIVE_PADDING | ||
type += 'ddIixxxx' | ||
input += [31.2, 28.8, 5678125, -3548415] | ||
|
||
# _NOT_AN_IDENTITY | ||
type += '16d' | ||
input += [ | ||
0.1, 0.2, 0.3, 0.4, | ||
0.5, 0.6, 0.7, 0.8, | ||
0.9, 1.0, 1.1, 1.2, | ||
1.3, 1.4, 1.5, 1.6 | ||
] | ||
|
||
# kate: hl python |
89 changes: 89 additions & 0 deletions
89
src/MagnumPlugins/TinyGltfImporter/Test/mesh-custom-attributes.gltf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"asset": { | ||
"version": "2.0" | ||
}, | ||
"meshes": [ | ||
{ | ||
"primitives": [ | ||
{ | ||
"attributes": { | ||
"_TBN": 0, | ||
"_UV_ROTATION": 1, | ||
"_TBN_PRECISER": 2, | ||
"_DOUBLE_SHOT": 3, | ||
"_OBJECT_ID": 4, | ||
"_NEGATIVE_PADDING": 5, | ||
"_NOT_AN_IDENTITY": 6 | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"accessors": [ | ||
{ | ||
"bufferView": 0, | ||
"byteOffset": 0, | ||
"componentType": 5120, | ||
"normalized": true, | ||
"count": 1, | ||
"type": "MAT3" | ||
}, | ||
{ | ||
"bufferView": 0, | ||
"byteOffset": 12, | ||
"componentType": 5120, | ||
"normalized": true, | ||
"count": 1, | ||
"type": "MAT2" | ||
}, | ||
{ | ||
"bufferView": 0, | ||
"byteOffset": 20, | ||
"componentType": 5122, | ||
"normalized": true, | ||
"count": 1, | ||
"type": "MAT3" | ||
}, | ||
{ | ||
"bufferView": 0, | ||
"byteOffset": 44, | ||
"componentType": 5130, | ||
"count": 1, | ||
"type": "VEC2" | ||
}, | ||
{ | ||
"bufferView": 0, | ||
"byteOffset": 60, | ||
"componentType": 5125, | ||
"count": 1, | ||
"type": "SCALAR" | ||
}, | ||
{ | ||
"bufferView": 0, | ||
"byteOffset": 64, | ||
"componentType": 5124, | ||
"count": 1, | ||
"type": "SCALAR" | ||
}, | ||
{ | ||
"bufferView": 0, | ||
"byteOffset": 72, | ||
"componentType": 5130, | ||
"count": 1, | ||
"type": "MAT4" | ||
} | ||
], | ||
"bufferViews": [ | ||
{ | ||
"buffer": 0, | ||
"byteLength": 200, | ||
"byteStride": 200 | ||
} | ||
], | ||
"buffers": [ | ||
{ | ||
"byteLength": 200, | ||
"uri": "mesh-custom-attributes.bin" | ||
} | ||
] | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"asset":{"version":"2.0"},"meshes":[{"name":"Non-indexed mesh","primitives":[{"attributes":{"POSITION":1,"TEXCOORD_0":3}}]},{"name":"Indexed mesh","primitives":[{"attributes":{"NORMAL":2,"POSITION":1},"indices":0}]},{"name":"Mesh with unknown attribute","primitives":[{"attributes":{"POSITION":1,"UNKNOWN":1}}]},{"name":"Attribute-less mesh","primitives":[{"attributes":{}}]},{"name":"Attribute-less indexed mesh","primitives":[{"attributes":{},"indices":0}]}],"accessors":[{"bufferView":0,"componentType":5121,"count":3,"type":"SCALAR"},{"bufferView":1,"componentType":5126,"count":3,"type":"VEC3"},{"bufferView":1,"byteOffset":12,"componentType":5126,"count":3,"type":"VEC3"},{"bufferView":2,"componentType":5126,"count":3,"type":"VEC2"}],"bufferViews":[{"buffer":0,"byteLength":3,"byteOffset":0,"target":34963},{"buffer":0,"byteLength":72,"byteOffset":4,"byteStride":24,"target":34962},{"buffer":0,"byteLength":24,"byteOffset":76,"target":34962}],"buffers":[{"byteLength":100,"uri":"data:application/octet-stream;base64,AAECAAAAwD8AAIC/AAAAv83MzD3NzEw+mpmZPgAAAL8AACBAAABAP83MzD4AAAA/mpkZPwAAAMAAAIA/mpmZPjMzMz/NzEw/ZmZmP5qZmT4AAAAAAAAAAAAAAD+amZk+mpmZPg=="}]} | ||
{"asset":{"version":"2.0"},"meshes":[{"name":"Non-indexed mesh","primitives":[{"attributes":{"POSITION":1,"TEXCOORD_0":3}}]},{"name":"Indexed mesh","primitives":[{"attributes":{"NORMAL":2,"POSITION":1},"indices":0}]},{"name":"Attribute-less mesh","primitives":[{"attributes":{}}]},{"name":"Attribute-less indexed mesh","primitives":[{"attributes":{},"indices":0}]}],"accessors":[{"bufferView":0,"componentType":5121,"count":3,"type":"SCALAR"},{"bufferView":1,"componentType":5126,"count":3,"type":"VEC3"},{"bufferView":1,"byteOffset":12,"componentType":5126,"count":3,"type":"VEC3"},{"bufferView":2,"componentType":5126,"count":3,"type":"VEC2"}],"bufferViews":[{"buffer":0,"byteLength":3,"byteOffset":0,"target":34963},{"buffer":0,"byteLength":72,"byteOffset":4,"byteStride":24,"target":34962},{"buffer":0,"byteLength":24,"byteOffset":76,"target":34962}],"buffers":[{"byteLength":100,"uri":"data:application/octet-stream;base64,AAECAAAAwD8AAIC/AAAAv83MzD3NzEw+mpmZPgAAAL8AACBAAABAP83MzD4AAAA/mpkZPwAAAMAAAIA/mpmZPjMzMz/NzEw/ZmZmP5qZmT4AAAAAAAAAAAAAAD+amZk+mpmZPg=="}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.