add animation fading and revert to platform channel handler
This commit is contained in:
@@ -12,310 +12,158 @@ using namespace polyvox;
|
||||
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
|
||||
|
||||
// static ThreadPool* _tp;
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "PolyvoxFilamentApi.h"
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void* create_filament_viewer(void* context, ResourceLoaderWrapper* loader) {
|
||||
// if(!_tp) {
|
||||
// _tp = new ThreadPool();
|
||||
// }
|
||||
// //std::packaged_task<void*()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer(const void* context, const ResourceLoaderWrapper* const loader) {
|
||||
return (void*) new FilamentViewer(context, loader);
|
||||
// });
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
// //return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadResourceFromOwner loadFn, FreeResourceFromOwner freeFn, void* const owner) {
|
||||
return new ResourceLoaderWrapper(loadFn, freeFn, owner);
|
||||
// ResourceLoaderWrapper* lod(loadFn, freeFn, owner);
|
||||
// return &lod;
|
||||
return new ResourceLoaderWrapper(loadFn, freeFn, owner);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void create_render_target(void* viewer, uint32_t textureId, uint32_t width, uint32_t height) {
|
||||
// //std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void create_render_target(const void* const viewer, uint32_t textureId, uint32_t width, uint32_t height) {
|
||||
((FilamentViewer*)viewer)->createRenderTarget(textureId, width, height);
|
||||
// });
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void delete_filament_viewer(void* viewer) {
|
||||
FLUTTER_PLUGIN_EXPORT void delete_filament_viewer(const void* const viewer) {
|
||||
delete((FilamentViewer*)viewer);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_color(void* viewer, const float r, const float g, const float b, const float a) {
|
||||
// //std::packaged_task<void()> lambda([=]() mutable {
|
||||
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);
|
||||
// });
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void clear_background_image(void* viewer) {
|
||||
// //std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void clear_background_image(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->clearBackgroundImage();
|
||||
// });
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image(void* viewer, const char* path) {
|
||||
// //std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image(const void* const viewer, const char* path) {
|
||||
((FilamentViewer*)viewer)->setBackgroundImage(path);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image_position(void* viewer, float x, float y, bool clamp) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image_position(const void* const viewer, float x, float y, bool clamp) {
|
||||
((FilamentViewer*)viewer)->setBackgroundImagePosition(x, y, clamp);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void load_skybox(void* viewer, const char* skyboxPath) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void load_skybox(const void* const viewer, const char* skyboxPath) {
|
||||
((FilamentViewer*)viewer)->loadSkybox(skyboxPath);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void load_ibl(void* viewer, const char* iblPath, float intensity) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void load_ibl(const void* const viewer, const char* iblPath, float intensity) {
|
||||
((FilamentViewer*)viewer)->loadIbl(iblPath, intensity);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void remove_skybox(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void remove_skybox(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->removeSkybox();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void remove_ibl(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void remove_ibl(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->removeIbl();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT EntityId add_light(void* viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows) {
|
||||
//std::packaged_task<EntityId()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT EntityId add_light(const void* const viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows) {
|
||||
return ((FilamentViewer*)viewer)->addLight((LightManager::Type)type, colour, intensity, posX, posY, posZ, dirX, dirY, dirZ, shadows);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void remove_light(void* viewer, int32_t entityId) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void remove_light(const void* const viewer, int32_t entityId) {
|
||||
((FilamentViewer*)viewer)->removeLight(entityId);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void clear_lights(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void clear_lights(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->clearLights();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT EntityId load_glb(void* assetManager, const char* assetPath, bool unlit) {
|
||||
//std::packaged_task<EntityId()> lambda([=]() mutable {
|
||||
return ((AssetManager*)assetManager)->loadGlb(assetPath, unlit);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT EntityId load_gltf(void* assetManager, const char* assetPath, const char* relativePath) {
|
||||
//std::packaged_task<EntityId()> lambda([=]() mutable {
|
||||
return ((AssetManager*)assetManager)->loadGltf(assetPath, relativePath);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT bool set_camera(void* viewer, EntityId asset, const char* nodeName) {
|
||||
//std::packaged_task<bool()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT bool set_camera(const void* const viewer, EntityId asset, const char* nodeName) {
|
||||
return ((FilamentViewer*)viewer)->setCamera(asset, nodeName);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_exposure(void* viewer, float aperture, float shutterSpeed, float sensitivity) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float distance) {
|
||||
((FilamentViewer*)viewer)->setCameraFocusDistance(distance);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_exposure(const void* const viewer, float aperture, float shutterSpeed, float sensitivity) {
|
||||
((FilamentViewer*)viewer)->setCameraExposure(aperture, shutterSpeed, sensitivity);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_position(void* viewer, float x, float y, float z) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_position(const void* const viewer, float x, float y, float z) {
|
||||
((FilamentViewer*)viewer)->setCameraPosition(x, y, z);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_rotation(void* viewer, float rads, float x, float y, float z) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_rotation(const void* const viewer, float rads, float x, float y, float z) {
|
||||
((FilamentViewer*)viewer)->setCameraRotation(rads, x, y, z);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_model_matrix(void* viewer, const float* const matrix) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_model_matrix(const void* const viewer, const float* const matrix) {
|
||||
((FilamentViewer*)viewer)->setCameraModelMatrix(matrix);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(void* viewer, float focalLength) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, float focalLength) {
|
||||
((FilamentViewer*)viewer)->setCameraFocalLength(focalLength);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void render(
|
||||
void* viewer,
|
||||
const void* const viewer,
|
||||
uint64_t frameTimeInNanos
|
||||
) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((FilamentViewer*)viewer)->render(frameTimeInNanos);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_frame_interval(
|
||||
void* viewer,
|
||||
const void* const viewer,
|
||||
float frameInterval
|
||||
) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((FilamentViewer*)viewer)->setFrameInterval(frameInterval);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->destroySwapChain();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain(void* viewer, void* surface=nullptr, uint32_t width=0, uint32_t height=0) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain(const void* const viewer, const void* const surface=nullptr, uint32_t width=0, uint32_t height=0) {
|
||||
((FilamentViewer*)viewer)->createSwapChain(surface, width, height);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void* get_renderer(void* viewer) {
|
||||
//std::packaged_task<void*()> lambda([=]() mutable {
|
||||
return ((FilamentViewer*)viewer)->getRenderer();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection(void* viewer, int width, int height, float scaleFactor) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection(const void* const viewer, int width, int height, float scaleFactor) {
|
||||
return ((FilamentViewer*)viewer)->updateViewportAndCameraProjection(width, height, scaleFactor);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_update(void* viewer, float x, float y, float delta) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_update(const void* const viewer, float x, float y, float delta) {
|
||||
((FilamentViewer*)viewer)->scrollUpdate(x, y, delta);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_begin(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_begin(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->scrollBegin();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_end(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_end(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->scrollEnd();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void grab_begin(void* viewer, float x, float y, bool pan) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void grab_begin(const void* const viewer, float x, float y, bool pan) {
|
||||
((FilamentViewer*)viewer)->grabBegin(x, y, pan);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void grab_update(void* viewer, float x, float y) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void grab_update(const void* const viewer, float x, float y) {
|
||||
((FilamentViewer*)viewer)->grabUpdate(x, y);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void grab_end(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void grab_end(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->grabEnd();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void* get_asset_manager(void* viewer) {
|
||||
//std::packaged_task<void*()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void* get_asset_manager(const void* const viewer) {
|
||||
return (void*)((FilamentViewer*)viewer)->getAssetManager();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void apply_weights(
|
||||
@@ -324,11 +172,7 @@ extern "C" {
|
||||
const char* const entityName,
|
||||
float* const weights,
|
||||
int count) {
|
||||
// //std::packaged_task<void()> lambda([=]() mutable {
|
||||
// ((AssetManager*)assetManager)->setMorphTargetWeights(asset, entityName, weights, count);
|
||||
// });
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_morph_target_weights(
|
||||
@@ -339,16 +183,12 @@ extern "C" {
|
||||
const int numWeights
|
||||
) {
|
||||
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
return ((AssetManager*)assetManager)->setMorphTargetWeights(
|
||||
asset,
|
||||
entityName,
|
||||
weights,
|
||||
numWeights
|
||||
);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT bool set_morph_animation(
|
||||
@@ -360,7 +200,6 @@ extern "C" {
|
||||
int numFrames,
|
||||
float frameLengthInMs) {
|
||||
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
return ((AssetManager*)assetManager)->setMorphAnimationBuffer(
|
||||
asset,
|
||||
entityName,
|
||||
@@ -369,9 +208,6 @@ extern "C" {
|
||||
numFrames,
|
||||
frameLengthInMs
|
||||
);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_bone_animation(
|
||||
@@ -384,7 +220,6 @@ extern "C" {
|
||||
const char** const meshNames,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((AssetManager*)assetManager)->setBoneAnimationBuffer(
|
||||
asset,
|
||||
frameData,
|
||||
@@ -395,10 +230,7 @@ extern "C" {
|
||||
numMeshTargets,
|
||||
frameLengthInMs
|
||||
);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -435,13 +267,9 @@ extern "C" {
|
||||
EntityId asset,
|
||||
int index,
|
||||
bool loop,
|
||||
bool reverse) {
|
||||
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((AssetManager*)assetManager)->playAnimation(asset, index, loop, reverse);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
bool reverse,
|
||||
float crossfade) {
|
||||
((AssetManager*)assetManager)->playAnimation(asset, index, loop, reverse, crossfade);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_animation_frame(
|
||||
@@ -449,11 +277,7 @@ extern "C" {
|
||||
EntityId asset,
|
||||
int animationIndex,
|
||||
int animationFrame) {
|
||||
// //std::packaged_task<void()> lambda([=]() mutable {
|
||||
// ((AssetManager*)assetManager)->setAnimationFrame(asset, animationIndex, animationFrame);
|
||||
// });
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT int get_animation_count(
|
||||
@@ -462,9 +286,8 @@ extern "C" {
|
||||
//std::packaged_task<int()> lambda([=]() mutable {
|
||||
auto names = ((AssetManager*)assetManager)->getAnimationNames(asset);
|
||||
return names->size();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
|
||||
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
@@ -474,49 +297,32 @@ extern "C" {
|
||||
char* const outPtr,
|
||||
int index
|
||||
) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
auto names = ((AssetManager*)assetManager)->getAnimationNames(asset);
|
||||
string name = names->at(index);
|
||||
strcpy(outPtr, name.c_str());
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count(void* assetManager, EntityId asset, const char* meshName) {
|
||||
//std::packaged_task<int()> lambda([=]() mutable {
|
||||
unique_ptr<vector<string>> names = ((AssetManager*)assetManager)->getMorphTargetNames(asset, meshName);
|
||||
return names->size();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
|
||||
|
||||
//return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void get_morph_target_name(void* assetManager, EntityId asset, const char* meshName, char* const outPtr, int index ) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
unique_ptr<vector<string>> names = ((AssetManager*)assetManager)->getMorphTargetNames(asset, meshName);
|
||||
string name = names->at(index);
|
||||
strcpy(outPtr, name.c_str());
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void remove_asset(void* viewer, EntityId asset) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void remove_asset(const void* const viewer, EntityId asset) {
|
||||
((FilamentViewer*)viewer)->removeAsset(asset);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void clear_assets(void* viewer) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
FLUTTER_PLUGIN_EXPORT void clear_assets(const void* const viewer) {
|
||||
((FilamentViewer*)viewer)->clearAssets();
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void load_texture(void* assetManager, EntityId asset, const char* assetPath, int renderableIndex) {
|
||||
@@ -528,59 +334,31 @@ extern "C" {
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void transform_to_unit_cube(void* assetManager, EntityId asset) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((AssetManager*)assetManager)->transformToUnitCube(asset);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_position(void* assetManager, EntityId asset, float x, float y, float z) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((AssetManager*)assetManager)->setPosition(asset, x, y, z);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_rotation(void* assetManager, EntityId asset, float rads, float x, float y, float z) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((AssetManager*)assetManager)->setRotation(asset, rads, x, y, z);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_scale(void* assetManager, EntityId asset, float scale) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((AssetManager*)assetManager)->setScale(asset, scale);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void stop_animation(void* assetManager, EntityId asset, int index) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
((AssetManager*)assetManager)->stopAnimation(asset, index);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
return ((AssetManager*)assetManager)->hide(asset, meshName);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void* assetManager, EntityId asset, const char* meshName) {
|
||||
//std::packaged_task<void()> lambda([=]() mutable {
|
||||
return ((AssetManager*)assetManager)->reveal(asset, meshName);
|
||||
//});
|
||||
// auto fut = _tp->add_task(lambda);
|
||||
// fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void ios_dummy() {
|
||||
|
||||
Reference in New Issue
Block a user