[][src]Crate gvr_sys

Structs

AHardwareBuffer
gvr_buffer_spec_
gvr_buffer_viewport_
gvr_buffer_viewport_list_
gvr_clock_time_point

A monotonic system time representation. On Android, this is equivalent to System.nanoTime(), or clock_gettime(CLOCK_MONOTONIC). If there is any doubt about how to get the current time for the current platform, simply use gvr_get_time_point_now().

gvr_context_
gvr_controller_context_
gvr_controller_state_
gvr_event

Container for various GVR-events to which the client can optionally respond.

gvr_frame_
gvr_mat4f

A floating point 4x4 matrix stored in row-major form. It needs to be transposed before being used with OpenGL.

gvr_properties_
gvr_quatf

A floating point quaternion, in JPL format. We use this simple struct in order not to impose a dependency on a particular math library. The user of this API is free to encapsulate this into any math library they want.

gvr_recenter_event_data

Event data associated with a system-initiated GVR_EVENT_RECENTER event. The client may wish to handle this event to provide custom recentering logic.

gvr_rectf

A floating point 2D rect. Used for field of view, and also for ranges in texture space. When used for a field of view, all angles are in positive degrees from the optical axis.

gvr_recti

An integral 2D rect. Used for window bounds in pixels.

gvr_sizei

An integral 2D size. Used for render target sizes.

gvr_swap_chain_
gvr_user_prefs_
gvr_value

A generic container for various pure value types.

gvr_vec2f

A floating point 2D vector.

gvr_vec3f

A floating point 3D vector.

gvr_version_

Version information for the Google VR API.

Enums

gvr_arm_model_behavior

Types of gaze behaviors used for arm model.

gvr_audio_distance_rolloff_type

Distance rolloff models used for distance attenuation.

gvr_audio_material_type

Room surface material names, used to set room properties.

gvr_audio_rendering_mode

Rendering modes define CPU load / rendering quality balances.

gvr_audio_surround_format_type

Supported surround sound formats.

gvr_color_format_type

Valid color formats for swap chain buffers.

gvr_controller_api_status

Constants that represent the status of the controller API.

gvr_controller_battery_level

Controller battery states.

gvr_controller_button

Controller buttons.

gvr_controller_connection_state

Constants that represent the state of the controller.

gvr_controller_handedness
gvr_depth_stencil_format_type
gvr_error

Constants that represent GVR error codes.

gvr_event_type

The type of gvr_event.

gvr_eye

An enum for the left and right eye.

gvr_feature

Types of VR-specific features which may or may not be supported on the underlying platform.

gvr_property_type

Property types exposed by the gvr_properties_get() API.

gvr_recenter_event_type

The type of a recentering associated with a GVR_EVENT_RECENTER event.

gvr_reprojection

Types of asynchronous reprojection.

gvr_safety_region_type

Safety region types exposed from the GVR_PROPERTY_SAFETY_REGION property.

gvr_value_type

Value types for the contents of a gvr_value object instance.

gvr_viewer_type

The type of VR viewer.

Functions

gvr_apply_neck_model

Applies a simple neck model translation based on the rotation of the provided head pose.

gvr_bind_default_framebuffer

Resets the OpenGL framebuffer binding to what it was at the time the passed gvr_context was created.

gvr_buffer_spec_create

Creates a default buffer specification.

gvr_buffer_spec_destroy

Destroy the buffer specification and null the pointer.

gvr_buffer_spec_get_samples

Gets the number of samples per pixel in the buffer to be created.

gvr_buffer_spec_get_size

Gets the size of the buffer to be created.

gvr_buffer_spec_set_color_format

Sets the color format for the buffer to be created. Default format is GVR_COLOR_FORMAT_RGBA_8888. For all alpha-containing formats, the pixels are expected to be premultiplied with alpha. In other words, the 60% opaque primary green color is (0.0, 0.6, 0.0, 0.6).

gvr_buffer_spec_set_depth_stencil_format

Sets the depth and stencil format for the buffer to be created. Currently, only packed stencil formats are supported. Default format is GVR_DEPTH_STENCIL_FORMAT_DEPTH_16.

gvr_buffer_spec_set_multiview_layers

Sets the number of layers in a framebuffer backed by an array texture.

gvr_buffer_spec_set_samples

