pass callback to native pick() and remove pick_ffi
This commit is contained in:
@@ -1442,12 +1442,11 @@ namespace flutter_filament
|
||||
_manipulator = nullptr;
|
||||
}
|
||||
|
||||
void FilamentViewer::pick(uint32_t x, uint32_t y, EntityId *entityId)
|
||||
void FilamentViewer::pick(uint32_t x, uint32_t y, void (*callback)(EntityId entityId, int x, int y))
|
||||
{
|
||||
_view->pick(x, y, [=](filament::View::PickingQueryResult const &result)
|
||||
{
|
||||
|
||||
*entityId = Entity::smuggle(result.renderable);
|
||||
callback(Entity::smuggle(result.renderable), x, y);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -548,9 +548,9 @@ extern "C"
|
||||
return ((SceneManager *)sceneManager)->reveal(asset, meshName);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void pick(void *const viewer, int x, int y, EntityId *entityId)
|
||||
FLUTTER_PLUGIN_EXPORT void pick(void *const viewer, int x, int y, void (*callback)(EntityId entityId, int x, int y))
|
||||
{
|
||||
((FilamentViewer *)viewer)->pick(static_cast<uint32_t>(x), static_cast<uint32_t>(y), static_cast<int32_t *>(entityId));
|
||||
((FilamentViewer *)viewer)->pick(static_cast<uint32_t>(x), static_cast<uint32_t>(y), callback);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT const char *get_name_for_entity(void *const sceneManager, const EntityId entityId)
|
||||
|
||||
Reference in New Issue
Block a user