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  // ----------------------------------------------------------------------------------------------------
60 #pragma mark ARToolKit lifecycle functions
61  // ----------------------------------------------------------------------------------------------------
68  EXPORT_API bool arwInitialiseAR();
69 
77  EXPORT_API bool arwInitialiseARWithOptions(const int pattSize, const int pattCountMax);
78 
86  EXPORT_API bool arwGetARToolKitVersion(char *buffer, int length);
87 
109  EXPORT_API int arwGetError();
110 
117  EXPORT_API bool arwChangeToResourcesDir(const char *resourcesDirectoryPath);
118 
128  EXPORT_API bool arwStartRunning(const char *vconf, const char *cparaName, const float nearPlane, const float farPlane);
129 
140  EXPORT_API bool arwStartRunningB(const char *vconf, const char *cparaBuff, const int cparaBuffLen, const float nearPlane, const float farPlane);
141 
142  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);
143 
144  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);
145 
150  EXPORT_API bool arwIsRunning();
151 
157  EXPORT_API bool arwStopRunning();
158 
167  EXPORT_API bool arwShutdownAR();
168 
169  // ----------------------------------------------------------------------------------------------------
170 #pragma mark Video stream management
171  // ----------------------------------------------------------------------------------------------------
172 
178  EXPORT_API bool arwGetProjectionMatrix(float p[16]);
179 
186  EXPORT_API bool arwGetProjectionMatrixStereo(float pL[16], float pR[16]);
187 
198  EXPORT_API bool arwGetVideoParams(int *width, int *height, int *pixelSize, char *pixelFormatStringBuffer, int pixelFormatStringBufferLen);
199 
215  EXPORT_API bool arwGetVideoParamsStereo(int *widthL, int *heightL, int *pixelSizeL, char *pixelFormatStringBufferL, int pixelFormatStringBufferLenL, int *widthR, int *heightR, int *pixelSizeR, char *pixelFormatStringBufferR, int pixelFormatStringBufferLenR);
216 
221  EXPORT_API bool arwCapture();
222 
228  EXPORT_API bool arwUpdateAR();
229 
235  EXPORT_API bool arwUpdateTexture(Color *buffer);
236 
237  EXPORT_API bool arwUpdateTexture32(unsigned int *buffer);
238 
239  EXPORT_API bool arwUpdateTextureStereo(Color *bufferL, Color *bufferR);
240 
241  EXPORT_API bool arwUpdateTexture32Stereo(unsigned int *bufferL, unsigned int *bufferR);
242 
250  EXPORT_API void arwSetVideoDebugMode(bool debug);
251 
257  EXPORT_API bool arwGetVideoDebugMode();
258 
265  EXPORT_API bool arwUpdateDebugTexture(Color *buffer, float alpha);
266 
267 #if !TARGET_PLATFORM_WINRT
268 
273  EXPORT_API bool arwUpdateTextureGL(const int textureID);
274 
275  EXPORT_API bool arwUpdateTextureGLStereo(const int textureID_L, const int textureID_R);
276 #endif // !TARGET_PLATFORM_WINRT
277 
278  // ----------------------------------------------------------------------------------------------------
279 #pragma mark Unity-specific API
280  // ----------------------------------------------------------------------------------------------------
281 
282  enum {
283  ARW_UNITY_RENDER_EVENTID_NOP = 0, // No operation (does nothing).
284 #if !TARGET_PLATFORM_WINRT
287 #endif // !TARGET_PLATFORM_WINRT
288  };
289 
297  EXPORT_API void UnityRenderEvent(int eventID);
298 
299 #if !TARGET_PLATFORM_WINRT
300 
305  EXPORT_API void arwSetUnityRenderEventUpdateTextureGLTextureID(int textureID);
306 
307  EXPORT_API void arwSetUnityRenderEventUpdateTextureGLStereoTextureIDs(int textureID_L, int textureID_R);
308 #endif // !TARGET_PLATFORM_WINRT
309 
310  // ----------------------------------------------------------------------------------------------------
311 #pragma mark Tracking configuration
312  // ----------------------------------------------------------------------------------------------------
318  EXPORT_API void arwSetVideoThreshold(int threshold);
319 
325  EXPORT_API int arwGetVideoThreshold();
326 
332  EXPORT_API void arwSetVideoThresholdMode(int mode);
333 
339  EXPORT_API int arwGetVideoThresholdMode();
340 
341  EXPORT_API void arwSetLabelingMode(int mode);
342 
343  EXPORT_API int arwGetLabelingMode();
344 
345  EXPORT_API void arwSetPatternDetectionMode(int mode);
346 
347  EXPORT_API int arwGetPatternDetectionMode();
348 
349  EXPORT_API void arwSetBorderSize(float size);
350 
351  EXPORT_API float arwGetBorderSize();
352 
353  EXPORT_API void arwSetMatrixCodeType(int type);
354 
355  EXPORT_API int arwGetMatrixCodeType();
356 
357  EXPORT_API void arwSetImageProcMode(int mode);
358 
359  EXPORT_API int arwGetImageProcMode();
360 
361  EXPORT_API void arwSetNFTMultiMode(bool on);
362 
363  EXPORT_API bool arwGetNFTMultiMode();
364 
365  // ----------------------------------------------------------------------------------------------------
366 #pragma mark Marker management
367  // ----------------------------------------------------------------------------------------------------
377  EXPORT_API int arwAddMarker(const char *cfg);
378 
384  EXPORT_API bool arwRemoveMarker(int markerUID);
385 
390  EXPORT_API int arwRemoveAllMarkers();
391 
398  EXPORT_API bool arwQueryMarkerVisibility(int markerUID);
399 
409  EXPORT_API bool arwQueryMarkerTransformation(int markerUID, float matrix[16]);
410 
421  EXPORT_API bool arwQueryMarkerTransformationStereo(int markerUID, float matrixL[16], float matrixR[16]);
422 
430  EXPORT_API int arwGetMarkerPatternCount(int markerUID);
431 
443  EXPORT_API bool arwGetMarkerPatternConfig(int markerUID, int patternID, float matrix[16], float *width, float *height, int *imageSizeX, int *imageSizeY);
444 
455  EXPORT_API bool arwGetMarkerPatternImage(int markerUID, int patternID, Color *buffer);
456 
460  enum {
468  };
469 
476  EXPORT_API void arwSetMarkerOptionBool(int markerUID, int option, bool value);
477 
484  EXPORT_API void arwSetMarkerOptionInt(int markerUID, int option, int value);
485 
492  EXPORT_API void arwSetMarkerOptionFloat(int markerUID, int option, float value);
493 
500  EXPORT_API bool arwGetMarkerOptionBool(int markerUID, int option);
501 
508  EXPORT_API int arwGetMarkerOptionInt(int markerUID, int option);
509 
516  EXPORT_API float arwGetMarkerOptionFloat(int markerUID, int option);
517 
518  // ----------------------------------------------------------------------------------------------------
519 #pragma mark Utility
520  // ----------------------------------------------------------------------------------------------------
542  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]);
543 }
544 
545 #endif // !ARTOOLKITWRAPPEREXPORTEDAPI_H