documentation & further renaming

This commit is contained in:
Nick Fisher
2024-06-15 21:26:08 +08:00
parent 3f88598498
commit dc0c855135
221 changed files with 5923 additions and 691 deletions

View File

@@ -211,7 +211,7 @@
id="tspan396-8-1"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.32292"
x="578.62885"
y="60.701408">FilamentViewer / Filament Engine (etc)</tspan></text>
y="60.701408">ThermionViewerFFI / Filament Engine (etc)</tspan></text>
<text
xml:space="preserve"
style="font-size:12.7px;font-family:'HarmonyOS Sans SC';-inkscape-font-specification:'HarmonyOS Sans SC';text-align:center;letter-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:0;stroke:#000000;stroke-width:1.32292;stroke-miterlimit:4.7"

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -38,7 +38,7 @@ typedef struct ResourceLoaderWrapper ResourceLoaderWrapper;
#if defined(__cplusplus)
namespace thermion_flutter {
namespace thermion_filament {
struct ResourceLoaderWrapperImpl : public ResourceLoaderWrapper
{

View File

@@ -1,16 +1,18 @@
import 'dart:async';
import 'dart:ui';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart.dart';
import 'package:flutter/widgets.dart';
import 'package:thermion_flutter_platform_interface/thermion_flutter_platform_interface.dart';
import 'package:thermion_flutter_platform_interface/thermion_flutter_texture.dart';
///
/// A Flutter-only class that instantiates/wraps a [AbstractFilamentViewer],
/// handling all platform-specific initialization work necessary to create a
/// backing rendering surface.
/// Handles all platform-specific initialization work necessary to create a
/// backing rendering surface in a Flutter application.
/// Instantiates/wraps a [ThermionViewer],
///
class ThermionFlutterPlugin {
ThermionViewer get _viewer => ThermionFlutterPlatform.instance.viewer;
bool _wasRenderingOnInactive = false;
void _handleStateChange(AppLifecycleState state) async {
@@ -19,50 +21,51 @@ class ThermionFlutterPlugin {
case AppLifecycleState.detached:
print("Detached");
if (!_wasRenderingOnInactive) {
_wasRenderingOnInactive = viewer.rendering;
_wasRenderingOnInactive = _viewer.rendering;
}
await viewer.setRendering(false);
await _viewer.setRendering(false);
break;
case AppLifecycleState.hidden:
print("Hidden");
if (!_wasRenderingOnInactive) {
_wasRenderingOnInactive = viewer.rendering;
_wasRenderingOnInactive = _viewer.rendering;
}
await viewer.setRendering(false);
await _viewer.setRendering(false);
break;
case AppLifecycleState.inactive:
print("Inactive");
if (!_wasRenderingOnInactive) {
_wasRenderingOnInactive = viewer.rendering;
_wasRenderingOnInactive = _viewer.rendering;
}
// on Windows in particular, restoring a window after minimizing stalls the renderer (and the whole application) for a considerable length of time.
// disabling rendering on minimize seems to fix the issue (so I wonder if there's some kind of command buffer that's filling up while the window is minimized).
await viewer.setRendering(false);
await _viewer.setRendering(false);
break;
case AppLifecycleState.paused:
print("Paused");
if (!_wasRenderingOnInactive) {
_wasRenderingOnInactive = viewer.rendering;
_wasRenderingOnInactive = _viewer.rendering;
}
await viewer.setRendering(false);
await _viewer.setRendering(false);
break;
case AppLifecycleState.resumed:
print("Resumed");
await viewer.setRendering(_wasRenderingOnInactive);
await _viewer.setRendering(_wasRenderingOnInactive);
break;
}
}
AppLifecycleListener? _appLifecycleListener;
AbstractFilamentViewer get viewer => ThermionFlutterPlatform.instance.viewer;
final _initialized = Completer<bool>();
Future<bool> get initialized => _initialized.future;
Future initialize({String? uberArchivePath}) async {
bool _initializing = false;
Future<ThermionViewer> initialize({String? uberArchivePath}) async {
_initializing = true;
if (_initialized.isCompleted) {
throw Exception("Instance already initialized");
return ThermionFlutterPlatform.instance.viewer;
}
await ThermionFlutterPlatform.instance
.initialize(uberArchivePath: uberArchivePath);
@@ -70,9 +73,10 @@ class ThermionFlutterPlugin {
_appLifecycleListener = AppLifecycleListener(
onStateChange: _handleStateChange,
);
_viewer.initialized;
_initialized.complete(true);
await viewer.initialized;
_initializing = false;
return ThermionFlutterPlatform.instance.viewer;
}
Future<ThermionFlutterTexture?> createTexture(

View File

@@ -1,5 +1,5 @@
import 'package:thermion_dart/thermion_dart/entities/filament_entity.dart';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';import 'package:flutter/material.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../../utils/camera_orientation.dart';
@@ -7,9 +7,9 @@ import 'dart:math';
import 'package:vector_math/vector_math_64.dart' as v64;
class CameraOptionsWidget extends StatefulWidget {
final AbstractFilamentViewer controller;
final ThermionViewer controller;
final CameraOrientation cameraOrientation;
final List<({FilamentEntity entity, String name})> cameras;
final List<({ThermionEntity entity, String name})> cameras;
CameraOptionsWidget(
{super.key,

View File

@@ -1,6 +1,6 @@
import 'dart:io';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'filament_gesture_detector_desktop.dart';
@@ -14,15 +14,15 @@ enum GestureType { rotateCamera, panCamera, panBackground }
class FilamentGestureDetector extends StatelessWidget {
///
/// The content to display below the gesture detector/listener widget.
/// This will usually be a FilamentWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
/// This will usually be a ThermionWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [FilamentController].
///
final Widget? child;
///
/// The [controller] attached to the [FilamentWidget] you wish to control.
/// The [controller] attached to the [ThermionWidget] you wish to control.
///
final AbstractFilamentViewer controller;
final ThermionViewer controller;
///
/// If true, an overlay will be shown with buttons to toggle whether pointer movements are interpreted as:

View File

@@ -1,6 +1,6 @@
import 'dart:async';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
@@ -10,15 +10,15 @@ import 'package:flutter/material.dart';
class FilamentGestureDetectorDesktop extends StatefulWidget {
///
/// The content to display below the gesture detector/listener widget.
/// This will usually be a FilamentWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
/// This will usually be a ThermionWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [FilamentController].
///
final Widget? child;
///
/// The [controller] attached to the [FilamentWidget] you wish to control.
/// The [controller] attached to the [ThermionWidget] you wish to control.
///
final AbstractFilamentViewer controller;
final ThermionViewer controller;
///
/// If true, an overlay will be shown with buttons to toggle whether pointer movements are interpreted as:

View File

@@ -1,5 +1,5 @@
import 'dart:async';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:flutter/material.dart';
enum GestureType { rotateCamera, panCamera, panBackground }
@@ -10,15 +10,15 @@ enum GestureType { rotateCamera, panCamera, panBackground }
class FilamentGestureDetectorMobile extends StatefulWidget {
///
/// The content to display below the gesture detector/listener widget.
/// This will usually be a FilamentWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
/// This will usually be a ThermionWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [FilamentController].
///
final Widget? child;
///
/// The [controller] attached to the [FilamentWidget] you wish to control.
/// The [controller] attached to the [ThermionWidget] you wish to control.
///
final AbstractFilamentViewer controller;
final ThermionViewer controller;
///
/// If true, an overlay will be shown with buttons to toggle whether pointer movements are interpreted as:

View File

@@ -1,18 +1,18 @@
import 'package:animation_tools_dart/animation_tools_dart.dart';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:thermion_dart/thermion_dart/entities/filament_entity.dart';
import 'package:flutter/material.dart';
import 'package:thermion_flutter/filament/widgets/debug/skeleton_menu_item_widget.dart';
import 'dart:math';
class ChildRenderableWidget extends StatelessWidget {
final AbstractFilamentViewer controller;
final FilamentEntity entity;
final ThermionViewer controller;
final ThermionEntity entity;
const ChildRenderableWidget(
{super.key, required this.controller, required this.entity});
Widget _childRenderable(FilamentEntity childEntity) {
Widget _childRenderable(ThermionEntity childEntity) {
var name = controller.getNameForEntity(childEntity) ?? "<none>";
var names = controller.getMorphTargetNames(entity, childEntity);

View File

@@ -1,11 +1,11 @@
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:thermion_dart/thermion_dart/entities/filament_entity.dart';
import 'package:thermion_flutter/filament/widgets/debug/child_renderable_widget.dart';
import 'package:flutter/material.dart';
import 'package:thermion_flutter/filament/widgets/debug/skeleton_menu_item_widget.dart';
class EntityListWidget extends StatefulWidget {
final AbstractFilamentViewer? controller;
final ThermionViewer? controller;
const EntityListWidget({super.key, required this.controller});
@@ -19,7 +19,7 @@ class _EntityListWidget extends State<EntityListWidget> {
super.didUpdateWidget(oldWidget);
}
Widget _entity(FilamentEntity entity) {
Widget _entity(ThermionEntity entity) {
return FutureBuilder(
future: widget.controller!.getAnimationNames(entity),
builder: (_, animations) {
@@ -108,7 +108,7 @@ class _EntityListWidget extends State<EntityListWidget> {
});
}
Widget _light(FilamentEntity entity) {
Widget _light(ThermionEntity entity) {
final controller = MenuController();
return Row(children: [
GestureDetector(

View File

@@ -1,15 +1,15 @@
import 'dart:math';
import 'package:thermion_dart/thermion_dart.dart';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:animation_tools_dart/animation_tools_dart.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:vector_math/vector_math_64.dart';
class SkeletonMenuItemWidget extends StatelessWidget {
final AbstractFilamentViewer controller;
final FilamentEntity entity;
final ThermionViewer controller;
final ThermionEntity entity;
const SkeletonMenuItemWidget(
{super.key, required this.controller, required this.entity});

View File

@@ -1,10 +1,10 @@
import 'dart:math';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:flutter/material.dart';
import 'package:vector_math/vector_math_64.dart' as v;
class IblRotationSliderWidget extends StatefulWidget {
final AbstractFilamentViewer controller;
final ThermionViewer controller;
const IblRotationSliderWidget({super.key, required this.controller});
@override

View File

@@ -1,5 +1,5 @@
import 'package:thermion_dart/thermion_dart/entities/filament_entity.dart';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:thermion_dart/thermion_dart/utils/light_options.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
import 'package:vector_math/vector_math_64.dart' as v;
class LightSliderWidget extends StatefulWidget {
final AbstractFilamentViewer controller;
final ThermionViewer controller;
final LightOptions options;
final bool showControls;
@@ -22,7 +22,7 @@ class LightSliderWidget extends StatefulWidget {
}
class _LightSliderWidgetState extends State<LightSliderWidget> {
FilamentEntity? _light;
ThermionEntity? _light;
@override
void initState() {

View File

@@ -8,7 +8,7 @@ import 'package:thermion_flutter_platform_interface/thermion_flutter_texture.dar
import 'package:thermion_flutter/thermion_flutter.dart';
import 'resize_observer.dart';
class FilamentWidget extends StatefulWidget {
class ThermionWidget extends StatefulWidget {
final ThermionFlutterPlugin plugin;
///
@@ -17,20 +17,20 @@ class FilamentWidget extends StatefulWidget {
///
final Widget? initial;
const FilamentWidget({Key? key, this.initial, required this.plugin})
const ThermionWidget({Key? key, this.initial, required this.plugin})
: super(key: key);
@override
_FilamentWidgetState createState() => _FilamentWidgetState();
_ThermionWidgetState createState() => _ThermionWidgetState();
}
class _FilamentWidgetState extends State<FilamentWidget> {
class _ThermionWidgetState extends State<ThermionWidget> {
ThermionFlutterTexture? _texture;
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
await widget.plugin.initialized;
var dpr = MediaQuery.of(context).devicePixelRatio;
var size = ((context.findRenderObject()) as RenderBox).size;
var width = (dpr * size.width).ceil();
@@ -72,14 +72,12 @@ class _FilamentWidgetState extends State<FilamentWidget> {
@override
Widget build(BuildContext context) {
if (_texture?.usesBackingWindow == true) {
return Stack(children: [
Positioned.fill(child: CustomPaint(painter: TransparencyPainter()))
]);
}
if (_texture == null || _resizing) {
return widget.initial ??
Container(color: kIsWeb ? Colors.transparent : Colors.red);
@@ -107,7 +105,6 @@ class _FilamentWidgetState extends State<FilamentWidget> {
}
}
class TransparencyPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
@@ -121,4 +118,4 @@ class TransparencyPainter extends CustomPainter {
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}
}

View File

@@ -1,4 +1,4 @@
library thermion_flutter;
export 'filament/thermion_flutter_plugin.dart';
export 'thermion/thermion_flutter_plugin.dart';
export 'package:thermion_dart/thermion_dart.dart';

View File

@@ -30,7 +30,7 @@ add_library(${PLUGIN_NAME} SHARED
"filament_texture.cc"
"filament_pb_texture.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/SceneManager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FilamentViewer.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/ThermionViewerFFI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/ThermionFlutterApi.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/StreamBufferAdapter.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/TimeIt.cpp"

View File

@@ -20,7 +20,7 @@
#include "include/thermion_flutter/filament_pb_texture.h"
#include "include/thermion_flutter/resource_loader.hpp"
#include "FilamentViewer.hpp"
#include "ThermionDartApi.h"
#include "Log.hpp"
extern "C" {
@@ -43,7 +43,7 @@ struct _ThermionFlutterPlugin {
double width = 0;
double height = 0;
bool rendering = false;
thermion_flutter::FilamentViewer* viewer;
thermion_flutter::ThermionViewerFFI* viewer;
};
G_DEFINE_TYPE(ThermionFlutterPlugin, thermion_flutter_plugin, g_object_get_type())
@@ -71,7 +71,7 @@ static FlMethodResponse* _create_filament_viewer(ThermionFlutterPlugin* self, Fl
self->height = height;
auto context = glXGetCurrentContext();
self->viewer = (thermion_flutter::FilamentViewer*)create_filament_viewer(
self->viewer = (thermion_flutter::ThermionViewerFFI*)create_filament_viewer(
(void*)context,
callback
);
@@ -718,7 +718,7 @@ static void thermion_flutter_plugin_handle_method_call(
const gchar* method = fl_method_call_get_name(method_call);
if(strcmp(method, "createFilamentViewer") == 0) {
if(strcmp(method, "createThermionViewerFFI") == 0) {
response = _create_filament_viewer(self, method_call);
} else if(strcmp(method, "createTexture") == 0) {
response = _create_texture(self, method_call);

View File

@@ -38,7 +38,7 @@ typedef struct ResourceLoaderWrapper ResourceLoaderWrapper;
#if defined(__cplusplus)
namespace thermion_flutter {
namespace thermion_filament {
struct ResourceLoaderWrapperImpl : public ResourceLoaderWrapper
{

View File

@@ -14,7 +14,7 @@
#include "ResourceBuffer.hpp"
using namespace filament;
using namespace thermion_flutter;
using namespace thermion_filament;
using namespace std;
int _i = 0;

View File

@@ -12,7 +12,7 @@
#pragma comment(lib, "dwmapi.lib")
#pragma comment(lib, "comctl32.lib")
namespace thermion_flutter {
namespace thermion_filament {
static constexpr auto kClassName = L"FLUTTER_FILAMENT_WINDOW";
static constexpr auto kWindowName = L"thermion_flutter_window";
@@ -354,4 +354,4 @@ void BackingWindow::Resize(int width, int height, int left, int top) {
}
HWND BackingWindow::GetHandle() { return _windowHandle; }
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -5,7 +5,7 @@
#include <flutter/plugin_registrar_windows.h>
#include <flutter/standard_method_codec.h>
namespace thermion_flutter {
namespace thermion_filament {
class BackingWindow {
public:

View File

@@ -7,7 +7,7 @@
#pragma comment(lib, "dwmapi.lib")
#pragma comment(lib, "comctl32.lib")
namespace thermion_flutter {
namespace thermion_filament {
FlutterEGLContext::FlutterEGLContext(
flutter::PluginRegistrarWindows* pluginRegistrar,

View File

@@ -12,7 +12,7 @@
#include "backend/platforms/PlatformEGL.h"
#include "flutter_render_context.h"
namespace thermion_flutter {
namespace thermion_filament {
class FlutterEGLContext : public FlutterRenderContext {
public:

View File

@@ -7,7 +7,7 @@
#include <thread>
namespace thermion_flutter {
namespace thermion_filament {
static void logEglError(const char *name) noexcept {
const char *err;
@@ -240,4 +240,4 @@ FlutterAngleTexture::FlutterAngleTexture(
result->Success(resultList);
}
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -26,7 +26,7 @@
typedef uint32_t GLuint;
namespace thermion_flutter {
namespace thermion_filament {
class FlutterAngleTexture : public FlutterTextureBuffer {
public:

View File

@@ -8,7 +8,7 @@
#include "flutter_texture_buffer.h"
namespace thermion_flutter {
namespace thermion_filament {
class FlutterRenderContext {
public:

View File

@@ -7,7 +7,7 @@
#include <flutter/texture_registrar.h>
namespace thermion_flutter {
namespace thermion_filament {
class FlutterTextureBuffer {
public:

View File

@@ -7,7 +7,7 @@
#include <thread>
namespace thermion_flutter {
namespace thermion_filament {
void _release_callback(void *releaseContext) {
// ((OpenGLTextureBuffer*)releaseContext)->unlock();
@@ -141,4 +141,4 @@ OpenGLTextureBuffer::~OpenGLTextureBuffer() {
wglMakeCurrent(NULL, NULL);
}
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -20,7 +20,7 @@
typedef uint32_t GLuint;
namespace thermion_flutter {
namespace thermion_filament {
class OpenGLTextureBuffer : public FlutterTextureBuffer {
public:

View File

@@ -10,7 +10,7 @@
#include "thermion_flutter_plugin.h"
namespace thermion_flutter {
namespace thermion_filament {
namespace test {
namespace {
@@ -40,4 +40,4 @@ TEST(ThermionFlutterPlugin, GetPlatformVersion) {
}
} // namespace test
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -35,7 +35,7 @@
#include "wgl_context.h"
#endif
namespace thermion_flutter {
namespace thermion_filament {
using namespace std::chrono_literals;
@@ -275,4 +275,4 @@ void ThermionFlutterPlugin::HandleMethodCall(
}
}
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -22,7 +22,7 @@
#include "wgl_context.h"
#endif
namespace thermion_flutter {
namespace thermion_filament {
class ThermionFlutterPlugin : public flutter::Plugin {
public:
@@ -66,6 +66,6 @@ public:
#endif
};
} // namespace thermion_flutter
} // namespace thermion_filament
#endif // FLUTTER_PLUGIN_FLUTTER_FILAMENT_PLUGIN_H_

View File

@@ -6,7 +6,7 @@
#include "flutter_texture_buffer.h"
namespace thermion_flutter {
namespace thermion_filament {
WGLContext::WGLContext(flutter::PluginRegistrarWindows *pluginRegistrar,
flutter::TextureRegistrar *textureRegistrar)
@@ -143,4 +143,4 @@ void WGLContext::CreateRenderingSurface(
void *WGLContext::GetSharedContext() { return (void *)_context; }
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -7,7 +7,7 @@
#if WGL_USE_BACKING_WINDOW
#include "backing_window.h"
#endif
namespace thermion_flutter {
namespace thermion_filament {
class WGLContext : public FlutterRenderContext {
public:

View File

@@ -6,13 +6,13 @@ import 'package:thermion_flutter_platform_interface/thermion_flutter_platform_in
import 'package:thermion_flutter_platform_interface/thermion_flutter_texture.dart';
///
/// A subclass of [FilamentViewer] that uses Flutter platform channels
/// A subclass of [ThermionViewerFFI] that uses Flutter platform channels
/// to create rendering contexts, callbacks and surfaces (either backing texture(s).
///
class ThermionFlutterFFI extends ThermionFlutterPlatform {
final _channel = const MethodChannel("app.polyvox.filament/event");
late final FilamentViewer viewer;
late final ThermionViewerFFI viewer;
static void registerWith() {
ThermionFlutterPlatform.instance = ThermionFlutterFFI();
@@ -46,7 +46,7 @@ class ThermionFlutterFFI extends ThermionFlutterPlatform {
? nullptr
: Pointer<Void>.fromAddress(sharedContext);
viewer = FilamentViewer(
viewer = ThermionViewerFFI(
resourceLoader: resourceLoader,
renderCallback: renderCallback,
renderCallbackOwner: renderCallbackOwner,
@@ -73,7 +73,7 @@ class ThermionFlutterFFI extends ThermionFlutterPlatform {
///
/// Create a backing surface for rendering.
/// This is called by [FilamentWidget]; don't call this yourself.
/// This is called by [ThermionWidget]; don't call this yourself.
///
/// The name here is slightly misleading because we only create
/// a texture render target on macOS and iOS; on Android, we render into
@@ -81,7 +81,7 @@ class ThermionFlutterFFI extends ThermionFlutterPlatform {
/// a HWND.
///
/// Currently, this only supports a single "texture" (aka rendering surface)
/// at any given time. If a [FilamentWidget] is disposed, it will call
/// at any given time. If a [ThermionWidget] is disposed, it will call
/// [destroyTexture]; if it is resized, it will call [resizeTexture].
///
/// In future, we probably want to be able to create multiple distinct
@@ -92,13 +92,13 @@ class ThermionFlutterFFI extends ThermionFlutterPlatform {
///
Future<ThermionFlutterTexture?> createTexture(
int width, int height, int offsetLeft, int offsetRight) async {
// when a FilamentWidget is inserted, disposed then immediately reinserted
// when a ThermionWidget is inserted, disposed then immediately reinserted
// into the widget hierarchy (e.g. rebuilding due to setState(() {}) being called in an ancestor widget)
// the first call to createTexture may not have completed before the second.
// add a loop here to wait (max 500ms) for the first call to complete
await _waitForTextureCreationToComplete();
// note that when [FilamentWidget] is disposed, we don't destroy the
// note that when [ThermionWidget] is disposed, we don't destroy the
// texture; instead, we keep it around in case a subsequent call requests
// a texture of the same size.
@@ -152,7 +152,7 @@ class ThermionFlutterFFI extends ThermionFlutterPlatform {
}
///
/// Called by [FilamentWidget] to destroy a texture. Don't call this yourself.
/// Called by [ThermionWidget] to destroy a texture. Don't call this yourself.
///
Future destroyTexture(ThermionFlutterTexture texture) async {
await _channel.invokeMethod("destroyTexture", texture.flutterTextureId);
@@ -162,7 +162,7 @@ class ThermionFlutterFFI extends ThermionFlutterPlatform {
bool _resizing = false;
///
/// Called by [FilamentWidget] to resize a texture. Don't call this yourself.
/// Called by [ThermionWidget] to resize a texture. Don't call this yourself.
///
@override
Future<ThermionFlutterTexture?> resizeTexture(ThermionFlutterTexture texture,

View File

@@ -1,6 +1,6 @@
import 'dart:async';
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'thermion_flutter_texture.dart';
@@ -18,7 +18,7 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
_instance = instance;
}
AbstractFilamentViewer get viewer;
ThermionViewer get viewer;
Future initialize({String? uberArchivePath});

View File

@@ -1,4 +1,4 @@
import 'package:thermion_dart/thermion_dart/abstract_filament_viewer.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:thermion_flutter_platform_interface/thermion_flutter_platform_interface.dart';
import 'package:thermion_flutter_platform_interface/thermion_flutter_texture.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
@@ -25,7 +25,7 @@ class ThermionFlutterWebPlugin extends ThermionFlutterPlatform {
@override
Future initialize({String? uberArchivePath}) async {
print("Creating viewer in web plugin");
viewer = JsInteropFilamentViewer("filamentViewer");
viewer = JsInteropThermionViewerFFI("filamentViewer");
print("Waiting for initialized");
await viewer.initialized;
print("int complete");
@@ -37,5 +37,5 @@ class ThermionFlutterWebPlugin extends ThermionFlutterPlatform {
@override
// TODO: implement viewer
late final AbstractFilamentViewer viewer;
late final ThermionViewer viewer;
}