update example projet
This commit is contained in:
Binary file not shown.
@@ -44,15 +44,15 @@
|
||||
],
|
||||
"name" : "Camera",
|
||||
"rotation" : [
|
||||
0.5797627568244934,
|
||||
0.0033576595596969128,
|
||||
-0.013425502926111221,
|
||||
0.8146679401397705
|
||||
0.5715538859367371,
|
||||
0,
|
||||
0,
|
||||
0.8205645084381104
|
||||
],
|
||||
"translation" : [
|
||||
0,
|
||||
6.8069868087768555,
|
||||
10.594138145446777
|
||||
10.164137840270996
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -68,6 +68,27 @@
|
||||
"type" : "perspective"
|
||||
}
|
||||
],
|
||||
"animations" : [
|
||||
{
|
||||
"channels" : [
|
||||
{
|
||||
"sampler" : 0,
|
||||
"target" : {
|
||||
"node" : 0,
|
||||
"path" : "translation"
|
||||
}
|
||||
}
|
||||
],
|
||||
"name" : "FloatUp",
|
||||
"samplers" : [
|
||||
{
|
||||
"input" : 36,
|
||||
"interpolation" : "LINEAR",
|
||||
"output" : 37
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"materials" : [
|
||||
{
|
||||
"doubleSided" : true,
|
||||
@@ -589,6 +610,24 @@
|
||||
"componentType" : 5126,
|
||||
"count" : 148,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 36,
|
||||
"componentType" : 5126,
|
||||
"count" : 60,
|
||||
"max" : [
|
||||
2.5
|
||||
],
|
||||
"min" : [
|
||||
0.041666666666666664
|
||||
],
|
||||
"type" : "SCALAR"
|
||||
},
|
||||
{
|
||||
"bufferView" : 37,
|
||||
"componentType" : 5126,
|
||||
"count" : 60,
|
||||
"type" : "VEC3"
|
||||
}
|
||||
],
|
||||
"bufferViews" : [
|
||||
@@ -771,11 +810,21 @@
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1776,
|
||||
"byteOffset" : 87020
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 240,
|
||||
"byteOffset" : 88796
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 720,
|
||||
"byteOffset" : 89036
|
||||
}
|
||||
],
|
||||
"buffers" : [
|
||||
{
|
||||
"byteLength" : 88796,
|
||||
"byteLength" : 89756,
|
||||
"uri" : "cube.bin"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -23,6 +23,7 @@ class _MyAppState extends State<MyApp> {
|
||||
int _primitiveIndex = 0;
|
||||
final weights = List.filled(255, 0.0);
|
||||
List<String> _targets = [];
|
||||
bool _loop = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -62,6 +63,7 @@ class _MyAppState extends State<MyApp> {
|
||||
onPressed: () async {
|
||||
await _filamentController.loadGltf(
|
||||
'assets/cube.gltf', 'assets');
|
||||
print(await _filamentController.getAnimationNames());
|
||||
}),
|
||||
ElevatedButton(
|
||||
child: const Text('set all weights to 1'),
|
||||
@@ -76,8 +78,14 @@ class _MyAppState extends State<MyApp> {
|
||||
.applyWeights(List.filled(8, 0));
|
||||
}),
|
||||
ElevatedButton(
|
||||
onPressed: () => _filamentController.playAnimation(0),
|
||||
onPressed: () =>
|
||||
_filamentController.playAnimation(0, loop:_loop),
|
||||
child: const Text('play animation')),
|
||||
Checkbox(
|
||||
onChanged: (_) => setState(() {
|
||||
_loop = !_loop;
|
||||
}),
|
||||
value: _loop),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_filamentController.zoom(-1.0);
|
||||
@@ -90,7 +98,7 @@ class _MyAppState extends State<MyApp> {
|
||||
child: const Text('zoom out')),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_filamentController.setCamera("Camera.001");
|
||||
_filamentController.setCamera("Camera");
|
||||
},
|
||||
child: const Text('set camera')),
|
||||
ElevatedButton(
|
||||
@@ -105,7 +113,8 @@ class _MyAppState extends State<MyApp> {
|
||||
numWeights, frame / totalFrames))
|
||||
.reduce((accum, next) => accum + next);
|
||||
|
||||
_filamentController.animate(frames, numWeights, framerate.toDouble());
|
||||
_filamentController.animate(
|
||||
frames, numWeights, framerate.toDouble());
|
||||
},
|
||||
child: const Text('animate weights')),
|
||||
Builder(
|
||||
|
||||
Reference in New Issue
Block a user