Sets the number of samples per pixel in the buffer to be created.

gvr_buffer_spec_set_size

Sets the size of the buffer to be created.

gvr_buffer_viewport_create

Creates a gvr_buffer_viewport instance.

gvr_buffer_viewport_destroy

Frees a gvr_buffer_viewport instance and clears the pointer.

gvr_buffer_viewport_equal

Compares two gvr_buffer_viewport instances and returns true if they specify the same view mapping.

gvr_buffer_viewport_get_external_surface_id

Gets the ID of the externally-managed Surface texture from which this viewport reads undistored pixels.

gvr_buffer_viewport_get_opacity

Gets the opacity to perform on the specified viewport.

gvr_buffer_viewport_get_reprojection

Gets the type of reprojection to perform on the specified viewport.

gvr_buffer_viewport_get_source_buffer_index

Gets the index of the source buffer from which the viewport reads its undistorted pixels.

gvr_buffer_viewport_get_source_fov

Retrieves the field of view for the referenced buffer region.

gvr_buffer_viewport_get_source_uv

Gets the UV coordinates specifying where the output buffer is sampled.

gvr_buffer_viewport_get_target_eye

Gets the target logical eye for the specified viewport.

gvr_buffer_viewport_get_transform

Gets the matrix that positions the viewport in eye space.

gvr_buffer_viewport_list_create

returned object when it is no longer needed.

gvr_buffer_viewport_list_destroy

Destroys a gvr_buffer_viewport_list instance. The parameter will be nulled by this operation.

gvr_buffer_viewport_list_get_item

Retrieve a buffer viewport entry from a list.

gvr_buffer_viewport_list_get_size

Returns the size of the given viewport list.

gvr_buffer_viewport_list_set_item

Update an element of the viewport list or append a new one at the end.

gvr_buffer_viewport_set_external_surface_id

Sets the ID of the externally-managed Surface texture from which this viewport reads. The ID is issued by GvrLayout. If this viewport does not read from an external surface, this should be set to GVR_EXTERNAL_SURFACE_ID_NONE, which is also the default value. If it does read from an external surface, set this to the ID obtained from GvrLayout and set the source buffer index to the special value GVR_BUFFER_INDEX_EXTERNAL_SURFACE.

gvr_buffer_viewport_set_opacity

Sets the opacity to perform on the specified viewport.

gvr_buffer_viewport_set_reprojection

Sets the type of reprojection to perform on the specified viewport. Viewports that display world content should use full reprojection. Viewports that display head-locked UI should disable reprojection to avoid excessive judder. The default is to perform full reprojection.

gvr_buffer_viewport_set_source_buffer_index

Sets the buffer from which the viewport reads its undistorted pixels.

gvr_buffer_viewport_set_source_fov

Sets the field of view for the viewport contents.

gvr_buffer_viewport_set_source_layer

Sets the layer in a multiview buffer from which the viewport should sample.

gvr_buffer_viewport_set_source_uv

Sets the UV coordinates specifying where the output buffer should be sampled when compositing the final distorted image.

gvr_buffer_viewport_set_target_eye

Sets the target logical eye for the specified viewport.

gvr_buffer_viewport_set_transform

Sets the matrix that positions the viewport in eye space.

gvr_clear_error

Clears the current GVR error code, and returns the error code that was cleared.

gvr_compute_distorted_point

Computes the distorted point for a given point in a given eye. The distortion inverts the optical distortion caused by the lens for the eye. Due to chromatic aberration, the distortion is different for each color channel.

gvr_controller_api_status_to_string

Convenience to convert an API status code to string. The returned pointer is static and valid throughout the lifetime of the application.

gvr_controller_apply_arm_model

Sets up arm model with user's handedness, gaze behavior and head rotation. This setting needs to be applied for every frame. User preferences of handedness and gaze behavior can be changed as needed in a sequence of frames. This needs to be called before gvr_controller_state_update() to apply arm model. GVR_CONTROLLER_ENABLE_ARM_MODEL flag needs to be enabled to apply arm model. The controller position computed with arm model is relative to the head origin. If using the opt-in neck model, the effective eye position after using vr_apply_neck_model() is shifted forward from the head origin by the neck-to-eye distance (8cm) when the head is in neutral position, and a matching forward offset should be applied to the controller position to compensate.

