Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit b0b14c8

Browse files
authored
Merge pull request #243 from javagl/SimpleSkin
Added SimpleSkin example
2 parents 5aec133 + 8907423 commit b0b14c8

File tree

13 files changed

+287
-0
lines changed

13 files changed

+287
-0
lines changed

2.0/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| [Simple Meshes](SimpleMeshes) | ![](SimpleMeshes/screenshot/screenshot.png) | A simple `scene` with two `nodes`, both containing the same `mesh`, namely a `mesh` with a single `mesh.primitive` with a single indexed triangle with *multiple* attributes (positions, normals and texture coordinates), but without a `material` |
1313
| [Simple Morph](SimpleMorph) | ![](SimpleMorph/screenshot/screenshot.png) | A triangle with a morph animation applied |
1414
| [Simple Sparse Accessor](SimpleSparseAccessor) | ![](SimpleSparseAccessor/screenshot/screenshot.png) | A simple mesh that uses sparse accessors |
15+
| [Simple Skin](SimpleSkin) | ![](SimpleSkin/screenshot/screenshot.gif) | A simple example of vertex skinning in glTF
1516
| [Cameras](Cameras) | ![](Cameras/screenshot/screenshot.png) | A sample with two different `camera` objects |
1617
| [Interpolation Test](InterpolationTest) | ![](InterpolationTest/screenshot/screenshot.gif) | A sample with three different `animation` interpolations |
1718

