After you create a stereo viewport, you will need to get a handle for that viewport's stereo frustum. Although your application can have multiple viewports, each one has a single stereo frustum.
ZSError zsCalculateFrustumDisparity | ( | ZSHandle | frustumHandle, |
const ZSVector3* | point, | ||
ZSFloat* | disparity | ||
) |
Calculates the pixel disparity for a specified point in camera space. Pixel disparity can be used to determine whether a specified point is in the coupled or decoupled comfort zones. Viewing objects outside of the coupled comfort zone can potentially lead to visual discomfort.
[in] | frustumHandle | A handle to the frustum. |
[in] | point | The point for which pixel disparity is calculated. |
[out] | disparity | The number of pixels between the left and right stereo images at the specified point. |
ZSError zsCalculateFrustumFit | ( | ZSHandle | frustumHandle, |
const ZSBoundingBox* | boundingBox, | ||
ZSFloat* | viewerScale, | ||
ZSMatrix4* | lookAtMatrix | ||
) |
Calculates the camera's lookat matrix and viewer scale for the specified world-space bounds.
Use this function to fit a 3D volume (ZSBoundingBox) so that it takes up the entire viewport without being clipped. The resulting viewer scale can be used as input to the zsSetFrustumAttribute() function.
[in] | frustumHandle | A handle to the frustum. |
[in] | boundingBox | The bounding box in world space. |
[out] | viewerScale | The viewer scale. |
[out] | lookAtMatrix | The 4x4 lookat matrix corresponding to the application's monoscopic camera. This is also known as the inverse of the monoscopic camera's world matrix.. |
ZSHandle frustumHandle; // Set up a bounding box that is centered about the world's origin (0, 0, 0) // and has a width, height, and depth of 0.10 meters. float halfSize = 0.05f; ZSBoundingBox b; b.lower.x = -halfSize; b.lower.y = -halfSize; b.lower.z = -halfSize; b.upper.x = halfSize; b.upper.y = halfSize; b.upper.z = halfSize; ZSMatrix4 lookAtMatrix; ZSFloat viewerScale; // Calculate the appropriate viewer scale and camera lookat matrix // such that content in the above bounding box will take up the entire // viewport without being clipped. zsCalculateFrustumFit(frustumHandle, &b, &viewerScale, &lookAtMatrix); // Set the frustum's viewer scale with the value that was calculated // by zsCalculateFrustumFit(). zsSetFrustumAttribute(frustumHandle, ZS_FRUSTUM_ATTRIBUTE_VIEWER_SCALE, viewerScale); // Although this is OpenGL specific, here is one way to apply the lookat // matrix that was calculated by zsCalculateFrustumFit(). glMatrixMode(GL_MODELVIEW); glLoadMatrixf(lookAtMatrix.f);
ZSError zsCalculateFrustumFovScale | ( | ZSHandle | frustumHandle, |
ZSFloat | fov, | ||
ZSFloat* | fovScale | ||
) |
Calculates the field of view scale for the specified field of view. Use the resulting fovScale as an input parameter to zsSetFrustumAttribute() to update the frustum's field of view scale.
[in] | frustumHandle | A handle to the frustum. |
[in] | fov | The field of view in degrees. |
[out] | fovScale | The calculated scale for the field of view. |
ZSError zsFindFrustum | ( | ZSHandle | viewportHandle, |
ZSHandle* | frustumHandle | ||
) |
Gets the frustum owned by a specified viewport.
[in] | viewportHandle | A handle to the viewport. |
[out] | frustumHandle | A handle to the frustum. |
ZSContext context = ...; ZSHandle viewportHandle = NULL; ZSHandle frustumHandle = NULL; zsCreateViewport(context, &viewportHandle); zsFindFrustum(viewportHandle, &frustumHandle);
ZSError zsGetFrustumAttribute | ( | ZSHandle | frustumHandle, |
ZSFrustumAttribute | attribute, | ||
ZSFloat* | value | ||
) |
Gets the specified frustum attribute's value. See ZSFrustumAttribute for a list of attributes that can be queried.
[in] | frustumHandle | A handle to the frustum. |
[in] | attribute | The attribute to be queried. |
[out] | value | The specified attribute's current floating point value. |
ZSError zsGetFrustumBounds | ( | ZSHandle | frustumHandle, |
ZSEye | eye, | ||
ZSFrustumBounds* | bounds | ||
) |
Gets the frustum's boundaries for the specified eye.
[in] | frustumHandle | A handle to the frustum. |
[in] | eye | The eye to query. |
[out] | bounds | The boundaries for the specified eye. |
Gets the frustum's camera offset.
[in] | frustumHandle | A handle to the frustum. |
[out] | cameraOffset | The current camera offset in meters. |
ZSError zsGetFrustumCoupledBoundingBox | ( | ZSHandle | frustumHandle, |
ZSBoundingBox* | boundingBox | ||
) |
Gets the axis-aligned bounding box of the coupled comfort zone in camera space.
[in] | frustumHandle | A handle to the frustum. |
[out] | boundingBox | The bounding box containing the coupled comfort zone's minimum and maximum extents. |
ZSError zsGetFrustumEyePosition | ( | ZSHandle | frustumHandle, |
ZSEye | eye, | ||
ZSCoordinateSpace | coordinateSpace, | ||
ZSVector3* | eyePosition | ||
) |
Gets the specified eye's position in the specified coordinate space.
[in] | frustumHandle | A handle to the frustum. |
[in] | eye | The eye to query. |
[in] | coordinateSpace | The coordinate space in which to return the eye position. |
[out] | eyePosition | The eye's position. |
ZSError zsGetFrustumHeadPose | ( | ZSHandle | frustumHandle, |
ZSTrackerPose* | headPose | ||
) |
Gets the frustum's current head pose.
[in] | frustumHandle | A handle to the frustum |
[out] | headPose | The current head pose |
ZSError zsGetFrustumPortalMode | ( | ZSHandle | frustumHandle, |
ZSInt32* | portalModeFlags | ||
) |
Gets the frustum's setting for portal mode. In portal mode, the scene is fixed relative to the physical world, not the viewport.
[in] | frustumHandle | A handle to the frustum. |
[out] | portalModeFlags | A bitmask representing the current portal mode settings. |
ZSError zsGetFrustumProjectionMatrix | ( | ZSHandle | frustumHandle, |
ZSEye | eye, | ||
ZSMatrix4* | projectionMatrix | ||
) |
Gets the frustum's projection matrix for a specified eye.
[in] | frustumHandle | A handle to the frustum. |
[in] | eye | The eye to query. |
[out] | projectionMatrix | The projection matrix for the specified eye. |
ZSHandle frustumHandle; // Get the projection matrix for the left eye. ZSMatrix4 projectionMatrix; zsGetFrustumProjectionMatrix(frustumHandle, ZS_EYE_LEFT, &projectionMatrix);
Gets the frustum's view matrix for a specified eye. The view matrix is calculated from the head pose + eye offset.
[in] | frustumHandle | A handle to the frustum. |
[in] | eye | The eye to query. |
[out] | viewMatrix | The view matrix for the specified eye. |
ZSHandle frustumHandle; // Get the view matrix for the left eye. ZSMatrix4 viewMatrix; zsGetFrustumViewMatrix(frustumHandle, ZS_EYE_LEFT, &viewMatrix);
ZSError zsSetFrustumAttribute | ( | ZSHandle | frustumHandle, |
ZSFrustumAttribute | attribute, | ||
ZSFloat | value | ||
) |
Sets the specified frustum attribute's value. See ZSFrustumAttribute for a list of attributes and valid values.
[in] | frustumHandle | A handle to the frustum. |
[in] | attribute | The attribute to be modified. |
[in] | value | The desired floating point value to be applied to the attribute. |
Sets the frustum's camera offset.
[in] | frustumHandle | A handle to the frustum. |
[in] | cameraOffset | The desired camera offset in meters. |
ZSError zsSetFrustumHeadPose | ( | ZSHandle | frustumHandle, |
const ZSTrackerPose* | headPose | ||
) |
Sets the frustum's head pose.
[in] | frustumHandle | A handle to the frustum. |
[in] | headPose | The desired head pose. |
ZSError zsSetFrustumPortalMode | ( | ZSHandle | frustumHandle, |
ZSInt32 | portalModeFlags | ||
) |
Sets the frustum's portal mode. In portal mode, the scene is fixed relative to the physical world, not the viewport. Refer to ZSPortalMode for details on portal modes.
[in] | frustumHandle | A handle to the frustum. |
[in] | portalModeFlags | A bitmask for the portal mode flags. |
ZSHandle frustumHandle; // The following calls are a few examples of how to specify // portal mode flags: zsSetFrustumPortalMode(frustumHandle, ZS_PORTAL_MODE_NONE); // Disables Portal Mode zsSetFrustumPortalMode(frustumHandle, ZS_PORTAL_MODE_ANGLE); // Angle zsSetFrustumPortalMode(frustumHandle, ZS_PORTAL_MODE_ANGLE | ZS_PORTAL_MODE_POSITION); // Angle & Position
enum ZSEye |
enum ZSFrustumAttribute |
Defines the attributes that you can set and query for the StereoFrustum. These attributes are important for comfortable viewing of stereoscopic 3D.
enum ZSPortalMode |
Defines options for positioning the scene relative to the physical display or relative to the viewport.