Skip to content

Metal-based framework project to be included in other light anchor projects

Notifications You must be signed in to change notification settings

conix-center/LightAnchorFramework

Repository files navigation

LightAnchorFramework

To build the light anchor framework

  1. Install XCode from the App Store
  2. Clone this repository
  3. Open the .xcodeproj file
  4. Plug in an iOS device
  5. Select the iOS device from the drop down next to the target at the top of XCode
  6. Build the project by clicking the play button in xcode

To build the metallib file

  1. Navigate to the folder containing the .metal file

  2. Run

    xcrun -sdk iphoneos metal -c lightanchorkernels.metal -o lightanchorkernels.air

    xcrun -sdk iphoneos metallib lightanchorkernels.air -o lightanchorkernels.metallib

To use the light anchor framework in a new project

  1. Install cocoapods by running "sudo gem install cocoapods" in the terminal

  2. Create a new xcode project

  3. Quit the xcode project

  4. Navigate in a terminal to the project folder

  5. Run "pod init" Cocoapods is a package manager for iOS

  6. Add 'pod "LASwift"' after the first target line in the "podfile" that was created when "pod init" was run

  7. Run "pod install"

  8. Open the white .xcworkspace file (not the blue .xcodeproj file)

  9. Drag the framework file from "products" in the framework project into "frameworks" of the app project. Select "Copy items if needed" when copying. alt text alt text

  10. Drag the .metallib file into the new project. Select "Copy items if needed" when copying.

  11. Within xcode drag the framework from the left side into "Embedded Binaries" in the general tab of your target's settings alt text

  12. Plug in an iOS device

  13. Select the iOS device from the drop down next to the target at the top of XCode

  14. Click the play button

Create an instance of LightAnchorPoseManager

Set a class to be the delegate of LightAnchorPoseManager

Implement the LightAnchorPoseManagerDelegate methods

@objc public protocol LightAnchorPoseManagerDelegate {
    func lightAnchorPoseManager(_ :LightAnchorPoseManager, didUpdate transform: SCNMatrix4)
    func lightAnchorPoseManager(_ :LightAnchorPoseManager, didUpdatePointsFor codeIndex: Int, displayMeanX:Float, displayMeanY: Float, displayStdDevX: Float, displayStdDevY: Float)
    func lightAnchorPoseManager(_ :LightAnchorPoseManager, didUpdateResultImage resultImage: UIImage)
}

Example usage can be found here:

https://github.com/conix-center/LightAnchors

About

Metal-based framework project to be included in other light anchor projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published