add Dart-side methods

This commit is contained in:
Nick Fisher
2025-03-17 16:55:53 +08:00
parent 4205b86f13
commit c23b991c9c
3 changed files with 10 additions and 1 deletions

View File

@@ -5,6 +5,14 @@ import '../thermion_viewer_base.dart';
enum Projection { Perspective, Orthographic } enum Projection { Perspective, Orthographic }
abstract class Camera { abstract class Camera {
Future lookAt(Vector3 position, {Vector3? focus, Vector3? up}) async {
focus ??= Vector3.zero();
up ??= Vector3(0, 1, 0);
final viewMatrix = makeViewMatrix(position, focus, up);
viewMatrix.invert();
await setModelMatrix(viewMatrix);
}
Future setProjection(Projection projection, double left, double right, Future setProjection(Projection projection, double left, double right,
double bottom, double top, double near, double far); double bottom, double top, double near, double far);
Future setProjectionMatrixWithCulling( Future setProjectionMatrixWithCulling(

View File

@@ -2,4 +2,5 @@ import 'package:thermion_dart/thermion_dart.dart';
abstract class RenderTarget { abstract class RenderTarget {
Future<Texture> getColorTexture(); Future<Texture> getColorTexture();
Future<Texture> getDepthTexture();
} }

View File

@@ -23,7 +23,7 @@ enum QualityLevel {
abstract class View { abstract class View {
Future<Viewport> getViewport(); Future<Viewport> getViewport();
Future updateViewport(int width, int height); Future setViewport(int width, int height);
Future<RenderTarget?> getRenderTarget(); Future<RenderTarget?> getRenderTarget();
Future setRenderTarget(covariant RenderTarget? renderTarget); Future setRenderTarget(covariant RenderTarget? renderTarget);
Future setCamera(covariant Camera camera); Future setCamera(covariant Camera camera);