ARWrapper
Provides a C++ wrapper around ARToolKit and exposes a C and JNI API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
ARToolKitWrapperExportedAPI.h
Go to the documentation of this file.
1 /*
2  * ARToolKitWrapperExportedAPI.h
3  * ARToolKit5
4  *
5  * This file is part of ARToolKit.
6  *
7  * ARToolKit is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * ARToolKit is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with ARToolKit. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * As a special exception, the copyright holders of this library give you
21  * permission to link this library with independent modules to produce an
22  * executable, regardless of the license terms of these independent modules, and to
23  * copy and distribute the resulting executable under terms of your choice,
24  * provided that you also meet, for each linked independent module, the terms and
25  * conditions of the license of that module. An independent module is a module
26  * which is neither derived from nor based on this library. If you modify this
27  * library, you may extend this exception to your version of the library, but you
28  * are not obligated to do so. If you do not wish to do so, delete this exception
29  * statement from your version.
30  *
31  * Copyright 2015 Daqri, LLC.
32  * Copyright 2010-2015 ARToolworks, Inc.
33  *
34  * Author(s): Philip Lamb, Julian Looser.
35  *
36  */
37 
38 #ifndef ARTOOLKITWRAPPEREXPORTEDAPI_H
39 #define ARTOOLKITWRAPPEREXPORTEDAPI_H
40 
41 #include <ARWrapper/Platform.h>
42 #include <ARWrapper/Image.h>
43 #include <ARWrapper/Error.h>
44 
50 extern "C" {
51 
57  EXPORT_API void arwRegisterLogCallback(PFN_LOGCALLBACK callback);
58 
59  EXPORT_API void arwSetLogLevel(const int logLevel);
60 
61  // ----------------------------------------------------------------------------------------------------
62 #pragma mark ARToolKit lifecycle functions
63  // ----------------------------------------------------------------------------------------------------
70  EXPORT_API bool arwInitialiseAR();
71 
79  EXPORT_API bool arwInitialiseARWithOptions(const int pattSize, const int pattCountMax);
80 
88  EXPORT_API bool arwGetARToolKitVersion(char *buffer, int length);
89 
111  EXPORT_API int arwGetError();
112 
119  EXPORT_API bool arwChangeToResourcesDir(const char *resourcesDirectoryPath);
120 
130  EXPORT_API bool arwStartRunning(const char *vconf, const char *cparaName, const float nearPlane, const float farPlane);
131 
142  EXPORT_API bool arwStartRunningB(const char *vconf, const char *cparaBuff, const int cparaBuffLen, const float nearPlane, const float farPlane);
143 
144  EXPORT_API bool arwStartRunningStereo(const char *vconfL, const char *cparaNameL, const char *vconfR, const char *cparaNameR, const char *transL2RName, const float nearPlane, const float farPlane);
145 
146  EXPORT_API bool arwStartRunningStereoB(const char *vconfL, const char *cparaBuffL, const int cparaBuffLenL, const char *vconfR, const char *cparaBuffR, int cparaBuffLenR, const char *transL2RBuff, const int transL2RBuffLen, const float nearPlane, const float farPlane);
147 
152  EXPORT_API bool arwIsRunning();
153 
159  EXPORT_API bool arwStopRunning();
160 
169  EXPORT_API bool arwShutdownAR();
170 
171  // ----------------------------------------------------------------------------------------------------
172 #pragma mark Video stream management
173  // ----------------------------------------------------------------------------------------------------
174 
180  EXPORT_API bool arwGetProjectionMatrix(float p[16]);
181 
188  EXPORT_API bool arwGetProjectionMatrixStereo(float pL[16], float pR[16]);
189 
200  EXPORT_API bool arwGetVideoParams(int *width, int *height, int *pixelSize, char *pixelFormatStringBuffer, int pixelFormatStringBufferLen);
201 
217  EXPORT_API bool arwGetVideoParamsStereo(int *widthL, int *heightL, int *pixelSizeL, char *pixelFormatStringBufferL, int pixelFormatStringBufferLenL, int *widthR, int *heightR, int *pixelSizeR, char *pixelFormatStringBufferR, int pixelFormatStringBufferLenR);
218 
223  EXPORT_API bool arwCapture();
224 
230  EXPORT_API bool arwUpdateAR();
231 
237  EXPORT_API bool arwUpdateTexture(Color *buffer);
238 
239  EXPORT_API bool arwUpdateTexture32(unsigned int *buffer);
240 
241  EXPORT_API bool arwUpdateTextureStereo(Color *bufferL, Color *bufferR);
242 
243  EXPORT_API bool arwUpdateTexture32Stereo(unsigned int *bufferL, unsigned int *bufferR);
244 
252  EXPORT_API void arwSetVideoDebugMode(bool debug);
253 
259  EXPORT_API bool arwGetVideoDebugMode();
260 
266  EXPORT_API bool arwUpdateDebugTexture(Color *buffer);
267 
268 
275  EXPORT_API bool arwUpdateDebugTexture32(unsigned int *buffer);
276 
277 #if !TARGET_PLATFORM_WINRT
278 
283  EXPORT_API bool arwUpdateTextureGL(const int textureID);
284 
285  EXPORT_API bool arwUpdateTextureGLStereo(const int textureID_L, const int textureID_R);
286 #endif // !TARGET_PLATFORM_WINRT
287 
288  // ----------------------------------------------------------------------------------------------------
289 #pragma mark Unity-specific API
290  // ----------------------------------------------------------------------------------------------------
291 
292  enum {
293  ARW_UNITY_RENDER_EVENTID_NOP = 0, // No operation (does nothing).
294 #if !TARGET_PLATFORM_WINRT
297 #endif // !TARGET_PLATFORM_WINRT
298  };
299 
307  EXPORT_API void UnityRenderEvent(int eventID);
308 
309 #if !TARGET_PLATFORM_WINRT
310 
315  EXPORT_API void arwSetUnityRenderEventUpdateTextureGLTextureID(int textureID);
316 
317  EXPORT_API void arwSetUnityRenderEventUpdateTextureGLStereoTextureIDs(int textureID_L, int textureID_R);
318 #endif // !TARGET_PLATFORM_WINRT
319 
320  // ----------------------------------------------------------------------------------------------------
321 #pragma mark Tracking configuration
322  // ----------------------------------------------------------------------------------------------------
328  EXPORT_API void arwSetVideoThreshold(int threshold);
329 
335  EXPORT_API int arwGetVideoThreshold();
336 
342  EXPORT_API void arwSetVideoThresholdMode(int mode);
343 
349  EXPORT_API int arwGetVideoThresholdMode();
350 
351  EXPORT_API void arwSetLabelingMode(int mode);
352 
353  EXPORT_API int arwGetLabelingMode();
354 
355  EXPORT_API void arwSetPatternDetectionMode(int mode);
356 
357  EXPORT_API int arwGetPatternDetectionMode();
358 
359  EXPORT_API void arwSetBorderSize(float size);
360 
361  EXPORT_API float arwGetBorderSize();
362 
363  EXPORT_API void arwSetMatrixCodeType(int type);
364 
365  EXPORT_API int arwGetMatrixCodeType();
366 
367  EXPORT_API void arwSetImageProcMode(int mode);
368 
369  EXPORT_API int arwGetImageProcMode();
370 
371  EXPORT_API void arwSetNFTMultiMode(bool on);
372 
373  EXPORT_API bool arwGetNFTMultiMode();
374 
375  // ----------------------------------------------------------------------------------------------------
376 #pragma mark Marker management
377  // ----------------------------------------------------------------------------------------------------
387  EXPORT_API int arwAddMarker(const char *cfg);
388 
394  EXPORT_API bool arwRemoveMarker(int markerUID);
395 
400  EXPORT_API int arwRemoveAllMarkers();
401 
408  EXPORT_API bool arwQueryMarkerVisibility(int markerUID);
409 
419  EXPORT_API bool arwQueryMarkerTransformation(int markerUID, float matrix[16]);
420 
431  EXPORT_API bool arwQueryMarkerTransformationStereo(int markerUID, float matrixL[16], float matrixR[16]);
432 
440  EXPORT_API int arwGetMarkerPatternCount(int markerUID);
441 
453  EXPORT_API bool arwGetMarkerPatternConfig(int markerUID, int patternID, float matrix[16], float *width, float *height, int *imageSizeX, int *imageSizeY);
454 
465  EXPORT_API bool arwGetMarkerPatternImage(int markerUID, int patternID, Color *buffer);
466 
470  enum {
481  };
482 
489  EXPORT_API void arwSetMarkerOptionBool(int markerUID, int option, bool value);
490 
497  EXPORT_API void arwSetMarkerOptionInt(int markerUID, int option, int value);
498 
505  EXPORT_API void arwSetMarkerOptionFloat(int markerUID, int option, float value);
506 
513  EXPORT_API bool arwGetMarkerOptionBool(int markerUID, int option);
514 
521  EXPORT_API int arwGetMarkerOptionInt(int markerUID, int option);
522 
529  EXPORT_API float arwGetMarkerOptionFloat(int markerUID, int option);
530 
531  // ----------------------------------------------------------------------------------------------------
532 #pragma mark Utility
533  // ----------------------------------------------------------------------------------------------------
555  EXPORT_API bool arwLoadOpticalParams(const char *optical_param_name, const char *optical_param_buff, const int optical_param_buffLen, float *fovy_p, float *aspect_p, float m[16], float p[16]);
556 }
557 
558 #endif // !ARTOOLKITWRAPPEREXPORTEDAPI_H