Commit b99d6399 authored by Will Cassella's avatar Will Cassella Committed by Commit Bot

Implement more of the ArCore API in arcore_shim.cc

This CL implements the ArLightEstimate and ArImage functions, as well as
more of the ArConfig and ArFrame methods.

Additionally, it cleans up some of the preprocessor weirdness,
preferring to use a higher-order macro rather than redefining an
existing macro.

Bug: 1034135
Change-Id: I95cd5101888b53d54abe432ea94d993b6678328e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1972909Reviewed-by: default avatarPiotr Bialecki <bialpio@chromium.org>
Commit-Queue: Will Cassella <cassew@google.com>
Cr-Commit-Position: refs/heads/master@{#726054}
parent fdd438d0
...@@ -12,98 +12,127 @@ ...@@ -12,98 +12,127 @@
namespace { namespace {
// Run CALL macro for every function defined in the API. // Run DO macro for every function defined in the API.
#define FOR_EACH_API_FN \ #define FOR_EACH_API_FN(DO) \
CALL(ArAnchorList_acquireItem) \ DO(ArAnchorList_acquireItem) \
CALL(ArAnchorList_create) \ DO(ArAnchorList_create) \
CALL(ArAnchorList_destroy) \ DO(ArAnchorList_destroy) \
CALL(ArAnchorList_getSize) \ DO(ArAnchorList_getSize) \
CALL(ArAnchor_detach) \ DO(ArAnchor_detach) \
CALL(ArAnchor_getPose) \ DO(ArAnchor_getPose) \
CALL(ArAnchor_getTrackingState) \ DO(ArAnchor_getTrackingState) \
CALL(ArAnchor_release) \ DO(ArAnchor_release) \
CALL(ArCamera_getDisplayOrientedPose) \ DO(ArCamera_getDisplayOrientedPose) \
CALL(ArCamera_getProjectionMatrix) \ DO(ArCamera_getProjectionMatrix) \
CALL(ArCamera_getTrackingState) \ DO(ArCamera_getTrackingState) \
CALL(ArCamera_getViewMatrix) \ DO(ArCamera_getViewMatrix) \
CALL(ArConfig_create) \ DO(ArConfig_create) \
CALL(ArConfig_destroy) \ DO(ArConfig_destroy) \
CALL(ArFrame_acquireCamera) \ DO(ArConfig_getLightEstimationMode) \
CALL(ArFrame_create) \ DO(ArConfig_setLightEstimationMode) \
CALL(ArFrame_destroy) \ DO(ArFrame_acquireCamera) \
CALL(ArFrame_getUpdatedAnchors) \ DO(ArFrame_create) \
CALL(ArFrame_getUpdatedTrackables) \ DO(ArFrame_destroy) \
CALL(ArFrame_hitTestRay) \ DO(ArFrame_getLightEstimate) \
CALL(ArFrame_transformCoordinates2d) \ DO(ArFrame_getUpdatedAnchors) \
CALL(ArHitResult_acquireTrackable) \ DO(ArFrame_getUpdatedTrackables) \
CALL(ArHitResult_create) \ DO(ArFrame_hitTestRay) \
CALL(ArHitResult_destroy) \ DO(ArFrame_transformCoordinates2d) \
CALL(ArHitResult_getHitPose) \ DO(ArHitResult_acquireTrackable) \
CALL(ArHitResultList_create) \ DO(ArHitResult_create) \
CALL(ArHitResultList_destroy) \ DO(ArHitResult_destroy) \
CALL(ArHitResultList_getItem) \ DO(ArHitResult_getHitPose) \
CALL(ArHitResultList_getSize) \ DO(ArHitResultList_create) \
CALL(ArPlane_acquireSubsumedBy) \ DO(ArHitResultList_destroy) \
CALL(ArPlane_getCenterPose) \ DO(ArHitResultList_getItem) \
CALL(ArPlane_getPolygon) \ DO(ArHitResultList_getSize) \
CALL(ArPlane_getPolygonSize) \ DO(ArLightEstimate_acquireEnvironmentalHdrCubemap) \
CALL(ArPlane_getType) \ DO(ArLightEstimate_create) \
CALL(ArPlane_isPoseInPolygon) \ DO(ArLightEstimate_destroy) \
CALL(ArPose_create) \ DO(ArLightEstimate_getEnvironmentalHdrAmbientSphericalHarmonics) \
CALL(ArPose_destroy) \ DO(ArLightEstimate_getEnvironmentalHdrMainLightDirection) \
CALL(ArPose_getMatrix) \ DO(ArLightEstimate_getEnvironmentalHdrMainLightIntensity) \
CALL(ArPose_getPoseRaw) \ DO(ArLightEstimate_getState) \
CALL(ArSession_acquireNewAnchor) \ DO(ArLightEstimate_getTimestamp) \
CALL(ArSession_configure) \ DO(ArPlane_acquireSubsumedBy) \
CALL(ArSession_create) \ DO(ArPlane_getCenterPose) \
CALL(ArSession_destroy) \ DO(ArPlane_getPolygon) \
CALL(ArSession_enableIncognitoMode_private) \ DO(ArPlane_getPolygonSize) \
CALL(ArSession_getAllAnchors) \ DO(ArPlane_getType) \
CALL(ArSession_getAllTrackables) \ DO(ArPlane_isPoseInPolygon) \
CALL(ArSession_pause) \ DO(ArPose_create) \
CALL(ArSession_resume) \ DO(ArPose_destroy) \
CALL(ArSession_setCameraTextureName) \ DO(ArPose_getMatrix) \
CALL(ArSession_setDisplayGeometry) \ DO(ArPose_getPoseRaw) \
CALL(ArSession_update) \ DO(ArSession_acquireNewAnchor) \
CALL(ArTrackable_acquireNewAnchor) \ DO(ArSession_configure) \
CALL(ArTrackable_getTrackingState) \ DO(ArSession_create) \
CALL(ArTrackable_getType) \ DO(ArSession_destroy) \
CALL(ArTrackable_release) \ DO(ArSession_enableIncognitoMode_private) \
CALL(ArTrackableList_acquireItem) \ DO(ArSession_getAllAnchors) \
CALL(ArTrackableList_create) \ DO(ArSession_getAllTrackables) \
CALL(ArTrackableList_destroy) \ DO(ArSession_pause) \
CALL(ArTrackableList_getSize) DO(ArSession_resume) \
DO(ArSession_setCameraTextureName) \
#define CALL(fn) decltype(&fn) impl_##fn = nullptr; DO(ArSession_setDisplayGeometry) \
DO(ArSession_update) \
DO(ArTrackable_acquireNewAnchor) \
DO(ArTrackable_getTrackingState) \
DO(ArTrackable_getType) \
DO(ArTrackable_release) \
DO(ArTrackableList_acquireItem) \
DO(ArTrackableList_create) \
DO(ArTrackableList_destroy) \
DO(ArTrackableList_getSize) \
DO(ArImage_getWidth) \
DO(ArImage_getHeight) \
DO(ArImage_getFormat) \
DO(ArImage_getNumberOfPlanes) \
DO(ArImage_getPlanePixelStride) \
DO(ArImage_getPlaneRowStride) \
DO(ArImage_getPlaneData) \
DO(ArImage_release)
struct ArCoreApi { struct ArCoreApi {
FOR_EACH_API_FN // Generate a function pointer field for every ArCore API function.
#define GEN_FN_PTR(fn) decltype(&fn) impl_##fn = nullptr;
FOR_EACH_API_FN(GEN_FN_PTR)
#undef GEN_FN_PTR
}; };
#undef CALL
static void* sdk_handle = nullptr;
static ArCoreApi* arcore_api = nullptr;
template <typename Fn> template <typename Fn>
void LoadFunction(void* handle, const char* function_name, Fn* fn_out) { void LoadFunction(void* handle, const char* function_name, Fn* fn_out) {
void* fn = dlsym(handle, function_name); void* fn = dlsym(handle, function_name);
if (!fn) if (!fn) {
return; return;
}
*fn_out = reinterpret_cast<Fn>(fn); *fn_out = reinterpret_cast<Fn>(fn);
} }
void LoadArCoreApi(void* handle, ArCoreApi* api) {
// Initialize each ArCoreApi function pointer field from the DLL
#define LOAD_FN_PTR(fn) LoadFunction(handle, #fn, &api->impl_##fn);
FOR_EACH_API_FN(LOAD_FN_PTR)
#undef LOAD_FN_PTR
}
#undef FOR_EACH_API_FN
void* g_sdk_handle = nullptr;
ArCoreApi* g_arcore_api = nullptr;
} // namespace } // namespace
namespace vr { namespace vr {
bool LoadArCoreSdk(const std::string& libraryPath) { bool LoadArCoreSdk(const std::string& libraryPath) {
if (arcore_api) if (g_arcore_api)
return true; return true;
sdk_handle = dlopen(libraryPath.c_str(), RTLD_GLOBAL | RTLD_NOW); auto* sdk_handle = dlopen(libraryPath.c_str(), RTLD_GLOBAL | RTLD_NOW);
if (!sdk_handle) { if (!sdk_handle) {
char* error_string = nullptr; char* error_string = dlerror();
error_string = dlerror();
LOG(ERROR) << "Could not open libarcore_sdk_c.so: " << error_string; LOG(ERROR) << "Could not open libarcore_sdk_c.so: " << error_string;
return false; return false;
} else { } else {
...@@ -111,12 +140,11 @@ bool LoadArCoreSdk(const std::string& libraryPath) { ...@@ -111,12 +140,11 @@ bool LoadArCoreSdk(const std::string& libraryPath) {
} }
// TODO(https://crbug.com/914999): check SDK version. // TODO(https://crbug.com/914999): check SDK version.
arcore_api = new ArCoreApi(); auto* arcore_api = new ArCoreApi();
LoadArCoreApi(sdk_handle, arcore_api);
#define CALL(fn) LoadFunction(sdk_handle, #fn, &arcore_api->impl_##fn);
FOR_EACH_API_FN
#undef CALL
g_sdk_handle = sdk_handle;
g_arcore_api = arcore_api;
return true; return true;
} }
...@@ -127,56 +155,57 @@ bool IsArCoreSupported() { ...@@ -127,56 +155,57 @@ bool IsArCoreSupported() {
} // namespace vr } // namespace vr
#undef FOR_EACH_API_FN
void ArAnchorList_acquireItem(const ArSession* session, void ArAnchorList_acquireItem(const ArSession* session,
const ArAnchorList* anchor_list, const ArAnchorList* anchor_list,
int32_t index, int32_t index,
ArAnchor** out_anchor) { ArAnchor** out_anchor) {
arcore_api->impl_ArAnchorList_acquireItem(session, anchor_list, index, return g_arcore_api->impl_ArAnchorList_acquireItem(session, anchor_list,
out_anchor); index, out_anchor);
} }
void ArAnchorList_create(const ArSession* session, void ArAnchorList_create(const ArSession* session,
ArAnchorList** out_anchor_list) { ArAnchorList** out_anchor_list) {
arcore_api->impl_ArAnchorList_create(session, out_anchor_list); return g_arcore_api->impl_ArAnchorList_create(session, out_anchor_list);
} }
void ArAnchorList_destroy(ArAnchorList* anchor_list) { void ArAnchorList_destroy(ArAnchorList* anchor_list) {
arcore_api->impl_ArAnchorList_destroy(anchor_list); g_arcore_api->impl_ArAnchorList_destroy(anchor_list);
} }
void ArAnchorList_getSize(const ArSession* session, void ArAnchorList_getSize(const ArSession* session,
const ArAnchorList* anchor_list, const ArAnchorList* anchor_list,
int32_t* out_size) { int32_t* out_size) {
arcore_api->impl_ArAnchorList_getSize(session, anchor_list, out_size); return g_arcore_api->impl_ArAnchorList_getSize(session, anchor_list,
out_size);
} }
void ArAnchor_detach(ArSession* session, ArAnchor* anchor) { void ArAnchor_detach(ArSession* session, ArAnchor* anchor) {
arcore_api->impl_ArAnchor_detach(session, anchor); return g_arcore_api->impl_ArAnchor_detach(session, anchor);
} }
void ArAnchor_getPose(const ArSession* session, void ArAnchor_getPose(const ArSession* session,
const ArAnchor* anchor, const ArAnchor* anchor,
ArPose* out_pose) { ArPose* out_pose) {
arcore_api->impl_ArAnchor_getPose(session, anchor, out_pose); return g_arcore_api->impl_ArAnchor_getPose(session, anchor, out_pose);
} }
void ArAnchor_getTrackingState(const ArSession* session, void ArAnchor_getTrackingState(const ArSession* session,
const ArAnchor* anchor, const ArAnchor* anchor,
ArTrackingState* out_tracking_state) { ArTrackingState* out_tracking_state) {
arcore_api->impl_ArAnchor_getTrackingState(session, anchor, return g_arcore_api->impl_ArAnchor_getTrackingState(session, anchor,
out_tracking_state); out_tracking_state);
} }
void ArAnchor_release(ArAnchor* anchor) { void ArAnchor_release(ArAnchor* anchor) {
arcore_api->impl_ArAnchor_release(anchor); g_arcore_api->impl_ArAnchor_release(anchor);
} }
void ArCamera_getDisplayOrientedPose(const ArSession* session, void ArCamera_getDisplayOrientedPose(const ArSession* session,
const ArCamera* camera, const ArCamera* camera,
ArPose* out_pose) { ArPose* out_pose) {
arcore_api->impl_ArCamera_getDisplayOrientedPose(session, camera, out_pose); return g_arcore_api->impl_ArCamera_getDisplayOrientedPose(session, camera,
out_pose);
} }
void ArCamera_getProjectionMatrix(const ArSession* session, void ArCamera_getProjectionMatrix(const ArSession* session,
...@@ -184,56 +213,81 @@ void ArCamera_getProjectionMatrix(const ArSession* session, ...@@ -184,56 +213,81 @@ void ArCamera_getProjectionMatrix(const ArSession* session,
float near, float near,
float far, float far,
float* dest_col_major_4x4) { float* dest_col_major_4x4) {
arcore_api->impl_ArCamera_getProjectionMatrix(session, camera, near, far, return g_arcore_api->impl_ArCamera_getProjectionMatrix(
dest_col_major_4x4); session, camera, near, far, dest_col_major_4x4);
} }
void ArCamera_getTrackingState(const ArSession* session, void ArCamera_getTrackingState(const ArSession* session,
const ArCamera* camera, const ArCamera* camera,
ArTrackingState* out_tracking_state) { ArTrackingState* out_tracking_state) {
arcore_api->impl_ArCamera_getTrackingState(session, camera, return g_arcore_api->impl_ArCamera_getTrackingState(session, camera,
out_tracking_state); out_tracking_state);
} }
void ArCamera_getViewMatrix(const ArSession* session, void ArCamera_getViewMatrix(const ArSession* session,
const ArCamera* camera, const ArCamera* camera,
float* out_matrix) { float* out_matrix) {
arcore_api->impl_ArCamera_getViewMatrix(session, camera, out_matrix); return g_arcore_api->impl_ArCamera_getViewMatrix(session, camera, out_matrix);
} }
void ArConfig_create(const ArSession* session, ArConfig** out_config) { void ArConfig_create(const ArSession* session, ArConfig** out_config) {
arcore_api->impl_ArConfig_create(session, out_config); return g_arcore_api->impl_ArConfig_create(session, out_config);
} }
void ArConfig_destroy(ArConfig* config) { void ArConfig_destroy(ArConfig* config) {
arcore_api->impl_ArConfig_destroy(config); return g_arcore_api->impl_ArConfig_destroy(config);
}
void ArConfig_getLightEstimationMode(
const ArSession* session,
const ArConfig* config,
ArLightEstimationMode* light_estimation_mode) {
return g_arcore_api->impl_ArConfig_getLightEstimationMode(
session, config, light_estimation_mode);
}
void ArConfig_setLightEstimationMode(
const ArSession* session,
ArConfig* config,
ArLightEstimationMode light_estimation_mode) {
return g_arcore_api->impl_ArConfig_setLightEstimationMode(
session, config, light_estimation_mode);
} }
void ArFrame_acquireCamera(const ArSession* session, void ArFrame_acquireCamera(const ArSession* session,
const ArFrame* frame, const ArFrame* frame,
ArCamera** out_camera) { ArCamera** out_camera) {
arcore_api->impl_ArFrame_acquireCamera(session, frame, out_camera); return g_arcore_api->impl_ArFrame_acquireCamera(session, frame, out_camera);
} }
void ArFrame_create(const ArSession* session, ArFrame** out_frame) { void ArFrame_create(const ArSession* session, ArFrame** out_frame) {
arcore_api->impl_ArFrame_create(session, out_frame); return g_arcore_api->impl_ArFrame_create(session, out_frame);
} }
void ArFrame_destroy(ArFrame* frame) { void ArFrame_destroy(ArFrame* frame) {
arcore_api->impl_ArFrame_destroy(frame); return g_arcore_api->impl_ArFrame_destroy(frame);
}
void ArFrame_getLightEstimate(const ArSession* session,
const ArFrame* frame,
ArLightEstimate* out_light_estimate) {
return g_arcore_api->impl_ArFrame_getLightEstimate(session, frame,
out_light_estimate);
} }
void ArFrame_getUpdatedAnchors(const ArSession* session, void ArFrame_getUpdatedAnchors(const ArSession* session,
const ArFrame* frame, const ArFrame* frame,
ArAnchorList* out_anchor_list) { ArAnchorList* out_anchor_list) {
arcore_api->impl_ArFrame_getUpdatedAnchors(session, frame, out_anchor_list); return g_arcore_api->impl_ArFrame_getUpdatedAnchors(session, frame,
out_anchor_list);
} }
void ArFrame_getUpdatedTrackables(const ArSession* session, void ArFrame_getUpdatedTrackables(const ArSession* session,
const ArFrame* frame, const ArFrame* frame,
ArTrackableType filter_type, ArTrackableType filter_type,
ArTrackableList* out_trackable_list) { ArTrackableList* out_trackable_list) {
arcore_api->impl_ArFrame_getUpdatedTrackables(session, frame, filter_type, return g_arcore_api->impl_ArFrame_getUpdatedTrackables(
out_trackable_list); session, frame, filter_type, out_trackable_list);
} }
void ArFrame_hitTestRay(const ArSession* session, void ArFrame_hitTestRay(const ArSession* session,
...@@ -241,8 +295,8 @@ void ArFrame_hitTestRay(const ArSession* session, ...@@ -241,8 +295,8 @@ void ArFrame_hitTestRay(const ArSession* session,
const float* ray_origin_3, const float* ray_origin_3,
const float* ray_direction_3, const float* ray_direction_3,
ArHitResultList* out_hit_results) { ArHitResultList* out_hit_results) {
arcore_api->impl_ArFrame_hitTestRay(session, frame, ray_origin_3, return g_arcore_api->impl_ArFrame_hitTestRay(
ray_direction_3, out_hit_results); session, frame, ray_origin_3, ray_direction_3, out_hit_results);
} }
void ArFrame_transformCoordinates2d(const ArSession* session, void ArFrame_transformCoordinates2d(const ArSession* session,
...@@ -252,221 +306,341 @@ void ArFrame_transformCoordinates2d(const ArSession* session, ...@@ -252,221 +306,341 @@ void ArFrame_transformCoordinates2d(const ArSession* session,
const float* vertices_2d, const float* vertices_2d,
ArCoordinates2dType output_coordinates, ArCoordinates2dType output_coordinates,
float* out_vertices_2d) { float* out_vertices_2d) {
arcore_api->impl_ArFrame_transformCoordinates2d( return g_arcore_api->impl_ArFrame_transformCoordinates2d(
session, frame, input_coordinates, number_of_vertices, vertices_2d, session, frame, input_coordinates, number_of_vertices, vertices_2d,
output_coordinates, out_vertices_2d); output_coordinates, out_vertices_2d);
} }
void ArHitResult_create(const ArSession* session, void ArHitResult_create(const ArSession* session,
ArHitResult** out_hit_result) { ArHitResult** out_hit_result) {
arcore_api->impl_ArHitResult_create(session, out_hit_result); return g_arcore_api->impl_ArHitResult_create(session, out_hit_result);
} }
void ArHitResult_destroy(ArHitResult* hit_result) { void ArHitResult_destroy(ArHitResult* hit_result) {
arcore_api->impl_ArHitResult_destroy(hit_result); return g_arcore_api->impl_ArHitResult_destroy(hit_result);
} }
void ArHitResult_getHitPose(const ArSession* session, void ArHitResult_getHitPose(const ArSession* session,
const ArHitResult* hit_result, const ArHitResult* hit_result,
ArPose* out_pose) { ArPose* out_pose) {
arcore_api->impl_ArHitResult_getHitPose(session, hit_result, out_pose); return g_arcore_api->impl_ArHitResult_getHitPose(session, hit_result,
out_pose);
} }
void ArHitResult_acquireTrackable(const ArSession* session, void ArHitResult_acquireTrackable(const ArSession* session,
const ArHitResult* hit_result, const ArHitResult* hit_result,
ArTrackable** out_trackable) { ArTrackable** out_trackable) {
arcore_api->impl_ArHitResult_acquireTrackable(session, hit_result, return g_arcore_api->impl_ArHitResult_acquireTrackable(session, hit_result,
out_trackable); out_trackable);
} }
ArStatus ArTrackable_acquireNewAnchor(ArSession* session, ArStatus ArTrackable_acquireNewAnchor(ArSession* session,
ArTrackable* trackable, ArTrackable* trackable,
ArPose* pose, ArPose* pose,
ArAnchor** out_anchor) { ArAnchor** out_anchor) {
return arcore_api->impl_ArTrackable_acquireNewAnchor(session, trackable, pose, return g_arcore_api->impl_ArTrackable_acquireNewAnchor(session, trackable,
out_anchor); pose, out_anchor);
} }
void ArTrackable_getTrackingState(const ArSession* session, void ArTrackable_getTrackingState(const ArSession* session,
const ArTrackable* trackable, const ArTrackable* trackable,
ArTrackingState* out_tracking_state) { ArTrackingState* out_tracking_state) {
arcore_api->impl_ArTrackable_getTrackingState(session, trackable, return g_arcore_api->impl_ArTrackable_getTrackingState(session, trackable,
out_tracking_state); out_tracking_state);
} }
void ArTrackable_getType(const ArSession* session, void ArTrackable_getType(const ArSession* session,
const ArTrackable* trackable, const ArTrackable* trackable,
ArTrackableType* out_trackable_type) { ArTrackableType* out_trackable_type) {
arcore_api->impl_ArTrackable_getType(session, trackable, out_trackable_type); return g_arcore_api->impl_ArTrackable_getType(session, trackable,
out_trackable_type);
} }
void ArTrackable_release(ArTrackable* trackable) { void ArTrackable_release(ArTrackable* trackable) {
arcore_api->impl_ArTrackable_release(trackable); return g_arcore_api->impl_ArTrackable_release(trackable);
} }
void ArTrackableList_acquireItem(const ArSession* session, void ArTrackableList_acquireItem(const ArSession* session,
const ArTrackableList* trackable_list, const ArTrackableList* trackable_list,
int32_t index, int32_t index,
ArTrackable** out_trackable) { ArTrackable** out_trackable) {
arcore_api->impl_ArTrackableList_acquireItem(session, trackable_list, index, return g_arcore_api->impl_ArTrackableList_acquireItem(session, trackable_list,
out_trackable); index, out_trackable);
} }
void ArTrackableList_create(const ArSession* session, void ArTrackableList_create(const ArSession* session,
ArTrackableList** out_trackable_list) { ArTrackableList** out_trackable_list) {
arcore_api->impl_ArTrackableList_create(session, out_trackable_list); return g_arcore_api->impl_ArTrackableList_create(session, out_trackable_list);
} }
void ArTrackableList_destroy(ArTrackableList* trackable_list) { void ArTrackableList_destroy(ArTrackableList* trackable_list) {
arcore_api->impl_ArTrackableList_destroy(trackable_list); return g_arcore_api->impl_ArTrackableList_destroy(trackable_list);
} }
void ArTrackableList_getSize(const ArSession* session, void ArTrackableList_getSize(const ArSession* session,
const ArTrackableList* trackable_list, const ArTrackableList* trackable_list,
int32_t* out_size) { int32_t* out_size) {
arcore_api->impl_ArTrackableList_getSize(session, trackable_list, out_size); return g_arcore_api->impl_ArTrackableList_getSize(session, trackable_list,
out_size);
} }
void ArPlane_acquireSubsumedBy(const ArSession* session, void ArPlane_acquireSubsumedBy(const ArSession* session,
const ArPlane* plane, const ArPlane* plane,
ArPlane** out_subsumed_by) { ArPlane** out_subsumed_by) {
arcore_api->impl_ArPlane_acquireSubsumedBy(session, plane, out_subsumed_by); return g_arcore_api->impl_ArPlane_acquireSubsumedBy(session, plane,
out_subsumed_by);
} }
void ArPlane_getCenterPose(const ArSession* session, void ArPlane_getCenterPose(const ArSession* session,
const ArPlane* plane, const ArPlane* plane,
ArPose* out_pose) { ArPose* out_pose) {
arcore_api->impl_ArPlane_getCenterPose(session, plane, out_pose); return g_arcore_api->impl_ArPlane_getCenterPose(session, plane, out_pose);
} }
void ArPlane_getPolygon(const ArSession* session, void ArPlane_getPolygon(const ArSession* session,
const ArPlane* plane, const ArPlane* plane,
float* out_polygon_xz) { float* out_polygon_xz) {
arcore_api->impl_ArPlane_getPolygon(session, plane, out_polygon_xz); return g_arcore_api->impl_ArPlane_getPolygon(session, plane, out_polygon_xz);
} }
void ArPlane_getPolygonSize(const ArSession* session, void ArPlane_getPolygonSize(const ArSession* session,
const ArPlane* plane, const ArPlane* plane,
int32_t* out_polygon_size) { int32_t* out_polygon_size) {
arcore_api->impl_ArPlane_getPolygonSize(session, plane, out_polygon_size); return g_arcore_api->impl_ArPlane_getPolygonSize(session, plane,
out_polygon_size);
} }
void ArPlane_getType(const ArSession* session, void ArPlane_getType(const ArSession* session,
const ArPlane* plane, const ArPlane* plane,
ArPlaneType* out_plane_type) { ArPlaneType* out_plane_type) {
arcore_api->impl_ArPlane_getType(session, plane, out_plane_type); return g_arcore_api->impl_ArPlane_getType(session, plane, out_plane_type);
} }
void ArPlane_isPoseInPolygon(const ArSession* session, void ArPlane_isPoseInPolygon(const ArSession* session,
const ArPlane* plane, const ArPlane* plane,
const ArPose* pose, const ArPose* pose,
int32_t* out_pose_in_polygon) { int32_t* out_pose_in_polygon) {
arcore_api->impl_ArPlane_isPoseInPolygon(session, plane, pose, return g_arcore_api->impl_ArPlane_isPoseInPolygon(session, plane, pose,
out_pose_in_polygon); out_pose_in_polygon);
} }
void ArHitResultList_create(const ArSession* session, void ArHitResultList_create(const ArSession* session,
ArHitResultList** out_hit_result_list) { ArHitResultList** out_hit_result_list) {
arcore_api->impl_ArHitResultList_create(session, out_hit_result_list); return g_arcore_api->impl_ArHitResultList_create(session,
out_hit_result_list);
} }
void ArHitResultList_destroy(ArHitResultList* hit_result_list) { void ArHitResultList_destroy(ArHitResultList* hit_result_list) {
arcore_api->impl_ArHitResultList_destroy(hit_result_list); return g_arcore_api->impl_ArHitResultList_destroy(hit_result_list);
} }
void ArHitResultList_getItem(const ArSession* session, void ArHitResultList_getItem(const ArSession* session,
const ArHitResultList* hit_result_list, const ArHitResultList* hit_result_list,
int index, int index,
ArHitResult* out_hit_result) { ArHitResult* out_hit_result) {
arcore_api->impl_ArHitResultList_getItem(session, hit_result_list, index, return g_arcore_api->impl_ArHitResultList_getItem(session, hit_result_list,
out_hit_result); index, out_hit_result);
} }
void ArHitResultList_getSize(const ArSession* session, void ArHitResultList_getSize(const ArSession* session,
const ArHitResultList* hit_result_list, const ArHitResultList* hit_result_list,
int* out_size) { int* out_size) {
arcore_api->impl_ArHitResultList_getSize(session, hit_result_list, out_size); return g_arcore_api->impl_ArHitResultList_getSize(session, hit_result_list,
out_size);
}
void ArLightEstimate_acquireEnvironmentalHdrCubemap(
const ArSession* session,
const ArLightEstimate* light_estimate,
ArImageCubemap out_textures_6) {
return g_arcore_api->impl_ArLightEstimate_acquireEnvironmentalHdrCubemap(
session, light_estimate, out_textures_6);
}
void ArLightEstimate_create(const ArSession* session,
ArLightEstimate** out_light_estimate) {
return g_arcore_api->impl_ArLightEstimate_create(session, out_light_estimate);
}
void ArLightEstimate_destroy(ArLightEstimate* light_estimate) {
return g_arcore_api->impl_ArLightEstimate_destroy(light_estimate);
}
void ArLightEstimate_getEnvironmentalHdrAmbientSphericalHarmonics(
const ArSession* session,
const ArLightEstimate* light_estimate,
float* out_coefficients_27) {
return g_arcore_api
->impl_ArLightEstimate_getEnvironmentalHdrAmbientSphericalHarmonics(
session, light_estimate, out_coefficients_27);
}
void ArLightEstimate_getEnvironmentalHdrMainLightDirection(
const ArSession* session,
const ArLightEstimate* light_estimate,
float* out_direction_3) {
return g_arcore_api
->impl_ArLightEstimate_getEnvironmentalHdrMainLightDirection(
session, light_estimate, out_direction_3);
}
void ArLightEstimate_getEnvironmentalHdrMainLightIntensity(
const ArSession* session,
const ArLightEstimate* light_estimate,
float* out_intensity_3) {
return g_arcore_api
->impl_ArLightEstimate_getEnvironmentalHdrMainLightIntensity(
session, light_estimate, out_intensity_3);
}
void ArLightEstimate_getState(const ArSession* session,
const ArLightEstimate* light_estimate,
ArLightEstimateState* out_light_estimate_state) {
return g_arcore_api->impl_ArLightEstimate_getState(session, light_estimate,
out_light_estimate_state);
}
void ArLightEstimate_getTimestamp(const ArSession* session,
const ArLightEstimate* light_estimate,
int64_t* out_timestamp_ns) {
return g_arcore_api->impl_ArLightEstimate_getTimestamp(
session, light_estimate, out_timestamp_ns);
} }
void ArPose_create(const ArSession* session, void ArPose_create(const ArSession* session,
const float* pose_raw, const float* pose_raw,
ArPose** out_pose) { ArPose** out_pose) {
arcore_api->impl_ArPose_create(session, pose_raw, out_pose); return g_arcore_api->impl_ArPose_create(session, pose_raw, out_pose);
} }
void ArPose_destroy(ArPose* pose) { void ArPose_destroy(ArPose* pose) {
arcore_api->impl_ArPose_destroy(pose); return g_arcore_api->impl_ArPose_destroy(pose);
} }
void ArPose_getMatrix(const ArSession* session, void ArPose_getMatrix(const ArSession* session,
const ArPose* pose, const ArPose* pose,
float* out_matrix) { float* out_matrix) {
arcore_api->impl_ArPose_getMatrix(session, pose, out_matrix); return g_arcore_api->impl_ArPose_getMatrix(session, pose, out_matrix);
} }
void ArPose_getPoseRaw(const ArSession* session, void ArPose_getPoseRaw(const ArSession* session,
const ArPose* pose, const ArPose* pose,
float* out_pose_raw) { float* out_pose_raw) {
arcore_api->impl_ArPose_getPoseRaw(session, pose, out_pose_raw); return g_arcore_api->impl_ArPose_getPoseRaw(session, pose, out_pose_raw);
} }
ArStatus ArSession_acquireNewAnchor(ArSession* session, ArStatus ArSession_acquireNewAnchor(ArSession* session,
const ArPose* pose, const ArPose* pose,
ArAnchor** out_anchor) { ArAnchor** out_anchor) {
return arcore_api->impl_ArSession_acquireNewAnchor(session, pose, out_anchor); return g_arcore_api->impl_ArSession_acquireNewAnchor(session, pose,
out_anchor);
} }
ArStatus ArSession_configure(ArSession* session, const ArConfig* config) { ArStatus ArSession_configure(ArSession* session, const ArConfig* config) {
return arcore_api->impl_ArSession_configure(session, config); return g_arcore_api->impl_ArSession_configure(session, config);
} }
ArStatus ArSession_create(void* env, ArStatus ArSession_create(void* env,
void* application_context, void* application_context,
ArSession** out_session_pointer) { ArSession** out_session_pointer) {
return arcore_api->impl_ArSession_create(env, application_context, return g_arcore_api->impl_ArSession_create(env, application_context,
out_session_pointer); out_session_pointer);
} }
void ArSession_destroy(ArSession* session) { void ArSession_destroy(ArSession* session) {
arcore_api->impl_ArSession_destroy(session); return g_arcore_api->impl_ArSession_destroy(session);
} }
void ArSession_enableIncognitoMode_private(ArSession* session) { void ArSession_enableIncognitoMode_private(ArSession* session) {
arcore_api->impl_ArSession_enableIncognitoMode_private(session); return g_arcore_api->impl_ArSession_enableIncognitoMode_private(session);
} }
void ArSession_getAllAnchors(const ArSession* session, void ArSession_getAllAnchors(const ArSession* session,
ArAnchorList* out_anchor_list) { ArAnchorList* out_anchor_list) {
arcore_api->impl_ArSession_getAllAnchors(session, out_anchor_list); return g_arcore_api->impl_ArSession_getAllAnchors(session, out_anchor_list);
} }
void ArSession_getAllTrackables(const ArSession* session, void ArSession_getAllTrackables(const ArSession* session,
ArTrackableType filter_type, ArTrackableType filter_type,
ArTrackableList* out_trackable_list) { ArTrackableList* out_trackable_list) {
arcore_api->impl_ArSession_getAllTrackables(session, filter_type, return g_arcore_api->impl_ArSession_getAllTrackables(session, filter_type,
out_trackable_list); out_trackable_list);
} }
ArStatus ArSession_pause(ArSession* session) { ArStatus ArSession_pause(ArSession* session) {
return arcore_api->impl_ArSession_pause(session); return g_arcore_api->impl_ArSession_pause(session);
} }
ArStatus ArSession_resume(ArSession* session) { ArStatus ArSession_resume(ArSession* session) {
return arcore_api->impl_ArSession_resume(session); return g_arcore_api->impl_ArSession_resume(session);
} }
void ArSession_setCameraTextureName(ArSession* session, uint32_t texture_id) { void ArSession_setCameraTextureName(ArSession* session, uint32_t texture_id) {
return arcore_api->impl_ArSession_setCameraTextureName(session, texture_id); return g_arcore_api->impl_ArSession_setCameraTextureName(session, texture_id);
} }
void ArSession_setDisplayGeometry(ArSession* session, void ArSession_setDisplayGeometry(ArSession* session,
int32_t rotation, int32_t rotation,
int32_t width, int32_t width,
int32_t height) { int32_t height) {
return arcore_api->impl_ArSession_setDisplayGeometry(session, rotation, width, return g_arcore_api->impl_ArSession_setDisplayGeometry(session, rotation,
height); width, height);
} }
ArStatus ArSession_update(ArSession* session, ArFrame* out_frame) { ArStatus ArSession_update(ArSession* session, ArFrame* out_frame) {
return arcore_api->impl_ArSession_update(session, out_frame); return g_arcore_api->impl_ArSession_update(session, out_frame);
}
void ArImage_getWidth(const ArSession* session,
const ArImage* image,
int32_t* out_width) {
return g_arcore_api->impl_ArImage_getWidth(session, image, out_width);
}
void ArImage_getHeight(const ArSession* session,
const ArImage* image,
int32_t* out_height) {
return g_arcore_api->impl_ArImage_getWidth(session, image, out_height);
}
void ArImage_getFormat(const ArSession* session,
const ArImage* image,
ArImageFormat* out_format) {
return g_arcore_api->impl_ArImage_getFormat(session, image, out_format);
}
void ArImage_getNumberOfPlanes(const ArSession* session,
const ArImage* image,
int32_t* out_num_planes) {
return g_arcore_api->impl_ArImage_getNumberOfPlanes(session, image,
out_num_planes);
}
void ArImage_getPlanePixelStride(const ArSession* session,
const ArImage* image,
int32_t plane_index,
int32_t* out_pixel_stride) {
return g_arcore_api->impl_ArImage_getPlanePixelStride(
session, image, plane_index, out_pixel_stride);
}
void ArImage_getPlaneRowStride(const ArSession* session,
const ArImage* image,
int32_t plane_index,
int32_t* out_row_stride) {
return g_arcore_api->impl_ArImage_getPlaneRowStride(
session, image, plane_index, out_row_stride);
}
void ArImage_getPlaneData(const ArSession* session,
const ArImage* image,
int32_t plane_index,
const uint8_t** out_data,
int32_t* out_data_length) {
return g_arcore_api->impl_ArImage_getPlaneData(session, image, plane_index,
out_data, out_data_length);
}
void ArImage_release(ArImage* image) {
return g_arcore_api->impl_ArImage_release(image);
} }
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_ARCORE_SHIM_H_ #ifndef CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_ARCORE_SHIM_H_
#define CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_ARCORE_SHIM_H_ #define CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_ARCORE_SHIM_H_
#include <string>
namespace vr { namespace vr {
// TODO(https://crbug.com/917526): add support for unloading the SDK. // TODO(https://crbug.com/917526): add support for unloading the SDK.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment