update example project

This commit is contained in:
Nick Fisher
2022-09-09 13:02:36 +10:00
parent 122f691a76
commit 5b99f8fa4a

View File

@@ -21,6 +21,7 @@ class _MyAppState extends State<MyApp> {
FilamentAsset? _cube; FilamentAsset? _cube;
FilamentAsset? _flightHelmet; FilamentAsset? _flightHelmet;
FilamentLight? _light;
final weights = List.filled(255, 0.0); final weights = List.filled(255, 0.0);
List<String> _targetNames = []; List<String> _targetNames = [];
@@ -74,9 +75,9 @@ class _MyAppState extends State<MyApp> {
.initialize(); .initialize();
break; break;
case 0: case 0:
await _filamentController await _filamentController
.setBackgroundImage( .setBackgroundImage(
'assets/background.png'); 'assets/background.ktx');
break; break;
case 1: case 1:
await _filamentController.loadSkybox( await _filamentController.loadSkybox(
@@ -142,12 +143,6 @@ class _MyAppState extends State<MyApp> {
_loop = !_loop; _loop = !_loop;
}); });
break; break;
case 12:
_filamentController.zoom(-1.0);
break;
case 13:
_filamentController.zoom(1.0);
break;
case 14: case 14:
_filamentController.setCamera( _filamentController.setCamera(
_cube!, "Camera_Orientation"); _cube!, "Camera_Orientation");
@@ -216,16 +211,28 @@ class _MyAppState extends State<MyApp> {
break; break;
case 26: case 26:
await _filamentController.setCameraPosition( await _filamentController.setCameraPosition(
0, -3, 10); 0, 0, 3);
await _filamentController.setCameraRotation( await _filamentController.setCameraRotation(
pi / 8, 1, 0, 0); 0, 0, 1, 0);
break; break;
case 27: case 27:
_framerate = _framerate == 60 ? 30 : 60; _framerate = _framerate == 60 ? 30 : 60;
await _filamentController.setFrameRate(_framerate); await _filamentController.setFrameRate(_framerate);
break; break;
case 28: case 28:
await _filamentController.setBackgroundImagePosition(-5, -5); await _filamentController.setBackgroundImagePosition(25, 25);
break;
case 29:
_light = await _filamentController.addLight(2, 6500, 15000000, 0,1,0, 0, -1 , 0, true);
_light = await _filamentController.addLight(2, 6500, 15000000, 0,0,1, 0, 0 , -1, true);
break;
case 30:
if(_light != null) {
await _filamentController.removeLight(_light!);
}
break;
case 31:
await _filamentController.clearLights();
break; break;
} }
}, },
@@ -271,7 +278,7 @@ class _MyAppState extends State<MyApp> {
value: 6, child: Text('remove cube')), value: 6, child: Text('remove cube')),
const PopupMenuItem( const PopupMenuItem(
value: 20, value: 20,
child: Text('remove all assets')), child: Text('clear all assets')),
const PopupMenuItem( const PopupMenuItem(
value: 7, value: 7,
child: Text('set all weights to 1')), child: Text('set all weights to 1')),
@@ -289,10 +296,6 @@ class _MyAppState extends State<MyApp> {
child: Text(_loop child: Text(_loop
? "don't loop animation" ? "don't loop animation"
: "loop animation")), : "loop animation")),
const PopupMenuItem(
value: 12, child: Text('zoom in')),
const PopupMenuItem(
value: 13, child: Text('zoom out')),
const PopupMenuItem( const PopupMenuItem(
value: 14, child: Text('set camera')), value: 14, child: Text('set camera')),
const PopupMenuItem( const PopupMenuItem(
@@ -316,7 +319,7 @@ class _MyAppState extends State<MyApp> {
PopupMenuItem( PopupMenuItem(
value: 26, value: 26,
child: child:
Text('set camera pos to 0,1,10')), Text('set camera pos to 0,0,3')),
PopupMenuItem( PopupMenuItem(
value: 27, value: 27,
child: child:
@@ -325,6 +328,18 @@ class _MyAppState extends State<MyApp> {
value: 28, value: 28,
child: child:
Text('set bg image pos')), Text('set bg image pos')),
PopupMenuItem(
value: 29,
child:
Text('add light')),
PopupMenuItem(
value: 30,
child:
Text('remove light')),
PopupMenuItem(
value: 31,
child:
Text('clear all lights')),
]))), ]))),
Align( Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,