LeiaInitializeCameraDataFromMatrix
The previous function is very useful when creating a set of perspective matrices you can use for rendering. However, if you already have a perspective matrix, it can sometimes be easier to use that. With that in mind, to simplify applications which already have matrices, you can use the following function:
1
void leiaInitializeCameraDataFromMatrix(float* matrix_4_4,
2
LeiaCameraData* data,
3
int num_horizontal_views,
4
int num_vertical_views,
5
float system_disparity_in_pixels,
6
float baseline_scaling,
7
float convergence_distance,
8
int view_resolution_x_pixels,
9
int view_resolution_y_pixels);
Copied!
matrix_4_4: a pointer to a previously created perspective matrix, made up of 16 floats.
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.
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