From 08e1eb7778b9d99cb3fc7cb2a685a142f215ced7 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Sat, 24 Aug 2024 16:22:12 +0800 Subject: [PATCH] feat: expose setLayerEnabled, viewportDimensions and getCameraFov on ThermionView --- .../lib/thermion_dart/thermion_viewer.dart | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/thermion_dart/lib/thermion_dart/thermion_viewer.dart b/thermion_dart/lib/thermion_dart/thermion_viewer.dart index 14597a90..d268ba16 100644 --- a/thermion_dart/lib/thermion_dart/thermion_viewer.dart +++ b/thermion_dart/lib/thermion_dart/thermion_viewer.dart @@ -63,6 +63,8 @@ abstract class ThermionViewer { /// late (double, double) viewportDimensions; + late double pixelRatio; + /// /// The result(s) of calling [pick] (see below). /// This may be a broadcast stream, so you should ensure you have subscribed to this stream before calling [pick]. @@ -430,9 +432,15 @@ abstract class ThermionViewer { Future getMainCamera(); /// - /// Sets the current scene camera to the glTF camera under [name] in [entity]. + /// Sets the horizontal field of view (if [horizontal] is true) or vertical field of view for the currently active camera to [degrees]. + /// The aspect ratio of the current viewport is used. /// - Future setCameraFov(double degrees, double width, double height); + Future setCameraFov(double degrees, {bool horizontal = true}); + + /// + /// Gets the field of view (in degrees). + /// + Future getCameraFov(bool horizontal); /// /// Sets the tone mapping (requires postprocessing). @@ -571,6 +579,12 @@ abstract class ThermionViewer { ThermionEntity entity, double x, double y, double z, {bool relative = false}); + /// + /// TODO + /// + Future queueRelativePositionUpdateWorldAxis(ThermionEntity entity, + double viewportX, double viewportY, double x, double y, double z); + /// /// Queues an update to the worldspace rotation for [entity]. /// The actual update will occur on the next frame, and will be subject to collision detection. @@ -719,7 +733,8 @@ abstract class ThermionViewer { /// /// Sets the parent transform of [child] to [parent]. /// - Future setParent(ThermionEntity child, ThermionEntity parent, { bool preserveScaling }); + Future setParent(ThermionEntity child, ThermionEntity parent, + {bool preserveScaling}); /// /// Test all collidable entities against this entity to see if any have collided. @@ -751,5 +766,11 @@ abstract class ThermionViewer { /// Gets the 2D bounding box (in viewport coordinates) for the given entity. /// Future getBoundingBox(ThermionEntity entity); -} + /// + /// Filament assigns renderables to a numeric layer. + /// We place all scene assets in layer 0 (enabled by default), gizmos in layer 1 (enabled by default), world grid in layer 2 (disabled by default). + /// Use this method to toggle visibility of the respective layer. + /// + Future setLayerEnabled(int layer, bool enabled); +}