gvr_sys/
bindings.rs

1/* automatically generated by rust-bindgen */
2
3#[repr(C)]
4#[derive(Debug, Copy, Clone)]
5pub struct gvr_context_ {
6    _unused: [u8; 0],
7}
8/// Primary context for invoking Google VR APIs.
9pub type gvr_context = gvr_context_;
10#[repr(u32)]
11/// An enum for the left and right eye.
12#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
13pub enum gvr_eye {
14    GVR_LEFT_EYE = 0,
15    GVR_RIGHT_EYE = 1,
16    GVR_NUM_EYES = 2,
17}
18#[repr(u32)]
19/// The type of VR viewer.
20#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
21pub enum gvr_viewer_type {
22    GVR_VIEWER_TYPE_CARDBOARD = 0,
23    GVR_VIEWER_TYPE_DAYDREAM = 1,
24}
25#[repr(u32)]
26/// Types of VR-specific features which may or may not be supported on the
27/// underlying platform.
28#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
29pub enum gvr_feature {
30    GVR_FEATURE_ASYNC_REPROJECTION = 0,
31    GVR_FEATURE_MULTIVIEW = 1,
32    GVR_FEATURE_EXTERNAL_SURFACE = 2,
33    GVR_FEATURE_HEAD_POSE_6DOF = 3,
34    GVR_FEATURE_HARDWARE_BUFFERS = 4,
35}
36/// Version information for the Google VR API.
37#[repr(C)]
38#[derive(Debug, Copy, Clone)]
39pub struct gvr_version_ {
40    pub major: i32,
41    pub minor: i32,
42    pub patch: i32,
43}
44#[test]
45fn bindgen_test_layout_gvr_version_() {
46    assert_eq!(
47        ::std::mem::size_of::<gvr_version_>(),
48        12usize,
49        concat!("Size of: ", stringify!(gvr_version_))
50    );
51    assert_eq!(
52        ::std::mem::align_of::<gvr_version_>(),
53        4usize,
54        concat!("Alignment of ", stringify!(gvr_version_))
55    );
56    assert_eq!(
57        unsafe { &(*(::std::ptr::null::<gvr_version_>())).major as *const _ as usize },
58        0usize,
59        concat!(
60            "Offset of field: ",
61            stringify!(gvr_version_),
62            "::",
63            stringify!(major)
64        )
65    );
66    assert_eq!(
67        unsafe { &(*(::std::ptr::null::<gvr_version_>())).minor as *const _ as usize },
68        4usize,
69        concat!(
70            "Offset of field: ",
71            stringify!(gvr_version_),
72            "::",
73            stringify!(minor)
74        )
75    );
76    assert_eq!(
77        unsafe { &(*(::std::ptr::null::<gvr_version_>())).patch as *const _ as usize },
78        8usize,
79        concat!(
80            "Offset of field: ",
81            stringify!(gvr_version_),
82            "::",
83            stringify!(patch)
84        )
85    );
86}
87pub type gvr_version = gvr_version_;
88/// An integral 2D size. Used for render target sizes.
89#[repr(C)]
90#[derive(Debug, Copy, Clone)]
91pub struct gvr_sizei {
92    pub width: i32,
93    pub height: i32,
94}
95#[test]
96fn bindgen_test_layout_gvr_sizei() {
97    assert_eq!(
98        ::std::mem::size_of::<gvr_sizei>(),
99        8usize,
100        concat!("Size of: ", stringify!(gvr_sizei))
101    );
102    assert_eq!(
103        ::std::mem::align_of::<gvr_sizei>(),
104        4usize,
105        concat!("Alignment of ", stringify!(gvr_sizei))
106    );
107    assert_eq!(
108        unsafe { &(*(::std::ptr::null::<gvr_sizei>())).width as *const _ as usize },
109        0usize,
110        concat!(
111            "Offset of field: ",
112            stringify!(gvr_sizei),
113            "::",
114            stringify!(width)
115        )
116    );
117    assert_eq!(
118        unsafe { &(*(::std::ptr::null::<gvr_sizei>())).height as *const _ as usize },
119        4usize,
120        concat!(
121            "Offset of field: ",
122            stringify!(gvr_sizei),
123            "::",
124            stringify!(height)
125        )
126    );
127}
128/// An integral 2D rect. Used for window bounds in pixels.
129#[repr(C)]
130#[derive(Debug, Copy, Clone)]
131pub struct gvr_recti {
132    pub left: i32,
133    pub right: i32,
134    pub bottom: i32,
135    pub top: i32,
136}
137#[test]
138fn bindgen_test_layout_gvr_recti() {
139    assert_eq!(
140        ::std::mem::size_of::<gvr_recti>(),
141        16usize,
142        concat!("Size of: ", stringify!(gvr_recti))
143    );
144    assert_eq!(
145        ::std::mem::align_of::<gvr_recti>(),
146        4usize,
147        concat!("Alignment of ", stringify!(gvr_recti))
148    );
149    assert_eq!(
150        unsafe { &(*(::std::ptr::null::<gvr_recti>())).left as *const _ as usize },
151        0usize,
152        concat!(
153            "Offset of field: ",
154            stringify!(gvr_recti),
155            "::",
156            stringify!(left)
157        )
158    );
159    assert_eq!(
160        unsafe { &(*(::std::ptr::null::<gvr_recti>())).right as *const _ as usize },
161        4usize,
162        concat!(
163            "Offset of field: ",
164            stringify!(gvr_recti),
165            "::",
166            stringify!(right)
167        )
168    );
169    assert_eq!(
170        unsafe { &(*(::std::ptr::null::<gvr_recti>())).bottom as *const _ as usize },
171        8usize,
172        concat!(
173            "Offset of field: ",
174            stringify!(gvr_recti),
175            "::",
176            stringify!(bottom)
177        )
178    );
179    assert_eq!(
180        unsafe { &(*(::std::ptr::null::<gvr_recti>())).top as *const _ as usize },
181        12usize,
182        concat!(
183            "Offset of field: ",
184            stringify!(gvr_recti),
185            "::",
186            stringify!(top)
187        )
188    );
189}
190/// A floating point 2D rect. Used for field of view, and also for ranges
191/// in texture space. When used for a field of view, all angles are in positive
192/// degrees from the optical axis.
193#[repr(C)]
194#[derive(Debug, Copy, Clone)]
195pub struct gvr_rectf {
196    pub left: f32,
197    pub right: f32,
198    pub bottom: f32,
199    pub top: f32,
200}
201#[test]
202fn bindgen_test_layout_gvr_rectf() {
203    assert_eq!(
204        ::std::mem::size_of::<gvr_rectf>(),
205        16usize,
206        concat!("Size of: ", stringify!(gvr_rectf))
207    );
208    assert_eq!(
209        ::std::mem::align_of::<gvr_rectf>(),
210        4usize,
211        concat!("Alignment of ", stringify!(gvr_rectf))
212    );
213    assert_eq!(
214        unsafe { &(*(::std::ptr::null::<gvr_rectf>())).left as *const _ as usize },
215        0usize,
216        concat!(
217            "Offset of field: ",
218            stringify!(gvr_rectf),
219            "::",
220            stringify!(left)
221        )
222    );
223    assert_eq!(
224        unsafe { &(*(::std::ptr::null::<gvr_rectf>())).right as *const _ as usize },
225        4usize,
226        concat!(
227            "Offset of field: ",
228            stringify!(gvr_rectf),
229            "::",
230            stringify!(right)
231        )
232    );
233    assert_eq!(
234        unsafe { &(*(::std::ptr::null::<gvr_rectf>())).bottom as *const _ as usize },
235        8usize,
236        concat!(
237            "Offset of field: ",
238            stringify!(gvr_rectf),
239            "::",
240            stringify!(bottom)
241        )
242    );
243    assert_eq!(
244        unsafe { &(*(::std::ptr::null::<gvr_rectf>())).top as *const _ as usize },
245        12usize,
246        concat!(
247            "Offset of field: ",
248            stringify!(gvr_rectf),
249            "::",
250            stringify!(top)
251        )
252    );
253}
254/// A floating point 2D vector.
255#[repr(C)]
256#[derive(Debug, Copy, Clone)]
257pub struct gvr_vec2f {
258    pub x: f32,
259    pub y: f32,
260}
261#[test]
262fn bindgen_test_layout_gvr_vec2f() {
263    assert_eq!(
264        ::std::mem::size_of::<gvr_vec2f>(),
265        8usize,
266        concat!("Size of: ", stringify!(gvr_vec2f))
267    );
268    assert_eq!(
269        ::std::mem::align_of::<gvr_vec2f>(),
270        4usize,
271        concat!("Alignment of ", stringify!(gvr_vec2f))
272    );
273    assert_eq!(
274        unsafe { &(*(::std::ptr::null::<gvr_vec2f>())).x as *const _ as usize },
275        0usize,
276        concat!(
277            "Offset of field: ",
278            stringify!(gvr_vec2f),
279            "::",
280            stringify!(x)
281        )
282    );
283    assert_eq!(
284        unsafe { &(*(::std::ptr::null::<gvr_vec2f>())).y as *const _ as usize },
285        4usize,
286        concat!(
287            "Offset of field: ",
288            stringify!(gvr_vec2f),
289            "::",
290            stringify!(y)
291        )
292    );
293}
294/// A floating point 3D vector.
295#[repr(C)]
296#[derive(Debug, Copy, Clone)]
297pub struct gvr_vec3f {
298    pub x: f32,
299    pub y: f32,
300    pub z: f32,
301}
302#[test]
303fn bindgen_test_layout_gvr_vec3f() {
304    assert_eq!(
305        ::std::mem::size_of::<gvr_vec3f>(),
306        12usize,
307        concat!("Size of: ", stringify!(gvr_vec3f))
308    );
309    assert_eq!(
310        ::std::mem::align_of::<gvr_vec3f>(),
311        4usize,
312        concat!("Alignment of ", stringify!(gvr_vec3f))
313    );
314    assert_eq!(
315        unsafe { &(*(::std::ptr::null::<gvr_vec3f>())).x as *const _ as usize },
316        0usize,
317        concat!(
318            "Offset of field: ",
319            stringify!(gvr_vec3f),
320            "::",
321            stringify!(x)
322        )
323    );
324    assert_eq!(
325        unsafe { &(*(::std::ptr::null::<gvr_vec3f>())).y as *const _ as usize },
326        4usize,
327        concat!(
328            "Offset of field: ",
329            stringify!(gvr_vec3f),
330            "::",
331            stringify!(y)
332        )
333    );
334    assert_eq!(
335        unsafe { &(*(::std::ptr::null::<gvr_vec3f>())).z as *const _ as usize },
336        8usize,
337        concat!(
338            "Offset of field: ",
339            stringify!(gvr_vec3f),
340            "::",
341            stringify!(z)
342        )
343    );
344}
345/// A floating point 4x4 matrix stored in row-major form. It needs to be
346/// transposed before being used with OpenGL.
347#[repr(C)]
348#[derive(Debug, Copy, Clone)]
349pub struct gvr_mat4f {
350    pub m: [[f32; 4usize]; 4usize],
351}
352#[test]
353fn bindgen_test_layout_gvr_mat4f() {
354    assert_eq!(
355        ::std::mem::size_of::<gvr_mat4f>(),
356        64usize,
357        concat!("Size of: ", stringify!(gvr_mat4f))
358    );
359    assert_eq!(
360        ::std::mem::align_of::<gvr_mat4f>(),
361        4usize,
362        concat!("Alignment of ", stringify!(gvr_mat4f))
363    );
364    assert_eq!(
365        unsafe { &(*(::std::ptr::null::<gvr_mat4f>())).m as *const _ as usize },
366        0usize,
367        concat!(
368            "Offset of field: ",
369            stringify!(gvr_mat4f),
370            "::",
371            stringify!(m)
372        )
373    );
374}
375/// A floating point quaternion, in JPL format.
376/// We use this simple struct in order not to impose a dependency on a
377/// particular math library. The user of this API is free to encapsulate this
378/// into any math library they want.
379#[repr(C)]
380#[derive(Debug, Copy, Clone)]
381pub struct gvr_quatf {
382    /// qx, qy, qz are the vector components.
383    pub qx: f32,
384    pub qy: f32,
385    pub qz: f32,
386    /// qw is the scalar component.
387    pub qw: f32,
388}
389#[test]
390fn bindgen_test_layout_gvr_quatf() {
391    assert_eq!(
392        ::std::mem::size_of::<gvr_quatf>(),
393        16usize,
394        concat!("Size of: ", stringify!(gvr_quatf))
395    );
396    assert_eq!(
397        ::std::mem::align_of::<gvr_quatf>(),
398        4usize,
399        concat!("Alignment of ", stringify!(gvr_quatf))
400    );
401    assert_eq!(
402        unsafe { &(*(::std::ptr::null::<gvr_quatf>())).qx as *const _ as usize },
403        0usize,
404        concat!(
405            "Offset of field: ",
406            stringify!(gvr_quatf),
407            "::",
408            stringify!(qx)
409        )
410    );
411    assert_eq!(
412        unsafe { &(*(::std::ptr::null::<gvr_quatf>())).qy as *const _ as usize },
413        4usize,
414        concat!(
415            "Offset of field: ",
416            stringify!(gvr_quatf),
417            "::",
418            stringify!(qy)
419        )
420    );
421    assert_eq!(
422        unsafe { &(*(::std::ptr::null::<gvr_quatf>())).qz as *const _ as usize },
423        8usize,
424        concat!(
425            "Offset of field: ",
426            stringify!(gvr_quatf),
427            "::",
428            stringify!(qz)
429        )
430    );
431    assert_eq!(
432        unsafe { &(*(::std::ptr::null::<gvr_quatf>())).qw as *const _ as usize },
433        12usize,
434        concat!(
435            "Offset of field: ",
436            stringify!(gvr_quatf),
437            "::",
438            stringify!(qw)
439        )
440    );
441}
442/// A *monotonic system time* representation. On Android, this is equivalent to
443/// System.nanoTime(), or clock_gettime(CLOCK_MONOTONIC). If there is any doubt
444/// about how to get the current time for the current platform, simply use
445/// gvr_get_time_point_now().
446#[repr(C)]
447#[derive(Debug, Copy, Clone)]
448pub struct gvr_clock_time_point {
449    pub monotonic_system_time_nanos: i64,
450}
451#[test]
452fn bindgen_test_layout_gvr_clock_time_point() {
453    assert_eq!(
454        ::std::mem::size_of::<gvr_clock_time_point>(),
455        8usize,
456        concat!("Size of: ", stringify!(gvr_clock_time_point))
457    );
458    assert_eq!(
459        ::std::mem::align_of::<gvr_clock_time_point>(),
460        8usize,
461        concat!("Alignment of ", stringify!(gvr_clock_time_point))
462    );
463    assert_eq!(
464        unsafe {
465            &(*(::std::ptr::null::<gvr_clock_time_point>())).monotonic_system_time_nanos as *const _
466                as usize
467        },
468        0usize,
469        concat!(
470            "Offset of field: ",
471            stringify!(gvr_clock_time_point),
472            "::",
473            stringify!(monotonic_system_time_nanos)
474        )
475    );
476}
477#[repr(C)]
478#[derive(Debug, Copy, Clone)]
479pub struct gvr_buffer_viewport_ {
480    _unused: [u8; 0],
481}
482/// A structure that ties together a region of a buffer, the field of view
483/// rendered into that region and a target eye index to define part of the
484/// user's field of view. The SDK implementation uses this information to
485/// transform the images generated by the app output into the final display that
486/// is sent to the screen.
487///
488/// A set of these structures will most often be generated by the API, via
489/// gvr_get_recommended_buffer_viewports() or
490/// gvr_get_screen_buffer_viewports(). However, the client may also customize
491/// these values via gvr_buffer_viewport_list_set(), constructing a custom
492/// gvr_buffer_viewport_list for use in the distortion pass.
493pub type gvr_buffer_viewport = gvr_buffer_viewport_;
494#[repr(C)]
495#[derive(Debug, Copy, Clone)]
496pub struct gvr_buffer_viewport_list_ {
497    _unused: [u8; 0],
498}
499/// List of buffer viewports that completely specifies how to transform the
500/// frame's buffers into the image displayed on the screen.
501pub type gvr_buffer_viewport_list = gvr_buffer_viewport_list_;
502#[repr(C)]
503#[derive(Debug, Copy, Clone)]
504pub struct gvr_buffer_spec_ {
505    _unused: [u8; 0],
506}
507/// Specification of a pixel buffer. A pixel buffer can have color, depth and
508/// stencil attachments and mostly corresponds to the OpenGL concept of a
509/// framebuffer object. However, since there can be multiple such objects for
510/// each frame, we avoid calling them "framebuffers". Pixel buffers which are
511/// part of the currently acquired frame are immutable, i.e., they cannot be
512/// resized or otherwise reconfigured.
513pub type gvr_buffer_spec = gvr_buffer_spec_;
514#[repr(C)]
515#[derive(Debug, Copy, Clone)]
516pub struct gvr_swap_chain_ {
517    _unused: [u8; 0],
518}
519/// Swap chain that contains some number of frames. Frames in the swap chain
520/// can be unused, in the process of being distorted and presented on the
521/// screen, or acquired and being rendered to by the application. The swap chain
522/// ensures that the most recent available frame is always shown and that the
523/// application never has to wait to render the next frame.
524pub type gvr_swap_chain = gvr_swap_chain_;
525#[repr(C)]
526#[derive(Debug, Copy, Clone)]
527pub struct gvr_frame_ {
528    _unused: [u8; 0],
529}
530/// A single frame acquired from the swap chain. Each frame is composed of one
531/// or more buffers, which are then lens distorted and composited into the final
532/// output. Buffers are identified by indices that correspond to the position
533/// of their gvr_buffer_spec in the list passed when constructing the swap
534/// chain.
535pub type gvr_frame = gvr_frame_;
536/// Generic flag type.
537pub type gvr_flags = u32;
538/// Generic 64-bit flag type.
539pub type gvr_flags64 = u64;
540#[repr(C)]
541#[derive(Debug, Copy, Clone)]
542pub struct gvr_properties_ {
543    _unused: [u8; 0],
544}
545/// Opaque handle to a collection of properties.
546pub type gvr_properties = gvr_properties_;
547#[repr(C)]
548#[derive(Debug, Copy, Clone)]
549pub struct gvr_controller_context_ {
550    _unused: [u8; 0],
551}
552/// Represents a Daydream Controller API object, used to invoke the
553/// Daydream Controller API.
554pub type gvr_controller_context = gvr_controller_context_;
555/// A generic container for various pure value types.
556#[repr(C)]
557#[derive(Copy, Clone)]
558pub struct gvr_value {
559    pub value_type: i32,
560    pub flags: gvr_flags,
561    pub __bindgen_anon_1: gvr_value__bindgen_ty_1,
562}
563#[repr(C)]
564#[derive(Copy, Clone)]
565pub union gvr_value__bindgen_ty_1 {
566    pub f: f32,
567    pub d: f64,
568    pub i: i32,
569    pub i64: i64,
570    pub fl: gvr_flags,
571    pub fl64: gvr_flags64,
572    pub si: gvr_sizei,
573    pub ri: gvr_recti,
574    pub rf: gvr_rectf,
575    pub v2f: gvr_vec2f,
576    pub v3f: gvr_vec3f,
577    pub qf: gvr_quatf,
578    pub m4f: gvr_mat4f,
579    pub t: gvr_clock_time_point,
580    pub padding: [u8; 248usize],
581    _bindgen_union_align: [u64; 31usize],
582}
583#[test]
584fn bindgen_test_layout_gvr_value__bindgen_ty_1() {
585    assert_eq!(
586        ::std::mem::size_of::<gvr_value__bindgen_ty_1>(),
587        248usize,
588        concat!("Size of: ", stringify!(gvr_value__bindgen_ty_1))
589    );
590    assert_eq!(
591        ::std::mem::align_of::<gvr_value__bindgen_ty_1>(),
592        8usize,
593        concat!("Alignment of ", stringify!(gvr_value__bindgen_ty_1))
594    );
595    assert_eq!(
596        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).f as *const _ as usize },
597        0usize,
598        concat!(
599            "Offset of field: ",
600            stringify!(gvr_value__bindgen_ty_1),
601            "::",
602            stringify!(f)
603        )
604    );
605    assert_eq!(
606        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).d as *const _ as usize },
607        0usize,
608        concat!(
609            "Offset of field: ",
610            stringify!(gvr_value__bindgen_ty_1),
611            "::",
612            stringify!(d)
613        )
614    );
615    assert_eq!(
616        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).i as *const _ as usize },
617        0usize,
618        concat!(
619            "Offset of field: ",
620            stringify!(gvr_value__bindgen_ty_1),
621            "::",
622            stringify!(i)
623        )
624    );
625    assert_eq!(
626        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).i64 as *const _ as usize },
627        0usize,
628        concat!(
629            "Offset of field: ",
630            stringify!(gvr_value__bindgen_ty_1),
631            "::",
632            stringify!(i64)
633        )
634    );
635    assert_eq!(
636        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).fl as *const _ as usize },
637        0usize,
638        concat!(
639            "Offset of field: ",
640            stringify!(gvr_value__bindgen_ty_1),
641            "::",
642            stringify!(fl)
643        )
644    );
645    assert_eq!(
646        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).fl64 as *const _ as usize },
647        0usize,
648        concat!(
649            "Offset of field: ",
650            stringify!(gvr_value__bindgen_ty_1),
651            "::",
652            stringify!(fl64)
653        )
654    );
655    assert_eq!(
656        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).si as *const _ as usize },
657        0usize,
658        concat!(
659            "Offset of field: ",
660            stringify!(gvr_value__bindgen_ty_1),
661            "::",
662            stringify!(si)
663        )
664    );
665    assert_eq!(
666        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).ri as *const _ as usize },
667        0usize,
668        concat!(
669            "Offset of field: ",
670            stringify!(gvr_value__bindgen_ty_1),
671            "::",
672            stringify!(ri)
673        )
674    );
675    assert_eq!(
676        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).rf as *const _ as usize },
677        0usize,
678        concat!(
679            "Offset of field: ",
680            stringify!(gvr_value__bindgen_ty_1),
681            "::",
682            stringify!(rf)
683        )
684    );
685    assert_eq!(
686        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).v2f as *const _ as usize },
687        0usize,
688        concat!(
689            "Offset of field: ",
690            stringify!(gvr_value__bindgen_ty_1),
691            "::",
692            stringify!(v2f)
693        )
694    );
695    assert_eq!(
696        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).v3f as *const _ as usize },
697        0usize,
698        concat!(
699            "Offset of field: ",
700            stringify!(gvr_value__bindgen_ty_1),
701            "::",
702            stringify!(v3f)
703        )
704    );
705    assert_eq!(
706        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).qf as *const _ as usize },
707        0usize,
708        concat!(
709            "Offset of field: ",
710            stringify!(gvr_value__bindgen_ty_1),
711            "::",
712            stringify!(qf)
713        )
714    );
715    assert_eq!(
716        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).m4f as *const _ as usize },
717        0usize,
718        concat!(
719            "Offset of field: ",
720            stringify!(gvr_value__bindgen_ty_1),
721            "::",
722            stringify!(m4f)
723        )
724    );
725    assert_eq!(
726        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).t as *const _ as usize },
727        0usize,
728        concat!(
729            "Offset of field: ",
730            stringify!(gvr_value__bindgen_ty_1),
731            "::",
732            stringify!(t)
733        )
734    );
735    assert_eq!(
736        unsafe { &(*(::std::ptr::null::<gvr_value__bindgen_ty_1>())).padding as *const _ as usize },
737        0usize,
738        concat!(
739            "Offset of field: ",
740            stringify!(gvr_value__bindgen_ty_1),
741            "::",
742            stringify!(padding)
743        )
744    );
745}
746#[test]
747fn bindgen_test_layout_gvr_value() {
748    assert_eq!(
749        ::std::mem::size_of::<gvr_value>(),
750        256usize,
751        concat!("Size of: ", stringify!(gvr_value))
752    );
753    assert_eq!(
754        ::std::mem::align_of::<gvr_value>(),
755        8usize,
756        concat!("Alignment of ", stringify!(gvr_value))
757    );
758    assert_eq!(
759        unsafe { &(*(::std::ptr::null::<gvr_value>())).value_type as *const _ as usize },
760        0usize,
761        concat!(
762            "Offset of field: ",
763            stringify!(gvr_value),
764            "::",
765            stringify!(value_type)
766        )
767    );
768    assert_eq!(
769        unsafe { &(*(::std::ptr::null::<gvr_value>())).flags as *const _ as usize },
770        4usize,
771        concat!(
772            "Offset of field: ",
773            stringify!(gvr_value),
774            "::",
775            stringify!(flags)
776        )
777    );
778}
779#[repr(u32)]
780/// The type of a recentering associated with a GVR_EVENT_RECENTER event.
781#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
782pub enum gvr_recenter_event_type {
783    GVR_RECENTER_EVENT_RESTART = 1,
784    GVR_RECENTER_EVENT_ALIGNED = 2,
785    GVR_RECENTER_EVENT_DON = 3,
786}
787/// Event data associated with a system-initiated GVR_EVENT_RECENTER event. The
788/// client may wish to handle this event to provide custom recentering logic.
789#[repr(C)]
790#[derive(Debug, Copy, Clone)]
791pub struct gvr_recenter_event_data {
792    pub recenter_type: i32,
793    pub recenter_event_flags: gvr_flags,
794    /// The new transform that maps from "sensor" space to the recentered "start"
795    /// /// space. This transform can also be retrieved by querying for the
796    /// /// GVR_PROPERTY_RECENTER_TRANSFORM property.
797    pub start_space_from_tracking_space_transform: gvr_mat4f,
798}
799#[test]
800fn bindgen_test_layout_gvr_recenter_event_data() {
801    assert_eq!(
802        ::std::mem::size_of::<gvr_recenter_event_data>(),
803        72usize,
804        concat!("Size of: ", stringify!(gvr_recenter_event_data))
805    );
806    assert_eq!(
807        ::std::mem::align_of::<gvr_recenter_event_data>(),
808        4usize,
809        concat!("Alignment of ", stringify!(gvr_recenter_event_data))
810    );
811    assert_eq!(
812        unsafe {
813            &(*(::std::ptr::null::<gvr_recenter_event_data>())).recenter_type as *const _ as usize
814        },
815        0usize,
816        concat!(
817            "Offset of field: ",
818            stringify!(gvr_recenter_event_data),
819            "::",
820            stringify!(recenter_type)
821        )
822    );
823    assert_eq!(
824        unsafe {
825            &(*(::std::ptr::null::<gvr_recenter_event_data>())).recenter_event_flags as *const _
826                as usize
827        },
828        4usize,
829        concat!(
830            "Offset of field: ",
831            stringify!(gvr_recenter_event_data),
832            "::",
833            stringify!(recenter_event_flags)
834        )
835    );
836    assert_eq!(
837        unsafe {
838            &(*(::std::ptr::null::<gvr_recenter_event_data>()))
839                .start_space_from_tracking_space_transform as *const _ as usize
840        },
841        8usize,
842        concat!(
843            "Offset of field: ",
844            stringify!(gvr_recenter_event_data),
845            "::",
846            stringify!(start_space_from_tracking_space_transform)
847        )
848    );
849}
850/// Container for various GVR-events to which the client can optionally respond.
851#[repr(C)]
852#[derive(Copy, Clone)]
853pub struct gvr_event {
854    pub timestamp: gvr_clock_time_point,
855    pub type_: i32,
856    pub flags: gvr_flags,
857    pub __bindgen_anon_1: gvr_event__bindgen_ty_1,
858}
859#[repr(C)]
860#[derive(Copy, Clone)]
861pub union gvr_event__bindgen_ty_1 {
862    pub recenter_event_data: gvr_recenter_event_data,
863    pub padding: [u8; 496usize],
864    _bindgen_union_align: [u32; 124usize],
865}
866#[test]
867fn bindgen_test_layout_gvr_event__bindgen_ty_1() {
868    assert_eq!(
869        ::std::mem::size_of::<gvr_event__bindgen_ty_1>(),
870        496usize,
871        concat!("Size of: ", stringify!(gvr_event__bindgen_ty_1))
872    );
873    assert_eq!(
874        ::std::mem::align_of::<gvr_event__bindgen_ty_1>(),
875        4usize,
876        concat!("Alignment of ", stringify!(gvr_event__bindgen_ty_1))
877    );
878    assert_eq!(
879        unsafe {
880            &(*(::std::ptr::null::<gvr_event__bindgen_ty_1>())).recenter_event_data as *const _
881                as usize
882        },
883        0usize,
884        concat!(
885            "Offset of field: ",
886            stringify!(gvr_event__bindgen_ty_1),
887            "::",
888            stringify!(recenter_event_data)
889        )
890    );
891    assert_eq!(
892        unsafe { &(*(::std::ptr::null::<gvr_event__bindgen_ty_1>())).padding as *const _ as usize },
893        0usize,
894        concat!(
895            "Offset of field: ",
896            stringify!(gvr_event__bindgen_ty_1),
897            "::",
898            stringify!(padding)
899        )
900    );
901}
902#[test]
903fn bindgen_test_layout_gvr_event() {
904    assert_eq!(
905        ::std::mem::size_of::<gvr_event>(),
906        512usize,
907        concat!("Size of: ", stringify!(gvr_event))
908    );
909    assert_eq!(
910        ::std::mem::align_of::<gvr_event>(),
911        8usize,
912        concat!("Alignment of ", stringify!(gvr_event))
913    );
914    assert_eq!(
915        unsafe { &(*(::std::ptr::null::<gvr_event>())).timestamp as *const _ as usize },
916        0usize,
917        concat!(
918            "Offset of field: ",
919            stringify!(gvr_event),
920            "::",
921            stringify!(timestamp)
922        )
923    );
924    assert_eq!(
925        unsafe { &(*(::std::ptr::null::<gvr_event>())).type_ as *const _ as usize },
926        8usize,
927        concat!(
928            "Offset of field: ",
929            stringify!(gvr_event),
930            "::",
931            stringify!(type_)
932        )
933    );
934    assert_eq!(
935        unsafe { &(*(::std::ptr::null::<gvr_event>())).flags as *const _ as usize },
936        12usize,
937        concat!(
938            "Offset of field: ",
939            stringify!(gvr_event),
940            "::",
941            stringify!(flags)
942        )
943    );
944}
945#[repr(u32)]
946/// Constants that represent GVR error codes.
947#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
948pub enum gvr_error {
949    GVR_ERROR_NONE = 0,
950    GVR_ERROR_CONTROLLER_CREATE_FAILED = 2,
951    GVR_ERROR_NO_FRAME_AVAILABLE = 3,
952    GVR_ERROR_NO_EVENT_AVAILABLE = 1000000,
953    GVR_ERROR_NO_PROPERTY_AVAILABLE = 1000001,
954}
955#[repr(u32)]
956/// Constants that represent the status of the controller API.
957#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
958pub enum gvr_controller_api_status {
959    GVR_CONTROLLER_API_OK = 0,
960    GVR_CONTROLLER_API_UNSUPPORTED = 1,
961    GVR_CONTROLLER_API_NOT_AUTHORIZED = 2,
962    GVR_CONTROLLER_API_UNAVAILABLE = 3,
963    GVR_CONTROLLER_API_SERVICE_OBSOLETE = 4,
964    GVR_CONTROLLER_API_CLIENT_OBSOLETE = 5,
965    GVR_CONTROLLER_API_MALFUNCTION = 6,
966}
967#[repr(u32)]
968/// Constants that represent the state of the controller.
969#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
970pub enum gvr_controller_connection_state {
971    GVR_CONTROLLER_DISCONNECTED = 0,
972    GVR_CONTROLLER_SCANNING = 1,
973    GVR_CONTROLLER_CONNECTING = 2,
974    GVR_CONTROLLER_CONNECTED = 3,
975}
976#[repr(u32)]
977/// Controller buttons.
978#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
979pub enum gvr_controller_button {
980    GVR_CONTROLLER_BUTTON_NONE = 0,
981    GVR_CONTROLLER_BUTTON_CLICK = 1,
982    GVR_CONTROLLER_BUTTON_HOME = 2,
983    GVR_CONTROLLER_BUTTON_APP = 3,
984    GVR_CONTROLLER_BUTTON_VOLUME_UP = 4,
985    GVR_CONTROLLER_BUTTON_VOLUME_DOWN = 5,
986    GVR_CONTROLLER_BUTTON_COUNT = 6,
987}
988#[repr(u32)]
989/// Controller battery states.
990#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
991pub enum gvr_controller_battery_level {
992    GVR_CONTROLLER_BATTERY_LEVEL_UNKNOWN = 0,
993    GVR_CONTROLLER_BATTERY_LEVEL_CRITICAL_LOW = 1,
994    GVR_CONTROLLER_BATTERY_LEVEL_LOW = 2,
995    GVR_CONTROLLER_BATTERY_LEVEL_MEDIUM = 3,
996    GVR_CONTROLLER_BATTERY_LEVEL_ALMOST_FULL = 4,
997    GVR_CONTROLLER_BATTERY_LEVEL_FULL = 5,
998    GVR_CONTROLLER_BATTERY_LEVEL_COUNT = 6,
999}
1000#[repr(C)]
1001#[derive(Debug, Copy, Clone)]
1002pub struct gvr_controller_state_ {
1003    _unused: [u8; 0],
1004}
1005/// Opaque handle to controller state.
1006pub type gvr_controller_state = gvr_controller_state_;
1007#[repr(u32)]
1008/// Rendering modes define CPU load / rendering quality balances.
1009#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1010pub enum gvr_audio_rendering_mode {
1011    GVR_AUDIO_RENDERING_STEREO_PANNING = 0,
1012    GVR_AUDIO_RENDERING_BINAURAL_LOW_QUALITY = 1,
1013    GVR_AUDIO_RENDERING_BINAURAL_HIGH_QUALITY = 2,
1014}
1015#[repr(u32)]
1016/// Room surface material names, used to set room properties.
1017#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1018pub enum gvr_audio_material_type {
1019    GVR_AUDIO_MATERIAL_TRANSPARENT = 0,
1020    GVR_AUDIO_MATERIAL_ACOUSTIC_CEILING_TILES = 1,
1021    GVR_AUDIO_MATERIAL_BRICK_BARE = 2,
1022    GVR_AUDIO_MATERIAL_BRICK_PAINTED = 3,
1023    GVR_AUDIO_MATERIAL_CONCRETE_BLOCK_COARSE = 4,
1024    GVR_AUDIO_MATERIAL_CONCRETE_BLOCK_PAINTED = 5,
1025    GVR_AUDIO_MATERIAL_CURTAIN_HEAVY = 6,
1026    GVR_AUDIO_MATERIAL_FIBER_GLASS_INSULATION = 7,
1027    GVR_AUDIO_MATERIAL_GLASS_THIN = 8,
1028    GVR_AUDIO_MATERIAL_GLASS_THICK = 9,
1029    GVR_AUDIO_MATERIAL_GRASS = 10,
1030    GVR_AUDIO_MATERIAL_LINOLEUM_ON_CONCRETE = 11,
1031    GVR_AUDIO_MATERIAL_MARBLE = 12,
1032    GVR_AUDIO_MATERIAL_METAL = 13,
1033    GVR_AUDIO_MATERIAL_PARQUET_ON_CONCRETE = 14,
1034    GVR_AUDIO_MATERIAL_PLASTER_ROUGH = 15,
1035    GVR_AUDIO_MATERIAL_PLASTER_SMOOTH = 16,
1036    GVR_AUDIO_MATERIAL_PLYWOOD_PANEL = 17,
1037    GVR_AUDIO_MATERIAL_POLISHED_CONCRETE_OR_TILE = 18,
1038    GVR_AUDIO_MATERIAL_SHEET_ROCK = 19,
1039    GVR_AUDIO_MATERIAL_WATER_OR_ICE_SURFACE = 20,
1040    GVR_AUDIO_MATERIAL_WOOD_CEILING = 21,
1041    GVR_AUDIO_MATERIAL_WOOD_PANEL = 22,
1042}
1043#[repr(u32)]
1044/// Distance rolloff models used for distance attenuation.
1045#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1046pub enum gvr_audio_distance_rolloff_type {
1047    GVR_AUDIO_ROLLOFF_LOGARITHMIC = 0,
1048    GVR_AUDIO_ROLLOFF_LINEAR = 1,
1049    GVR_AUDIO_ROLLOFF_NONE = 2,
1050}
1051/// Sound object and sound field identifier.
1052pub type gvr_audio_source_id = i32;
1053#[repr(u32)]
1054/// Supported surround sound formats.
1055#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1056pub enum gvr_audio_surround_format_type {
1057    GVR_AUDIO_SURROUND_FORMAT_INVALID = 0,
1058    GVR_AUDIO_SURROUND_FORMAT_SURROUND_MONO = 1,
1059    GVR_AUDIO_SURROUND_FORMAT_SURROUND_STEREO = 2,
1060    GVR_AUDIO_SURROUND_FORMAT_SURROUND_FIVE_DOT_ONE = 3,
1061    GVR_AUDIO_SURROUND_FORMAT_SURROUND_SEVEN_DOT_ONE = 10,
1062    GVR_AUDIO_SURROUND_FORMAT_FIRST_ORDER_AMBISONICS = 4,
1063    GVR_AUDIO_SURROUND_FORMAT_SECOND_ORDER_AMBISONICS = 5,
1064    GVR_AUDIO_SURROUND_FORMAT_THIRD_ORDER_AMBISONICS = 6,
1065    GVR_AUDIO_SURROUND_FORMAT_FIRST_ORDER_AMBISONICS_WITH_NON_DIEGETIC_STEREO = 7,
1066    GVR_AUDIO_SURROUND_FORMAT_SECOND_ORDER_AMBISONICS_WITH_NON_DIEGETIC_STEREO = 8,
1067    GVR_AUDIO_SURROUND_FORMAT_THIRD_ORDER_AMBISONICS_WITH_NON_DIEGETIC_STEREO = 9,
1068}
1069#[repr(u32)]
1070/// Valid color formats for swap chain buffers.
1071#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1072pub enum gvr_color_format_type {
1073    GVR_COLOR_FORMAT_RGBA_8888 = 0,
1074    GVR_COLOR_FORMAT_RGB_565 = 1,
1075}
1076#[repr(u32)]
1077#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1078pub enum gvr_depth_stencil_format_type {
1079    GVR_DEPTH_STENCIL_FORMAT_NONE = 255,
1080    GVR_DEPTH_STENCIL_FORMAT_DEPTH_16 = 0,
1081    GVR_DEPTH_STENCIL_FORMAT_DEPTH_24 = 1,
1082    GVR_DEPTH_STENCIL_FORMAT_DEPTH_24_STENCIL_8 = 2,
1083    GVR_DEPTH_STENCIL_FORMAT_DEPTH_32_F = 3,
1084    GVR_DEPTH_STENCIL_FORMAT_DEPTH_32_F_STENCIL_8 = 4,
1085    GVR_DEPTH_STENCIL_FORMAT_STENCIL_8 = 5,
1086}
1087#[repr(u32)]
1088/// Types of asynchronous reprojection.
1089#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1090pub enum gvr_reprojection {
1091    GVR_REPROJECTION_NONE = 0,
1092    GVR_REPROJECTION_FULL = 1,
1093}
1094#[repr(u32)]
1095#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1096pub enum gvr_controller_handedness {
1097    GVR_CONTROLLER_RIGHT_HANDED = 0,
1098    GVR_CONTROLLER_LEFT_HANDED = 1,
1099}
1100#[repr(u32)]
1101/// Types of gaze behaviors used for arm model.
1102#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1103pub enum gvr_arm_model_behavior {
1104    GVR_ARM_MODEL_SYNC_GAZE = 0,
1105    GVR_ARM_MODEL_FOLLOW_GAZE = 1,
1106    GVR_ARM_MODEL_IGNORE_GAZE = 2,
1107}
1108#[repr(C)]
1109#[derive(Debug, Copy, Clone)]
1110pub struct gvr_user_prefs_ {
1111    _unused: [u8; 0],
1112}
1113pub type gvr_user_prefs = gvr_user_prefs_;
1114#[repr(u32)]
1115/// Property types exposed by the gvr_properties_get() API.
1116#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1117pub enum gvr_property_type {
1118    GVR_PROPERTY_TRACKING_FLOOR_HEIGHT = 1,
1119    GVR_PROPERTY_RECENTER_TRANSFORM = 2,
1120    GVR_PROPERTY_SAFETY_REGION = 3,
1121    GVR_PROPERTY_SAFETY_CYLINDER_ENTER_RADIUS = 4,
1122    GVR_PROPERTY_SAFETY_CYLINDER_EXIT_RADIUS = 5,
1123    GVR_PROPERTY_TRACKING_STATUS = 6,
1124}
1125#[repr(u32)]
1126/// Safety region types exposed from the GVR_PROPERTY_SAFETY_REGION property.
1127#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1128pub enum gvr_safety_region_type {
1129    GVR_SAFETY_REGION_NONE = 0,
1130    GVR_SAFETY_REGION_CYLINDER = 1,
1131}
1132#[repr(u32)]
1133/// Value types for the contents of a gvr_value object instance.
1134#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1135pub enum gvr_value_type {
1136    GVR_VALUE_TYPE_NONE = 0,
1137    GVR_VALUE_TYPE_FLOAT = 1,
1138    GVR_VALUE_TYPE_DOUBLE = 2,
1139    GVR_VALUE_TYPE_INT = 3,
1140    GVR_VALUE_TYPE_INT64 = 4,
1141    GVR_VALUE_TYPE_FLAGS = 5,
1142    GVR_VALUE_TYPE_SIZEI = 6,
1143    GVR_VALUE_TYPE_RECTI = 7,
1144    GVR_VALUE_TYPE_RECTF = 8,
1145    GVR_VALUE_TYPE_VEC2F = 9,
1146    GVR_VALUE_TYPE_VEC3F = 10,
1147    GVR_VALUE_TYPE_QUATF = 11,
1148    GVR_VALUE_TYPE_MAT4F = 12,
1149    GVR_VALUE_TYPE_CLOCK_TIME_POINT = 13,
1150}
1151#[repr(u32)]
1152/// The type of gvr_event.
1153#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1154pub enum gvr_event_type {
1155    GVR_EVENT_RECENTER = 1,
1156    GVR_EVENT_SAFETY_REGION_EXIT = 2,
1157    GVR_EVENT_SAFETY_REGION_ENTER = 3,
1158    GVR_EVENT_HEAD_TRACKING_RESUMED = 4,
1159    GVR_EVENT_HEAD_TRACKING_PAUSED = 5,
1160}
1161#[repr(C)]
1162#[derive(Debug, Copy, Clone)]
1163pub struct AHardwareBuffer {
1164    _unused: [u8; 0],
1165}
1166extern "C" {
1167
1168    /// @return Pointer to the created gvr instance, NULL on failure.
1169    pub fn gvr_create() -> *mut gvr_context;
1170}
1171extern "C" {
1172
1173    /// Gets the current GVR runtime version.
1174    ///
1175    /// Note: This runtime version may differ from the version against which the
1176    /// client app is compiled, as defined by the semantic version components in
1177    /// gvr_version.h.
1178    ///
1179    /// @return The version as a gvr_version.
1180    pub fn gvr_get_version() -> gvr_version;
1181}
1182extern "C" {
1183
1184    /// Gets a string representation of the current GVR runtime version. This is of
1185    /// the form "MAJOR.MINOR.PATCH".
1186    ///
1187    /// Note: This runtime version may differ from the version against which the
1188    /// client app is compiled, as defined in gvr_version.h by
1189    /// GVR_SDK_VERSION_STRING.
1190    ///
1191    /// @return The version as a static char pointer.
1192    pub fn gvr_get_version_string() -> *const ::std::os::raw::c_char;
1193}
1194extern "C" {
1195
1196    /// Gets the current GVR error code, or GVR_ERROR_NONE if there is no error.
1197    /// This function doesn't clear the error code; see gvr_clear_error().
1198    ///
1199    /// @param gvr Pointer to the gvr instance.
1200    /// @return The current gvr_error code, or GVR_ERROR_NONE if no error has
1201    /// occurred.
1202    pub fn gvr_get_error(gvr: *mut gvr_context) -> i32;
1203}
1204extern "C" {
1205
1206    /// Clears the current GVR error code, and returns the error code that was
1207    /// cleared.
1208    ///
1209    /// @param gvr Pointer to the gvr instance.
1210    /// @return The gvr_error code that was cleared by this function, or
1211    /// GVR_ERROR_NONE if no error has occurred.
1212    pub fn gvr_clear_error(gvr: *mut gvr_context) -> i32;
1213}
1214extern "C" {
1215
1216    /// Gets a human-readable string representing the given error code.
1217    ///
1218    /// @param error_code The gvr_error code.
1219    /// @return A human-readable string representing the error code.
1220    pub fn gvr_get_error_string(error_code: i32) -> *const ::std::os::raw::c_char;
1221}
1222extern "C" {
1223
1224    /// Polls the event queue, populating the provided event if available while also
1225    /// popping it from the event queue.
1226    ///
1227    /// Note that it is the caller's responsibility for querying the event queue
1228    /// in a timely fashion, as it will otherwise be flushed periodically.
1229    ///
1230    /// @param gvr_context The current context.
1231    /// @param event_out The event to populate. This will be populated with a valid
1232    /// gvr_event iff the result is GVR_NO_ERROR.
1233    /// @return GVR_ERROR_NONE if an event was available, otherwise
1234    /// GVR_ERROR_NO_EVENT_AVAILABLE.
1235    pub fn gvr_poll_event(gvr: *mut gvr_context, event_out: *mut gvr_event) -> i32;
1236}
1237extern "C" {
1238
1239    /// Gets a read-only handle to the current global set of GVR-related properties.
1240    ///
1241    /// @param gvr_context The current context.
1242    /// @return gvr_properties An opaque handle to the current, global properties
1243    /// instance. Note that this handle is valid only as long as the provided
1244    /// context is valid, and must not be used after the context is destroyed.
1245    pub fn gvr_get_current_properties(gvr: *mut gvr_context) -> *const gvr_properties;
1246}
1247extern "C" {
1248
1249    /// Queries the given property's value, populating the provided value if
1250    /// available.
1251    ///
1252    /// @param gvr_properties The set of properties to query.
1253    /// @param property_key The property being queried.
1254    /// @return GVR_ERROR_NONE if the property was available, otherwise
1255    /// GVR_ERROR_NO_PROPERTY_AVAILABLE.
1256    pub fn gvr_properties_get(
1257        properties: *const gvr_properties,
1258        property_key: i32,
1259        value_out: *mut gvr_value,
1260    ) -> i32;
1261}
1262extern "C" {
1263
1264    /// Returns an opaque struct containing information about user preferences.
1265    ///
1266    /// The returned struct will remain valid as long as the context is valid.
1267    /// The returned struct may be updated when the user changes their preferences,
1268    /// so this function only needs to be called once, and calling it multiple
1269    /// times will return the same object each time.
1270    ///
1271    /// @param gvr Pointer to the gvr instance.
1272    /// @return An opaque struct containing information about user preferences.
1273    pub fn gvr_get_user_prefs(gvr: *mut gvr_context) -> *const gvr_user_prefs;
1274}
1275extern "C" {
1276
1277    /// Returns the controller handedness of the given gvr_user_prefs struct.
1278    ///
1279    /// @param user_prefs Pointer to the gvr_user_prefs object returned by
1280    /// gvr_get_user_prefs.
1281    /// @return Either GVR_CONTROLLER_RIGHT_HANDED or GVR_CONTROLLER_LEFT_HANDED
1282    /// depending on which hand the user holds the controller in.
1283    pub fn gvr_user_prefs_get_controller_handedness(user_prefs: *const gvr_user_prefs) -> i32;
1284}
1285extern "C" {
1286
1287    /// Destroys a gvr_context instance.  The parameter will be nulled by this
1288    /// operation.  Once this function is called, the behavior of any subsequent
1289    /// call to a GVR SDK function that references objects created from this
1290    /// context is undefined.
1291    ///
1292    /// @param gvr Pointer to a pointer to the gvr instance to be destroyed and
1293    /// nulled.
1294    pub fn gvr_destroy(gvr: *mut *mut gvr_context);
1295}
1296extern "C" {
1297
1298    /// Initializes necessary GL-related objects and uses the current thread and
1299    /// GL context for rendering. Please make sure that a valid GL context is
1300    /// available when this function is called.
1301    ///
1302    /// @param gvr Pointer to the gvr instance to be initialized.
1303    pub fn gvr_initialize_gl(gvr: *mut gvr_context);
1304}
1305extern "C" {
1306
1307    /// Gets whether asynchronous reprojection is currently enabled.
1308    ///
1309    /// If enabled, frames will be collected by the rendering system and
1310    /// asynchronously re-projected in sync with the scanout of the display. This
1311    /// feature may not be available on every platform, and requires a
1312    /// high-priority render thread with special extensions to function properly.
1313    ///
1314    /// Note: On Android, this feature can be enabled solely via the GvrLayout Java
1315    /// instance which (indirectly) owns this gvr_context. The corresponding
1316    /// method call is GvrLayout.setAsyncReprojectionEnabled().
1317    ///
1318    /// Note: Because of the above requirements, asynchronous reprojection is only
1319    /// currently available on Daydream-ready Android devices.  This function will
1320    /// always return false on other devices.
1321    ///
1322    /// @param gvr Pointer to the gvr instance.
1323    /// @return Whether async reprojection is enabled. Defaults to false.
1324    pub fn gvr_get_async_reprojection_enabled(gvr: *const gvr_context) -> bool;
1325}
1326extern "C" {
1327
1328    /// Gets the recommended buffer viewport configuration, populating a previously
1329    /// allocated gvr_buffer_viewport_list object. The updated values include the
1330    /// per-eye recommended viewport and field of view for the target.
1331    ///
1332    /// When the recommended viewports are used for distortion rendering, this
1333    /// method should always be called after calling refresh_viewer_profile(). That
1334    /// will ensure that the populated viewports reflect the currently paired
1335    /// viewer.
1336    ///
1337    /// This function assumes that the client is *not* using multiview to render to
1338    /// multiple layers simultaneously.
1339    ///
1340    /// @param gvr Pointer to the gvr instance from which to get the viewports.
1341    /// @param viewport_list Pointer to a previously allocated viewport list. This
1342    /// will be populated with the recommended buffer viewports and resized if
1343    /// necessary.
1344    pub fn gvr_get_recommended_buffer_viewports(
1345        gvr: *const gvr_context,
1346        viewport_list: *mut gvr_buffer_viewport_list,
1347    );
1348}
1349extern "C" {
1350
1351    /// Gets the screen (non-distorted) buffer viewport configuration, populating a
1352    /// previously allocated gvr_buffer_viewport_list object. The updated values
1353    /// include the per-eye recommended viewport and field of view for the target.
1354    ///
1355    /// @param gvr Pointer to the gvr instance from which to get the viewports.
1356    /// @param viewport_list Pointer to a previously allocated viewport list. This
1357    /// will be populated with the screen buffer viewports and resized if
1358    /// necessary.
1359    pub fn gvr_get_screen_buffer_viewports(
1360        gvr: *const gvr_context,
1361        viewport_list: *mut gvr_buffer_viewport_list,
1362    );
1363}
1364extern "C" {
1365
1366    /// Returns the maximum effective size for the client's render target, given the
1367    /// parameters of the head mounted device selected. At this resolution, we have
1368    /// a 1:1 ratio between source pixels and screen pixels in the most magnified
1369    /// region of the screen. Applications should rarely, if ever, need to render
1370    /// to a larger target, as it will simply result in sampling artifacts.
1371    ///
1372    /// Note that this is probably too large for most applications to use as a
1373    /// render target size. Applications should scale this value to be appropriate
1374    /// to their graphical load.
1375    ///
1376    /// @param gvr Pointer to the gvr instance from which to get the size.
1377    ///
1378    /// @return Maximum effective size for the target render target.
1379    pub fn gvr_get_maximum_effective_render_target_size(gvr: *const gvr_context) -> gvr_sizei;
1380}
1381extern "C" {
1382
1383    /// Returns a non-distorted size for the screen, given the parameters
1384    /// of the phone and/or the head mounted device selected.
1385    ///
1386    /// @param gvr Pointer to the gvr instance from which to get the size.
1387    ///
1388    /// @return Screen (non-distorted) size for the render target.
1389    pub fn gvr_get_screen_target_size(gvr: *const gvr_context) -> gvr_sizei;
1390}
1391extern "C" {
1392    pub fn gvr_set_surface_size(gvr: *mut gvr_context, surface_size_pixels: gvr_sizei);
1393}
1394extern "C" {
1395
1396    /// @deprecated Use the Swap Chain API instead. This function exists only to
1397    /// support legacy rendering pathways for Cardboard devices. It is
1398    /// incompatible with the low-latency experiences supported by async
1399    /// reprojection.
1400    ///
1401    /// Performs postprocessing, including lens distortion, on the contents of the
1402    /// passed texture and shows the result on the screen. Lens distortion is
1403    /// determined by the parameters of the viewer encoded in its QR code. The
1404    /// passed texture is not modified.
1405    ///
1406    /// If the application does not call gvr_initialize_gl() before calling this
1407    /// function, the results are undefined.
1408    ///
1409    /// @param gvr Pointer to the gvr instance which will do the distortion.
1410    /// @param texture_id The OpenGL ID of the texture that contains the next frame
1411    /// to be displayed.
1412    /// @param viewport_list Rendering parameters.
1413    /// @param head_space_from_start_space This parameter is ignored.
1414    /// @param target_presentation_time This parameter is ignored.
1415    pub fn gvr_distort_to_screen(
1416        gvr: *mut gvr_context,
1417        texture_id: i32,
1418        viewport_list: *const gvr_buffer_viewport_list,
1419        head_space_from_start_space: gvr_mat4f,
1420        target_presentation_time: gvr_clock_time_point,
1421    );
1422}
1423extern "C" {
1424
1425    /// Queries whether a particular GVR feature is supported by the underlying
1426    /// platform.  This should be called after gvr_initialize_gl().
1427    ///
1428    /// @param gvr The context to query against.
1429    /// @param feature The gvr_feature type being queried.
1430    /// @return true if feature is supported, false otherwise.
1431    pub fn gvr_is_feature_supported(gvr: *const gvr_context, feature: i32) -> bool;
1432}
1433extern "C" {
1434
1435    /// Creates a gvr_buffer_viewport instance.
1436    pub fn gvr_buffer_viewport_create(gvr: *mut gvr_context) -> *mut gvr_buffer_viewport;
1437}
1438extern "C" {
1439
1440    /// Frees a gvr_buffer_viewport instance and clears the pointer.
1441    pub fn gvr_buffer_viewport_destroy(viewport: *mut *mut gvr_buffer_viewport);
1442}
1443extern "C" {
1444
1445    /// Gets the UV coordinates specifying where the output buffer is sampled.
1446    ///
1447    /// @param viewport The buffer viewport.
1448    /// @return UV coordinates as a rectangle.
1449    pub fn gvr_buffer_viewport_get_source_uv(viewport: *const gvr_buffer_viewport) -> gvr_rectf;
1450}
1451extern "C" {
1452
1453    /// Sets the UV coordinates specifying where the output buffer should be
1454    /// sampled when compositing the final distorted image.
1455    ///
1456    /// @param viewport The buffer viewport.
1457    /// @param uv The new UV coordinates for sampling. The coordinates must be
1458    /// valid, that is, left <= right and bottom <= top. Otherwise an empty
1459    /// source region is set, which will result in no output for this viewport.
1460    pub fn gvr_buffer_viewport_set_source_uv(viewport: *mut gvr_buffer_viewport, uv: gvr_rectf);
1461}
1462extern "C" {
1463
1464    /// Retrieves the field of view for the referenced buffer region.
1465    ///
1466    /// This is a helper that converts the stored projection matrix to a field of
1467    /// view. Note that if the previously set projection matrix cannot be expressed
1468    /// as a view frustum aligned with the eye's optical axis, the result will be
1469    /// incorrect.
1470    ///
1471    /// @param viewport The buffer viewport.
1472    /// @return The field of view of the rendered image, in degrees.
1473    pub fn gvr_buffer_viewport_get_source_fov(viewport: *const gvr_buffer_viewport) -> gvr_rectf;
1474}
1475extern "C" {
1476
1477    /// Sets the field of view for the viewport contents.
1478    ///
1479    /// This is a helper that sets the projection matrix in such a way that the
1480    /// viewport's contents fill the specified FOV around the eye's optical axis.
1481    ///
1482    /// @param viewport The buffer viewport.
1483    /// @param fov The field of view to use when compositing the rendered image,
1484    /// in degrees.
1485    pub fn gvr_buffer_viewport_set_source_fov(viewport: *mut gvr_buffer_viewport, fov: gvr_rectf);
1486}
1487extern "C" {
1488
1489    /// Gets the matrix that positions the viewport in eye space.
1490    ///
1491    /// @param viewport The buffer viewport.
1492    /// @return Matrix that transforms a quad with vertices (-1, -1, 0), (1, -1, 0),
1493    /// (-1, 1, 0), (1, 1, 0) representing the viewport contents to its desired
1494    /// eye space position for the target eye.
1495    pub fn gvr_buffer_viewport_get_transform(viewport: *const gvr_buffer_viewport) -> gvr_mat4f;
1496}
1497extern "C" {
1498
1499    /// Sets the matrix that positions the viewport in eye space.
1500    ///
1501    /// @param viewport The buffer viewport.
1502    /// @param transform Matrix that transforms a quad with vertices (-1, -1, 0),
1503    /// (1, -1, 0), (-1, 1, 0), (1, 1, 0) representing the viewport contents to
1504    /// its desired eye space position for the target eye.
1505    pub fn gvr_buffer_viewport_set_transform(
1506        viewport: *mut gvr_buffer_viewport,
1507        transform: gvr_mat4f,
1508    );
1509}
1510extern "C" {
1511
1512    /// Gets the target logical eye for the specified viewport.
1513    ///
1514    /// @param viewport The buffer viewport.
1515    /// @return Index of the target logical eye for this viewport.
1516    pub fn gvr_buffer_viewport_get_target_eye(viewport: *const gvr_buffer_viewport) -> i32;
1517}
1518extern "C" {
1519
1520    /// Sets the target logical eye for the specified viewport.
1521    ///
1522    /// @param viewport The buffer viewport.
1523    /// @param index Index of the target logical eye.
1524    pub fn gvr_buffer_viewport_set_target_eye(viewport: *mut gvr_buffer_viewport, index: i32);
1525}
1526extern "C" {
1527
1528    /// Gets the index of the source buffer from which the viewport reads its
1529    /// undistorted pixels.
1530    ///
1531    /// @param viewport The buffer viewport.
1532    /// @return Index of the source buffer. This corresponds to the index in the
1533    /// list of buffer specs that was passed to gvr_swap_chain_create().
1534    pub fn gvr_buffer_viewport_get_source_buffer_index(viewport: *const gvr_buffer_viewport)
1535        -> i32;
1536}
1537extern "C" {
1538
1539    /// Sets the buffer from which the viewport reads its undistorted pixels.
1540    ///
1541    /// To use the contents of the external surface as buffer contents, associate an
1542    /// external surface with the viewport by calling
1543    /// gvr_buffer_viewport_set_external_surface_id(), then call this function and
1544    /// pass GVR_BUFFER_INDEX_EXTERNAL_SURFACE.
1545    ///
1546    /// @param viewport The buffer viewport.
1547    /// @param buffer_index The index of the source buffer. This is either an index
1548    /// in the list of buffer specs that was passed to
1549    /// gvr_swap_chain_create(), or GVR_BUFFER_INDEX_EXTERNAL_SURFACE.
1550    pub fn gvr_buffer_viewport_set_source_buffer_index(
1551        viewport: *mut gvr_buffer_viewport,
1552        buffer_index: i32,
1553    );
1554}
1555extern "C" {
1556
1557    /// Gets the ID of the externally-managed Surface texture from which this
1558    /// viewport reads undistored pixels.
1559    ///
1560    /// @param viewport The buffer viewport.
1561    /// @return ID of the externally-managed Surface of undistorted pixels.
1562    pub fn gvr_buffer_viewport_get_external_surface_id(viewport: *const gvr_buffer_viewport)
1563        -> i32;
1564}
1565extern "C" {
1566
1567    /// Sets the ID of the externally-managed Surface texture from which this
1568    /// viewport reads. The ID is issued by GvrLayout. If this viewport does not
1569    /// read from an external surface, this should be set to
1570    /// GVR_EXTERNAL_SURFACE_ID_NONE, which is also the default value. If it does
1571    /// read from an external surface, set this to the ID obtained from GvrLayout
1572    /// and set the source buffer index to the special value
1573    /// GVR_BUFFER_INDEX_EXTERNAL_SURFACE.
1574    ///
1575    /// @param viewport The buffer viewport.
1576    /// @param external_surface_id The ID of the surface to read from.
1577    pub fn gvr_buffer_viewport_set_external_surface_id(
1578        viewport: *mut gvr_buffer_viewport,
1579        external_surface_id: i32,
1580    );
1581}
1582extern "C" {
1583
1584    /// Gets the type of reprojection to perform on the specified viewport.
1585    ///
1586    /// @param viewport The buffer viewport.
1587    /// @return Type of reprojection that is applied to the viewport.
1588    pub fn gvr_buffer_viewport_get_reprojection(viewport: *const gvr_buffer_viewport) -> i32;
1589}
1590extern "C" {
1591
1592    /// Sets the type of reprojection to perform on the specified viewport.
1593    /// Viewports that display world content should use full reprojection.
1594    /// Viewports that display head-locked UI should disable reprojection to avoid
1595    /// excessive judder. The default is to perform full reprojection.
1596    ///
1597    /// @param viewport The buffer viewport.
1598    /// @param reprojection Type of reprojection that will be applied to the passed
1599    /// viewport.
1600    pub fn gvr_buffer_viewport_set_reprojection(
1601        viewport: *mut gvr_buffer_viewport,
1602        reprojection: i32,
1603    );
1604}
1605extern "C" {
1606
1607    /// Sets the layer in a multiview buffer from which the viewport should sample.
1608    ///
1609    /// @param layer_index The layer in the array texture that distortion samples
1610    /// from.  Must be non-negative.  Defaults to 0.
1611    pub fn gvr_buffer_viewport_set_source_layer(
1612        viewport: *mut gvr_buffer_viewport,
1613        layer_index: i32,
1614    );
1615}
1616extern "C" {
1617
1618    /// Gets the opacity to perform on the specified viewport.
1619    ///
1620    /// @param viewport The buffer viewport.
1621    /// @return opacity that is applied to the viewport, default to be 1.
1622    pub fn gvr_buffer_viewport_get_opacity(viewport: *const gvr_buffer_viewport) -> f32;
1623}
1624extern "C" {
1625
1626    /// Sets the opacity to perform on the specified viewport.
1627    ///
1628    /// @param viewport The buffer viewport.
1629    /// @param opacity Opacity that will be applied per viewport.
1630    /// It should be within [0,1], default to be 1.
1631    pub fn gvr_buffer_viewport_set_opacity(viewport: *mut gvr_buffer_viewport, opacity: f32);
1632}
1633extern "C" {
1634
1635    /// Compares two gvr_buffer_viewport instances and returns true if they specify
1636    /// the same view mapping.
1637    ///
1638    /// @param a Instance of a buffer viewport.
1639    /// @param b Another instance of a buffer viewport.
1640    /// @return True if the passed viewports are the same.
1641    pub fn gvr_buffer_viewport_equal(
1642        a: *const gvr_buffer_viewport,
1643        b: *const gvr_buffer_viewport,
1644    ) -> bool;
1645}
1646extern "C" {
1647
1648    /// returned object when it is no longer needed.
1649    pub fn gvr_buffer_viewport_list_create(
1650        gvr: *const gvr_context,
1651    ) -> *mut gvr_buffer_viewport_list;
1652}
1653extern "C" {
1654
1655    /// Destroys a gvr_buffer_viewport_list instance. The parameter will be nulled
1656    /// by this operation.
1657    ///
1658    /// @param viewport_list Pointer to a pointer to the viewport list instance to
1659    /// be destroyed and nulled.
1660    pub fn gvr_buffer_viewport_list_destroy(viewport_list: *mut *mut gvr_buffer_viewport_list);
1661}
1662extern "C" {
1663
1664    /// Returns the size of the given viewport list.
1665    ///
1666    /// @param viewport_list Pointer to a viewport list.
1667    /// @return The number of entries in the viewport list.
1668    pub fn gvr_buffer_viewport_list_get_size(
1669        viewport_list: *const gvr_buffer_viewport_list,
1670    ) -> usize;
1671}
1672extern "C" {
1673
1674    /// Retrieve a buffer viewport entry from a list.
1675    ///
1676    /// @param viewport_list Pointer to the previously allocated viewport list.
1677    /// @param index Zero-based index of the viewport entry to query. Must be
1678    /// smaller than the list size.
1679    /// @param viewport The buffer viewport structure that will be populated with
1680    /// retrieved data.
1681    pub fn gvr_buffer_viewport_list_get_item(
1682        viewport_list: *const gvr_buffer_viewport_list,
1683        index: usize,
1684        viewport: *mut gvr_buffer_viewport,
1685    );
1686}
1687extern "C" {
1688
1689    /// Update an element of the viewport list or append a new one at the end.
1690    ///
1691    /// @param viewport_list Pointer to a previously allocated viewport list.
1692    /// @param index Index of the buffer viewport entry to update. If the
1693    /// `viewport_list` size is equal to the index, a new viewport entry will be
1694    /// added. The `viewport_list` size must *not* be less than the index value.
1695    /// @param viewport A pointer to the buffer viewport object.
1696    pub fn gvr_buffer_viewport_list_set_item(
1697        viewport_list: *mut gvr_buffer_viewport_list,
1698        index: usize,
1699        viewport: *const gvr_buffer_viewport,
1700    );
1701}
1702extern "C" {
1703
1704    /// Creates a default buffer specification.
1705    pub fn gvr_buffer_spec_create(gvr: *mut gvr_context) -> *mut gvr_buffer_spec;
1706}
1707extern "C" {
1708
1709    /// Destroy the buffer specification and null the pointer.
1710    pub fn gvr_buffer_spec_destroy(spec: *mut *mut gvr_buffer_spec);
1711}
1712extern "C" {
1713
1714    /// Gets the size of the buffer to be created.
1715    ///
1716    /// @param spec Buffer specification.
1717    /// @return Size of the pixel buffer. The default is equal to the recommended
1718    /// render target size at the time when the specification was created.
1719    pub fn gvr_buffer_spec_get_size(spec: *const gvr_buffer_spec) -> gvr_sizei;
1720}
1721extern "C" {
1722
1723    /// Sets the size of the buffer to be created.
1724    ///
1725    /// @param spec Buffer specification.
1726    /// @param size The size. Width and height must both be greater than zero.
1727    /// Otherwise, the application is aborted.
1728    pub fn gvr_buffer_spec_set_size(spec: *mut gvr_buffer_spec, size: gvr_sizei);
1729}
1730extern "C" {
1731
1732    /// Gets the number of samples per pixel in the buffer to be created.
1733    ///
1734    /// @param spec Buffer specification.
1735    /// @return Value >= 1 giving the number of samples. 1 means multisampling is
1736    /// disabled. Negative values and 0 are never returned.
1737    pub fn gvr_buffer_spec_get_samples(spec: *const gvr_buffer_spec) -> i32;
1738}
1739extern "C" {
1740
1741    /// Sets the number of samples per pixel in the buffer to be created.
1742    ///
1743    /// @param spec Buffer specification.
1744    /// @param num_samples The number of samples. Negative values are an error.
1745    /// The values 0 and 1 are treated identically and indicate that
1746    pub fn gvr_buffer_spec_set_samples(spec: *mut gvr_buffer_spec, num_samples: i32);
1747}
1748extern "C" {
1749
1750    /// Sets the color format for the buffer to be created. Default format is
1751    /// GVR_COLOR_FORMAT_RGBA_8888. For all alpha-containing formats, the pixels
1752    /// are expected to be premultiplied with alpha. In other words, the 60% opaque
1753    /// primary green color is (0.0, 0.6, 0.0, 0.6).
1754    ///
1755    /// @param spec Buffer specification.
1756    /// @param color_format The color format for the buffer. Valid formats are in
1757    /// the gvr_color_format_type enum.
1758    pub fn gvr_buffer_spec_set_color_format(spec: *mut gvr_buffer_spec, color_format: i32);
1759}
1760extern "C" {
1761
1762    /// Sets the depth and stencil format for the buffer to be created. Currently,
1763    /// only packed stencil formats are supported. Default format is
1764    /// GVR_DEPTH_STENCIL_FORMAT_DEPTH_16.
1765    ///
1766    /// @param spec Buffer specification.
1767    /// @param depth_stencil_format The depth and stencil format for the buffer.
1768    /// Valid formats are in the gvr_depth_stencil_format_type enum.
1769    pub fn gvr_buffer_spec_set_depth_stencil_format(
1770        spec: *mut gvr_buffer_spec,
1771        depth_stencil_format: i32,
1772    );
1773}
1774extern "C" {
1775
1776    /// Sets the number of layers in a framebuffer backed by an array texture.
1777    ///
1778    /// Default is 1, which means a non-layered texture will be created.
1779    /// Not all platforms support multiple layers, so clients can call
1780    /// gvr_is_feature_supported(GVR_FEATURE_MULTIVIEW) to check.
1781    ///
1782    /// @param spec Buffer specification.
1783    /// @param num_layers The number of layers in the array texture.
1784    pub fn gvr_buffer_spec_set_multiview_layers(spec: *mut gvr_buffer_spec, num_layers: i32);
1785}
1786extern "C" {
1787
1788    /// Creates a swap chain from the given buffer specifications.
1789    /// This is a potentially time-consuming operation. All frames within the
1790    /// swapchain will be allocated. Once rendering is stopped, call
1791    /// gvr_swap_chain_destroy() to free GPU resources. The passed gvr_context must
1792    /// not be destroyed until then.
1793    ///
1794    /// Swap chains can have no buffers. This is useful when only displaying
1795    /// external surfaces. When `count` is zero, `buffers` must be null.
1796    ///
1797    /// @param gvr GVR instance for which a swap chain will be created.
1798    /// @param buffers Array of pixel buffer specifications. Each frame in the
1799    /// swap chain will be composed of these buffers.
1800    /// @param count Number of buffer specifications in the array.
1801    /// @return Opaque handle to the newly created swap chain.
1802    pub fn gvr_swap_chain_create(
1803        gvr: *mut gvr_context,
1804        buffers: *mut *const gvr_buffer_spec,
1805        count: i32,
1806    ) -> *mut gvr_swap_chain;
1807}
1808extern "C" {
1809
1810    /// Destroys the swap chain and nulls the pointer.
1811    pub fn gvr_swap_chain_destroy(swap_chain: *mut *mut gvr_swap_chain);
1812}
1813extern "C" {
1814
1815    /// Gets the number of buffers in each frame of the swap chain.
1816    pub fn gvr_swap_chain_get_buffer_count(swap_chain: *const gvr_swap_chain) -> i32;
1817}
1818extern "C" {
1819
1820    /// Retrieves the size of the specified pixel buffer. Note that if the buffer
1821    /// was resized while the current frame was acquired, the return value will be
1822    /// different than the value obtained from the equivalent function for the
1823    /// current frame.
1824    ///
1825    /// @param swap_chain The swap chain.
1826    /// @param index Index of the pixel buffer.
1827    /// @return Size of the specified pixel buffer in frames that will be returned
1828    /// from gvr_swap_chain_acquire_frame().
1829    pub fn gvr_swap_chain_get_buffer_size(
1830        swap_chain: *const gvr_swap_chain,
1831        index: i32,
1832    ) -> gvr_sizei;
1833}
1834extern "C" {
1835
1836    /// Resizes the specified pixel buffer to the given size. The frames are resized
1837    /// when they are unused, so the currently acquired frame will not be resized
1838    /// immediately.
1839    ///
1840    /// @param swap_chain The swap chain.
1841    /// @param index Index of the pixel buffer to resize.
1842    /// @param size New size for the specified pixel buffer.
1843    pub fn gvr_swap_chain_resize_buffer(
1844        swap_chain: *mut gvr_swap_chain,
1845        index: i32,
1846        size: gvr_sizei,
1847    );
1848}
1849extern "C" {
1850
1851    /// Acquires a frame from the swap chain for rendering. Buffers that are part of
1852    /// the frame can then be bound with gvr_frame_bind_buffer(). Once the frame
1853    /// is finished and all its constituent buffers are ready, call
1854    /// gvr_frame_submit() to display it while applying lens distortion.
1855    ///
1856    /// When this is called, the current thread's GL context must be the same
1857    /// context that was current when gvr_initialize_gl() was called, or at least be
1858    /// in a share group with the initialization context.
1859    ///
1860    /// @param swap_chain The swap chain.
1861    /// @return Handle to the acquired frame. NULL if the swap chain is invalid,
1862    /// or if acquire has already been called on this swap chain.
1863    pub fn gvr_swap_chain_acquire_frame(swap_chain: *mut gvr_swap_chain) -> *mut gvr_frame;
1864}
1865extern "C" {
1866
1867    /// Binds a pixel buffer that is part of the frame to the OpenGL framebuffer.
1868    ///
1869    /// @param frame Frame handle acquired from the swap chain.
1870    /// @param index Index of the pixel buffer to bind. This corresponds to the
1871    /// index in the buffer spec list that was passed to
1872    /// gvr_swap_chain_create().
1873    pub fn gvr_frame_bind_buffer(frame: *mut gvr_frame, index: i32);
1874}
1875extern "C" {
1876
1877    /// Unbinds any buffers bound from this frame and binds the default OpenGL
1878    /// framebuffer.
1879    pub fn gvr_frame_unbind(frame: *mut gvr_frame);
1880}
1881extern "C" {
1882
1883    /// Returns the dimensions of the pixel buffer with the specified index. Note
1884    /// that a frame that was acquired before resizing a swap chain buffer will not
1885    /// be resized until it is submitted to the swap chain.
1886    ///
1887    /// @param frame Frame handle.
1888    /// @param index Index of the pixel buffer to inspect.
1889    /// @return Dimensions of the specified pixel buffer.
1890    pub fn gvr_frame_get_buffer_size(frame: *const gvr_frame, index: i32) -> gvr_sizei;
1891}
1892extern "C" {
1893
1894    /// Gets the name (ID) of the framebuffer object associated with the specified
1895    /// buffer. The OpenGL state is not modified.
1896    ///
1897    /// @param frame Frame handle.
1898    /// @param index Index of a pixel buffer.
1899    /// @return OpenGL object name (ID) of a framebuffer object which can be used
1900    /// to render into the buffer. The ID is valid only until the frame is
1901    /// submitted.
1902    pub fn gvr_frame_get_framebuffer_object(frame: *const gvr_frame, index: i32) -> i32;
1903}
1904extern "C" {
1905
1906    /// Gets the hardware buffer backing the specified frame buffer.
1907    ///
1908    /// Hardware buffers (Android NDK type AHardwareBuffer) are used to back frames
1909    /// if asynchronous reprojection is enabled and GVR_FEATURE_HARDWARE_BUFFERS is
1910    /// supported (currently on Android O and later Android versions). See the
1911    /// documentation for the feature enum value for further information.
1912    ///
1913    /// There is no need to acquire or release the AHardwareBuffer. The swap chain
1914    /// maintains a reference to it while the frame is acquired.
1915    ///
1916    /// @param frame The gvr_frame from which to obtain the buffer.
1917    /// @param index Index of the pixel buffer.
1918    /// @return Pointer to AHardwareBuffer backing the frame's pixel buffer where
1919    /// available, or NULL otherwise.
1920    pub fn gvr_frame_get_hardware_buffer(
1921        frame: *const gvr_frame,
1922        index: i32,
1923    ) -> *mut AHardwareBuffer;
1924}
1925extern "C" {
1926
1927    /// Submits the frame for distortion and display on the screen. The passed
1928    /// pointer is nulled to prevent reuse.
1929    ///
1930    /// @param frame The frame to submit.
1931    /// @param list Buffer view configuration to be used for this frame.
1932    /// @param head_space_from_start_space Transform from start space (space with
1933    /// head at the origin at last tracking reset) to head space (space with
1934    /// head at the origin and axes aligned to the view vector).
1935    pub fn gvr_frame_submit(
1936        frame: *mut *mut gvr_frame,
1937        list: *const gvr_buffer_viewport_list,
1938        head_space_from_start_space: gvr_mat4f,
1939    );
1940}
1941extern "C" {
1942
1943    /// Resets the OpenGL framebuffer binding to what it was at the time the
1944    /// passed gvr_context was created.
1945    pub fn gvr_bind_default_framebuffer(gvr: *mut gvr_context);
1946}
1947extern "C" {
1948
1949    /// Gets the current monotonic system time.
1950    ///
1951    /// @return The current monotonic system time.
1952    pub fn gvr_get_time_point_now() -> gvr_clock_time_point;
1953}
1954extern "C" {
1955
1956    /// @deprecated Calls to this method can be safely replaced by calls to
1957    /// gvr_get_head_space_from_start_space_transform. The new API reflects that
1958    /// the call *can* return a full 6DoF transform when supported by both the
1959    /// host platform and the client application.
1960    ///
1961    /// Gets the rotation from start space to head space.  The head space is a
1962    /// space where the head is at the origin and faces the -Z direction.
1963    ///
1964    /// @param gvr Pointer to the gvr instance from which to get the pose.
1965    /// @param time The time at which to get the head pose. The time should be in
1966    /// the future. If the time is not in the future, it will be clamped to now.
1967    /// @return A matrix representation of the rotation from start space (the space
1968    /// where the head was last reset) to head space (the space with the head
1969    /// at the origin, and the axes aligned to the view vector).
1970    pub fn gvr_get_head_space_from_start_space_rotation(
1971        gvr: *const gvr_context,
1972        time: gvr_clock_time_point,
1973    ) -> gvr_mat4f;
1974}
1975extern "C" {
1976
1977    /// Gets the position and rotation from start space to head space.  The head
1978    /// space is a space where the head is at the origin and faces the -Z direction.
1979    ///
1980    /// For platforms that support 6DoF head tracking, the app may also be required
1981    /// to declare support for 6DoF in order to receive a fully formed 6DoF pose,
1982    /// e.g., on Android, this requires declaration of support for at least version
1983    /// 1 of the "android.hardware.vr.headtracking" feature in the manifest.
1984    ///
1985    /// @param gvr Pointer to the gvr instance from which to get the pose.
1986    /// @param time The time at which to get the head pose. The time should be in
1987    /// the future. If the time is not in the future, it will be clamped to now.
1988    /// @return A matrix representation of the position and rotation from start
1989    /// space (the space where the head was last reset) to head space (the
1990    /// space with the head at the origin, and the axes aligned to the view
1991    /// vector).
1992    pub fn gvr_get_head_space_from_start_space_transform(
1993        gvr: *const gvr_context,
1994        time: gvr_clock_time_point,
1995    ) -> gvr_mat4f;
1996}
1997extern "C" {
1998
1999    /// Applies a simple neck model translation based on the rotation of the
2000    /// provided head pose.
2001    ///
2002    /// Note: Neck model application may not be appropriate for all tracking
2003    /// scenarios, e.g., when tracking is non-biological.
2004    ///
2005    /// @param gvr Pointer to the context instance from which the pose was obtained.
2006    /// @param head_space_from_start_space_rotation The head rotation as returned by
2007    /// gvr_get_head_space_from_start_space_rotation().
2008    /// @param factor A scaling factor for the neck model offset, clamped from 0 to
2009    /// 1. This should be 1 for most scenarios, while 0 will effectively disable
2010    /// neck model application. This value can be animated to smoothly
2011    /// interpolate between alternative (client-defined) neck models.
2012    /// @return The new head pose with the neck model applied.
2013    pub fn gvr_apply_neck_model(
2014        gvr: *const gvr_context,
2015        head_space_from_start_space_rotation: gvr_mat4f,
2016        factor: f32,
2017    ) -> gvr_mat4f;
2018}
2019extern "C" {
2020
2021    /// Pauses head tracking, disables all sensors (to save power).
2022    ///
2023    /// @param gvr Pointer to the gvr instance for which tracking will be paused and
2024    /// sensors disabled.
2025    pub fn gvr_pause_tracking(gvr: *mut gvr_context);
2026}
2027extern "C" {
2028
2029    /// Resumes head tracking, re-enables all sensors.
2030    ///
2031    /// @param gvr Pointer to the gvr instance for which tracking will be resumed.
2032    pub fn gvr_resume_tracking(gvr: *mut gvr_context);
2033}
2034extern "C" {
2035
2036    /// @deprecated Calls to this method can be safely replaced by calls to
2037    /// gvr_recenter_tracking. This accomplishes the same effects but avoids the
2038    /// undesirable side-effects of a full reset (temporary loss of tracking
2039    /// quality).
2040    ///
2041    /// Resets head tracking.
2042    ///
2043    /// Only to be used by Cardboard apps. Daydream apps must not call this. On the
2044    /// Daydream platform, recentering is handled automatically and should never
2045    /// be triggered programmatically by applications. Hybrid apps that support both
2046    /// Cardboard and Daydream must only call this function when in Cardboard mode
2047    /// (that is, when the phone is paired with a Cardboard viewer), never in
2048    /// Daydream mode.
2049    ///
2050    /// @param gvr Pointer to the gvr instance for which tracking will be reseted.
2051    pub fn gvr_reset_tracking(gvr: *mut gvr_context);
2052}
2053extern "C" {
2054
2055    /// Recenters the head orientation (resets the yaw to zero, leaving pitch and
2056    /// roll unmodified).
2057    ///
2058    /// Only to be used by Cardboard apps. Daydream apps must not call this. On the
2059    /// Daydream platform, recentering is handled automatically and should never
2060    /// be triggered programmatically by applications. Hybrid apps that support both
2061    /// Cardboard and Daydream must only call this function when in Cardboard mode
2062    /// (that is, when the phone is paired with a Cardboard viewer), never in
2063    /// Daydream mode.
2064    ///
2065    /// @param gvr Pointer to the gvr instance for which tracking will be
2066    /// recentered.
2067    pub fn gvr_recenter_tracking(gvr: *mut gvr_context);
2068}
2069extern "C" {
2070
2071    /// Sets the default viewer profile specified by viewer_profile_uri.
2072    /// The viewer_profile_uri that is passed in will be ignored if a valid
2073    /// viewer profile has already been stored on the device that the app
2074    /// is running on.
2075    ///
2076    /// Note: This function has the potential of blocking for up to 30 seconds for
2077    /// each redirect if a shortened URI is passed in as argument. It will try to
2078    /// unroll the shortened URI for a maximum number of 5 times if the redirect
2079    /// continues. In that case, it is recommended to create a separate thread to
2080    /// call this function so that other tasks like rendering will not be blocked
2081    /// on this. The blocking can be avoided if a standard URI is passed in.
2082    ///
2083    /// @param gvr Pointer to the gvr instance which to set the profile on.
2084    /// @param viewer_profile_uri A string that contains either the shortened URI or
2085    /// the standard URI representing the viewer profile that the app should be
2086    /// using. If the valid viewer profile can be found on the device, the URI
2087    /// that is passed in will be ignored and nothing will happen. Otherwise,
2088    /// gvr will look for the viewer profile specified by viewer_profile_uri,
2089    /// and it will be stored if found. Also, the values will be applied to gvr.
2090    /// A valid standard URI can be generated from this page:
2091    /// https://www.google.com/get/cardboard/viewerprofilegenerator/
2092    /// @return True if the viewer profile specified by viewer_profile_uri was
2093    /// successfully stored and applied, false otherwise.
2094    pub fn gvr_set_default_viewer_profile(
2095        gvr: *mut gvr_context,
2096        viewer_profile_uri: *const ::std::os::raw::c_char,
2097    ) -> bool;
2098}
2099extern "C" {
2100
2101    /// Refreshes gvr_context with the viewer profile that is stored on the device.
2102    /// If it can not find the viewer profile, nothing will happen.
2103    ///
2104    /// @param gvr Pointer to the gvr instance to refresh the profile on.
2105    pub fn gvr_refresh_viewer_profile(gvr: *mut gvr_context);
2106}
2107extern "C" {
2108
2109    /// Gets the name of the viewer vendor.
2110    ///
2111    /// @param gvr Pointer to the gvr instance from which to get the vendor.
2112    /// @return A pointer to the vendor name. May be NULL if no viewer is paired.
2113    /// WARNING: This method guarantees the validity of the returned pointer
2114    /// only until the next use of the `gvr` context. The string should be
2115    /// copied immediately if persistence is required.
2116    pub fn gvr_get_viewer_vendor(gvr: *const gvr_context) -> *const ::std::os::raw::c_char;
2117}
2118extern "C" {
2119
2120    /// Gets the name of the viewer model.
2121    ///
2122    /// @param gvr Pointer to the gvr instance from which to get the name.
2123    /// @return A pointer to the model name. May be NULL if no viewer is paired.
2124    /// WARNING: This method guarantees the validity of the returned pointer
2125    /// only until the next use of the `gvr` context. The string should be
2126    /// copied immediately if persistence is required.
2127    pub fn gvr_get_viewer_model(gvr: *const gvr_context) -> *const ::std::os::raw::c_char;
2128}
2129extern "C" {
2130
2131    /// Gets the type of the viewer, as defined by gvr_viewer_type.
2132    ///
2133    /// @param gvr Pointer to the gvr instance from which to get the viewer type.
2134    /// @return The gvr_viewer_type of the currently paired viewer.
2135    pub fn gvr_get_viewer_type(gvr: *const gvr_context) -> i32;
2136}
2137extern "C" {
2138
2139    /// Gets the transformation matrix to convert from Head Space to Eye Space for
2140    /// the given eye.
2141    ///
2142    /// @param gvr Pointer to the gvr instance from which to get the matrix.
2143    /// @param eye Selected eye type.
2144    /// @return Transformation matrix from Head Space to selected Eye Space.
2145    pub fn gvr_get_eye_from_head_matrix(gvr: *const gvr_context, eye: i32) -> gvr_mat4f;
2146}
2147extern "C" {
2148
2149    /// Gets the window bounds.
2150    ///
2151    /// @param gvr Pointer to the gvr instance from which to get the bounds.
2152    ///
2153    /// @return Window bounds in physical pixels.
2154    pub fn gvr_get_window_bounds(gvr: *const gvr_context) -> gvr_recti;
2155}
2156extern "C" {
2157
2158    /// Computes the distorted point for a given point in a given eye.  The
2159    /// distortion inverts the optical distortion caused by the lens for the eye.
2160    /// Due to chromatic aberration, the distortion is different for each
2161    /// color channel.
2162    ///
2163    /// @param gvr Pointer to the gvr instance which will do the computing.
2164    /// @param eye The gvr_eye type (left or right).
2165    /// @param uv_in A point in screen eye Viewport Space in [0,1]^2 with (0, 0)
2166    /// in the lower left corner of the eye's viewport and (1, 1) in the
2167    /// upper right corner of the eye's viewport.
2168    /// @param uv_out A pointer to an array of (at least) 3 elements, with each
2169    /// element being a Point2f representing a point in render texture eye
2170    /// Viewport Space in [0,1]^2 with (0, 0) in the lower left corner of the
2171    /// eye's viewport and (1, 1) in the upper right corner of the eye's
2172    /// viewport.
2173    /// `uv_out[0]` is the corrected position of `uv_in` for the red channel
2174    /// `uv_out[1]` is the corrected position of `uv_in` for the green channel
2175    /// `uv_out[2]` is the corrected position of `uv_in` for the blue channel
2176    pub fn gvr_compute_distorted_point(
2177        gvr: *const gvr_context,
2178        eye: i32,
2179        uv_in: gvr_vec2f,
2180        uv_out: *mut gvr_vec2f,
2181    );
2182}
2183extern "C" {
2184
2185    /// Returns the default features for the controller API.
2186    ///
2187    /// @return The set of default features, as bit flags (an OR'ed combination of
2188    /// the GVR_CONTROLLER_ENABLE_* feature flags).
2189    pub fn gvr_controller_get_default_options() -> i32;
2190}
2191extern "C" {
2192
2193    /// Creates and initializes a gvr_controller_context instance which can be used
2194    /// to invoke the Daydream Controller API functions. Important: after creation
2195    /// the API will be in the paused state (the controller will be inactive).
2196    /// You must call gvr_controller_resume() explicitly (typically, in your Android
2197    /// app's onResume() callback).
2198    ///
2199    /// @param options The API options. To get the defaults, use
2200    /// gvr_controller_get_default_options().
2201    /// @param context The GVR Context object to sync with (optional).
2202    /// This can be nullptr. If provided, the context's state will
2203    /// be synchronized with the controller's state where possible. For
2204    /// example, when the user recenters the controller, this will
2205    /// automatically recenter head tracking as well.
2206    /// WARNING: the caller is responsible for making sure the pointer
2207    /// remains valid for the lifetime of this object.
2208    /// @return A pointer to the initialized API, or NULL if an error occurs.
2209    pub fn gvr_controller_create_and_init(
2210        options: i32,
2211        context: *mut gvr_context,
2212    ) -> *mut gvr_controller_context;
2213}
2214extern "C" {
2215
2216    /// Destroys a gvr_controller_context that was previously created with
2217    /// gvr_controller_init.
2218    ///
2219    /// @param api Pointer to a pointer to a gvr_controller_context. The pointer
2220    /// will be set to NULL after destruction.
2221    pub fn gvr_controller_destroy(api: *mut *mut gvr_controller_context);
2222}
2223extern "C" {
2224
2225    /// Pauses the controller, possibly releasing resources.
2226    /// Call this when your app/game loses focus.
2227    /// Calling this when already paused is a no-op.
2228    /// Thread-safe (call from any thread).
2229    ///
2230    /// @param api Pointer to a gvr_controller_context.
2231    pub fn gvr_controller_pause(api: *mut gvr_controller_context);
2232}
2233extern "C" {
2234
2235    /// Resumes the controller. Call this when your app/game regains focus.
2236    /// Calling this when already resumed is a no-op.
2237    /// Thread-safe (call from any thread).
2238    ///
2239    /// @param api Pointer to a gvr_controller_context.
2240    pub fn gvr_controller_resume(api: *mut gvr_controller_context);
2241}
2242extern "C" {
2243
2244    /// Returns the number (N) of controllers currently available.
2245    ///
2246    /// Each controller can be identified by an index in the range [0, N), which
2247    /// can be passed to gvr_controller_state_update to set a gvr_controller_state
2248    /// instance to the state of the controller for that index.
2249    ///
2250    /// @param api Pointer to a gvr_controller_context.
2251    /// @return The number of controllers currently available.
2252    pub fn gvr_controller_get_count(api: *mut gvr_controller_context) -> i32;
2253}
2254extern "C" {
2255
2256    /// Convenience to convert an API status code to string. The returned pointer
2257    /// is static and valid throughout the lifetime of the application.
2258    ///
2259    /// @param status The gvr_controller_api_status to convert to string.
2260    /// @return A pointer to a string that describes the value.
2261    pub fn gvr_controller_api_status_to_string(status: i32) -> *const ::std::os::raw::c_char;
2262}
2263extern "C" {
2264
2265    /// Convenience to convert an connection state to string. The returned pointer
2266    /// is static and valid throughout the lifetime of the application.
2267    ///
2268    /// @param state The state to convert to string.
2269    /// @return A pointer to a string that describes the value.
2270    pub fn gvr_controller_connection_state_to_string(state: i32) -> *const ::std::os::raw::c_char;
2271}
2272extern "C" {
2273
2274    /// Convenience to convert an connection state to string. The returned pointer
2275    /// is static and valid throughout the lifetime of the application.
2276    ///
2277    /// @param button The gvr_controller_button to convert to string.
2278    /// @return A pointer to a string that describes the value.
2279    pub fn gvr_controller_button_to_string(button: i32) -> *const ::std::os::raw::c_char;
2280}
2281extern "C" {
2282
2283    /// Creates a gvr_controller_state.
2284    ///
2285    /// @return A gvr_controller_state instance that will receive state updates for
2286    /// a controller.
2287    pub fn gvr_controller_state_create() -> *mut gvr_controller_state;
2288}
2289extern "C" {
2290
2291    /// Destroys and sets to NULL a gvr_controller_state that was previously
2292    /// created with gvr_controller_state_create.
2293    ///
2294    /// @param state Pointer to a pointer to the controller state to be destroyed
2295    /// and nulled.
2296    pub fn gvr_controller_state_destroy(state: *mut *mut gvr_controller_state);
2297}
2298extern "C" {
2299
2300    /// Updates the controller state. Reading the controller state is not a
2301    /// const getter: it has side-effects. In particular, some of the
2302    /// gvr_controller_state fields (the ones documented as "transient") represent
2303    /// one-time events and will be true for only one read operation, and false
2304    /// in subsequent reads.
2305    ///
2306    /// If the controller_index passed here does not correspond to an available
2307    /// controller (i.e. the controller_index is not in the range [0,N) where N is
2308    /// the number of controllers returned by gvr_controller_get_count), then the
2309    /// values of fields set for the gvr_controller_state instance passed in here
2310    /// are undefined.
2311    ///
2312    /// The index of each controller device will remain constant the same across
2313    /// controller disconnects/connects during a given VR session. If the
2314    /// underlying set of controllers expected to be available to applications has
2315    /// changed, the gvr_controller_context may no longer be valid, and must be
2316    /// recreated by the applicaion when notified of this.
2317    ///
2318    /// @param api Pointer to a gvr_controller_context.
2319    /// @param controller_index The index of the controller to update the state
2320    /// from.
2321    /// @param out_state A pointer where the controller's state
2322    /// is to be written. This must have been allocated with
2323    /// gvr_controller_state_create().
2324    pub fn gvr_controller_state_update(
2325        api: *mut gvr_controller_context,
2326        controller_index: i32,
2327        out_state: *mut gvr_controller_state,
2328    );
2329}
2330extern "C" {
2331
2332    /// Sets up arm model with user's handedness, gaze behavior and head rotation.
2333    /// This setting needs to be applied for every frame. User preferences of
2334    /// handedness and gaze behavior can be changed as needed in a sequence of
2335    /// frames. This needs to be called before gvr_controller_state_update() to
2336    /// apply arm model. GVR_CONTROLLER_ENABLE_ARM_MODEL flag needs to be enabled
2337    /// to apply arm model. The controller position computed with arm model is
2338    /// relative to the head origin. If using the opt-in neck model, the effective
2339    /// eye position after using vr_apply_neck_model() is shifted forward from the
2340    /// head origin by the neck-to-eye distance (8cm) when the head is in
2341    /// neutral position, and a matching forward offset should be applied to the
2342    /// controller position to compensate.
2343    ///
2344    /// When multiple controllers are configured, this arm model will be applied to
2345    /// the controller at the given controller_index, if one exists.
2346    ///
2347    /// @param api Pointer to a gvr_controller_context.
2348    /// @param controller_index Index of the controller to apply the arm model to.
2349    /// @param handedness User's preferred handedness (GVR_CONTROLLER_RIGHT_HANDED
2350    /// or GVR_CONTROLLER_LEFT_HANDED). Arm model will assume this is the hand
2351    /// that is holding the controller and position the arm accordingly.
2352    /// @param behavior User's preferred gaze behavior (SYNC_GAZE / FOLLOW_GAZE
2353    /// / IGNORE_GAZE). Arm model uses this to determine how the body rotates as
2354    /// gaze direction (i.e. head rotation) changes.
2355    /// @param head_space_from_start_space_rotation User's head rotation with
2356    /// respect to start space.
2357    pub fn gvr_controller_apply_arm_model(
2358        api: *mut gvr_controller_context,
2359        controller_index: i32,
2360        handedness: i32,
2361        behavior: i32,
2362        head_space_from_start_space_rotation: gvr_mat4f,
2363    );
2364}
2365extern "C" {
2366
2367    /// Gets the API status of the controller state. Returns one of the
2368    /// gvr_controller_api_status variants, but returned as an int32_t for ABI
2369    /// compatibility.
2370    ///
2371    /// @param state The controller state to get the status from.
2372    /// @return The status code from the controller state, as a
2373    /// gvr_controller_api_status variant.
2374    pub fn gvr_controller_state_get_api_status(state: *const gvr_controller_state) -> i32;
2375}
2376extern "C" {
2377
2378    /// Gets the connection state of the controller. Returns one of the
2379    /// gvr_controller_connection_state variants, but returned as an int32_t for ABI
2380    /// compatibility.
2381    ///
2382    /// @param state The controller state to get the connection state from.
2383    /// @return The connection state from the controller state as a
2384    /// gvr_controller_connection_state variant.
2385    pub fn gvr_controller_state_get_connection_state(state: *const gvr_controller_state) -> i32;
2386}
2387extern "C" {
2388
2389    /// Returns the current controller orientation, in Start Space. The Start Space
2390    /// is the same space as the headset space and has these three axes
2391    /// (right-handed):
2392    ///
2393    /// * The positive X axis points to the right.
2394    /// * The positive Y axis points upwards.
2395    /// * The positive Z axis points backwards.
2396    ///
2397    /// The definition of "backwards" and "to the right" are based on the position
2398    /// of the controller when tracking started. For Daydream, this is when the
2399    /// controller was first connected in the "Connect your Controller" screen
2400    /// which is shown when the user enters VR.
2401    ///
2402    /// The definition of "upwards" is given by gravity (away from the pull of
2403    /// gravity). This API may not work in environments without gravity, such
2404    /// as space stations or near the center of the Earth.
2405    ///
2406    /// Since the coordinate system is right-handed, rotations are given by the
2407    /// right-hand rule. For example, rotating the controller counter-clockwise
2408    /// on a table top as seen from above means a positive rotation about the
2409    /// Y axis, while clockwise would mean negative.
2410    ///
2411    /// Note that this is the Start Space for the *controller*, which initially
2412    /// coincides with the Start Space for the headset, but they may diverge over
2413    /// time due to controller/headset drift. A recentering operation will bring
2414    /// the two spaces back into sync.
2415    ///
2416    /// Remember that a unit quaternion expresses a rotation. Given a rotation of
2417    /// theta radians about the (x, y, z) axis, the corresponding quaternion (in
2418    /// xyzw order) is:
2419    ///
2420    /// (x * sin(theta/2), y * sin(theta/2), z * sin(theta/2), cos(theta/2))
2421    ///
2422    /// Here are some examples of orientations of the controller and their
2423    /// corresponding quaternions, all given in xyzw order:
2424    ///
2425    /// * Initial pose, pointing forward and lying flat on a surface: identity
2426    /// quaternion (0, 0, 0, 1). Corresponds to "no rotation".
2427    ///
2428    /// * Flat on table, rotated 90 degrees counter-clockwise: (0, 0.7071, 0,
2429    /// 0.7071). Corresponds to a +90 degree rotation about the Y axis.
2430    ///
2431    /// * Flat on table, rotated 90 degrees clockwise: (0, -0.7071, 0, 0.7071).
2432    /// Corresponds to a -90 degree rotation about the Y axis.
2433    ///
2434    /// * Flat on table, rotated 180 degrees (pointing backwards): (0, 1, 0, 0).
2435    /// Corresponds to a 180 degree rotation about the Y axis.
2436    ///
2437    /// * Pointing straight up towards the sky: (0.7071, 0, 0, 0.7071).
2438    /// Corresponds to a +90 degree rotation about the X axis.
2439    ///
2440    /// * Pointing straight down towards the ground: (-0.7071, 0, 0, 0.7071).
2441    /// Corresponds to a -90 degree rotation about the X axis.
2442    ///
2443    /// * Banked 90 degrees to the left: (0, 0, 0.7071, 0.7071). Corresponds
2444    /// to a +90 degree rotation about the Z axis.
2445    ///
2446    /// * Banked 90 degrees to the right: (0, 0, -0.7071, 0.7071). Corresponds
2447    /// to a -90 degree rotation about the Z axis.
2448    ///
2449    /// @param state The controller state to get the orientation from.
2450    /// @return The unit quaternion orientation from the controller state.
2451    pub fn gvr_controller_state_get_orientation(state: *const gvr_controller_state) -> gvr_quatf;
2452}
2453extern "C" {
2454
2455    /// Returns the current controller gyro reading, in Start Space.
2456    ///
2457    /// The gyro measures the controller's angular speed in radians per second.
2458    /// Note that this is an angular *speed*, so it reflects how fast the
2459    /// controller's orientation is changing with time.
2460    /// In particular, if the controller is not being rotated, the angular speed
2461    /// will be zero on all axes, regardless of the current pose.
2462    ///
2463    /// The axes are in the controller's device space. Specifically:
2464    ///
2465    /// * The X axis points to the right of the controller.
2466    /// * The Y axis points upwards perpendicular to the top surface of the
2467    /// controller.
2468    /// * The Z axis points backwards along the body of the controller,
2469    /// towards its rear, where the charging port is.
2470    ///
2471    /// As usual in a right-handed coordinate system, the sign of the angular
2472    /// velocity is given by the right-hand rule. So, for example:
2473    ///
2474    /// * If the controller is flat on a table top spinning counter-clockwise
2475    /// as seen from above, you will read a positive angular velocity
2476    /// about the Y axis. Clockwise would be negative.
2477    /// * If the controller is initially pointing forward and lying flat and
2478    /// is then gradually angled up so that its tip points towards the sky,
2479    /// it will report a positive angular velocity about the X axis during
2480    /// that motion. Likewise, angling it down will report a negative angular
2481    /// velocity about the X axis.
2482    /// * If the controller is banked (rolled) to the right, this will
2483    /// report a negative angular velocity about the Z axis during the
2484    /// motion (remember the Z axis points backwards along the controller).
2485    /// Banking to the left will report a positive angular velocity about
2486    /// the Z axis.
2487    ///
2488    /// @param state The controller state to get the gyro reading from.
2489    /// @return The gyro reading from the controller state.
2490    pub fn gvr_controller_state_get_gyro(state: *const gvr_controller_state) -> gvr_vec3f;
2491}
2492extern "C" {
2493
2494    /// Current (latest) controller accelerometer reading, in Start Space.
2495    ///
2496    /// The accelerometer indicates the direction in which the controller feels
2497    /// an acceleration, including gravity. The reading is given in meters
2498    /// per second squared (m/s^2). The axes are the same as for the gyro.
2499    /// To have an intuition for the signs used in the accelerometer, it is useful
2500    /// to imagine that, when at rest, the controller is being "pushed" by a
2501    /// force opposite to gravity. It is as if, by the equivalency princle, it were
2502    /// on a frame of reference that is accelerating in the opposite direction to
2503    /// gravity. For example:
2504    ///
2505    /// * If the controller is lying flat on a table top, it will read a positive
2506    /// acceleration of about 9.8 m/s^2 along the Y axis, corresponding to
2507    /// the acceleration of gravity (as if the table were pushing the controller
2508    /// upwards at 9.8 m/s^2 to counteract gravity).
2509    /// * If, in that situation, the controller is now accelerated upwards at
2510    /// 3.0 m/s^2, then the reading will be 12.8 m/s^2 along the Y axis,
2511    /// since the controller will now feel a stronger acceleration corresponding
2512    /// to the 9.8 m/s^2 plus the upwards push of 3.0 m/s^2.
2513    /// * If, the controller is accelerated downwards at 5.0 m/s^2, then the
2514    /// reading will now be 4.8 m/s^2 along the Y axis, since the controller
2515    /// will now feel a weaker acceleration (as the acceleration is giving in
2516    /// to gravity).
2517    /// * If you were to give in to gravity completely, letting the controller
2518    /// free fall towards the ground, it will read 0 on all axes, as there
2519    /// will be no force acting on the controller. (Please do not put your
2520    /// controller in a free-fall situation. This is just a theoretical
2521    /// example.)
2522    ///
2523    /// @param state The controller state to get the accelerometer reading from.
2524    /// @return The accelerometer reading from the controller state.
2525    pub fn gvr_controller_state_get_accel(state: *const gvr_controller_state) -> gvr_vec3f;
2526}
2527extern "C" {
2528
2529    /// Returns whether the user is touching the touchpad.
2530    ///
2531    /// @param state The controller state to get the touchpad being touched state
2532    /// from.
2533    /// @return True iff the user is touching the controller, false otherwise.
2534    pub fn gvr_controller_state_is_touching(state: *const gvr_controller_state) -> bool;
2535}
2536extern "C" {
2537
2538    /// If the user is touching the touchpad, this returns the touch position in
2539    /// normalized coordinates, where (0,0) is the top-left of the touchpad
2540    /// and (1,1) is the bottom right. If the user is not touching the touchpad,
2541    /// then this is the position of the last touch.
2542    ///
2543    /// @param state The controller state to get the touchpad touch position from.
2544    /// @return The touchpad touch position in normalized coordinates iff the user
2545    /// is touching the toucpad.  The last touched coordinate otherwise.
2546    pub fn gvr_controller_state_get_touch_pos(state: *const gvr_controller_state) -> gvr_vec2f;
2547}
2548extern "C" {
2549
2550    /// Returns true iff user just started touching touchpad.  This is a transient
2551    /// event (i.e., it is true for only one frame after the event).
2552    ///
2553    /// @param state The controller state to get the touch down data from.
2554    /// @return True iff the user just started touching the touchpad, false
2555    /// otherwise.
2556    pub fn gvr_controller_state_get_touch_down(state: *const gvr_controller_state) -> bool;
2557}
2558extern "C" {
2559
2560    /// Returns true if user just stopped touching touchpad.  This is a transient
2561    /// event: (i.e., it is true for only one frame after the event).
2562    ///
2563    /// @param state The controller state to get the touch up data from.
2564    /// @return True iff the user just released the touchpad, false otherwise.
2565    pub fn gvr_controller_state_get_touch_up(state: *const gvr_controller_state) -> bool;
2566}
2567extern "C" {
2568
2569    /// Returns true if a recenter operation just ended.  This is a transient event:
2570    /// (i.e., it is true only for one frame after the recenter ended). If this is
2571    /// true then the `orientation` field is already relative to the new center.
2572    ///
2573    /// @param state The controller state to get the recenter information from.
2574    /// @return True iff a recenter operation just ended, false otherwise.
2575    pub fn gvr_controller_state_get_recentered(state: *const gvr_controller_state) -> bool;
2576}
2577extern "C" {
2578
2579    /// @deprecated Use gvr_controller_state_get_recentered instead.
2580    ///
2581    /// Returns whether the recenter flow is currently in progress.
2582    ///
2583    /// @param state The controller state to get the recenter information from.
2584    /// @return True iff recenter flow is in progress, false otherwise.
2585    pub fn gvr_controller_state_get_recentering(state: *const gvr_controller_state) -> bool;
2586}
2587extern "C" {
2588
2589    /// Returns whether the given button is currently pressed.
2590    ///
2591    /// @param state The controller state to get the button state from.
2592    /// @return True iff the button specified by the 'state' parameter is pressed,
2593    /// false otherwise.
2594    pub fn gvr_controller_state_get_button_state(
2595        state: *const gvr_controller_state,
2596        button: i32,
2597    ) -> bool;
2598}
2599extern "C" {
2600
2601    /// Returns whether the given button was just pressed (transient).
2602    ///
2603    /// @param state The controller state to get the button pressed data from.
2604    /// @return True iff the button specified by the 'state' parameter was just
2605    /// pressed, false otherwise.
2606    pub fn gvr_controller_state_get_button_down(
2607        state: *const gvr_controller_state,
2608        button: i32,
2609    ) -> bool;
2610}
2611extern "C" {
2612
2613    /// Returns whether the given button was just released (transient).
2614    ///
2615    /// @param state The controller state to get the button released data from.
2616    /// @return True iff the button specified by the 'state' parameter was just
2617    /// released, false otherwise.
2618    pub fn gvr_controller_state_get_button_up(
2619        state: *const gvr_controller_state,
2620        button: i32,
2621    ) -> bool;
2622}
2623extern "C" {
2624
2625    /// Returns the timestamp (nanos) when the last orientation event was received.
2626    ///
2627    /// @param state The controller state to get the last orientation event
2628    /// timestamp from.
2629    /// @return A 64-bit integer representation of the timestamp when the last
2630    /// orientation event was recieved.
2631    pub fn gvr_controller_state_get_last_orientation_timestamp(
2632        state: *const gvr_controller_state,
2633    ) -> i64;
2634}
2635extern "C" {
2636
2637    /// Returns the timestamp (nanos) when the last gyro event was received.
2638    ///
2639    /// @param state The controller state to get the last gyro event timestamp from.
2640    /// @return A 64-bit integer representation of the timestamp when the last
2641    /// gyro event was recieved.
2642    pub fn gvr_controller_state_get_last_gyro_timestamp(state: *const gvr_controller_state) -> i64;
2643}
2644extern "C" {
2645
2646    /// Returns the timestamp (nanos) when the last accelerometer event was
2647    /// received.
2648    ///
2649    /// @param state The controller state to get the last accelerometer timestamp
2650    /// from.
2651    /// @return A 64-bit integer representation of the timestamp when the last
2652    /// accelerometer event was recieved.
2653    pub fn gvr_controller_state_get_last_accel_timestamp(state: *const gvr_controller_state)
2654        -> i64;
2655}
2656extern "C" {
2657
2658    /// Returns the timestamp (nanos) when the last touch event was received.
2659    ///
2660    /// @param state The controller state to get the last touch timestamp from.
2661    /// @return A 64-bit integer representation of the timestamp when the last
2662    /// touch event was recieved.
2663    pub fn gvr_controller_state_get_last_touch_timestamp(state: *const gvr_controller_state)
2664        -> i64;
2665}
2666extern "C" {
2667
2668    /// Returns the timestamp (nanos) when the last button event was received.
2669    ///
2670    /// @param state The controller state to get the last button event timestamp
2671    /// from.
2672    /// @return A 64-bit integer representation of the timestamp when the last
2673    /// button event was recieved.
2674    pub fn gvr_controller_state_get_last_button_timestamp(
2675        state: *const gvr_controller_state,
2676    ) -> i64;
2677}
2678extern "C" {
2679
2680    /// Current (latest) controller simulated position for use with an elbow model.
2681    ///
2682    /// @param state The controller state to get the latest simulated position from.
2683    /// @return The current controller simulated position (intended for use with an
2684    /// elbow model).
2685    pub fn gvr_controller_state_get_position(state: *const gvr_controller_state) -> gvr_vec3f;
2686}
2687extern "C" {
2688
2689    /// Returns the timestamp (nanos) when the last position event was received.
2690    ///
2691    /// @param state The controller state to get the last position event timestamp
2692    /// from.
2693    /// @return A 64-bit integer representation of the timestamp when the last
2694    /// position event was recieved.
2695    pub fn gvr_controller_state_get_last_position_timestamp(
2696        state: *const gvr_controller_state,
2697    ) -> i64;
2698}
2699extern "C" {
2700
2701    /// Returns whether the controller battery is currently charging.
2702    /// This may not be real time information and may be slow to be updated.
2703    /// The last battery update time is available by calling
2704    /// gvr_controller_state_get_battery_timestamp.
2705    ///
2706    /// @param state The controller state to get the battery charging state from.
2707    /// @return True iff the battery was charging at the last available update,
2708    /// false otherwise.
2709    pub fn gvr_controller_state_get_battery_charging(state: *const gvr_controller_state) -> bool;
2710}
2711extern "C" {
2712
2713    /// Returns the bucketed controller battery level at the last update.
2714    /// Note this is a gvr_controller_battery_level and not a percent.
2715    /// The last battery update time is available by calling
2716    /// gvr_controller_state_get_battery_timestamp.
2717    ///
2718    /// @param state The controller state to get the battery level from.
2719    /// @return The last known battery level as a gvr_controller_battery_level
2720    /// variant.
2721    pub fn gvr_controller_state_get_battery_level(state: *const gvr_controller_state) -> i32;
2722}
2723extern "C" {
2724
2725    /// Returns the timestamp (nanos) when the last battery event was received.
2726    ///
2727    /// @param state The controller state to get battery event timestamp from.
2728    /// @return A 64-bit integer representation of the timestamp when the last
2729    /// battery event was received.
2730    pub fn gvr_controller_state_get_last_battery_timestamp(
2731        state: *const gvr_controller_state,
2732    ) -> i64;
2733}
2734extern "C" {
2735
2736    /// Convenience to convert a battery level to string. The returned pointer
2737    /// is static and valid throughout the lifetime of the application.
2738    ///
2739    /// @param level The gvr_controller_battery_level to convert to string.
2740    /// @return A pointer to a string that describes the value.
2741    pub fn gvr_controller_battery_level_to_string(level: i32) -> *const ::std::os::raw::c_char;
2742}