add generic parameter to NativeHandle, rather than getNativeHandle()
This commit is contained in:
@@ -200,8 +200,8 @@ class FFIMaterialInstance extends MaterialInstance<Pointer<TMaterialInstance>> {
|
||||
}
|
||||
|
||||
@override
|
||||
T getNativeHandle<T>() {
|
||||
return pointer as T;
|
||||
Pointer<TMaterialInstance> getNativeHandle() {
|
||||
return pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,17 @@ import 'package:thermion_dart/src/filament/src/interface/skybox.dart';
|
||||
import 'package:thermion_dart/thermion_dart.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class FFIScene extends Scene {
|
||||
class FFIScene extends Scene<Pointer<TScene>> {
|
||||
late final _logger = Logger(this.runtimeType.toString());
|
||||
|
||||
final Pointer<TScene> scene;
|
||||
|
||||
FFIScene(this.scene);
|
||||
|
||||
Pointer<TScene> getNativeHandle() {
|
||||
return scene;
|
||||
}
|
||||
|
||||
@override
|
||||
Future add(ThermionAsset asset) async {
|
||||
SceneAsset_addToScene(asset.getHandle(), scene);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:thermion_dart/thermion_dart.dart';
|
||||
|
||||
class FFISwapChain extends SwapChain<Pointer> {
|
||||
class FFISwapChain extends SwapChain<Pointer<TSwapChain>> {
|
||||
|
||||
final Pointer<TSwapChain> pointer;
|
||||
|
||||
T getNativeHandle<T>() => pointer as T;
|
||||
Pointer<TSwapChain> getNativeHandle() => pointer;
|
||||
|
||||
FFISwapChain(this.pointer);
|
||||
|
||||
|
||||
@@ -150,8 +150,8 @@ class FFIView extends View {
|
||||
View_setRenderQuality(view, quality.index);
|
||||
}
|
||||
|
||||
Future setScene(covariant FFIScene scene) async {
|
||||
View_setScene(view, scene.scene);
|
||||
Future setScene(Scene scene) async {
|
||||
View_setScene(view, scene.getNativeHandle());
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
/// not a compile-time error).
|
||||
///
|
||||
abstract class NativeHandle<T> {
|
||||
T getNativeHandle<T>();
|
||||
T getNativeHandle();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'package:thermion_dart/src/filament/src/interface/native_handle.dart';
|
||||
import 'package:thermion_dart/src/filament/src/interface/skybox.dart';
|
||||
import 'package:thermion_dart/thermion_dart.dart';
|
||||
|
||||
abstract class Scene {
|
||||
abstract class Scene<T> extends NativeHandle<T> {
|
||||
|
||||
/// Adds all renderable entities in [asset] to this scene.
|
||||
///
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user