Provides low-level information and tools for rendering AR and VR content.
RenderingPrimitives provides a set of unified function calls that are designed to work across all AR/VR display devices, including hand-held, head-mounted (monocular/stereo) and wearable mobile devices.
This means that you can write a single common rendering loop and have it work across multiple output platforms, AR or VR, mono and stereo, with a minimum of device-specific or context-specific code required.
A valid RenderingPrimitives instance can only be obtained from the Device singleton instance after:
The transformation measurement unit used is the same as the one used to define the target size (usually meters).
Public Member Functions | |
virtual | ~RenderingPrimitives () |
RenderingPrimitives (const RenderingPrimitives &other) | |
Copy constructor. More... | |
virtual bool | isValid () const |
Returns true if the rendering primitives are valid. More... | |
virtual ViewList & | getRenderingViews () const |
Get the set of VIEWs available for rendering from these primitives. More... | |
virtual Vec4I | getViewport (VIEW viewID) const |
Get the viewport for a particular VIEW. More... | |
virtual Vec4F | getNormalizedViewport (VIEW viewID) const |
Get the normalized viewport for a particular VIEW. More... | |
virtual Matrix34F | getProjectionMatrix (VIEW viewID, const CameraCalibration *cameraCalibration, bool adjustForViewportCentreToEyeAxis=true) |
Get a projection matrix for rendering content for the specified VIEW. More... | |
virtual Matrix34F | getEyeDisplayAdjustmentMatrix (VIEW viewID) const |
Get a matrix that can correct rendering to account for the offset of the eye from the central rendering position. More... | |
virtual const Vec2I | getVideoBackgroundTextureSize () const |
Get the size of a texture that can be used to render the video background. More... | |
virtual Matrix34F | getVideoBackgroundProjectionMatrix (VIEW viewID, bool adjustForViewportCentreToEyeAxis=true) const |
Get a projection matrix to use when rendering the video frame as a background image for the augmentation. More... | |
virtual const Mesh & | getVideoBackgroundMesh (VIEW viewID) const |
Get a simple mesh suitable for use when rendering the video frame as a background image. More... | |
Protected Member Functions | |
RenderingPrimitives () | |
Protected Attributes | |
Impl * | mImpl |
|
virtual |
RenderingPrimitives | ( | const RenderingPrimitives & | other | ) |
Copy constructor.
|
protected |
|
virtual |
Returns true if the rendering primitives are valid.
|
virtual |
Get the set of VIEWs available for rendering from these primitives.
In the most common use case (handheld AR on a mobile device), the returned ViewList will contain just a single entry, VIEW::VIEW_SINGULAR.
In other use cases (such as stereo head-mounted AR or VR) the returned ViewList may contain multiple entries: typically VIEW::VIEW_LEFTEYE and VIEW::VIEW_RIGHTEYE.
For see-through AR, the list will typically contain VIEW::VIEW_LEFTEYE and VIEW::VIEW_RIGHTEYE.
An empty list is returned if rendering primitives are invalid
Get the viewport for a particular VIEW.
The returned vector describes the starting position, width, and height of the area where content for the given viewID should be rendered, in screen coordinates (i.e. pixels).
viewID | The VIEW you want a viewport for |
Get the normalized viewport for a particular VIEW.
The returned vector describes the starting position, width, and height of the area where content for the given viewID should be rendered, in normalized coordinates (i.e. all values are in the range 0..1).
viewID | The VIEW you want a viewport for. |
|
virtual |
Get a projection matrix for rendering content for the specified VIEW.
viewID | The VIEW you want a projection matrix for. |
cameraCalibration | Camera calibration details, or NULL. Typically, you should pass in camera calibration returned from State::getCameraCalibration(). If NULL, the camera calibration calculated when this RenderingPrimitives instance was constructed will be used. |
adjustForViewportCentreToEyeAxis | If true, apply skew offsets (see getViewportCentreToEyeAxis) for VIEW::VIEW_LEFTEYE and VIEW::VIEW_RIGHTEYE. (DEPRECATED) |
Get a matrix that can correct rendering to account for the offset of the eye from the central rendering position.
The returned matrix should be applied to the pose matrix of any tracked object during rendering.
The matrix is specified in meters. If your scene is defined in another unit you will need to adjust the matrix (by scaling the offset parameters) before applying it to your scene.
Note that when working with OpenGL, this matrix will need be converted to column-major format using Tool::convert2GLMatrix().
viewID | The VIEW you want an adjustment matrix for (typically VIEW::VIEW_LEFTEYE or VIEW::VIEW_RIGHTEYE). |
|
virtual |
Get the size of a texture that can be used to render the video background.
Note that the returned size may be larger than the video background itself (for example when a power-of-two texture size is required for performance).
|
virtual |
Get a projection matrix to use when rendering the video frame as a background image for the augmentation.
Note that when working with OpenGL, this matrix will need be converted to column-major format using Tool::convert2GLMatrix().
viewID | The VIEW you want a video background projection matrix for. |
adjustForViewportCentreToEyeAxis | If true, apply skew offsets ( |
Get a simple mesh suitable for use when rendering the video frame as a background image.
The returned mesh has dimensions and texture coordinates that are suitable for rendering a distortion-free camera frame in the requested VIEW, compensating for any discrepancies between the camera and viewport size and aspect ratio.
The mesh should be rendered as a textured mesh, in combination with the projection matrix returned by getVideoBackgroundProjectionMatrix(), using the video frame image as a texture.
viewID | The VIEW you want the mesh for. |
|
protected |