update example project
This commit is contained in:
@@ -52,10 +52,12 @@ class _MyAppState extends State<MyApp> {
|
|||||||
height: _vertical ? 400 : 200,
|
height: _vertical ? 400 : 200,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
child: GestureDetectingFilamentView(
|
child: FilamentGestureDetector(
|
||||||
showControls: true,
|
showControls: true,
|
||||||
controller: _filamentController,
|
controller: _filamentController,
|
||||||
),
|
child: FilamentWidget(
|
||||||
|
controller: _filamentController,
|
||||||
|
)),
|
||||||
)),
|
)),
|
||||||
Text(
|
Text(
|
||||||
"Target names : ${_targetNames.join(",")}, Animation names : ${_animationNames.join(",")}"),
|
"Target names : ${_targetNames.join(",")}, Animation names : ${_animationNames.join(",")}"),
|
||||||
@@ -71,13 +73,12 @@ class _MyAppState extends State<MyApp> {
|
|||||||
onSelected: (int item) async {
|
onSelected: (int item) async {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case -1:
|
case -1:
|
||||||
await _filamentController
|
await _filamentController.initialize();
|
||||||
.initialize();
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
await _filamentController
|
await _filamentController
|
||||||
.setBackgroundImage(
|
.setBackgroundImage(
|
||||||
'assets/background.ktx');
|
'assets/background.ktx');
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
await _filamentController.loadSkybox(
|
await _filamentController.loadSkybox(
|
||||||
@@ -217,18 +218,41 @@ class _MyAppState extends State<MyApp> {
|
|||||||
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(25, 25);
|
await _filamentController
|
||||||
|
.setBackgroundImagePosition(25, 25);
|
||||||
break;
|
break;
|
||||||
case 29:
|
case 29:
|
||||||
_light = await _filamentController.addLight(2, 6500, 15000000, 0,1,0, 0, -1 , 0, true);
|
_light = await _filamentController.addLight(
|
||||||
_light = await _filamentController.addLight(2, 6500, 15000000, 0,0,1, 0, 0 , -1, true);
|
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;
|
break;
|
||||||
case 30:
|
case 30:
|
||||||
if(_light != null) {
|
if (_light != null) {
|
||||||
await _filamentController.removeLight(_light!);
|
await _filamentController
|
||||||
|
.removeLight(_light!);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 31:
|
case 31:
|
||||||
@@ -239,8 +263,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
itemBuilder: (BuildContext context) =>
|
itemBuilder: (BuildContext context) =>
|
||||||
<PopupMenuEntry<int>>[
|
<PopupMenuEntry<int>>[
|
||||||
const PopupMenuItem(
|
const PopupMenuItem(
|
||||||
value: -1,
|
value: -1, child: Text("initialize")),
|
||||||
child: Text("initialize")),
|
|
||||||
const PopupMenuItem(
|
const PopupMenuItem(
|
||||||
value: 0,
|
value: 0,
|
||||||
child: Text("load background image")),
|
child: Text("load background image")),
|
||||||
@@ -318,54 +341,47 @@ class _MyAppState extends State<MyApp> {
|
|||||||
: 'set vertical')),
|
: 'set vertical')),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 26,
|
value: 26,
|
||||||
child:
|
child: Text('set camera pos to 0,0,3')),
|
||||||
Text('set camera pos to 0,0,3')),
|
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 27,
|
value: 27,
|
||||||
child:
|
child: Text('toggle framerate')),
|
||||||
Text('toggle framerate')),
|
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 28,
|
value: 28,
|
||||||
child:
|
child: Text('set bg image pos')),
|
||||||
Text('set bg image pos')),
|
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 29,
|
value: 29, child: Text('add light')),
|
||||||
child:
|
PopupMenuItem(
|
||||||
Text('add light')),
|
value: 30, child: Text('remove light')),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 30,
|
|
||||||
child:
|
|
||||||
Text('remove light')),
|
|
||||||
PopupMenuItem(
|
|
||||||
value: 31,
|
value: 31,
|
||||||
child:
|
child: Text('clear all lights')),
|
||||||
Text('clear all lights')),
|
|
||||||
]))),
|
]))),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
child: Row(children:[
|
child: Row(children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_rendering = !_rendering;
|
_rendering = !_rendering;
|
||||||
_filamentController.setRendering(_rendering);
|
_filamentController.setRendering(_rendering);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child:Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: const EdgeInsets.all(50),
|
padding: const EdgeInsets.all(50),
|
||||||
child:Text("Rendering: $_rendering "))),
|
child: Text("Rendering: $_rendering "))),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_framerate = _framerate == 60 ? 30 : 60;
|
_framerate = _framerate == 60 ? 30 : 60;
|
||||||
_filamentController.setFrameRate(_framerate);
|
_filamentController.setFrameRate(_framerate);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child:Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: const EdgeInsets.all(50),
|
padding: const EdgeInsets.all(50),
|
||||||
child:Text("$_framerate fps")) )]))
|
child: Text("$_framerate fps")))
|
||||||
|
]))
|
||||||
])));
|
])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user