Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magic leap found object tracking #1360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deps/exokit-bindings/magicleap/include/magicleap.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <ml_planes.h>
#include <ml_camera.h>
#include <ml_eye_tracking.h>
#include <ml_found_object.h>
#include <ml_privilege_ids.h>
#include <ml_privilege_functions.h>
#include <ml_input.h>
Expand Down
16 changes: 15 additions & 1 deletion deps/exokit-bindings/magicleap/src/magicleap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ std::vector<EyeRequest *> eyeRequests;
MLEyeTrackingState eyeState;
MLEyeTrackingStaticData eyeStaticData;

MLHandle objectTracker;

bool isPresent() {
return lifecycle_status == MLResult_Ok;
}
Expand Down Expand Up @@ -1020,6 +1022,12 @@ NAN_METHOD(MLContext::Present) {
info.GetReturnValue().Set(Nan::Null());
return;
}

if (MLFoundObjectTrackerCreate(&objectTracker) != MLResult_Ok) {
ML_LOG(Error, "%s: failed to create object tracker handle", application_name);
info.GetReturnValue().Set(Nan::Null());
return;
}

// Now that graphics is connected, the app is ready to go
if (MLLifecycleSetReadyIndication() != MLResult_Ok) {
Expand Down Expand Up @@ -1154,7 +1162,13 @@ NAN_METHOD(MLContext::Exit) {
}

if (MLEyeTrackingDestroy(eyeTracker) != MLResult_Ok) {
ML_LOG(Error, "%s: failed to create eye handle", application_name);
ML_LOG(Error, "%s: failed to destroy eye handle", application_name);
info.GetReturnValue().Set(Nan::Null());
return;
}

if (MLFoundObjectTrackerDestroy(objectTracker) != MLResult_Ok) {
ML_LOG(Error, "%s: failed to destroy object tracker handle", application_name);
info.GetReturnValue().Set(Nan::Null());
return;
}
Expand Down