gvr_controller_battery_level_to_string

Convenience to convert a battery level to string. The returned pointer is static and valid throughout the lifetime of the application.

gvr_controller_button_to_string

Convenience to convert an connection state to string. The returned pointer is static and valid throughout the lifetime of the application.

gvr_controller_connection_state_to_string

Convenience to convert an connection state to string. The returned pointer is static and valid throughout the lifetime of the application.

gvr_controller_create_and_init

Creates and initializes a gvr_controller_context instance which can be used to invoke the Daydream Controller API functions. Important: after creation the API will be in the paused state (the controller will be inactive). You must call gvr_controller_resume() explicitly (typically, in your Android app's onResume() callback).

gvr_controller_destroy

Destroys a gvr_controller_context that was previously created with gvr_controller_init.

gvr_controller_get_count

Returns the number (N) of controllers currently available.

gvr_controller_get_default_options

Returns the default features for the controller API.

gvr_controller_pause

Pauses the controller, possibly releasing resources. Call this when your app/game loses focus. Calling this when already paused is a no-op. Thread-safe (call from any thread).

gvr_controller_resume

Resumes the controller. Call this when your app/game regains focus. Calling this when already resumed is a no-op. Thread-safe (call from any thread).

gvr_controller_state_create

Creates a gvr_controller_state.

gvr_controller_state_destroy

Destroys and sets to NULL a gvr_controller_state that was previously created with gvr_controller_state_create.

gvr_controller_state_get_accel

Current (latest) controller accelerometer reading, in Start Space.

gvr_controller_state_get_api_status

Gets the API status of the controller state. Returns one of the gvr_controller_api_status variants, but returned as an int32_t for ABI compatibility.

gvr_controller_state_get_battery_charging

Returns whether the controller battery is currently charging. This may not be real time information and may be slow to be updated. The last battery update time is available by calling gvr_controller_state_get_battery_timestamp.

gvr_controller_state_get_battery_level

Returns the bucketed controller battery level at the last update. Note this is a gvr_controller_battery_level and not a percent. The last battery update time is available by calling gvr_controller_state_get_battery_timestamp.

gvr_controller_state_get_button_down

Returns whether the given button was just pressed (transient).

gvr_controller_state_get_button_state

Returns whether the given button is currently pressed.

gvr_controller_state_get_button_up

Returns whether the given button was just released (transient).

gvr_controller_state_get_connection_state

Gets the connection state of the controller. Returns one of the gvr_controller_connection_state variants, but returned as an int32_t for ABI compatibility.

gvr_controller_state_get_gyro

Returns the current controller gyro reading, in Start Space.

gvr_controller_state_get_last_accel_timestamp

Returns the timestamp (nanos) when the last accelerometer event was received.

gvr_controller_state_get_last_battery_timestamp

Returns the timestamp (nanos) when the last battery event was received.

gvr_controller_state_get_last_button_timestamp

Returns the timestamp (nanos) when the last button event was received.

gvr_controller_state_get_last_gyro_timestamp

Returns the timestamp (nanos) when the last gyro event was received.

gvr_controller_state_get_last_orientation_timestamp

Returns the timestamp (nanos) when the last orientation event was received.

gvr_controller_state_get_last_position_timestamp

Returns the timestamp (nanos) when the last position event was received.

gvr_controller_state_get_last_touch_timestamp

Returns the timestamp (nanos) when the last touch event was received.

gvr_controller_state_get_orientation

Returns the current controller orientation, in Start Space. The Start Space is the same space as the headset space and has these three axes (right-handed):

gvr_controller_state_get_position

Current (latest) controller simulated position for use with an elbow model.

gvr_controller_state_get_recentered

Returns true if a recenter operation just ended. This is a transient event: (i.e., it is true only for one frame after the recenter ended). If this is true then the orientation field is already relative to the new center.

gvr_controller_state_get_recentering

@deprecated Use gvr_controller_state_get_recentered instead.

gvr_controller_state_get_touch_down

Returns true iff user just started touching touchpad. This is a transient event (i.e., it is true for only one frame after the event).

gvr_controller_state_get_touch_pos

If the user is touching the touchpad, this returns the touch position in normalized coordinates, where (0,0) is the top-left of the touchpad and (1,1) is the bottom right. If the user is not touching the touchpad, then this is the position of the last touch.

gvr_controller_state_get_touch_up

Returns true if user just stopped touching touchpad. This is a transient event: (i.e., it is true for only one frame after the event).

gvr_controller_state_is_touching

Returns whether the user is touching the touchpad.

gvr_controller_state_update

Updates the controller state. Reading the controller state is not a const getter: it has side-effects. In particular, some of the gvr_controller_state fields (the ones documented as "transient") represent one-time events and will be true for only one read operation, and false in subsequent reads.

gvr_create

@return Pointer to the created gvr instance, NULL on failure.

gvr_destroy

Destroys a gvr_context instance. The parameter will be nulled by this operation. Once this function is called, the behavior of any subsequent call to a GVR SDK function that references objects created from this context is undefined.

gvr_distort_to_screen

@deprecated Use the Swap Chain API instead. This function exists only to support legacy rendering pathways for Cardboard devices. It is incompatible with the low-latency experiences supported by async reprojection.

gvr_frame_bind_buffer

Binds a pixel buffer that is part of the frame to the OpenGL framebuffer.

gvr_frame_get_buffer_size

Returns the dimensions of the pixel buffer with the specified index. Note that a frame that was acquired before resizing a swap chain buffer will not be resized until it is submitted to the swap chain.

gvr_frame_get_framebuffer_object

Gets the name (ID) of the framebuffer object associated with the specified buffer. The OpenGL state is not modified.

gvr_frame_get_hardware_buffer

Gets the hardware buffer backing the specified frame buffer.

gvr_frame_submit

Submits the frame for distortion and display on the screen. The passed pointer is nulled to prevent reuse.

gvr_frame_unbind

Unbinds any buffers bound from this frame and binds the default OpenGL framebuffer.

gvr_get_async_reprojection_enabled

Gets whether asynchronous reprojection is currently enabled.

gvr_get_current_properties

Gets a read-only handle to the current global set of GVR-related properties.

gvr_get_error

Gets the current GVR error code, or GVR_ERROR_NONE if there is no error. This function doesn't clear the error code; see gvr_clear_error().

gvr_get_error_string

Gets a human-readable string representing the given error code.

gvr_get_eye_from_head_matrix

Gets the transformation matrix to convert from Head Space to Eye Space for the given eye.

gvr_get_head_space_from_start_space_rotation

@deprecated Calls to this method can be safely replaced by calls to gvr_get_head_space_from_start_space_transform. The new API reflects that the call can return a full 6DoF transform when supported by both the host platform and the client application.

gvr_get_head_space_from_start_space_transform

Gets the position and rotation from start space to head space. The head space is a space where the head is at the origin and faces the -Z direction.

gvr_get_maximum_effective_render_target_size

Returns the maximum effective size for the client's render target, given the parameters of the head mounted device selected. At this resolution, we have a 1:1 ratio between source pixels and screen pixels in the most magnified region of the screen. Applications should rarely, if ever, need to render to a larger target, as it will simply result in sampling artifacts.

gvr_get_recommended_buffer_viewports

Gets the recommended buffer viewport configuration, populating a previously allocated gvr_buffer_viewport_list object. The updated values include the per-eye recommended viewport and field of view for the target.

gvr_get_screen_buffer_viewports

Gets the screen (non-distorted) buffer viewport configuration, populating a previously allocated gvr_buffer_viewport_list object. The updated values include the per-eye recommended viewport and field of view for the target.

gvr_get_screen_target_size

Returns a non-distorted size for the screen, given the parameters of the phone and/or the head mounted device selected.

gvr_get_time_point_now

Gets the current monotonic system time.

gvr_get_user_prefs

Returns an opaque struct containing information about user preferences.

gvr_get_version

Gets the current GVR runtime version.

gvr_get_version_string

Gets a string representation of the current GVR runtime version. This is of the form "MAJOR.MINOR.PATCH".

gvr_get_viewer_model

Gets the name of the viewer model.

gvr_get_viewer_type

Gets the type of the viewer, as defined by gvr_viewer_type.

gvr_get_viewer_vendor

Gets the name of the viewer vendor.

gvr_get_window_bounds

Gets the window bounds.

gvr_initialize_gl

Initializes necessary GL-related objects and uses the current thread and GL context for rendering. Please make sure that a valid GL context is available when this function is called.

gvr_is_feature_supported

Queries whether a particular GVR feature is supported by the underlying platform. This should be called after gvr_initialize_gl().

gvr_pause_tracking

Pauses head tracking, disables all sensors (to save power).

gvr_poll_event

Polls the event queue, populating the provided event if available while also popping it from the event queue.

gvr_properties_get

Queries the given property's value, populating the provided value if available.

gvr_recenter_tracking

Recenters the head orientation (resets the yaw to zero, leaving pitch and roll unmodified).

gvr_refresh_viewer_profile

Refreshes gvr_context with the viewer profile that is stored on the device. If it can not find the viewer profile, nothing will happen.

gvr_reset_tracking

@deprecated Calls to this method can be safely replaced by calls to gvr_recenter_tracking. This accomplishes the same effects but avoids the undesirable side-effects of a full reset (temporary loss of tracking quality).

gvr_resume_tracking

Resumes head tracking, re-enables all sensors.

gvr_set_default_viewer_profile

Sets the default viewer profile specified by viewer_profile_uri. The viewer_profile_uri that is passed in will be ignored if a valid viewer profile has already been stored on the device that the app is running on.

gvr_set_surface_size
gvr_swap_chain_acquire_frame

Acquires a frame from the swap chain for rendering. Buffers that are part of the frame can then be bound with gvr_frame_bind_buffer(). Once the frame is finished and all its constituent buffers are ready, call gvr_frame_submit() to display it while applying lens distortion.

gvr_swap_chain_create

Creates a swap chain from the given buffer specifications. This is a potentially time-consuming operation. All frames within the swapchain will be allocated. Once rendering is stopped, call gvr_swap_chain_destroy() to free GPU resources. The passed gvr_context must not be destroyed until then.

gvr_swap_chain_destroy

Destroys the swap chain and nulls the pointer.

gvr_swap_chain_get_buffer_count

Gets the number of buffers in each frame of the swap chain.

gvr_swap_chain_get_buffer_size

Retrieves the size of the specified pixel buffer. Note that if the buffer was resized while the current frame was acquired, the return value will be different than the value obtained from the equivalent function for the current frame.

gvr_swap_chain_resize_buffer

Resizes the specified pixel buffer to the given size. The frames are resized when they are unused, so the currently acquired frame will not be resized immediately.

gvr_user_prefs_get_controller_handedness

Returns the controller handedness of the given gvr_user_prefs struct.

Type Definitions

gvr_audio_source_id

Sound object and sound field identifier.

gvr_buffer_spec

Specification of a pixel buffer. A pixel buffer can have color, depth and stencil attachments and mostly corresponds to the OpenGL concept of a framebuffer object. However, since there can be multiple such objects for each frame, we avoid calling them "framebuffers". Pixel buffers which are part of the currently acquired frame are immutable, i.e., they cannot be resized or otherwise reconfigured.

gvr_buffer_viewport

A structure that ties together a region of a buffer, the field of view rendered into that region and a target eye index to define part of the user's field of view. The SDK implementation uses this information to transform the images generated by the app output into the final display that is sent to the screen.

gvr_buffer_viewport_list

List of buffer viewports that completely specifies how to transform the frame's buffers into the image displayed on the screen.

gvr_context

Primary context for invoking Google VR APIs.

gvr_controller_context

Represents a Daydream Controller API object, used to invoke the Daydream Controller API.

gvr_controller_state

Opaque handle to controller state.

gvr_flags

Generic flag type.

gvr_flags64

Generic 64-bit flag type.

gvr_frame

A single frame acquired from the swap chain. Each frame is composed of one or more buffers, which are then lens distorted and composited into the final output. Buffers are identified by indices that correspond to the position of their gvr_buffer_spec in the list passed when constructing the swap chain.

gvr_properties

Opaque handle to a collection of properties.

gvr_swap_chain

Swap chain that contains some number of frames. Frames in the swap chain can be unused, in the process of being distorted and presented on the screen, or acquired and being rendered to by the application. The swap chain ensures that the most recent available frame is always shown and that the application never has to wait to render the next frame.

gvr_user_prefs
gvr_version

Unions

gvr_event__bindgen_ty_1
gvr_value__bindgen_ty_1