initial work to re-implement FFI with background thread render loop
This commit is contained in:
@@ -204,7 +204,7 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
||||
case "destroyViewer":
|
||||
if(viewer != nil) {
|
||||
destroy_swap_chain(viewer)
|
||||
delete_filament_viewer(viewer)
|
||||
destroy_filament_viewer(viewer)
|
||||
viewer = nil
|
||||
}
|
||||
result(true)
|
||||
@@ -227,7 +227,7 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
||||
print("createFilamentViewer")
|
||||
if(viewer != nil) {
|
||||
destroy_swap_chain(viewer)
|
||||
delete_filament_viewer(viewer)
|
||||
destroy_filament_viewer(viewer)
|
||||
viewer = nil
|
||||
}
|
||||
let callback = make_resource_loader(loadResource, freeResource, Unmanaged.passUnretained(self).toOpaque())
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace polyvox {
|
||||
void setBackgroundImage(const char* resourcePath, bool fillHeight);
|
||||
void clearBackgroundImage();
|
||||
void setBackgroundImagePosition(float x, float y, bool clamp);
|
||||
|
||||
void setViewFrustumCulling(bool enabled);
|
||||
void moveCameraToAsset(EntityId entityId);
|
||||
|
||||
void setCameraExposure(float aperture, float shutterSpeed, float sensitivity);
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
typedef int32_t EntityId;
|
||||
|
||||
const void* create_filament_viewer(const void* const context, const ResourceLoaderWrapper* const loader);
|
||||
ResourceLoaderWrapper* make_resource_loader(LoadResourceFromOwner loadFn, FreeResourceFromOwner freeFn, void* owner);
|
||||
void delete_filament_viewer(const void* const viewer);
|
||||
ResourceLoaderWrapper* make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void* owner);
|
||||
void destroy_filament_viewer(const void* const viewer);
|
||||
void* get_asset_manager(const void* const viewer);
|
||||
void create_render_target(const void* const viewer, uint32_t textureId, uint32_t width, uint32_t height);
|
||||
void clear_background_image(const void* const viewer);
|
||||
@@ -26,6 +26,7 @@ void clear_lights(const void* const viewer);
|
||||
EntityId load_glb(void *assetManager, const char *assetPath, bool unlit);
|
||||
EntityId load_gltf(void *assetManager, const char *assetPath, const char *relativePath);
|
||||
bool set_camera(const void* const viewer, EntityId asset, const char *nodeName);
|
||||
void set_view_frustum_culling(const void* const viewer, bool enabled);
|
||||
void render(const void* const viewer, uint64_t frameTimeInNanos);
|
||||
void create_swap_chain(const void* const viewer, const void* const window, uint32_t width, uint32_t height);
|
||||
void destroy_swap_chain(const void* const viewer);
|
||||
@@ -82,8 +83,6 @@ void get_morph_target_name(void* assetManager, EntityId asset, const char *meshN
|
||||
int get_morph_target_name_count(void* assetManager, EntityId asset, const char *meshName);
|
||||
void remove_asset(const void* const viewer, EntityId asset);
|
||||
void clear_assets(const void* const viewer);
|
||||
void load_texture(void* assetManager, EntityId asset, const char *assetPath, int renderableIndex);
|
||||
void set_texture(void* assetManager, EntityId asset);
|
||||
bool set_material_color(void* assetManager, EntityId asset, const char* meshName, int materialIndex, const float r, const float g, const float b, const float a);
|
||||
void transform_to_unit_cube(void* assetManager, EntityId asset);
|
||||
void set_position(void* assetManager, EntityId asset, float x, float y, float z);
|
||||
|
||||
83
ios/include/PolyvoxFilamentFFIApi.h
Normal file
83
ios/include/PolyvoxFilamentFFIApi.h
Normal file
@@ -0,0 +1,83 @@
|
||||
#ifndef _POLYVOX_FILAMENT_FFI_API_H
|
||||
#define _POLYVOX_FILAMENT_FFI_API_H
|
||||
|
||||
#include "PolyvoxFilamentApi.h"
|
||||
|
||||
///
|
||||
/// This header replicates most of the methods in PolyvoxFilamentApi.h, and is only intended to be used to generate client FFI bindings.
|
||||
/// The intention is that calling one of these methods will call its respective method in PolyvoxFilamentApi.h, but wrapped in some kind of thread runner to ensure thread safety.
|
||||
///
|
||||
|
||||
typedef int32_t EntityId;
|
||||
|
||||
const void* create_filament_viewer_ffi(void* const context, const ResourceLoaderWrapper* const loader);
|
||||
void destroy_filament_viewer_ffi(void* const viewer);
|
||||
void render_ffi(void* const viewer);
|
||||
void set_rendering_ffi(void* const viewer, bool rendering);
|
||||
void set_frame_interval_ffi(float frameInterval);
|
||||
void update_viewport_and_camera_projection_ffi(void* const viewer, const uint32_t width, const uint32_t height, const float scaleFactor);
|
||||
void create_render_target_ffi(void* const viewer, uint32_t textureId, uint32_t width, uint32_t height);
|
||||
void set_background_color_ffi(void* const viewer, const float r, const float g, const float b, const float a);
|
||||
void clear_background_image_ffi(void* const viewer);
|
||||
void set_background_image_ffi(void* const viewer, const char *path, bool fillHeight);
|
||||
void set_background_image_position_ffi(void* const viewer, float x, float y, bool clamp);
|
||||
void set_background_color_ffi(void* const viewer, const float r, const float g, const float b, const float a);
|
||||
void set_tone_mapping_ffi(void* const viewer, int toneMapping);
|
||||
void set_bloom_ffi(void* const viewer, float strength);
|
||||
void load_skybox_ffi(void* const viewer, const char *skyboxPath);
|
||||
void load_ibl_ffi(void* const viewer, const char *iblPath, float intensity);
|
||||
void remove_skybox_ffi(void* const viewer);
|
||||
void remove_ibl_ffi(void* const viewer);
|
||||
EntityId add_light_ffi(void* const viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
||||
void remove_light_ffi(void* const viewer, EntityId entityId);
|
||||
void clear_lights_ffi(void* const viewer);
|
||||
EntityId load_glb_ffi(void* const assetManager, const char *assetPath, bool unlit);
|
||||
EntityId load_gltf_ffi(void* const assetManager, const char *assetPath, const char *relativePath);
|
||||
void remove_asset_ffi(const void* const viewer, EntityId asset);
|
||||
void clear_assets_ffi(const void* const viewer);
|
||||
bool set_camera_ffi(void* const viewer, EntityId asset, const char *nodeName);
|
||||
void apply_weights_ffi(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const char *const entityName,
|
||||
float *const weights,
|
||||
int count
|
||||
);
|
||||
void set_morph_target_weights_ffi(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const char *const entityName,
|
||||
const float *const morphData,
|
||||
int numWeights
|
||||
);
|
||||
bool set_morph_animation_ffi(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const char *const entityName,
|
||||
const float *const morphData,
|
||||
const int* const morphIndices,
|
||||
int numMorphTargets,
|
||||
int numFrames,
|
||||
float frameLengthInMs);
|
||||
|
||||
void set_bone_animation_ffi(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const float* const frameData,
|
||||
int numFrames,
|
||||
int numBones,
|
||||
const char** const boneNames,
|
||||
const char** const meshName,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs);
|
||||
|
||||
void play_animation_ffi(void* assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade);
|
||||
void set_animation_frame_ffi(void* assetManager, EntityId asset, int animationIndex, int animationFrame);
|
||||
void stop_animation_ffi(void* assetManager, EntityId asset, int index);
|
||||
int get_animation_count_ffi(void* assetManager, EntityId asset);
|
||||
void get_animation_name_ffi(void* assetManager, EntityId asset, char *const outPtr, int index);
|
||||
float get_animation_duration_ffi(void* assetManager, EntityId asset, int index);
|
||||
void get_morph_target_name_ffi(void* assetManager, EntityId asset, const char *meshName, char *const outPtr, int index);
|
||||
int get_morph_target_name_count_ffi(void* assetManager, EntityId asset, const char *meshName);
|
||||
|
||||
#endif // _POLYVOX_FILAMENT_FFI_API_H
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#if defined(__cplusplus)
|
||||
#include "Log.hpp"
|
||||
extern "C" {
|
||||
#endif
|
||||
//
|
||||
@@ -28,6 +27,10 @@ extern "C" {
|
||||
struct ResourceBuffer {
|
||||
#if defined(__cplusplus)
|
||||
ResourceBuffer(const void* const data, const uint32_t size, const uint32_t id) : data(data), size(size), id(id) {};
|
||||
ResourceBuffer(const ResourceBuffer& rb) : data(rb.data), size(rb.size), id(rb.id) { };
|
||||
ResourceBuffer(const ResourceBuffer&& rb) : data(rb.data), size(rb.size), id(rb.id) { };
|
||||
ResourceBuffer& operator=(const ResourceBuffer& other) = delete;
|
||||
|
||||
#endif
|
||||
const void * const data;
|
||||
const uint32_t size;
|
||||
@@ -35,41 +38,41 @@ extern "C" {
|
||||
};
|
||||
|
||||
typedef struct ResourceBuffer ResourceBuffer;
|
||||
typedef ResourceBuffer (*LoadResource)(const char* uri);
|
||||
typedef ResourceBuffer (*LoadResourceFromOwner)(const char* const, void* const owner);
|
||||
typedef void (*FreeResource)(ResourceBuffer);
|
||||
typedef void (*FreeResourceFromOwner)(ResourceBuffer, void* const owner);
|
||||
typedef ResourceBuffer (*LoadFilamentResource)(const char* uri);
|
||||
typedef ResourceBuffer (*LoadFilamentResourceFromOwner)(const char* const, void* const owner);
|
||||
typedef void (*FreeFilamentResource)(ResourceBuffer);
|
||||
typedef void (*FreeFilamentResourceFromOwner)(ResourceBuffer, void* const owner);
|
||||
|
||||
// this may be compiled as either C or C++, depending on which compiler is being invoked (e.g. binding to Swift will compile as C).
|
||||
// the former does not allow default initialization to be specified inline), so we need to explicitly set the unused members to nullptr
|
||||
struct ResourceLoaderWrapper {
|
||||
#if defined(__cplusplus)
|
||||
ResourceLoaderWrapper(LoadResource loader, FreeResource freeResource) : mLoadResource(loader), mFreeResource(freeResource), mLoadResourceFromOwner(nullptr), mFreeResourceFromOwner(nullptr),
|
||||
ResourceLoaderWrapper(LoadFilamentResource loader, FreeFilamentResource freeResource) : mLoadFilamentResource(loader), mFreeFilamentResource(freeResource), mLoadFilamentResourceFromOwner(nullptr), mFreeFilamentResourceFromOwner(nullptr),
|
||||
mOwner(nullptr) {}
|
||||
|
||||
ResourceLoaderWrapper(LoadResourceFromOwner loader, FreeResourceFromOwner freeResource, void* const owner) : mLoadResource(nullptr), mFreeResource(nullptr), mLoadResourceFromOwner(loader), mFreeResourceFromOwner(freeResource), mOwner(owner) {
|
||||
ResourceLoaderWrapper(LoadFilamentResourceFromOwner loader, FreeFilamentResourceFromOwner freeResource, void* const owner) : mLoadFilamentResource(nullptr), mFreeFilamentResource(nullptr), mLoadFilamentResourceFromOwner(loader), mFreeFilamentResourceFromOwner(freeResource), mOwner(owner) {
|
||||
|
||||
};
|
||||
|
||||
ResourceBuffer load(const char* uri) const {
|
||||
if(mLoadResourceFromOwner) {
|
||||
return mLoadResourceFromOwner(uri, mOwner);
|
||||
if(mLoadFilamentResourceFromOwner) {
|
||||
return mLoadFilamentResourceFromOwner(uri, mOwner);
|
||||
}
|
||||
return mLoadResource(uri);
|
||||
return mLoadFilamentResource(uri);
|
||||
}
|
||||
|
||||
void free(ResourceBuffer rb) const {
|
||||
if(mFreeResourceFromOwner) {
|
||||
mFreeResourceFromOwner(rb, mOwner);
|
||||
if(mFreeFilamentResourceFromOwner) {
|
||||
mFreeFilamentResourceFromOwner(rb, mOwner);
|
||||
} else {
|
||||
mFreeResource(rb);
|
||||
mFreeFilamentResource(rb);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
LoadResource mLoadResource;
|
||||
FreeResource mFreeResource;
|
||||
LoadResourceFromOwner mLoadResourceFromOwner;
|
||||
FreeResourceFromOwner mFreeResourceFromOwner;
|
||||
LoadFilamentResource mLoadFilamentResource;
|
||||
FreeFilamentResource mFreeFilamentResource;
|
||||
LoadFilamentResourceFromOwner mLoadFilamentResourceFromOwner;
|
||||
FreeFilamentResourceFromOwner mFreeFilamentResourceFromOwner;
|
||||
void* mOwner;
|
||||
};
|
||||
typedef struct ResourceLoaderWrapper ResourceLoaderWrapper;
|
||||
|
||||
@@ -54,12 +54,12 @@ _scene(scene) {
|
||||
_gltfResourceLoader = new ResourceLoader({.engine = _engine,
|
||||
.normalizeSkinningWeights = true });
|
||||
|
||||
auto uberdata = resourceLoaderWrapper->load("packages/polyvox_filament/assets/materials_ios_arm64.uberz");
|
||||
// auto uberdata = resourceLoaderWrapper->load("packages/polyvox_filament/assets/materials_ios_arm64.uberz");
|
||||
|
||||
_ubershaderProvider = gltfio::createUbershaderProvider(
|
||||
_engine, uberdata.data, uberdata.size);
|
||||
// _ubershaderProvider = gltfio::createUbershaderProvider(
|
||||
// _engine, UBERARCHIVE_DEFAULT_DATA, UBERARCHIVE_DEFAULT_SIZE);
|
||||
// _engine, uberdata.data, uberdata.size);
|
||||
_ubershaderProvider = gltfio::createUbershaderProvider(
|
||||
_engine, UBERARCHIVE_DEFAULT_DATA, UBERARCHIVE_DEFAULT_SIZE);
|
||||
// _ubershaderProvider = gltfio::createJitShaderProvider(_engine, true);
|
||||
EntityManager &em = EntityManager::get();
|
||||
|
||||
|
||||
@@ -870,9 +870,12 @@ void FilamentViewer::setCameraPosition(float x, float y, float z) {
|
||||
cam.setModelMatrix(_cameraPosition * _cameraRotation);
|
||||
}
|
||||
|
||||
void FilamentViewer::moveCameraToAsset(EntityId entityId) {
|
||||
void FilamentViewer::setViewFrustumCulling(bool enabled) {
|
||||
_view->setFrustumCullingEnabled(enabled);
|
||||
}
|
||||
|
||||
auto asset = _assetManager->getAssetByEntityId(entityId);
|
||||
void FilamentViewer::moveCameraToAsset(EntityId entityId) {
|
||||
auto asset = _assetManager->getAssetByEntityId(entityId);
|
||||
if(!asset) {
|
||||
Log("Failed to find asset attached to specified entity id.");
|
||||
return;
|
||||
|
||||
@@ -17,10 +17,10 @@ extern "C" {
|
||||
#include "PolyvoxFilamentApi.h"
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer(const void* context, const ResourceLoaderWrapper* const loader) {
|
||||
return (void*) new FilamentViewer(context, loader);
|
||||
return (const void*) new FilamentViewer(context, loader);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadResourceFromOwner loadFn, FreeResourceFromOwner freeFn, void* const owner) {
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void* const owner) {
|
||||
return new ResourceLoaderWrapper(loadFn, freeFn, owner);
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ extern "C" {
|
||||
((FilamentViewer*)viewer)->createRenderTarget(textureId, width, height);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void delete_filament_viewer(const void* const viewer) {
|
||||
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer(const void* const viewer) {
|
||||
delete((FilamentViewer*)viewer);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_color(const void* const viewer, const float r, const float g, const float b, const float a) {
|
||||
((FilamentViewer*)viewer)->setBackgroundColor(r, g, b, a);
|
||||
((FilamentViewer*)viewer)->setBackgroundColor(r, g, b, a);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void clear_background_image(const void* const viewer) {
|
||||
@@ -97,6 +97,10 @@ extern "C" {
|
||||
return ((FilamentViewer*)viewer)->setCamera(asset, nodeName);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_view_frustum_culling(const void* const viewer, bool enabled) {
|
||||
((FilamentViewer*)viewer)->setViewFrustumCulling(enabled);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void move_camera_to_asset(const void* const viewer, EntityId asset) {
|
||||
((FilamentViewer*)viewer)->moveCameraToAsset(asset);
|
||||
}
|
||||
@@ -344,14 +348,6 @@ extern "C" {
|
||||
((FilamentViewer*)viewer)->clearAssets();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void load_texture(void* assetManager, EntityId asset, const char* assetPath, int renderableIndex) {
|
||||
// ((AssetManager*)assetManager)->loadTexture(assetPath, renderableIndex);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_texture(void* assetManager, EntityId asset) {
|
||||
// ((AssetManager*)assetManager)->setTexture();
|
||||
}
|
||||
|
||||
bool set_material_color(void* assetManager, EntityId asset, const char* meshName, int materialIndex, const float r, const float g, const float b, const float a) {
|
||||
return ((AssetManager*)assetManager)->setMaterialColor(asset, meshName, materialIndex, r, g, b, a);
|
||||
}
|
||||
@@ -366,7 +362,7 @@ extern "C" {
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_rotation(void* assetManager, EntityId asset, float rads, float x, float y, float z) {
|
||||
((AssetManager*)assetManager)->setRotation(asset, rads, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_scale(void* assetManager, EntityId asset, float scale) {
|
||||
((AssetManager*)assetManager)->setScale(asset, scale);
|
||||
|
||||
119
ios/src/PolyvoxFilamentFFIApi.cpp
Normal file
119
ios/src/PolyvoxFilamentFFIApi.cpp
Normal file
@@ -0,0 +1,119 @@
|
||||
#include "ResourceBuffer.hpp"
|
||||
|
||||
#include "FilamentViewer.hpp"
|
||||
#include "filament/LightManager.h"
|
||||
#include "Log.hpp"
|
||||
#include "ThreadPool.hpp"
|
||||
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
|
||||
using namespace polyvox;
|
||||
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
class RenderLoop {
|
||||
public:
|
||||
explicit RenderLoop() {
|
||||
_t = new std::thread([this]() {
|
||||
while(!_stop) {
|
||||
std::function<void()> task;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_access);
|
||||
if(_tasks.empty()) {
|
||||
_cond.wait_for(lock, std::chrono::duration<int, std::milli>(5));
|
||||
continue;
|
||||
}
|
||||
task = std::move(_tasks.front());
|
||||
_tasks.pop_front();
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(_frameIntervalInMilliseconds));
|
||||
}
|
||||
|
||||
task();
|
||||
}
|
||||
});
|
||||
}
|
||||
~RenderLoop() {
|
||||
_stop = true;
|
||||
_t->join();
|
||||
}
|
||||
|
||||
void setRendering(bool rendering) {
|
||||
_rendering = rendering;
|
||||
}
|
||||
|
||||
template<class Rt>
|
||||
auto add_task(std::packaged_task<Rt()>& pt) -> std::future<Rt> {
|
||||
std::unique_lock<std::mutex> lock(_access);
|
||||
auto ret = pt.get_future();
|
||||
_tasks.push_back([pt=std::make_shared<std::packaged_task<Rt()>>(std::move(pt))]{ (*pt)();});
|
||||
_cond.notify_one();
|
||||
return ret;
|
||||
}
|
||||
private:
|
||||
bool _stop = false;
|
||||
bool _rendering = false;
|
||||
int _frameIntervalInMilliseconds = 1000 / 60;
|
||||
std::mutex _access;
|
||||
FilamentViewer* _viewer = nullptr;
|
||||
std::thread* _t = nullptr;
|
||||
std::condition_variable _cond;
|
||||
std::deque<std::function<void()>> _tasks;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "PolyvoxFilamentApi.h"
|
||||
|
||||
static RenderLoop* _rl;
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer_ffi(const void* context, const ResourceLoaderWrapper* const loader) {
|
||||
if(!_rl) {
|
||||
_rl = new RenderLoop();
|
||||
}
|
||||
std::packaged_task<const void*()> lambda([&]() mutable {
|
||||
return (const void*) new FilamentViewer(context, loader);
|
||||
});
|
||||
auto fut = _rl->add_task(lambda);
|
||||
fut.wait();
|
||||
return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection_ffi(void* const viewer, const uint32_t width, const uint32_t height, const float scaleFactor);
|
||||
std::packaged_task<void()> lambda([&]() mutable {
|
||||
update_viewport_and_camera_projection(viewer, width, height, scaleFactor);
|
||||
});
|
||||
auto fut = _rl->add_task(lambda);
|
||||
fut.wait();
|
||||
}
|
||||
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT bool set_rendering(bool rendering) {
|
||||
if(!_rl) {
|
||||
return false;
|
||||
}
|
||||
_rl->setRendering(rendering);
|
||||
return true;
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void render_ffi(void* const viewer) {
|
||||
std::packaged_task<void()> lambda([&]() mutable {
|
||||
render(viewer, 0);
|
||||
});
|
||||
auto fut = _rl->add_task(lambda);
|
||||
fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_color_ffi(const void* const viewer, const float r, const float g, const float b, const float a) {
|
||||
std::packaged_task<void()> lambda([&]() mutable {
|
||||
set_background_color(viewer, r, g,b, a);
|
||||
});
|
||||
auto fut = _rl->add_task(lambda);
|
||||
fut.wait();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user