properly free memory in model/view matrix getters
This commit is contained in:
@@ -348,7 +348,7 @@ abstract class FilamentController {
|
||||
Future<Matrix4> getCameraViewMatrix();
|
||||
|
||||
///
|
||||
/// Set the camera position in world space.
|
||||
/// Set the camera position in world space. Note this is not persistent - any viewport navigation will reset the camera transform.
|
||||
///
|
||||
Future setCameraPosition(double x, double y, double z);
|
||||
|
||||
@@ -374,7 +374,7 @@ abstract class FilamentController {
|
||||
double aperture, double shutterSpeed, double sensitivity);
|
||||
|
||||
///
|
||||
/// Rotate the camera by [rads] around the given axis.
|
||||
/// Rotate the camera by [rads] around the given axis. Note this is not persistent - any viewport navigation will reset the camera transform.
|
||||
///
|
||||
Future setCameraRotation(double rads, double x, double y, double z);
|
||||
|
||||
|
||||
@@ -992,7 +992,9 @@ class FilamentControllerFFI extends FilamentController {
|
||||
throw Exception("No viewer available");
|
||||
}
|
||||
var arrayPtr = _lib.get_camera_view_matrix(_viewer!);
|
||||
return Matrix4.fromList(arrayPtr.asTypedList(16));
|
||||
var viewMatrix = Matrix4.fromList(arrayPtr.asTypedList(16));
|
||||
calloc.free(arrayPtr);
|
||||
return viewMatrix;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1001,7 +1003,9 @@ class FilamentControllerFFI extends FilamentController {
|
||||
throw Exception("No viewer available");
|
||||
}
|
||||
var arrayPtr = _lib.get_camera_model_matrix(_viewer!);
|
||||
return Matrix4.fromList(arrayPtr.asTypedList(16));
|
||||
var modelMatrix = Matrix4.fromList(arrayPtr.asTypedList(16));
|
||||
calloc.free(arrayPtr);
|
||||
return modelMatrix;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user