-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy patharcore_c_api.h
7796 lines (7187 loc) · 361 KB
/
arcore_c_api.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright 2017 Google LLC
*
* Licensed for use under "ARCore Additional Terms of Service". You may obtain
* a copy of the license at https://developers.google.com/ar/develop/terms.
*/
#ifndef ARCORE_C_API_H_
#define ARCORE_C_API_H_
#include <stddef.h>
#include <stdint.h>
/// @defgroup concepts Concepts
/// High-Level ARCore concepts.
///
/// @section ownership Object ownership
///
/// ARCore objects fall into two categories:
///
/// - <b>Value types</b> are owned by application. They are created and
/// destroyed using the @c create / @c destroy functions, and are populated by
/// ARCore using functions with @c get in the function name.
///
/// - <b>Reference types</b> are owned by ARCore. A reference is acquired by one
/// of the @c acquire functions. For each call to the @c acquire function,
/// the application must call the matching @c release function. Note that even
/// if the last reference is released, ARCore may continue to hold a reference
/// to the object at ARCore's discretion.
///
/// Reference types are further split into:
///
/// - <b>Long-lived objects</b>. These objects persist across frames, possibly
/// for the life span of the application or session. Acquire may fail if
/// ARCore is in an incorrect state, e.g. not tracking. Acquire from list
/// always succeeds, as the object already exists.
///
/// - <b>Transient large data</b>. These objects are usually acquired per-frame
/// and are a limited resource. The @c acquire call may fail if the resource
/// is exhausted (too many are currently held), deadline exceeded (the target
/// of the acquire was already released), or the resource is not yet
/// available.
///
/// Note: Lists are value types (owned by application), but can hold references
/// to long-lived objects. This means that the references held by a list are not
/// released until either the list is destroyed, or is re-populated by another
/// api call.
///
/// For example, @c ::ArAnchorList, which is a value type, will hold references
/// to anchors, which are long-lived objects.
///
/// @section spaces Poses and coordinate spaces
///
/// An @c ::ArPose describes an rigid transformation from one coordinate space
/// to another. As provided from all ARCore APIs, poses always describe the
/// transformation from object's local coordinate space to the <b>world
/// coordinate space</b> (see below). That is, poses from ARCore APIs can be
/// thought of as equivalent to OpenGL model matrices.
///
/// The transformation is defined using a quaternion rotation about the origin
/// followed by a translation.
///
/// The coordinate system is right-handed, like OpenGL conventions.
///
/// Translation units are meters.
///
/// @section worldcoordinates World coordinate space
///
/// As ARCore's understanding of the environment changes, it adjusts its model
/// of the world to keep things consistent. When this happens, the numerical
/// location (coordinates) of the camera and anchors can change significantly to
/// maintain appropriate relative positions of the physical locations they
/// represent.
///
/// These changes mean that every frame should be considered to be in a
/// completely unique world coordinate space. The numerical coordinates of
/// anchors and the camera should never be used outside the rendering frame
/// during which they were retrieved. If a position needs to be considered
/// beyond the scope of a single rendering frame, either an anchor should be
/// created or a position relative to a nearby existing anchor should be used.
/// @defgroup shared_types Shared types and enums
/// Shared types and constants.
/// @defgroup utility_functions Utility functions
/// Utility functions for releasing data.
#ifdef __cplusplus
/// @defgroup type_conversions C++ type conversions
/// These functions expose allowable type conversions as C++ helper functions.
/// This avoids having to explicitly @c reinterpret_cast in most cases.
///
/// Note: These functions only change the type of a pointer; they do not change
/// the reference count of the referenced objects.
///
/// Note: There is no runtime checking that casts are correct. When downcasting
/// @c ::ArTrackable, call @c ::ArTrackable_getType beforehand to figure out the
/// correct cast.
#endif // __cplusplus
/// @defgroup ArAnchor ArAnchor
/// Describes a fixed location and orientation in the real world, representing
/// local and Cloud Anchors.
/// @defgroup ArAugmentedFace ArAugmentedFace
/// Describes a face detected by ARCore and provides functions to access
/// additional center and face region poses as well as face mesh related data.
///
/// Augmented Faces supports front-facing (selfie) camera only, and does not
/// support attaching anchors nor raycast hit testing. Calling
/// @c ::ArTrackable_acquireNewAnchor will return @c #AR_ERROR_ILLEGAL_STATE.
/// @defgroup ArAugmentedImage ArAugmentedImage
/// An image being detected and tracked by ARCore.
/// @defgroup ArAugmentedImageDatabase ArAugmentedImageDatabase
/// Database containing a list of images to be detected and tracked by ARCore.
/// @defgroup ArCamera ArCamera
/// Provides information about the camera that is used to capture images.
/// @defgroup ArCameraConfig ArCameraConfig
/// Camera configuration.
/// @defgroup ArCameraConfigFilter ArCameraConfigFilter
/// Filters available camera configurations.
/// @defgroup ArCameraIntrinsics ArCameraIntrinsics
/// Provides information about the physical characteristics of the device
/// camera.
/// @defgroup ArFuture ArFuture
/// Futures in ARCore.
///
/// @section future_concept Futures in ARCore
///
/// Futures represent the eventual completion of an asynchronous
/// operation. A future has one of three states, @c ::ArFutureState, which can
/// be obtained with @c ::ArFuture_getState:
///
/// - @c #AR_FUTURE_STATE_PENDING - The operation is still pending. The result
/// of the operation isn't available yet and any associated callback hasn't
/// yet been invoked.
/// - @c #AR_FUTURE_STATE_DONE - The operation is complete, and a result is
/// available.
/// - @c #AR_FUTURE_STATE_CANCELLED - The operation has been cancelled.
///
/// An @c ::ArFuture starts in the @c #AR_FUTURE_STATE_PENDING state and
/// transitions to @c #AR_FUTURE_STATE_DONE upon completion. If the
/// future is cancelled using @c ::ArFuture_cancel, then its state may become @c
/// #AR_FUTURE_STATE_CANCELLED (see @ref future_cancellation
/// "cancelling a future" for caveats).
///
/// Futures must eventually be released using @c ::ArFuture_release.
/// (@ref ownership "reference type, long-lived").
///
/// @section future_results Obtaining results from a Future
///
/// There are two ways of obtaining results from an @c ::ArFuture:
///
/// @subsection future_polling Polling a Future
///
/// When the @c ::ArFuture is created, its @c ::ArFutureState is set to @c
/// #AR_FUTURE_STATE_PENDING. You may poll the future using @c
/// ::ArFuture_getState to query the state of the asynchronous operation. When
/// its state is @c #AR_FUTURE_STATE_DONE, you can obtain the operation's
/// result. The future must eventually be released using @c ::ArFuture_release.
///
/// @subsection future_callback Using a callback to obtain Future results
///
/// The operation's result can be reported via a callback. When providing a
/// callback, ARCore will invoke the given function when the operation is
/// complete, unless the future has been cancelled using @c ::ArFuture_cancel.
/// This callback will be invoked on the <a
/// href="https://developer.android.com/guide/components/processes-and-threads#Threads">main
/// thread</a>.
///
/// When providing a callback, you may provide a
/// @c context, which will be passed as the first parameter to the callback.
/// It is a best practice to free the memory of @c context at the end of the
/// callback and when @c ::ArFuture_cancel successfully cancels the callback.
///
/// @section future_cancellation Cancelling a Future
///
/// You can try to cancel an @c ::ArFuture by calling @c ::ArFuture_cancel.
/// Due to multi-threading, it is possible that the cancel operation is not
/// successful. The @c out_was_cancelled parameter indicates if the cancellation
/// was successful.
///
/// If the cancellation is successful, then any
/// @ref future_callback "associated callback" will never be called. It is a
/// best practice to free context memory
/// provided to the callback, if any.
///
/// @defgroup ArConfig ArConfig
/// Session configuration.
///
/// To configure an @c ::ArSession:
///
/// 1. Use @c ::ArConfig_create to create an @c ::ArConfig object.
/// 2. Call any number of configuration functions on the newly created object.
/// 3. To apply the configuration to the session, use @c ::ArSession_configure.
/// 4. To release the memory used by the @c ::ArConfig object, use
/// @c ::ArConfig_destroy.
///
/// Note: None of the `ArConfig_set*()` functions will actually affect the state
/// of the given @c ::ArSession until @c ::ArSession_configure is called.
/// @defgroup ArCoreApk ArCoreApk
/// Functions for installing and updating "Google Play Services for AR" (ARCore)
/// and determining whether the current device is an
/// <a href="https://developers.google.com/ar/devices">ARCore
/// supported device</a>.
/// @defgroup ArDepthPoint ArDepthPoint
/// Hit Depth API
/// @defgroup ArEarth ArEarth
/// A @c ::ArTrackable implementation representing the Earth. Provides
/// localization ability in geospatial coordinates.
///
/// To access @c ::ArEarth, configure the session with an appropriate @c
/// ::ArGeospatialMode and use @c ::ArSession_acquireEarth.
///
/// Not all devices support @c #AR_GEOSPATIAL_MODE_ENABLED, use
/// @c ::ArSession_isGeospatialModeSupported to check if the current device and
/// selected camera support enabling this mode.
///
/// @c ::ArEarth should only be used when its @c ::ArTrackingState is @c
/// #AR_TRACKING_STATE_TRACKING, and otherwise should not be used. Use @c
/// ::ArTrackable_getTrackingState to obtain the current @c ::ArTrackingState.
/// If the @c ::ArTrackingState does not become @c #AR_TRACKING_STATE_TRACKING,
/// then @c ::ArEarth_getEarthState may contain more information as @c
/// ::ArEarthState.
///
/// Use @c ::ArEarth_getCameraGeospatialPose to obtain the Earth-relative
/// virtual camera pose for the latest frame.
///
/// Use @c ::ArEarth_acquireNewAnchor to attach anchors to Earth. Calling @c
/// ::ArTrackable_acquireNewAnchor with an @c ::ArEarth instance will
/// fail to create a new anchor and will return the @c
/// #AR_ERROR_INVALID_ARGUMENT error code.
///
/// @c ::ArEarth does not support hit testing. Because @c ::ArEarth
/// is a type of @c ::ArTrackable, the singleton @c ::ArEarth instance may also
/// be returned by @c ::ArSession_getAllTrackables when enabled.
/// @defgroup ArGeospatialPose ArGeospatialPose
/// Describes a specific location, elevation, and compass heading relative to
/// Earth (@ref ownership "value type"). It is comprised of:
///
/// - Latitude and longitude are specified in degrees, with positive values
/// being north of the equator and east of the prime meridian as defined by
/// the <a href="https://en.wikipedia.org/wiki/World_Geodetic_System">WGS84
/// specification</a>.
/// - Altitude is specified in meters above the WGS84 ellipsoid, which is
/// roughly equivalent to meters above sea level.
/// - Orientation approximates the direction the user is facing in the EUS
/// coordinate system. The EUS coordinate system has X+ pointing east, Y+
/// pointing up, and Z+ pointing south.
/// - Accuracy of the latitude, longitude, altitude, and heading are available
/// as numeric confidence intervals where a large value (large interval) means
/// low confidence and small value (small interval) means high confidence.
///
/// An @c ::ArGeospatialPose can be retrieved from @c
/// ::ArEarth_getCameraGeospatialPose.
///
/// @defgroup ArSemanticLabel ArSemanticLabel
/// Scene Semantics API. See the
/// <a href="https://developers.google.com/ar/develop/c/scene-semantics">Scene
/// Semantics Developer Guide</a> for more information.
/// @defgroup ArStreetscapeGeometry ArStreetscapeGeometry
/// ARCore Geospatial Streetscape Geometry APIs. See the <a
/// href="https://developers.google.com/ar/develop/c/geospatial/streetscape-geometry">Streetscape
/// Geometry Developer Guide</a> for additional information.
/// @defgroup ArFrame ArFrame
/// Per-frame state.
/// @defgroup ArHitResult ArHitResult
/// Defines an intersection between a ray and estimated real-world geometry.
/// @defgroup ArImage ArImage
/// Provides access to CPU camera images.
/// @defgroup ArImageMetadata ArImageMetadata
/// Provides access to CPU image camera metadata.
/// @defgroup ArInstantPlacementPoint ArInstantPlacementPoint
/// Trackable Instant Placement point returned by
/// @c ::ArFrame_hitTestInstantPlacement.
///
/// If ARCore has an accurate 3D pose for the @c ::ArInstantPlacementPoint
/// returned by @c ::ArFrame_hitTestInstantPlacement it will start with tracking
/// method @c #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING.
/// Otherwise, it will start with tracking method
/// @c
/// #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE,<!--NOLINT-->
/// and will transition to
/// @c #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
/// once ARCore has an accurate 3D pose. Once the tracking method is
/// @c #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING it will not
/// revert to @c
/// #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE.<!--NOLINT-->
///
/// When the tracking method changes from
/// @c
/// #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE<!--NOLINT-->
/// in one frame to @c #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
/// in the next frame, the pose will jump from its initial location based on the
/// provided approximate distance to a new location at an accurate distance.
///
/// This instantaneous change in pose will change the apparent scale of any
/// objects that are anchored to the @c ::ArInstantPlacementPoint. That is, an
/// object will suddenly appear larger or smaller than it was in the previous
/// frame.
///
/// To avoid the visual jump due to the sudden change in apparent object scale,
/// use the following procedure:
/// 1. Keep track of the pose and tracking method of the
/// @c ::ArInstantPlacementPoint in each frame.
/// 2. Wait for the tracking method to change to
/// @c #AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING.
/// 3. Use the pose from the previous frame and the pose in the current frame to
/// determine the object's distance to the device in both frames.
/// 4. Calculate the apparent change in scale due to the change in distance
/// from the camera.
/// 5. Adjust the scale of the object to counteract the perceived change in
/// scale, so that visually the object does not appear to change in size.
/// 6. Optionally, smoothly adjust the scale of the object back to its original
/// value over several frames.
/// @defgroup ArLightEstimate ArLightEstimate
/// Holds information about the estimated lighting of the real scene.
/// @defgroup ArPlane ArPlane
/// Describes the current best knowledge of a real-world planar surface.
/// @defgroup ArPoint ArPoint
/// Represents a point in space that ARCore is tracking.
/// @defgroup ArPointCloud ArPointCloud
/// Contains a set of observed 3D points and confidence values.
/// @defgroup ArPose ArPose
/// Represents an immutable rigid transformation from one coordinate
/// space to another.
/// @defgroup ArRecordingConfig ArRecordingConfig
/// Session recording management.
/// @defgroup ArTrack ArTrack
/// External data recording.
/// @defgroup ArTrackData ArTrackData
/// External data track, used by Recording and Playback API.
/// @defgroup ArSession ArSession
/// Session management.
/// @defgroup ArMesh ArMesh
/// Represents a polygon mesh describing geometry.
///
/// Obtained by @c ::ArStreetscapeGeometry_acquireMesh.
/// @defgroup ArTrackable ArTrackable
/// Something that can be tracked and that anchors can be attached to.
/// @defgroup ArVpsAvailabilityFuture ArVpsAvailabilityFuture
/// An asynchronous operation checking VPS availability. The availability of VPS
/// in a given location helps to improve the quality of Geospatial localization
/// and tracking accuracy. See @c ::ArSession_checkVpsAvailabilityAsync for more
/// details.
/// @defgroup ArHostCloudAnchorFuture ArHostCloudAnchorFuture
/// An asynchronous operation for hosting a Cloud Anchor launched by @c
/// ::ArSession_hostCloudAnchorAsync. See the <a
/// href="https://developers.google.com/ar/develop/c/cloud-anchors/developer-guide">Cloud
/// Anchors developer guide</a> for more information.
/// @defgroup ArResolveCloudAnchorFuture ArResolveCloudAnchorFuture
/// An asynchronous operation for resolving a Cloud Anchor launched by @c
/// ::ArSession_resolveCloudAnchorAsync. See the <a
/// href="https://developers.google.com/ar/develop/c/cloud-anchors/developer-guide">Cloud
/// Anchors developer guide</a> for more information.
/// @defgroup ArResolveAnchorOnTerrainFuture ArResolveAnchorOnTerrainFuture
/// An asynchronous operation for resolving a terrain anchor launched by
/// @c ::ArEarth_resolveAnchorOnTerrainAsync. See the <a
/// href="https://developers.google.com/ar/develop/geospatial/c/anchors#terrain-anchors">Terrain
/// anchors developer guide</a> for more information.
/// @defgroup ArResolveAnchorOnRooftopFuture ArResolveAnchorOnRooftopFuture
/// Handle to an async operation launched by @c
/// ::ArEarth_resolveAnchorOnRooftopAsync. See the <a
/// href="https://developers.google.com/ar/develop/geospatial/c/anchors#rooftop-anchors">Rooftop
/// anchors developer guide</a> for more information.
/// @ingroup ArConfig
/// An opaque session configuration object (@ref ownership "value type").
///
/// - Create with: @c ::ArConfig_create
/// - Release with: @c ::ArConfig_destroy
typedef struct ArConfig_ ArConfig;
// CameraConfig objects and list.
/// @ingroup ArCameraConfig
/// A camera config struct that contains the config supported by
/// the physical camera obtained from the low level device profiles.
/// (@ref ownership "value type").
///
/// - Create with: @c ::ArCameraConfig_create
/// - Release with: @c ::ArCameraConfig_destroy
typedef struct ArCameraConfig_ ArCameraConfig;
/// @ingroup ArCameraConfig
/// A list of camera config (@ref ownership "value type").
///
/// - Create with: @c ::ArCameraConfigList_create
/// - Release with: @c ::ArCameraConfigList_destroy
typedef struct ArCameraConfigList_ ArCameraConfigList;
// Shared Camera objects definition.
// Excluded from generated docs (// vs ///) since it's a detail of the Java SDK.
//
// A shared camera contains functions that require sending Java objects over
// the c/c++ interface. To avoid using void* and making code clarity that the
// Java object is being just transmitted we define a new typedef.
typedef void *ArJavaObject;
// Camera config filters and camera config filters objects.
/// @ingroup ArCameraConfigFilter
/// A camera config filter struct contains the filters that are desired
/// by the application. (@ref ownership "value type").
///
/// - Create with: @c ::ArCameraConfigFilter_create
/// - Release with: @c ::ArCameraConfigFilter_destroy
typedef struct ArCameraConfigFilter_ ArCameraConfigFilter;
/// @ingroup ArRecordingConfig
/// A recording config struct that contains the config to set the recorder.
///
/// (@ref ownership "value type").
///
/// - Create with: @c ::ArRecordingConfig_create
/// - Release with: @c ::ArRecordingConfig_destroy
typedef struct ArRecordingConfig_ ArRecordingConfig;
/// @ingroup ArTrack
/// A track recording configuration struct of type data.
///
/// (@ref ownership "value type").
///
/// - Create with: @c ::ArTrack_create
/// - Release with: @c ::ArTrack_destroy
typedef struct ArTrack_ ArTrack;
/// @ingroup ArSession
/// The ARCore session (@ref ownership "value type").
///
/// - Create with: @c ::ArSession_create
/// - Release with: @c ::ArSession_destroy
typedef struct ArSession_ ArSession;
/// @ingroup ArPose
/// A structured rigid transformation (@ref ownership "value type").
///
/// - Allocate with: @c ::ArPose_create
/// - Release with: @c ::ArPose_destroy
typedef struct ArPose_ ArPose;
// Camera.
/// @ingroup ArCamera
/// The virtual and physical camera
/// (@ref ownership "reference type, long-lived").
///
/// - Acquire with: @c ::ArFrame_acquireCamera
/// - Release with: @c ::ArCamera_release
typedef struct ArCamera_ ArCamera;
// === Camera intrinstics types and functions ===
/// @ingroup ArCameraIntrinsics
/// The physical characteristics of a given camera.
///
/// - Allocate with: @c ::ArCameraIntrinsics_create
/// - Release with: @c ::ArCameraIntrinsics_destroy
typedef struct ArCameraIntrinsics_ ArCameraIntrinsics;
// Frame and frame objects.
/// @ingroup ArFrame
/// The world state resulting from an update (@ref ownership "value type").
///
/// - Create with: @c ::ArFrame_create
/// - Allocate with: @c ::ArSession_update
/// - Release with: @c ::ArFrame_destroy
typedef struct ArFrame_ ArFrame;
// LightEstimate.
/// @ingroup ArLightEstimate
/// An estimate of the real-world lighting (@ref ownership "value type").
///
/// - Create with: @c ::ArLightEstimate_create
/// - Allocate with: @c ::ArFrame_getLightEstimate
/// - Release with: @c ::ArLightEstimate_destroy
typedef struct ArLightEstimate_ ArLightEstimate;
// PointCloud.
/// @ingroup ArPointCloud
/// A cloud of tracked 3D visual feature points
/// (@ref ownership "reference type, large data").
///
/// - Acquire with: @c ::ArFrame_acquirePointCloud
/// - Release with: @c ::ArPointCloud_release
typedef struct ArPointCloud_ ArPointCloud;
// ImageMetadata.
/// @ingroup ArImageMetadata
/// Camera capture metadata (@ref ownership "reference type, large data").
///
/// - Acquire with: @c ::ArFrame_acquireImageMetadata
/// - Release with: @c ::ArImageMetadata_release
typedef struct ArImageMetadata_ ArImageMetadata;
/// @ingroup ArImage
/// Accessing CPU image from the camera
/// (@ref ownership "reference type, large data").
///
/// - Acquire with: @c ::ArFrame_acquireCameraImage
/// - Release with: @c ::ArImage_release.
typedef struct ArImage_ ArImage;
/// @ingroup ArImage
/// Convenient definition for cubemap image storage where it is a fixed size
/// array of 6 @c ::ArImage.
typedef ArImage *ArImageCubemap[6];
// Trackables.
/// @ingroup ArTrackable
/// Trackable base type (@ref ownership "reference type, long-lived").
typedef struct ArTrackable_ ArTrackable;
/// @ingroup ArTrackable
/// A list of @c ::ArTrackable's (@ref ownership "value type").
///
/// - Create with: @c ::ArTrackableList_create
/// - Release with: @c ::ArTrackableList_destroy
typedef struct ArTrackableList_ ArTrackableList;
/// @ingroup ArTrackData
/// Data that has been recorded to an external track.
typedef struct ArTrackData_ ArTrackData;
/// @ingroup ArTrackData
/// A list of @c ::ArTrackData
typedef struct ArTrackDataList_ ArTrackDataList;
// Planes.
/// @ingroup ArPlane
/// A detected planar surface (@ref ownership "reference type, long-lived").
///
/// - Trackable type: @c #AR_TRACKABLE_PLANE
/// - Release with: @c ::ArTrackable_release
typedef struct ArPlane_ ArPlane;
// Points.
/// @ingroup ArPoint
/// An arbitrary point in space (@ref ownership "reference type, long-lived").
///
/// - Trackable type: @c #AR_TRACKABLE_POINT
/// - Release with: @c ::ArTrackable_release
typedef struct ArPoint_ ArPoint;
// Depth Points.
/// @ingroup ArDepthPoint
/// A point measurement taken from a depth image
/// (@ref ownership "reference type, long-lived").
///
/// - Trackable type: @c #AR_TRACKABLE_DEPTH_POINT
/// - Release with: @c ::ArTrackable_release
typedef struct ArDepthPoint_ ArDepthPoint;
// Instant Placement points.
/// @ingroup ArInstantPlacementPoint
/// (@ref ownership "reference type, long-lived").
///
/// - Trackable type: @c #AR_TRACKABLE_INSTANT_PLACEMENT_POINT
/// - Release with: @c ::ArTrackable_release
typedef struct ArInstantPlacementPoint_ ArInstantPlacementPoint;
// Augmented Images.
/// @ingroup ArAugmentedImage
/// An image that has been detected and tracked
/// (@ref ownership "reference type, long-lived").
///
/// - Trackable type: @c #AR_TRACKABLE_AUGMENTED_IMAGE
/// - Release with: @c ::ArTrackable_release
typedef struct ArAugmentedImage_ ArAugmentedImage;
// Augmented Faces.
/// @ingroup ArAugmentedFace
/// A detected face trackable (@ref ownership "reference type, long-lived").
///
/// - Trackable type: @c #AR_TRACKABLE_FACE
/// - Release with: @c ::ArTrackable_release
typedef struct ArAugmentedFace_ ArAugmentedFace;
/// @ingroup ArStreetscapeGeometry
/// A Streetscape Geometry trackable (@ref ownership "reference type,
/// long-lived").
///
/// Defines geometry such as terrain, buildings, or other structures obtained
/// from the Streetscape Geometry API. See the <a
/// href="https://developers.google.com/ar/develop/c/geospatial/streetscape-geometry">Streetscape
/// Geometry Developer Guide</a> for additional information.
///
/// <p>Obtained from a call to @c ::ArSession_getAllTrackables
/// and @c ::ArFrame_getUpdatedTrackables when @c ::ArStreetscapeGeometryMode is
/// set to @c #AR_STREETSCAPE_GEOMETRY_MODE_ENABLED and @c ::ArGeospatialMode is
/// set to @c #AR_GEOSPATIAL_MODE_ENABLED.
///
/// - Trackable type: @c #AR_TRACKABLE_STREETSCAPE_GEOMETRY
/// - Release with: @c ::ArTrackable_release
typedef struct ArStreetscapeGeometry_ ArStreetscapeGeometry;
// Earth.
/// @ingroup ArEarth
/// The Earth trackable (@ref ownership "reference type, long-lived").
///
/// - Trackable type: @c #AR_TRACKABLE_EARTH
/// - Acquire with: @c ::ArSession_acquireEarth
/// - Release with: @c ::ArTrackable_release
typedef struct ArEarth_ ArEarth;
// Geospatial Pose.
/// @ingroup ArGeospatialPose
/// Describes a specific location, elevation, and orientation relative to
/// Earth (@ref ownership "value type").
///
/// - Create with: @c ::ArGeospatialPose_create
/// - Release with: @c ::ArGeospatialPose_destroy
typedef struct ArGeospatialPose_ ArGeospatialPose;
// Augmented Images database
/// @ingroup ArAugmentedImageDatabase
/// A database of images to be detected and tracked by ARCore (@ref ownership
/// "value type").
///
/// An image database supports up to 1000 images. A database can be generated by
/// the `arcoreimg` command-line database generation tool provided in the SDK,
/// or dynamically created at runtime by adding individual images.
///
/// Only one image database can be active in a session. Any images in the
/// currently active image database that have a
/// @c #AR_TRACKING_STATE_TRACKING or @c #AR_TRACKING_STATE_PAUSED state will
/// immediately be set to the @c #AR_TRACKING_STATE_STOPPED state if a different
/// or @c NULL image database is made active in the current session Config.
///
/// - Create with: @c ::ArAugmentedImageDatabase_create or
/// @c ::ArAugmentedImageDatabase_deserialize
/// - Release with: @c ::ArAugmentedImageDatabase_destroy
typedef struct ArAugmentedImageDatabase_ ArAugmentedImageDatabase;
// Anchors.
/// @ingroup ArAnchor
/// A position in space attached to a trackable
/// (@ref ownership "reference type, long-lived").
///
/// - To create a new anchor call @c ::ArSession_acquireNewAnchor or
/// @c ::ArHitResult_acquireNewAnchor.
/// - To have ARCore stop tracking the anchor, call @c ::ArAnchor_detach.
/// - To release the memory associated with this anchor reference, call
/// @c ::ArAnchor_release. Note that this will not cause ARCore to stop
/// tracking the anchor. Other references to the same anchor acquired through
/// @c ::ArAnchorList_acquireItem are unaffected.
typedef struct ArAnchor_ ArAnchor;
/// @ingroup ArAnchor
/// A list of anchors (@ref ownership "value type").
///
/// - Create with: @c ::ArAnchorList_create
/// - Release with: @c ::ArAnchorList_destroy
typedef struct ArAnchorList_ ArAnchorList;
/// @ingroup ArMesh
/// A triangulated mesh representing a surface reconstruction of the scene.
/// (@ref ownership "reference type, large data").
///
/// - Release with: @c ::ArMesh_release
typedef struct ArMesh_ ArMesh;
// Hit result functionality.
/// @ingroup ArHitResult
/// A single trackable hit (@ref ownership "value type").
///
/// - Create with: @c ::ArHitResult_create
/// - Allocate with: @c ::ArHitResultList_getItem
/// - Release with: @c ::ArHitResult_destroy
typedef struct ArHitResult_ ArHitResult;
/// @ingroup ArHitResult
/// A list of hit test results (@ref ownership "value type").
///
/// - Create with: @c ::ArHitResultList_create
/// - Release with: @c ::ArHitResultList_destroy
typedef struct ArHitResultList_ ArHitResultList;
#ifdef __cplusplus
/// @ingroup type_conversions
/// Upcasts to @c ::ArTrackable
inline ArTrackable *ArAsTrackable(ArPlane *plane) {
return reinterpret_cast<ArTrackable *>(plane);
}
/// @ingroup type_conversions
/// Upcasts to @c ::ArTrackable
inline ArTrackable *ArAsTrackable(ArPoint *point) {
return reinterpret_cast<ArTrackable *>(point);
}
/// @ingroup type_conversions
/// Upcasts to @c ::ArTrackable
inline ArTrackable *ArAsTrackable(ArAugmentedImage *augmented_image) {
return reinterpret_cast<ArTrackable *>(augmented_image);
}
/// @ingroup type_conversions
/// Downcasts to @c ::ArPlane.
inline ArPlane *ArAsPlane(ArTrackable *trackable) {
return reinterpret_cast<ArPlane *>(trackable);
}
/// @ingroup type_conversions
/// Downcasts to @c ::ArPoint.
inline ArPoint *ArAsPoint(ArTrackable *trackable) {
return reinterpret_cast<ArPoint *>(trackable);
}
/// @ingroup type_conversions
/// Upcasts to @c ::ArTrackable.
inline ArTrackable *ArAsTrackable(
ArInstantPlacementPoint *instant_placement_point) {
return reinterpret_cast<ArTrackable *>(instant_placement_point);
}
/// @ingroup type_conversions
/// Downcasts to @c ::ArInstantPlacementPoint.
inline ArInstantPlacementPoint *ArAsInstantPlacementPoint(
ArTrackable *trackable) {
return reinterpret_cast<ArInstantPlacementPoint *>(trackable);
}
/// @ingroup type_conversions
/// Downcasts to @c ::ArAugmentedImage.
inline ArAugmentedImage *ArAsAugmentedImage(ArTrackable *trackable) {
return reinterpret_cast<ArAugmentedImage *>(trackable);
}
/// @ingroup type_conversions
/// Upcasts to @c ::ArTrackable
inline ArTrackable *ArAsTrackable(ArAugmentedFace *face) {
return reinterpret_cast<ArTrackable *>(face);
}
/// @ingroup type_conversions
/// Downcasts to @c ::ArAugmentedFace
inline ArAugmentedFace *ArAsFace(ArTrackable *trackable) {
return reinterpret_cast<ArAugmentedFace *>(trackable);
}
/// @ingroup type_conversions
/// Upcasts to @c ::ArTrackable
inline ArTrackable *ArAsTrackable(ArStreetscapeGeometry *streetscape_geometry) {
return reinterpret_cast<ArTrackable *>(streetscape_geometry);
}
/// @ingroup type_conversions
/// Downcasts to @c ::ArStreetscapeGeometry.
inline ArStreetscapeGeometry *ArAsStreetscapeGeometry(ArTrackable *trackable) {
return reinterpret_cast<ArStreetscapeGeometry *>(trackable);
}
#endif // __cplusplus
// If compiling for C++11, use the 'enum underlying type' feature to enforce
// size for ABI compatibility. In pre-C++11, use int32_t for fixed size.
#if __cplusplus >= 201100
#define AR_DEFINE_ENUM(_type) enum _type : int32_t
#else
#define AR_DEFINE_ENUM(_type) \
typedef int32_t _type; \
enum
#endif // __cplusplus >= 201100
#if defined(__GNUC__) && !defined(AR_DEPRECATED_SUPPRESS)
#define AR_DEPRECATED(_deprecation_string) \
__attribute__((deprecated(_deprecation_string)))
#else
#define AR_DEPRECATED(_deprecation_string)
#endif // defined(__GNUC__) && !defined(AR_DEPRECATED_SUPPRESS)
/// @ingroup ArTrackable
/// Object types for heterogeneous query/update lists.
AR_DEFINE_ENUM(ArTrackableType){
/// The base Trackable type. Can be passed to @c ::ArSession_getAllTrackables
/// and @c ::ArFrame_getUpdatedTrackables as the @p filter_type to get
/// all/updated Trackables of all types.
AR_TRACKABLE_BASE_TRACKABLE = 0x41520100,
/// The @c ::ArPlane subtype of Trackable.
AR_TRACKABLE_PLANE = 0x41520101,
/// The @c ::ArPoint subtype of Trackable.
AR_TRACKABLE_POINT = 0x41520102,
/// The @c ::ArAugmentedImage subtype of Trackable.
AR_TRACKABLE_AUGMENTED_IMAGE = 0x41520104,
/// Trackable type for faces.
AR_TRACKABLE_FACE = 0x41520105,
/// Trackable type for Streetscape Geometry.
AR_TRACKABLE_STREETSCAPE_GEOMETRY = 0x41520103,
/// Trackable type for @c ::ArEarth.
AR_TRACKABLE_EARTH = 0x41520109,
/// On supported devices, trackable type for depth image based hit results
/// returned by @c ::ArFrame_hitTest when @c ::ArConfig_setDepthMode has been
/// set to @c #AR_DEPTH_MODE_AUTOMATIC.
AR_TRACKABLE_DEPTH_POINT = 0x41520111,
/// Trackable type for results retrieved from
/// @c ::ArFrame_hitTestInstantPlacement. This trackable type is only
/// available when when @c ::ArConfig_setInstantPlacementMode is
/// @c #AR_INSTANT_PLACEMENT_MODE_LOCAL_Y_UP.
AR_TRACKABLE_INSTANT_PLACEMENT_POINT = 0x41520112,
/// An invalid Trackable type.
AR_TRACKABLE_NOT_VALID = 0};
/// @ingroup ArSession
/// Feature names for use with @c ::ArSession_createWithFeatures
///
/// All currently defined features are mutually compatible.
AR_DEFINE_ENUM(ArSessionFeature){
/// Indicates the end of a features list. This must be the last entry in the
/// array passed to @c ::ArSession_createWithFeatures.
AR_SESSION_FEATURE_END_OF_LIST = 0,
/// Use the front-facing (selfie) camera. When the front camera is selected,
/// ARCore's behavior changes in the following ways:
///
/// - The display will be mirrored. Specifically,
/// @c ::ArCamera_getProjectionMatrix will include a horizontal flip in the
/// generated projection matrix and APIs that reason about things in screen
/// space, such as @c ::ArFrame_transformCoordinates2d, will mirror screen
/// coordinates. Open GL apps should consider using @c glFrontFace to
/// render mirrored assets without changing their winding direction.
/// - @c ::ArCamera_getTrackingState will always output
/// @c #AR_TRACKING_STATE_PAUSED.
/// - @c ::ArFrame_hitTest will always output an empty list.
/// - @c ::ArCamera_getDisplayOrientedPose will always output an identity
/// pose.
/// - @c ::ArSession_acquireNewAnchor will always return
/// @c #AR_ERROR_NOT_TRACKING.
/// - Planes will never be detected.
/// - @c ::ArSession_configure will fail if the supplied configuration
/// requests
/// Cloud Anchors, Augmented Images, or Environmental HDR Lighting
/// Estimation mode.
///
/// @deprecated To create a session using the front-facing (selfie)
/// camera, use @c ::ArSession_setCameraConfig with the desired config
/// retrieved from @c ::ArSession_getSupportedCameraConfigsWithFilter.
AR_SESSION_FEATURE_FRONT_CAMERA AR_DEPRECATED(
"To create a session using the front-facing (selfie) camera, use "
"@c ::ArSession_setCameraConfig with the desired config retrieved "
"from @c ::ArSession_getSupportedCameraConfigsWithFilter.") = 1,
};
/// @ingroup shared_types
/// Return code indicating success or failure of a function.
AR_DEFINE_ENUM(ArStatus){
/// The operation was successful.
AR_SUCCESS = 0,
/// One of the arguments was invalid; either @c NULL or not appropriate for
/// the operation requested.
AR_ERROR_INVALID_ARGUMENT = -1,
/// An internal error occurred that the application should not attempt to
/// recover from.
AR_ERROR_FATAL = -2,
/// An operation was attempted that requires the session be running, but the
/// session was paused.
AR_ERROR_SESSION_PAUSED = -3,
/// An operation was attempted that requires the session be paused, but the
/// session was running.
AR_ERROR_SESSION_NOT_PAUSED = -4,
/// An operation was attempted that the session be in the
/// @c #AR_TRACKING_STATE_TRACKING state, but the session was not.
AR_ERROR_NOT_TRACKING = -5,
/// A texture name was not set by calling @c ::ArSession_setCameraTextureName
/// before the first call to @c ::ArSession_update.
AR_ERROR_TEXTURE_NOT_SET = -6,
/// An operation required GL context but one was not available.
AR_ERROR_MISSING_GL_CONTEXT = -7,
/// The configuration supplied to @c ::ArSession_configure is unsupported.
/// To avoid this error, ensure that Session_checkSupported() returns true.
AR_ERROR_UNSUPPORTED_CONFIGURATION = -8,
/// The application does not have Android camera permission.
AR_ERROR_CAMERA_PERMISSION_NOT_GRANTED = -9,
/// Acquire failed because the object being acquired was already released.
/// For example, this happens if the application holds an @c ::ArFrame beyond
/// the next call to @c ::ArSession_update, and then tries to acquire its
/// Point Cloud.
AR_ERROR_DEADLINE_EXCEEDED = -10,
/// There are no available resources to complete the operation. In cases of
/// @c acquire functions returning this error, this can be avoided by
/// releasing previously acquired objects before acquiring new ones.
AR_ERROR_RESOURCE_EXHAUSTED = -11,
/// Acquire failed because the data isn't available yet for the current
/// frame. For example, acquiring image metadata may fail with this error
/// because the camera hasn't fully started.
AR_ERROR_NOT_YET_AVAILABLE = -12,
/// The Android camera has been reallocated to a higher priority application
/// or is otherwise unavailable.
AR_ERROR_CAMERA_NOT_AVAILABLE = -13,
/// The host/resolve function call failed because the Session is not
/// configured for Cloud Anchors.
AR_ERROR_CLOUD_ANCHORS_NOT_CONFIGURED = -14,
/// @c ::ArSession_configure failed because the specified configuration
/// required the Android INTERNET permission, which the application did not
/// have.
AR_ERROR_INTERNET_PERMISSION_NOT_GRANTED = -15,
/// Hosting a Cloud Anchor failed because the anchor is not a type of anchor
/// that is currently supported for hosting.
AR_ERROR_ANCHOR_NOT_SUPPORTED_FOR_HOSTING = -16,
/// Attempted to add an image with insufficient quality (e.g., too few
/// features) to the image database.
AR_ERROR_IMAGE_INSUFFICIENT_QUALITY = -17,
/// The data passed in for this operation was not in a valid format.
AR_ERROR_DATA_INVALID_FORMAT = -18,
/// The data passed in for this operation is not supported by this version
/// of the SDK.
AR_ERROR_DATA_UNSUPPORTED_VERSION = -19,
/// A function has been invoked at an illegal or inappropriate time. A
/// message will be printed to logcat with additional details for the
/// developer. For example, @c ::ArSession_resume will return this status if
/// the camera configuration was changed and there is at least one
/// unreleased image.
AR_ERROR_ILLEGAL_STATE = -20,
/// The Android precise location permission (@c ACCESS_FINE_LOCATION) is
/// required, but has not been granted prior to calling @c
/// ::ArSession_configure when @c ::ArGeospatialMode is set to @c
/// #AR_GEOSPATIAL_MODE_ENABLED.
///
/// See <a
/// href="https://developer.android.com/training/location/permissions#request-location-access-runtime">Android