update projection tests to use aspect-ratio other than 1
This commit is contained in:
@@ -9,7 +9,7 @@ import 'helpers.dart';
|
|||||||
|
|
||||||
Future<Texture> createTextureFromImage(TestHelper testHelper) async {
|
Future<Texture> createTextureFromImage(TestHelper testHelper) async {
|
||||||
final image = await FilamentApp.instance!.decodeImage(
|
final image = await FilamentApp.instance!.decodeImage(
|
||||||
File("${testHelper.testDir}/assets/cube_texture2_512x512.png")
|
File("${testHelper.testDir}/assets/cube_texture_512x512.png")
|
||||||
.readAsBytesSync());
|
.readAsBytesSync());
|
||||||
final texture = await FilamentApp.instance!
|
final texture = await FilamentApp.instance!
|
||||||
.createTexture(await image.getWidth(), await image.getHeight());
|
.createTexture(await image.getWidth(), await image.getHeight());
|
||||||
@@ -39,8 +39,10 @@ void main() async {
|
|||||||
await testHelper.withViewer((viewer) async {
|
await testHelper.withViewer((viewer) async {
|
||||||
final camera = await viewer.getActiveCamera();
|
final camera = await viewer.getActiveCamera();
|
||||||
await viewer.view.setFrustumCullingEnabled(false);
|
await viewer.view.setFrustumCullingEnabled(false);
|
||||||
await camera.setLensProjection(near: 0.75, far: 100);
|
|
||||||
final vp = await viewer.view.getViewport();
|
final vp = await viewer.view.getViewport();
|
||||||
|
await camera.setLensProjection(
|
||||||
|
near: 0.75, far: 100, aspect: vp.width / vp.height);
|
||||||
|
|
||||||
final (width, height) = (vp.width, vp.height);
|
final (width, height) = (vp.width, vp.height);
|
||||||
final dist = 2.5;
|
final dist = 2.5;
|
||||||
await camera.lookAt(
|
await camera.lookAt(
|
||||||
@@ -85,7 +87,11 @@ void main() async {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final result = await textureProjection.project(
|
final result = await textureProjection.project(
|
||||||
await (await viewer.view.getRenderTarget())!.getColorTexture(), cube);
|
await (await viewer.view.getRenderTarget())!.getColorTexture(),
|
||||||
|
cube);
|
||||||
|
final color = result.sourceView!;
|
||||||
|
await savePixelBufferToBmp(
|
||||||
|
color, width, height, "${testHelper.outDir.path}/color_$i.bmp");
|
||||||
final depth = result.depth;
|
final depth = result.depth;
|
||||||
await savePixelBufferToBmp(
|
await savePixelBufferToBmp(
|
||||||
depth, width, height, "${testHelper.outDir.path}/depth_$i.bmp");
|
depth, width, height, "${testHelper.outDir.path}/depth_$i.bmp");
|
||||||
@@ -207,7 +213,9 @@ void main() async {
|
|||||||
await testHelper.capture(viewer.view,
|
await testHelper.capture(viewer.view,
|
||||||
"capture_uv_blended_orbit_${frame.toString().padLeft(3, '0')}");
|
"capture_uv_blended_orbit_${frame.toString().padLeft(3, '0')}");
|
||||||
}
|
}
|
||||||
}, createRenderTarget: true);
|
},
|
||||||
|
createRenderTarget: true,
|
||||||
|
viewportDimensions: (height: 512, width: 1024));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user