This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageTargetsParentViewController.mm
executable file
·96 lines (73 loc) · 3.15 KB
/
ImageTargetsParentViewController.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*==============================================================================
Copyright (c) 2010-2013 QUALCOMM Austria Research Center GmbH.
All Rights Reserved.
Qualcomm Confidential and Proprietary
==============================================================================*/
#import "ImageTargetsParentViewController.h"
#import "ImageTargetsQCARutils.h"
#import "ImageTargetsOverlayViewController.h"
#import "ARViewController.h"
#import "AboutViewController.h"
@implementation ImageTargetsParentViewController
- (void)loadView
{
NSLog(@"ImageTargetsParentViewController: creating");
// arViewRect.size = self.view.bounds.size;
// arViewRect.origin.x = arViewRect.origin.y = 0;
[self createParentViewAndSplashContinuation];
// Add the EAGLView and the overlay view to the window
arViewController = [[ARViewController alloc] init];
//1280, 960
// need to set size here to setup camera image size for AR
arViewController.arViewSize = arViewRect.size;
[parentView addSubview:arViewController.view];
// Hide the AR view so the parent view can be seen during start-up (the
// parent view contains the splash continuation image on iPad and is empty
// on iPhone and iPod)
[arViewController.view setHidden:YES];
// Create an auto-rotating overlay view and its view controller (used for
// displaying UI objects, such as the camera control menu)
overlayViewController = [[ImageTargetsOverlayViewController alloc] init];
[parentView addSubview: overlayViewController.view];
self.view = parentView;
}
// Deprecated on iOS 6. Use the 2 methods below to control autorotation
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
BOOL retVal = [[ImageTargetsQCARutils getInstance] shouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
return retVal;
}
- (BOOL)shouldAutorotate
{
BOOL retVal = [[ImageTargetsQCARutils getInstance] shouldAutorotate];
return retVal;
}
- (NSUInteger) supportedInterfaceOrientations
{
NSUInteger retVal = [[ImageTargetsQCARutils getInstance] supportedInterfaceOrientations];
return retVal;
}
#pragma mark -
#pragma mark Splash screen control
- (void)endSplash:(NSTimer*)theTimer
{
// Poll to see if the camera video stream has started and if so remove the
// splash screen
[super endSplash:theTimer];
if ([QCARutils getInstance].videoStreamStarted == YES)
{
// Create and show the about view
// AboutViewController *aboutViewController = [[[AboutViewController alloc] init] autorelease];
// aboutViewController.modalPresentationStyle = UIModalPresentationFormSheet;
// Animate the modal only if it's an iPad
BOOL shouldAnimateTransition = NO;
if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
shouldAnimateTransition = YES;
}
dispatch_async( dispatch_get_main_queue(), ^{
// [self presentModalViewController:aboutViewController animated:shouldAnimateTransition];
});
}
}
@end