Updating Your Matrices

The LeiaCameraData and LeiaCameraView objects are both structs. This leaves the data inside them readily accessible for you to use in your application. However, these are read-only. The data members of both structs are highly dependent on each other and the math involved in creating them. This means the objects cannot be directly updated by simply changing one of the internal values of the struct. For example, your application should not do:

myLeiaCameraData.mVerticalFieldOfView =70.0f​;

While this is entirely valid code which will compile, this does not ensure that the entire struct is completely updated, and that the view objects get updated as well. In order to update the LeiaCameraData struct properly, your application should use one of the “setter” functions provided:

void leiaSetNumberOfViews(LeiaCameraData* data,
                          int num_horizontal_views,
                          int num_vertical_views);
void leiaSetSystemDisparityInPixels(LeiaCameraData* data,
                                    float disparity_in_pixels);
void leiaSetApplicationBaselineScale(LeiaCameraData* data,
                                     float baseline_scaling);
void leiaSetFieldOfView(LeiaCameraData* data,
                        float fov_in_degrees);
void leiaSetFrustumPlanes(LeiaCameraData* data,
                          float near,
                          float focal_distance,
                          float far);
void leiaSetViewSizeInPixels(LeiaCameraData* data,
                             int resolution_x,
                             int resolution_y);

It is good to note that these functions are just simpler versions of the original function used to fill the LeiaCameraData object (leiaInitializeCameraData). If the plan is to update many of the data members of the LeiaCameraData struct, it is better to simply call leiaInitializeData rather than call each setter of the struct.

Once the LeiaCameraData struct has been updated appropriately, you must again use the “leiaCalculateViews” function to update each view object. If this is not done, then the changes made to the LeiaCameraData struct will not affect the LeiaCameraView objects. For a complete example of using these objects, please take a look at the Samples directory.

Last updated

Copyright © 2023 Leia Inc. All Rights Reserved