Skip to content

Instantly share code, notes, and snippets.

@cdun
Created May 18, 2016 17:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cdun/ee66969d4a6eb2ed50832a04bc1cee6c to your computer and use it in GitHub Desktop.
Wikitude CPU / completion
// Check that the device is supported.
NSError *deviceError = nil;
if ( [WTArchitectView isDeviceSupportedForRequiredFeatures:self.requiredFeatures error:&deviceError] ) {
// Create the architect view if needed.
if ( self.architectView == nil) {
WTArchitectView *architectView = [[WTArchitectView alloc] initWithFrame:self.wikitudeParentView.frame];
architectView.delegate = self;
// Set the licence key.
[architectView setLicenseKey:self.wikitudeLicenceKey];
[self.wikitudeParentView addSubview:architectView];
self.architectView = architectView;
}
// Make sure calls are balanced.
if ( !self.architectView.isRunning ) {
// Start rendering.
[self.architectView start:^(WTStartupConfiguration *configuration) {
// Optional config for camera direction, frame rate etc.
configuration.captureDevicePosition = self.captureDevicePosition;
} completion:^(BOOL isRunning, NSError *error) {
if (self.loadedURL == nil)
{
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html" subdirectory:@"world"];
[self.architectView loadArchitectWorldFromURL:url withRequiredFeatures:WTFeature_2DTracking];
}
}];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment