feat: expose more camera methods

This commit is contained in:
Nick Fisher
2024-09-25 23:09:27 +08:00
parent 59aec2bcc9
commit 2b1339b560
7 changed files with 45 additions and 35 deletions

View File

@@ -11,12 +11,13 @@ class ThermionFFICamera extends Camera {
ThermionFFICamera(this.pointer);
@override
Future setProjectionMatrixWithCulling(Matrix4 projectionMatrix,
double near, double far) async {
Future setProjectionMatrixWithCulling(
Matrix4 projectionMatrix, double near, double far) async {
Camera_setCustomProjectionWithCulling(
pointer,
matrix4ToDouble4x4(projectionMatrix),
near,
far);
pointer, matrix4ToDouble4x4(projectionMatrix), near, far);
}
Future<Matrix4> getModelMatrix() async {
return double4x4ToMatrix4(Camera_getModelMatrix(pointer));
}
}

View File

@@ -16,16 +16,6 @@ external ffi.Pointer<ffi.Void> make_resource_loader(
ffi.Pointer<ffi.Void> owner,
);
@ffi.Native<
ffi.Pointer<TViewer> Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>(isLeaf: true)
external ffi.Pointer<TViewer> create_filament_viewer(
ffi.Pointer<ffi.Void> context,
ffi.Pointer<ffi.Void> loader,
ffi.Pointer<ffi.Void> platform,
ffi.Pointer<ffi.Char> uberArchivePath,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
external void destroy_filament_viewer(
ffi.Pointer<TViewer> viewer,
@@ -906,11 +896,9 @@ external void Camera_setCustomProjectionWithCulling(
double far,
);
@ffi.Native<ffi.Pointer<TCamera> Function(ffi.Pointer<TEngine>, EntityId)>(
isLeaf: true)
external ffi.Pointer<TCamera> get_camera_component(
ffi.Pointer<TEngine> engine,
int entity,
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
external double4x4 Camera_getModelMatrix(
ffi.Pointer<TCamera> camera,
);
@ffi.Native<

View File

@@ -1,8 +1,8 @@
import 'package:vector_math/vector_math_64.dart';
abstract class Camera {
Future setProjectionMatrixWithCulling(
Matrix4 projectionMatrix, double near, double far);
Future setProjectionMatrixWithCulling(Matrix4 projectionMatrix, double near, double far);
Future<Matrix4> getModelMatrix();
}