pass callback to native pick() and remove pick_ffi
This commit is contained in:
@@ -125,7 +125,7 @@ namespace flutter_filament
|
||||
void scrollBegin();
|
||||
void scrollUpdate(float x, float y, float delta);
|
||||
void scrollEnd();
|
||||
void pick(uint32_t x, uint32_t y, EntityId *entityId);
|
||||
void pick(uint32_t x, uint32_t y, void (*callback)(EntityId entityId, int x, int y));
|
||||
|
||||
EntityId addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
||||
void removeLight(EntityId entityId);
|
||||
|
||||
@@ -184,7 +184,7 @@ extern "C"
|
||||
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void *sceneManager, EntityId asset, const char *meshName);
|
||||
FLUTTER_PLUGIN_EXPORT void set_post_processing(void *const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void set_antialiasing(void *const viewer, bool msaa, bool fxaa, bool taa);
|
||||
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));
|
||||
FLUTTER_PLUGIN_EXPORT const char *get_name_for_entity(void *const sceneManager, const EntityId entityId);
|
||||
FLUTTER_PLUGIN_EXPORT EntityId find_child_entity_by_name(void *const sceneManager, const EntityId parent, const char* name);
|
||||
FLUTTER_PLUGIN_EXPORT int get_entity_count(void *const sceneManager, const EntityId target, bool renderableOnly);
|
||||
|
||||
@@ -113,7 +113,6 @@ extern "C"
|
||||
float frameLengthInMs,
|
||||
bool isModelSpace);
|
||||
FLUTTER_PLUGIN_EXPORT void set_post_processing_ffi(void *const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void pick_ffi(void *const viewer, int x, int y, EntityId *entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void reset_to_rest_pose_ffi(void *const sceneManager, EntityId entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi();
|
||||
FLUTTER_PLUGIN_EXPORT void create_geometry_ffi(void *const viewer, float *vertices, int numVertices, uint16_t *indices, int numIndices, const char *materialPath, void (*callback)(EntityId));
|
||||
|
||||
@@ -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