use FilterQuality.none in widget
This commit is contained in:
@@ -52,7 +52,9 @@ public:
|
|||||||
_renderCallback = renderCallback;
|
_renderCallback = renderCallback;
|
||||||
_renderCallbackOwner = owner;
|
_renderCallbackOwner = owner;
|
||||||
std::packaged_task<FilamentViewer*()> lambda([&]() mutable
|
std::packaged_task<FilamentViewer*()> lambda([&]() mutable
|
||||||
{ return new FilamentViewer(context, loader, platform); });
|
{
|
||||||
|
return new FilamentViewer(context, loader, platform);
|
||||||
|
});
|
||||||
auto fut = add_task(lambda);
|
auto fut = add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
_viewer = fut.get();
|
_viewer = fut.get();
|
||||||
@@ -118,8 +120,11 @@ extern "C"
|
|||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain_ffi(void* const viewer, void* const surface, uint32_t width, uint32_t height)
|
FLUTTER_PLUGIN_EXPORT void create_swap_chain_ffi(void* const viewer, void* const surface, uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
|
Log("Creating swapchain %dx%d", width, height);
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
std::packaged_task<void()> lambda([&]() mutable
|
||||||
{ create_swap_chain(viewer, surface, width, height); });
|
{
|
||||||
|
create_swap_chain(viewer, surface, width, height);
|
||||||
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
}
|
}
|
||||||
@@ -134,8 +139,11 @@ extern "C"
|
|||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection_ffi(void* const viewer, const uint32_t width, const uint32_t height, const float scaleFactor)
|
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection_ffi(void* const viewer, const uint32_t width, const uint32_t height, const float scaleFactor)
|
||||||
{
|
{
|
||||||
|
Log("Update viewport %dx%d", width, height);
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
std::packaged_task<void()> lambda([&]() mutable
|
||||||
{ update_viewport_and_camera_projection(viewer, width, height, scaleFactor); });
|
{
|
||||||
|
update_viewport_and_camera_projection(viewer, width, height, scaleFactor);
|
||||||
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
}
|
}
|
||||||
@@ -167,7 +175,9 @@ extern "C"
|
|||||||
FLUTTER_PLUGIN_EXPORT void render_ffi(void* const viewer)
|
FLUTTER_PLUGIN_EXPORT void render_ffi(void* const viewer)
|
||||||
{
|
{
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
std::packaged_task<void()> lambda([&]() mutable
|
||||||
{ _rl->doRender(); });
|
{
|
||||||
|
_rl->doRender();
|
||||||
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
}
|
}
|
||||||
@@ -192,7 +202,9 @@ extern "C"
|
|||||||
FLUTTER_PLUGIN_EXPORT void clear_background_image_ffi(void* const viewer)
|
FLUTTER_PLUGIN_EXPORT void clear_background_image_ffi(void* const viewer)
|
||||||
{
|
{
|
||||||
std::packaged_task<void()> lambda([&]
|
std::packaged_task<void()> lambda([&]
|
||||||
{ clear_background_image(viewer); });
|
{
|
||||||
|
clear_background_image(viewer);
|
||||||
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
}
|
}
|
||||||
@@ -200,7 +212,9 @@ extern "C"
|
|||||||
FLUTTER_PLUGIN_EXPORT void set_background_image_ffi(void* const viewer, const char *path, bool fillHeight)
|
FLUTTER_PLUGIN_EXPORT void set_background_image_ffi(void* const viewer, const char *path, bool fillHeight)
|
||||||
{
|
{
|
||||||
std::packaged_task<void()> lambda([&]
|
std::packaged_task<void()> lambda([&]
|
||||||
{ set_background_image(viewer, path, fillHeight); });
|
{
|
||||||
|
set_background_image(viewer, path, fillHeight);
|
||||||
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,14 +59,15 @@ class FilamentWidget extends StatefulWidget {
|
|||||||
late final Widget initial;
|
late final Widget initial;
|
||||||
final void Function()? onResize;
|
final void Function()? onResize;
|
||||||
|
|
||||||
FilamentWidget({Key? key, required this.controller, this.onResize, Widget? initial})
|
FilamentWidget(
|
||||||
|
{Key? key, required this.controller, this.onResize, Widget? initial})
|
||||||
: super(key: key) {
|
: super(key: key) {
|
||||||
if(initial != null) {
|
if (initial != null) {
|
||||||
this.initial = initial;
|
this.initial = initial;
|
||||||
} else {
|
} else {
|
||||||
this.initial = Container(color:Colors.red);
|
this.initial = Container(color: Colors.red);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_FilamentWidgetState createState() => _FilamentWidgetState();
|
_FilamentWidgetState createState() => _FilamentWidgetState();
|
||||||
@@ -83,39 +84,39 @@ class _FilamentWidgetState extends State<FilamentWidget> {
|
|||||||
Timer? _resizeTimer;
|
Timer? _resizeTimer;
|
||||||
|
|
||||||
void _handleStateChange(AppLifecycleState state) async {
|
void _handleStateChange(AppLifecycleState state) async {
|
||||||
// switch (state) {
|
switch (state) {
|
||||||
// case AppLifecycleState.detached:
|
case AppLifecycleState.detached:
|
||||||
// print("Detached");
|
print("Detached");
|
||||||
// _textureId = null;
|
_textureId = null;
|
||||||
|
|
||||||
// await widget.controller.destroyViewer();
|
await widget.controller.destroyViewer();
|
||||||
// await widget.controller.destroyTexture();
|
await widget.controller.destroyTexture();
|
||||||
// break;
|
break;
|
||||||
// case AppLifecycleState.hidden:
|
case AppLifecycleState.hidden:
|
||||||
// print("Hidden");
|
print("Hidden");
|
||||||
// if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
// _textureId = null;
|
_textureId = null;
|
||||||
// await widget.controller.destroyViewer();
|
await widget.controller.destroyViewer();
|
||||||
// await widget.controller.destroyTexture();
|
await widget.controller.destroyTexture();
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
// case AppLifecycleState.inactive:
|
case AppLifecycleState.inactive:
|
||||||
// print("Inactive");
|
print("Inactive");
|
||||||
// break;
|
break;
|
||||||
// case AppLifecycleState.paused:
|
case AppLifecycleState.paused:
|
||||||
// print("Paused");
|
print("Paused");
|
||||||
// break;
|
break;
|
||||||
// case AppLifecycleState.resumed:
|
case AppLifecycleState.resumed:
|
||||||
// print("Resumed");
|
print("Resumed");
|
||||||
// if (_textureId == null) {
|
if (_textureId == null) {
|
||||||
// var size = ((context.findRenderObject()) as RenderBox).size;
|
var size = ((context.findRenderObject()) as RenderBox).size;
|
||||||
// print("Size after resuming : $size");
|
print("Size after resuming : $size");
|
||||||
// await widget.controller
|
await widget.controller
|
||||||
// .createViewer(size.width.toInt(), size.height.toInt());
|
.createViewer(size.width.toInt(), size.height.toInt());
|
||||||
// print("Created viewer Size after resuming");
|
print("Created viewer Size after resuming");
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
_lastState = state;
|
_lastState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +128,7 @@ class _FilamentWidgetState extends State<FilamentWidget> {
|
|||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
var size = ((context.findRenderObject()) as RenderBox).size;
|
var size = ((context.findRenderObject()) as RenderBox).size;
|
||||||
|
|
||||||
widget.controller.createViewer(size.width.toInt(), size.height.toInt());
|
widget.controller.createViewer(size.width.toInt(), size.height.toInt());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -159,7 +161,7 @@ class _FilamentWidgetState extends State<FilamentWidget> {
|
|||||||
var texture = Texture(
|
var texture = Texture(
|
||||||
key: ObjectKey("texture_$_textureId"),
|
key: ObjectKey("texture_$_textureId"),
|
||||||
textureId: _textureId!,
|
textureId: _textureId!,
|
||||||
filterQuality: FilterQuality.high,
|
filterQuality: FilterQuality.none,
|
||||||
);
|
);
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: constraints.maxHeight,
|
height: constraints.maxHeight,
|
||||||
|
|||||||
Reference in New Issue
Block a user