first pass Windows support
This commit is contained in:
@@ -99,9 +99,9 @@ class FilamentController {
|
||||
_viewer = await _channel
|
||||
.invokeMethod("createFilamentViewer", [size.width, size.height]);
|
||||
|
||||
await _channel.invokeMethod("updateViewportAndCameraProjection",
|
||||
[size.width.toInt(), size.height.toInt(), 1.0]);
|
||||
_assetManager = await _channel.invokeMethod("getAssetManager");
|
||||
// await _channel.invokeMethod("updateViewportAndCameraProjection",
|
||||
// [size.width.toInt(), size.height.toInt(), 1.0]);
|
||||
// _assetManager = await _channel.invokeMethod("getAssetManager");
|
||||
|
||||
_textureIdController.add(_textureId);
|
||||
|
||||
|
||||
@@ -50,10 +50,22 @@ class _RenderResizeObserver extends RenderProxyBox {
|
||||
|
||||
class FilamentWidget extends StatefulWidget {
|
||||
final FilamentController controller;
|
||||
|
||||
///
|
||||
/// The content to render before the texture widget is available.
|
||||
/// The default is a solid red Container, intentionally chosen to make it clear that there will be at least one frame where the Texture widget is not being rendered.
|
||||
///
|
||||
late final Widget initial;
|
||||
final void Function()? onResize;
|
||||
|
||||
const FilamentWidget({Key? key, required this.controller, this.onResize})
|
||||
: super(key: key);
|
||||
FilamentWidget({Key? key, required this.controller, this.onResize, Widget? initial})
|
||||
: super(key: key) {
|
||||
if(initial != null) {
|
||||
this.initial = initial;
|
||||
} else {
|
||||
this.initial = Container(color:Colors.red);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
_FilamentWidgetState createState() => _FilamentWidgetState();
|
||||
@@ -141,7 +153,7 @@ class _FilamentWidgetState extends State<FilamentWidget> {
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(builder: ((context, constraints) {
|
||||
if (_textureId == null) {
|
||||
return Container(color: Colors.transparent);
|
||||
return widget.initial;
|
||||
}
|
||||
|
||||
var texture = Texture(
|
||||
|
||||
@@ -38,8 +38,8 @@ class NativeLibrary {
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ResourceLoaderWrapper>)>();
|
||||
|
||||
ffi.Pointer<ResourceLoaderWrapper> make_resource_loader(
|
||||
LoadResourceFromOwner loadFn,
|
||||
FreeResourceFromOwner freeFn,
|
||||
LoadFilamentResourceFromOwner loadFn,
|
||||
FreeFilamentResourceFromOwner freeFn,
|
||||
ffi.Pointer<ffi.Void> owner,
|
||||
) {
|
||||
return _make_resource_loader(
|
||||
@@ -52,12 +52,12 @@ class NativeLibrary {
|
||||
late final _make_resource_loaderPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ResourceLoaderWrapper> Function(
|
||||
LoadResourceFromOwner,
|
||||
FreeResourceFromOwner,
|
||||
LoadFilamentResourceFromOwner,
|
||||
FreeFilamentResourceFromOwner,
|
||||
ffi.Pointer<ffi.Void>)>>('make_resource_loader');
|
||||
late final _make_resource_loader = _make_resource_loaderPtr.asFunction<
|
||||
ffi.Pointer<ResourceLoaderWrapper> Function(LoadResourceFromOwner,
|
||||
FreeResourceFromOwner, ffi.Pointer<ffi.Void>)>();
|
||||
ffi.Pointer<ResourceLoaderWrapper> Function(LoadFilamentResourceFromOwner,
|
||||
FreeFilamentResourceFromOwner, ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
void delete_filament_viewer(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
@@ -1387,9 +1387,9 @@ class ResourceLoaderWrapper extends ffi.Struct {
|
||||
|
||||
external FreeResource mFreeResource;
|
||||
|
||||
external LoadResourceFromOwner mLoadResourceFromOwner;
|
||||
external LoadFilamentResourceFromOwner mLoadFilamentResourceFromOwner;
|
||||
|
||||
external FreeResourceFromOwner mFreeResourceFromOwner;
|
||||
external FreeFilamentResourceFromOwner mFreeFilamentResourceFromOwner;
|
||||
|
||||
external ffi.Pointer<ffi.Void> mOwner;
|
||||
}
|
||||
@@ -1398,10 +1398,10 @@ typedef LoadResource = ffi.Pointer<
|
||||
ffi.NativeFunction<ResourceBuffer Function(ffi.Pointer<ffi.Char> uri)>>;
|
||||
typedef FreeResource
|
||||
= ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ResourceBuffer)>>;
|
||||
typedef LoadResourceFromOwner = ffi.Pointer<
|
||||
typedef LoadFilamentResourceFromOwner = ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ResourceBuffer Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Void>)>>;
|
||||
typedef FreeResourceFromOwner = ffi.Pointer<
|
||||
typedef FreeFilamentResourceFromOwner = ffi.Pointer<
|
||||
ffi
|
||||
.NativeFunction<ffi.Void Function(ResourceBuffer, ffi.Pointer<ffi.Void>)>>;
|
||||
typedef EntityId = ffi.Int32;
|
||||
|
||||
Reference in New Issue
Block a user