C API Unity API
C API Reference (Version 10.22.5)
VuRenderState Struct Reference

Detailed Description

Vuforia Render State.

Public Attributes

VuVector4I viewport
 Video background viewport suitable for rendering. More...
 
VuMatrix44F vbProjectionMatrix
 Video background projection matrix immediately suitable for rendering in OpenGL. More...
 
VuMeshvbMesh
 Video background mesh. More...
 
VuMatrix44F viewMatrix
 View matrix (inverse of device pose) immediately suitable for rendering in OpenGL. More...
 
VuMatrix44F projectionMatrix
 Projection matrix (using near/far plane values set in render controller) More...
 

Member Data Documentation

◆ viewport

VuVector4I viewport

Video background viewport suitable for rendering.

The viewport specifies the location and size inside the render view (as specified via vuRenderControllerSetRenderViewConfig) where the video background should be rendered.

The viewport is defined in the same way as the parameters for glViewport in OpenGL, with the first two fields specifying the lower left corner point of the viewport rectangle in pixels and the second and third fields specyfing the width and height of the viewport.

The viewport is thereby constrained not to exceed the bounds of the render view. This is the viewport that should be used directly for rendering.

For a viewport that is not constrained by the bounds of the render view, see vuRenderControllerGetVideoBackgroundViewport, vuRenderControllerGetVideoBackgroundViewInfo and VuVideoBackgroundViewInfo::viewport.

If a viewport mode has been set via vuRenderControllerSetVideoBackgroundViewportMode the viewport will be calculated based on the viewport mode, the render view config (see vuRenderControllerSetRenderViewConfig), the view orientation (see vuPlatformControllerSetViewOrientation) and the camera image resolution.

If a custom viewport has been set via vuRenderControllerSetVideoBackgroundViewport the viewport will be calculated based on the custom viewport and the render view config only.

If no render view config is available (either explicitly via vuRenderControllerSetRenderViewConfig or a default one) this will be set to the zero-vector.

◆ vbProjectionMatrix

VuMatrix44F vbProjectionMatrix

Video background projection matrix immediately suitable for rendering in OpenGL.

If a viewport mode has been set via vuRenderControllerSetVideoBackgroundViewportMode the video background projection matrix will be calculated based on the viewport mode, the render view config (see vuRenderControllerSetRenderViewConfig), the view orientation (see vuPlatformControllerSetViewOrientation) and the camera image resolution.

If a custom viewport has been set via vuRenderControllerSetVideoBackgroundViewport the viewport will be calculated based on the custom viewport, the render view config (see vuRenderControllerSetRenderViewConfig), the view orientation (see vuPlatformControllerSetViewOrientation) and the camera image resolution.

If no render view config is available (either explicitly via vuRenderControllerSetRenderViewConfig or a default one) this will be set to the zero-matrix.

◆ vbMesh

VuMesh* vbMesh

Video background mesh.

Will be NULL if the state is acquired before the first camera frame is retrieved by Vuforia or if running on a see-through eyewear device

The video background mesh is bound to the lifetime of the VuState it was retrieved from. Do not use this pointer or the data it points to beyond the lifetime of the respective VuState.

If no render view config is available (either explicitly via vuRenderControllerSetRenderViewConfig or a default one) this will be set to NULL.

◆ viewMatrix

VuMatrix44F viewMatrix

View matrix (inverse of device pose) immediately suitable for rendering in OpenGL.

This is set to the identity matrix if there is no active device pose observer.

For details about the convention used, see the documentation of VuMatrix44F.

◆ projectionMatrix

VuMatrix44F projectionMatrix

Projection matrix (using near/far plane values set in render controller)

Vuforia Engine creates a projection matrix from the latest intrinsic camera calibration information available on the current device, which you can retrieve from the Vuforia State via vuStateGetCameraIntrinsics. The projection matrix uses an OpenGL-style column-major matrix with the following right-handed coordinate system convention for the view space:

  • The X coordinate system axis points to the right and the Y axis points downwards.
  • The camera is positioned at the coordinate system origin and points in the positive Z direction.
  • Normalized device coordinates are used where the Z coordinates are normalized to the range (-1, 1).

Rendering solutions using a backend with the same matrix convention as OpenGL can use the matrix as is, while those with a different convention (e.g. DirectX) require conversion before use.

Vuforia Engine's projection matrix convention is described as follows. Let's assume that the pose matrix retrieved from an observation via vuObservationGetPoseInfo in VuPoseInfo::pose is set to identity, and the near/far clipping planes have been set up accordingly (e.g. from 0.01f to 100.0f) via vuRenderControllerSetProjectionMatrixNearFar.

  • An object with coordinates (0,0,1) will show up in the middle of the viewport, being one scene unit away from the camera center.
  • If we place the object at (0,0,2), it will still be in the middle of the viewport but at half the size as before.
  • If we move the object to (1,0,1), then it will move to the right of the viewport center.
  • If we move the object to (0,1,1), then it will move to lower than the viewport center.

Since the Vuforia Engine API provides access to the intrinsic camera calibration, you can always build your own projection matrix if your application uses a rendering solution that requires a different convention. In this case, the observations' pose matrix must be also converted accordingly.

If a viewport mode has been set via vuRenderControllerSetVideoBackgroundViewportMode the projection matrix will be calculated based on the viewport mode, the render view config (see vuRenderControllerSetRenderViewConfig), the view orientation (see vuPlatformControllerSetViewOrientation), the camera intrinsics, the near and far clipping planes and the camera image resolution.

If a custom viewport has been set via vuRenderControllerSetVideoBackgroundViewport the projection matrix will be calculated based on the custom viewport, the render view config, the view orientation, the camera intrinsics and the near/far clipping planes.

If no render view config is available (either explicitly via vuRenderControllerSetRenderViewConfig or a default one) the projection matrix will be calculated based on the camera intrinsics, near/far clipping planes and the view orientation.