add getCameraFrustum() and getCameraProjectionMatrix()

This commit is contained in:
Nick Fisher
2023-11-08 20:30:14 +08:00
parent 962d53442f
commit 2db353cc3b
12 changed files with 521 additions and 78 deletions

View File

@@ -57,6 +57,46 @@ class _CameraSubmenuState extends State<CameraSubmenu> {
child: Text(
"${ExampleWidgetState.frustumCulling ? "Disable" : "Enable"} frustum culling"),
),
MenuItemButton(
closeOnActivate: false,
onPressed: () async {
var projMatrix =
await widget.controller.getCameraProjectionMatrix();
await showDialog(
context: context,
builder: (ctx) {
return Center(
child: Container(
height: 100,
width: 300,
color: Colors.white,
child: Text(projMatrix.storage
.map((v) => v.toStringAsFixed(2))
.join(","))));
});
},
child: const Text("Get projection matrix")),
MenuItemButton(
closeOnActivate: false,
onPressed: () async {
var frustum = await widget.controller.getCameraFrustum();
await showDialog(
context: context,
builder: (ctx) {
return Center(
child: Container(
height: 300,
width: 300,
color: Colors.white,
child: Column(
children: frustum
.map((vector) => Text(vector.storage
.map((v) => v.toStringAsFixed(2))
.join(",")))
.toList())));
});
},
child: const Text("Get frustum")),
SubmenuButton(
menuChildren: ManipulatorMode.values.map((mm) {
return MenuItemButton(