LeiaInitializeCameraData
At the beginning initialization part of the scene, your application will need to fill a LeiaCameraData object, which the rest of the library uses. Any time the camera parameters get updated, this object needs to be updated appropriately. In order to initialize this data the first time, a LeiaCameraData object should be passed into leiaInitializeCameraData, using the below function:
1
void leiaInitializeCameraData(LeiaCameraData * data,
2
int num_horizontal_views,
3
int num_vertical_views,
4
float system_disparity_in_pixels,
5
float baseline_scaling,
6
float convergence_distance,
7
float vertical_field_of_view_degrees,
8
float near, float far,
9
int view_resolution_x_pixels,
10
int view_resolution_y_pixels);
Copied!
data:​ get filled with a number of useful values used to compute the perspective matrices.
num_horizontal_views​ and ​num_vertical_views:​ give the library an idea of how many cameras will be used during rendering.
system_disparity_in_pixels: ​ a value retrieved from the Leia System Service.
baseline_scaling:​ this is a scalar for how far beyond the system disparity you would like. For example, by setting ​baseline_scaling​ to 2.0, you will double the amount of disparity compared to if you set baseline_scaling​ to 1.0. The larger the value, the more objects will appear to pop out or into the screen, but larger values may cause you to lose the effect altogether.
convergence_distance:​ In world space, this is the location where an object looks exactly the same from all views. This value should fall between ​near​ and ​far​. Objects between ​near​ and convergence_distance​ (but not AT ​convergence_distance​) will appear to pop out of the screen, while objects between ​convergence_distance​ and ​far​ will appear to fall into the screen.
vertical_field_of_view_degrees​: The number of degrees vertically of the field of view, which is a standard value used for creating a perspective matrix.
near​ and ​far​: the near and far planes of the main camera frustum.
view_resolution_x_pixels​ and ​view_resolution_y_pixels​: the size of each view the Leia Camera will render into. These values can be retrieved from Android using ​SimpleDisplayQuery​, and are a value smaller than the resolution of the screen based on orientation.
Copy link