expose getters for near/far culling distance and clean up example project for more readability on frustum
This commit is contained in:
@@ -345,10 +345,20 @@ abstract class FilamentController {
|
||||
Future setCameraFocalLength(double focalLength);
|
||||
|
||||
///
|
||||
/// Sets the near/far culling planes for the active camera. Default values are 0.05/1000.0. See Camera.h for details.
|
||||
/// Sets the distance (in world units) to the near/far planes for the active camera. Default values are 0.05/1000.0. See Camera.h for details.
|
||||
///
|
||||
Future setCameraCulling(double near, double far);
|
||||
|
||||
///
|
||||
/// Get the distance (in world units) to the near culling plane for the active camera.
|
||||
///
|
||||
Future<double> getCameraCullingNear();
|
||||
|
||||
///
|
||||
/// Get the distance (in world units) to the far culling plane for the active camera.
|
||||
///
|
||||
Future<double> getCameraCullingFar();
|
||||
|
||||
///
|
||||
/// Sets the focus distance for the camera.
|
||||
///
|
||||
|
||||
@@ -867,6 +867,16 @@ class FilamentControllerFFI extends FilamentController {
|
||||
set_camera_culling(_viewer!, near, far);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<double> getCameraCullingNear() async {
|
||||
return get_camera_culling_near(_viewer!);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<double> getCameraCullingFar() async {
|
||||
return get_camera_culling_far(_viewer!);
|
||||
}
|
||||
|
||||
@override
|
||||
Future setCameraFocusDistance(double focusDistance) async {
|
||||
if (_viewer == null) {
|
||||
@@ -1147,10 +1157,7 @@ class FilamentControllerFFI extends FilamentController {
|
||||
}
|
||||
var arrayPtr = get_camera_frustum(_viewer!);
|
||||
var doubleList = arrayPtr.asTypedList(24);
|
||||
var planeNormals = [];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
planeNormals.add(Vector3.array(doubleList.sublist(i * 3, (i + 1) * 3)));
|
||||
}
|
||||
print(doubleList);
|
||||
|
||||
var frustum = Frustum();
|
||||
frustum.plane0.setFromComponents(
|
||||
@@ -1165,7 +1172,7 @@ class FilamentControllerFFI extends FilamentController {
|
||||
doubleList[16], doubleList[17], doubleList[18], doubleList[19]);
|
||||
frustum.plane5.setFromComponents(
|
||||
doubleList[20], doubleList[21], doubleList[22], doubleList[23]);
|
||||
|
||||
flutter_filament_free(arrayPtr.cast<Void>());
|
||||
return frustum;
|
||||
}
|
||||
|
||||
|
||||
@@ -651,6 +651,18 @@ external void set_camera_culling(
|
||||
double far,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Double Function(ffi.Pointer<ffi.Void>)>(
|
||||
symbol: 'get_camera_culling_near', assetId: 'flutter_filament_plugin')
|
||||
external double get_camera_culling_near(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Double Function(ffi.Pointer<ffi.Void>)>(
|
||||
symbol: 'get_camera_culling_far', assetId: 'flutter_filament_plugin')
|
||||
external double get_camera_culling_far(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Pointer<ffi.Double> Function(ffi.Pointer<ffi.Void>)>(
|
||||
symbol: 'get_camera_culling_projection_matrix',
|
||||
assetId: 'flutter_filament_plugin')
|
||||
|
||||
Reference in New Issue
Block a user