fix: use render thread methods for grid overlay creation and create ubershader instance
This commit is contained in:
@@ -1760,13 +1760,18 @@ class ThermionViewerFFI extends ThermionViewer {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
Future showGridOverlay({FFIMaterial? material}) async {
|
Future showGridOverlay({FFIMaterial? material}) async {
|
||||||
late Pointer<TSceneAsset> ptr;
|
if (_grid == null) {
|
||||||
if (material == null) {
|
final ptr = await withPointerCallback<TSceneAsset>((cb) {
|
||||||
ptr = SceneManager_createGrid(_sceneManager!, nullptr);
|
if (material == null) {
|
||||||
} else {
|
SceneManager_createGridRenderThread(_sceneManager!, nullptr, cb);
|
||||||
ptr = SceneManager_createGrid(_sceneManager!, material.pointer);
|
} else {
|
||||||
|
SceneManager_createGridRenderThread(
|
||||||
|
_sceneManager!, material.pointer, cb);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_grid =
|
||||||
|
FFIAsset(ptr, _sceneManager!, _engine!, _unlitMaterialProvider!);
|
||||||
}
|
}
|
||||||
_grid ??= FFIAsset(ptr, _sceneManager!, _engine!, _unlitMaterialProvider!);
|
|
||||||
await _grid!.addToScene();
|
await _grid!.addToScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1913,8 +1918,10 @@ class ThermionViewerFFI extends ThermionViewer {
|
|||||||
key.hasIOR = hasIOR;
|
key.hasIOR = hasIOR;
|
||||||
key.hasVolume = hasVolume;
|
key.hasVolume = hasVolume;
|
||||||
|
|
||||||
final materialInstance = MaterialProvider_createMaterialInstance(
|
final materialInstance = await withPointerCallback<TMaterialInstance>((cb) {
|
||||||
_ubershaderMaterialProvider!, key.address);
|
MaterialProvider_createMaterialInstanceRenderThread(
|
||||||
|
_ubershaderMaterialProvider!, key.address, cb);
|
||||||
|
});
|
||||||
if (materialInstance == nullptr) {
|
if (materialInstance == nullptr) {
|
||||||
throw Exception("Failed to create material instance");
|
throw Exception("Failed to create material instance");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user