chore: getter for native camera view matrix

This commit is contained in:
Nick Fisher
2024-09-26 18:49:32 +08:00
parent 2408104bd0
commit 41432a07ed
6 changed files with 29 additions and 6 deletions

View File

@@ -75,4 +75,9 @@ class ThermionFFICamera extends Camera {
Future<double> getFocalLength() async {
return Camera_getFocalLength(camera);
}
@override
Future<Matrix4> getViewMatrix() async {
return double4x4ToMatrix4(Camera_getViewMatrix(camera));
}
}

View File

@@ -887,6 +887,16 @@ external double Camera_getCullingFar(
ffi.Pointer<TCamera> camera,
);
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
external double4x4 Camera_getViewMatrix(
ffi.Pointer<TCamera> camera,
);
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
external double4x4 Camera_getModelMatrix(
ffi.Pointer<TCamera> camera,
);
@ffi.Native<ffi.Double Function(ffi.Pointer<TCamera>)>(isLeaf: true)
external double get_camera_near(
ffi.Pointer<TCamera> camera,
@@ -947,11 +957,6 @@ external void Camera_setLensProjection(
double focalLength,
);
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
external double4x4 Camera_getModelMatrix(
ffi.Pointer<TCamera> camera,
);
@ffi.Native<EntityId Function(ffi.Pointer<TCamera>)>(isLeaf: true)
external int Camera_getEntity(
ffi.Pointer<TCamera> camera,

View File

@@ -12,6 +12,7 @@ abstract class Camera {
double aspect = 1.0,
double focalLength = kFocalLength});
Future<Matrix4> getViewMatrix();
Future<Matrix4> getModelMatrix();
Future setModelMatrix(Matrix4 matrix);