2.0/SimpleSkin/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SimpleSkin
2+
3+
A simple example for vertex skinning in glTF 2.0.
4+
5+
Details about skinning using this particular model are explained in the
6+
[skinning section of the glTF tutorial](https://github.com/javagl/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_019_SimpleSkin.md).
7+
8+
## Screenshot
9+
10+
![screenshot](screenshot/screenshot.gif)
11+
12+
## License Information
13+
14+
Public domain ([CC0](https://creativecommons.org/publicdomain/zero/1.0/))
15+
16+
## Data layout
17+
18+
The following images show the data layout of this sample:
19+
20+
![skinGeometry](screenshot/skinGeometry.png)
21+
![skinAnimation](screenshot/skinAnimation.png)
22+
![inverseBindMatrices](screenshot/inverseBindMatrices.png)
23+
![skinningData](screenshot/skinningData.png)
24+
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
{
2+
"scene" : 0,
3+
"scenes" : [ {
4+
"nodes" : [ 0, 1 ]
5+
} ],
6+
7+
"nodes" : [ {
8+
"skin" : 0,
9+
"mesh" : 0
10+
}, {
11+
"children" : [ 2 ],
12+
"translation" : [ 0.0, 1.0, 0.0 ]
13+
}, {
14+
"rotation" : [ 0.0, 0.0, 0.0, 1.0 ]
15+
} ],
16+
17+
"meshes" : [ {
18+
"primitives" : [ {
19+
"attributes" : {
20+
"POSITION" : 1,
21+
"JOINTS_0" : 2,
22+
"WEIGHTS_0" : 3
23+
},
24+
"indices" : 0
25+
} ]
26+
} ],
27+
28+
"skins" : [ {
29+
"inverseBindMatrices" : 4,
30+
"joints" : [ 1, 2 ]
31+
} ],
32+
33+
"animations" : [ {
34+
"channels" : [ {
35+
"sampler" : 0,
36+
"target" : {
37+
"node" : 2,
38+
"path" : "rotation"
39+
}
40+
} ],
41+
"samplers" : [ {
42+
"input" : 5,
43+
"interpolation" : "LINEAR",
44+
"output" : 6
45+
} ]
46+
} ],
47+
48+
"buffers" : [ {
49+
"uri" : "data:application/gltf-buffer;base64,AAABAAMAAAADAAIAAgADAAUAAgAFAAQABAAFAAcABAAHAAYABgAHAAkABgAJAAgAAAAAvwAAAAAAAAAAAAAAPwAAAAAAAAAAAAAAvwAAAD8AAAAAAAAAPwAAAD8AAAAAAAAAvwAAgD8AAAAAAAAAPwAAgD8AAAAAAAAAvwAAwD8AAAAAAAAAPwAAwD8AAAAAAAAAvwAAAEAAAAAAAAAAPwAAAEAAAAAA",
50+
"byteLength" : 168
51+
}, {
52+
"uri" : "data:application/gltf-buffer;base64,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAABAPwAAgD4AAAAAAAAAAAAAQD8AAIA+AAAAAAAAAAAAAAA/AAAAPwAAAAAAAAAAAAAAPwAAAD8AAAAAAAAAAAAAgD4AAEA/AAAAAAAAAAAAAIA+AABAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAA=",
53+
"byteLength" : 320
54+
}, {
55+
"uri" : "data:application/gltf-buffer;base64,AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAgL8AAAAAAACAPwAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAIC/AAAAAAAAgD8=",
56+
"byteLength" : 128
57+
}, {
58+
"uri" : "data:application/gltf-buffer;base64,AAAAAAAAAD8AAIA/AADAPwAAAEAAACBAAABAQAAAYEAAAIBAAACQQAAAoEAAALBAAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAkxjEPkSLbD8AAAAAAAAAAPT9ND/0/TQ/AAAAAAAAAAD0/TQ/9P00PwAAAAAAAAAAkxjEPkSLbD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAkxjEvkSLbD8AAAAAAAAAAPT9NL/0/TQ/AAAAAAAAAAD0/TS/9P00PwAAAAAAAAAAkxjEvkSLbD8AAAAAAAAAAAAAAAAAAIA/",
59+
"byteLength" : 240
60+
} ],
61+
62+
"bufferViews" : [ {
63+
"buffer" : 0,
64+
"byteLength" : 48,
65+
"target" : 34963
66+
}, {
67+
"buffer" : 0,
68+
"byteOffset" : 48,
69+
"byteLength" : 120,
70+
"target" : 34962
71+
}, {
72+
"buffer" : 1,
73+
"byteLength" : 320,
74+
"byteStride" : 16
75+
}, {
76+
"buffer" : 2,
77+
"byteLength" : 128
78+
}, {
79+
"buffer" : 3,
80+
"byteLength" : 240
81+
} ],
82+
83+
"accessors" : [ {
84+
"bufferView" : 0,
85+
"componentType" : 5123,
86+
"count" : 24,
87+
"type" : "SCALAR"
88+
}, {
89+
"bufferView" : 1,
90+
"componentType" : 5126,
91+
"count" : 10,
92+
"type" : "VEC3",
93+
"max" : [ 0.5, 2.0, 0.0 ],
94+
"min" : [ -0.5, 0.0, 0.0 ]
95+
}, {
96+
"bufferView" : 2,
97+
"componentType" : 5123,
98+
"count" : 10,
99+
"type" : "VEC4"
100+
}, {
101+
"bufferView" : 2,
102+
"byteOffset" : 160,
103+
"componentType" : 5126,
104+
"count" : 10,
105+
"type" : "VEC4"
106+
}, {
107+
"bufferView" : 3,
108+
"componentType" : 5126,
109+
"count" : 2,
110+
"type" : "MAT4"
111+
}, {
112+
"bufferView" : 4,
113+
"componentType" : 5126,
114+
"count" : 12,
115+
"type" : "SCALAR",
116+
"max" : [ 5.5 ],
117+
"min" : [ 0.0 ]
118+
}, {
119+
"bufferView" : 4,
120+
"byteOffset" : 48,
121+
"componentType" : 5126,
122+
"count" : 12,
123+
"type" : "VEC4",
124+
"max" : [ 0.0, 0.0, 0.707, 1.0 ],
125+
"min" : [ 0.0, 0.0, -0.707, 0.707 ]
126+
} ],
127+
128+
"asset" : {
129+
"version" : "2.0"
130+
}
131+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
{
2+
"scene" : 0,
3+
"scenes" : [ {
4+
"nodes" : [ 0, 1 ]
5+
} ],
6+
7+
"nodes" : [ {
8+
"skin" : 0,
9+
"mesh" : 0
10+
}, {
11+
"children" : [ 2 ],
12+
"translation" : [ 0.0, 1.0, 0.0 ]
13+
}, {
14+
"rotation" : [ 0.0, 0.0, 0.0, 1.0 ]
15+
} ],
16+
17+
"meshes" : [ {
18+
"primitives" : [ {
19+
"attributes" : {
20+
"POSITION" : 1,
21+
"JOINTS_0" : 2,
22+
"WEIGHTS_0" : 3
23+
},
24+
"indices" : 0
25+
} ]
26+
} ],
27+
28+
"skins" : [ {
29+
"inverseBindMatrices" : 4,
30+
"joints" : [ 1, 2 ]
31+
} ],
32+
33+
"animations" : [ {
34+
"channels" : [ {
35+
"sampler" : 0,
36+
"target" : {
37+
"node" : 2,
38+
"path" : "rotation"
39+
}
40+
} ],
41+
"samplers" : [ {
42+
"input" : 5,
43+
"interpolation" : "LINEAR",
44+
"output" : 6
45+
} ]
46+
} ],
47+
48+
"buffers" : [ {
49+
"uri" : "skinGeometry.bin",
50+
"byteLength" : 168
51+
}, {
52+
"uri" : "skinningData.bin",
53+
"byteLength" : 320
54+
}, {
55+
"uri" : "inverseBindMatrices.bin",
56+
"byteLength" : 128
57+
}, {
58+
"uri" : "skinAnimation.bin",
59+
"byteLength" : 240
60+
} ],
61+
62+
"bufferViews" : [ {
63+
"buffer" : 0,
64+
"byteLength" : 48,
65+
"target" : 34963
66+
}, {
67+
"buffer" : 0,
68+
"byteOffset" : 48,
69+
"byteLength" : 120,
70+
"target" : 34962
71+
}, {
72+
"buffer" : 1,
73+
"byteLength" : 320,
74+
"byteStride" : 16
75+
}, {
76+
"buffer" : 2,
77+
"byteLength" : 128
78+
}, {
79+
"buffer" : 3,
80+
"byteLength" : 240
81+
} ],
82+
83+
"accessors" : [ {
84+
"bufferView" : 0,
85+
"componentType" : 5123,
86+
"count" : 24,
87+
"type" : "SCALAR"
88+
}, {
89+
"bufferView" : 1,
90+
"componentType" : 5126,
91+
"count" : 10,
92+
"type" : "VEC3",
93+
"max" : [ 0.5, 2.0, 0.0 ],
94+
"min" : [ -0.5, 0.0, 0.0 ]
95+
}, {
96+
"bufferView" : 2,
97+
"componentType" : 5123,
98+
"count" : 10,
99+
"type" : "VEC4"
100+
}, {
101+
"bufferView" : 2,
102+
"byteOffset" : 160,
103+
"componentType" : 5126,
104+
"count" : 10,
105+
"type" : "VEC4"
106+
}, {
107+
"bufferView" : 3,
108+
"componentType" : 5126,
109+
"count" : 2,
110+
"type" : "MAT4"
111+
}, {
112+
"bufferView" : 4,
113+
"componentType" : 5126,
114+
"count" : 12,
115+
"type" : "SCALAR",
116+
"max" : [ 5.5 ],
117+
"min" : [ 0.0 ]
118+
}, {
119+
"bufferView" : 4,
120+
"byteOffset" : 48,
121+
"componentType" : 5126,
122+
"count" : 12,
123+
"type" : "VEC4",
124+
"max" : [ 0.0, 0.0, 0.707, 1.0 ],
125+
"min" : [ 0.0, 0.0, -0.707, 0.707 ]
126+
} ],
127+
128+
"asset" : {
129+
"version" : "2.0"
130+
}
131+
}
128 Bytes
Binary file not shown.
240 Bytes
Binary file not shown.
168 Bytes
Binary file not shown.
320 Bytes
Binary file not shown.
44.1 KB
Loading
1.91 MB
Loading

0 commit comments

Comments
 (0)