rename from *FFI to *RenderThread, return bool from render() to check frame timings, update render loop to wait on condition variable, add requestFrame() method

This commit is contained in:
Nick Fisher
2024-09-21 10:21:46 +08:00
parent b5a7996769
commit 57872d2e40
14 changed files with 1170 additions and 1135 deletions

View File

@@ -92,7 +92,8 @@ void main() async {
print(frustum.plane5.normal);
print(frustum.plane5.constant);
await viewer.setCameraLensProjection(near:10.0, far:1000.0, aspect:1.0, focalLength:28.0);
await viewer.setCameraLensProjection(
near: 10.0, far: 1000.0, aspect: 1.0, focalLength: 28.0);
frustum = await viewer.getCameraFrustum();
print(frustum.plane5.normal);
print(frustum.plane5.constant);
@@ -459,7 +460,7 @@ void main() async {
expect(materialInstance, isNotNull);
// with depth write enabled on both materials, cube2 renders behind the white cube
await _capture(viewer, "material_instance_depth_write_enabled");
await _capture(viewer, "material_instance_depth_write_enabled");
// if we disable depth write on cube1, then cube2 will always appear in front
// (relying on insertion order)
@@ -468,12 +469,11 @@ void main() async {
// set priority for the cube1 cube to 7 (render) last, cube1 renders in front
await viewer.setPriority(cube1, 7);
await _capture(viewer, "material_instance_depth_write_disabled_with_priority");
await _capture(
viewer, "material_instance_depth_write_disabled_with_priority");
});
});
// test('create instance from glb when keepData is true', () async {
// var model = await viewer.loadGlb("$testDir/cube.glb", keepData: true);
// await viewer.transformToUnitCube(model);
@@ -901,6 +901,16 @@ void main() async {
});
});
group("render thread", () {
test("request frame on render thread", () async {
var viewer = await createViewer();
viewer.requestFrame();
await Future.delayed(Duration(milliseconds: 20));
await viewer.dispose();
});
});
group("unproject", () {
test("unproject", () async {
final dimensions = (width: 1280, height: 768);