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,
void leiaSetSystemDisparityInPixels(LeiaCameraData* data,
void leiaSetApplicationBaselineScale(LeiaCameraData* data,
void leiaSetFieldOfView(LeiaCameraData* data,
void leiaSetFrustumPlanes(LeiaCameraData* data,
void leiaSetViewSizeInPixels(LeiaCameraData* data,
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.