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
/
QCARutils.h
executable file
·172 lines (137 loc) · 5.19 KB
/
QCARutils.h
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*==============================================================================
Copyright (c) 2010-2013 QUALCOMM Austria Research Center GmbH.
All Rights Reserved.
Qualcomm Confidential and Proprietary
==============================================================================*/
#import <Foundation/Foundation.h>
#import <QCAR/Tool.h>
#import <QCAR/DataSet.h>
#import <QCAR/ImageTarget.h>
#import <QCAR/CameraDevice.h>
#import <QCAR/TrackableResult.h>
#import "Texture.h"
// Target type - used by the app to tell QCAR its intent
typedef enum typeOfTarget {
TYPE_IMAGETARGETS,
TYPE_MULTITARGETS,
TYPE_FRAMEMARKERS
} TargetType;
// Application status - used by QCAR initialisation
typedef enum _status {
APPSTATUS_UNINITED,
APPSTATUS_INIT_APP,
APPSTATUS_INIT_QCAR,
APPSTATUS_INIT_TRACKER,
APPSTATUS_INIT_APP_AR,
APPSTATUS_LOAD_TRACKER,
APPSTATUS_INITED,
APPSTATUS_CAMERA_STOPPED,
APPSTATUS_CAMERA_RUNNING,
APPSTATUS_ERROR
} status;
// Local error codes - offset by -1000 to allow for QCAR::init() error codes in QCAR.h
enum _errorCode {
QCAR_ERRCODE_INIT_TRACKER = -1000,
QCAR_ERRCODE_CREATE_DATASET = -1001,
QCAR_ERRCODE_LOAD_DATASET = -1002,
QCAR_ERRCODE_ACTIVATE_DATASET = -1003,
QCAR_ERRCODE_DEACTIVATE_DATASET = -1004,
QCAR_ERRCODE_DESTROY_DATASET = -1005,
QCAR_ERRCODE_LOAD_TARGET = -1006,
QCAR_ERRCODE_NO_NETWORK_CONNECTION = -1007,
QCAR_ERRCODE_NO_SERVICE_AVAILABLE = -1008
};
#pragma mark --- Class interface for DataSet list ---
@interface DataSetItem : NSObject
{
@protected
NSString *name;
NSString *path;
QCAR::DataSet *dataSet;
}
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *path;
@property (nonatomic) QCAR::DataSet *dataSet;
- (id) initWithName:(NSString *)theName andPath:(NSString *)thePath;
@end
#pragma mark --- Class interface ---
@interface QCARutils : NSObject <UIAlertViewDelegate>
{
@public
CGSize viewSize; // set in initialisation
id delegate; // a class that will handle optional callbacks
CGFloat contentScalingFactor; // 1.0 normal, 2.0 for retina enabled
NSMutableArray *targetsList; // Array of DataSetItem - load target from this list of resources
int QCARFlags; // QCAR initialisation flags
status appStatus; // Current app status
int errorCode; // if appStatus == APPSTATUS_ERROR
TargetType targetType; // for app to inform QCARutils
struct tagViewport { // shared between users of QCARutils
int posX;
int posY;
int sizeX;
int sizeY;
} viewport;
QCAR::Matrix44F projectionMatrix; // OpenGL projection matrix
BOOL videoStreamStarted; // becomes true at first "camera is running"
BOOL isVisualSearchOn;
BOOL vsAutoControlEnabled;
NSInteger noOfCameras;
BOOL orientationChanged;
UIInterfaceOrientation orientation;
@private
QCAR::DataSet * currentDataSet; // the loaded DataSet
BOOL cameraTorchOn;
BOOL cameraContinuousAFOn;
@protected
QCAR::CameraDevice::CAMERA activeCamera;
}
@property (nonatomic) CGSize viewSize;
@property (nonatomic, assign) id delegate;
@property (nonatomic) CGFloat contentScalingFactor;
@property (nonatomic, retain) NSMutableArray *targetsList;
@property (nonatomic) int QCARFlags;
@property (nonatomic) status appStatus;
@property (nonatomic) int errorCode;
@property (nonatomic) NSInteger noOfCameras;
@property (nonatomic) TargetType targetType;
@property (nonatomic) struct tagViewport viewport;
@property (nonatomic) QCAR::Matrix44F projectionMatrix;
@property (nonatomic) BOOL videoStreamStarted;
@property (nonatomic, readonly) BOOL cameraTorchOn;
@property (nonatomic, readonly) BOOL cameraContinuousAFOn;
@property (nonatomic) BOOL isVisualSearchOn;
@property (nonatomic) BOOL vsAutoControlEnabled;
@property (readwrite) BOOL orientationChanged;
@property (readwrite) UIInterfaceOrientation orientation;
@property (nonatomic, readonly) QCAR::CameraDevice::CAMERA activeCamera;
#pragma mark --- Class Methods ---
+ (QCARutils *) getInstance;
- (void)initApplication;
- (void)initApplicationAR;
- (void)postInitQCAR;
- (void)restoreCameraSettings;
- (void)createARofSize:(CGSize)theSize forDelegate:(id)theDelegate;
- (void)destroyAR;
- (void)pauseAR;
- (void)resumeAR;
- (void) addTargetName:(NSString *)theName atPath:(NSString *)thePath;
- (BOOL)unloadDataSet:(QCAR::DataSet *)theDataSet;
- (QCAR::DataSet *)loadDataSet:(NSString *)dataSetPath;
- (BOOL)deactivateDataSet:(QCAR::DataSet *)theDataSet;
- (BOOL)activateDataSet:(QCAR::DataSet *)theDataSet;
- (void) allowDataSetModification;
- (void) saveDataSetModifications;
- (QCAR::ImageTarget *) findImageTarget:(const char *) name;
- (QCAR::MultiTarget *) findMultiTarget;
- (QCAR::ImageTarget *) getImageTarget:(int)itemNo;
- (void)cameraSetTorchMode:(BOOL)switchOn;
- (void)cameraSetContinuousAFMode:(BOOL)switchOn;
- (void)cameraTriggerAF;
- (void)cameraCancelAF;
- (void)cameraPerformAF;
- (NSMutableArray*) loadTextures:(NSArray*)textureList;
- (Texture *) createTexture:(NSString*)fileName;
- (void) configureVideoBackground;
@end
extern QCARutils *qUtils;