![]() |
SDK DOCUMENTATION
|
Go to the source code of this file.
Functions | |
varjo_Bool | varjo_IsAvailable () |
Checks whether Varjo system is available. More... | |
const char * | varjo_GetVersionString () |
Gets the short version of the library. More... | |
const uint64_t | varjo_GetVersion () |
Gets the version number of the library. More... | |
struct varjo_Session * | varjo_SessionInit (void) |
Initializes a Varjo client session. More... | |
void | varjo_SessionShutDown (struct varjo_Session *session) |
Shuts down a session and releases all the resources internally allocated by Varjo session. More... | |
varjo_Nanoseconds | varjo_GetCurrentTime (struct varjo_Session *session) |
Gets the current time in a format that Varjo API uses. More... | |
struct varjo_FrameInfo * | varjo_CreateFrameInfo (struct varjo_Session *session) |
Creates a frame info with initial values. More... | |
void | varjo_FreeFrameInfo (struct varjo_FrameInfo *frameInfo) |
Frees an allocated frame info. More... | |
struct varjo_SubmitInfo * | varjo_CreateSubmitInfo (struct varjo_Session *session) |
Creates a submit info for ending a frame with default viewport layout. More... | |
void | varjo_FreeSubmitInfo (struct varjo_SubmitInfo *submitInfo) |
Frees an allocated submit info. More... | |
void | varjo_LayoutDefaultViewports (struct varjo_Session *session, struct varjo_Viewport *viewports) |
Layout default viewport configuration. More... | |
void | varjo_SetCenteredProjection (struct varjo_Session *session, varjo_Bool enabled) |
Forces the provided projection matrices to be centered. More... | |
struct varjo_AlignedView | varjo_GetAlignedView (double *projectionMatrix) |
Gets an aligned view from a projection matrix. More... | |
void | varjo_UpdateClipPlaneDistances (struct varjo_Session *session, double *projectionMatrix, double nearClipDistance, double farClipDistance) |
Updates clip plane distances in the projection matrix. More... | |
void | varjo_WaitSync (struct varjo_Session *session, struct varjo_FrameInfo *frameInfo) |
Called at the start of a frame. More... | |
void | varjo_BeginFrame (struct varjo_Session *session, struct varjo_SubmitInfo *submitInfo) |
Begin rendering the frame. More... | |
void | varjo_EndFrame (struct varjo_Session *session, struct varjo_FrameInfo *frameInfo, struct varjo_SubmitInfo *submitInfo) |
End the current frame. More... | |
varjo_Nanoseconds | varjo_FrameGetDisplayTime (struct varjo_Session *session) |
Gets the time when the frame is scheduled to be displayed. More... | |
struct varjo_Matrix | varjo_FrameGetPose (struct varjo_Session *session, varjo_PoseType type) |
Gets a pose for the current frame. More... | |
struct varjo_Matrix | varjo_GetRelativePoseTransform (struct varjo_Session *session, varjo_PoseType src, varjo_PoseType dest) |
Gets a relative transformation from source pose to destination pose. More... | |
struct varjo_Matrix | varjo_ApplyTransform (struct varjo_Session *session, struct varjo_Matrix *m1, struct varjo_Matrix *m2) |
Applies transform using post multiplication. More... | |
void | varjo_ResetPose (struct varjo_Session *session, varjo_Bool position, varjo_RotationReset rotation) |
Resets pose tracking origin. More... | |
struct varjo_ViewDescription | varjo_GetViewDescription (struct varjo_Session *session, int32_t viewIndex) |
Gets the display information for a given view. More... | |
struct varjo_Mesh2Df * | varjo_CreateOcclusionMesh (struct varjo_Session *session, int32_t viewIndex, varjo_WindingOrder windingOrder) |
Creates the occlusion mesh for a given view index. More... | |
void | varjo_FreeOcclusionMesh (struct varjo_Mesh2Df *mesh) |
Frees the memory allocated by varjo_CreateOcclusionMesh. More... | |
varjo_Error | varjo_GetError (struct varjo_Session *session) |
Gets the latest error code. More... | |
VARJO_DEPRECATED_API const char * | varjo_GetErrorDescription (struct varjo_Session *session) |
Gets the current error description string in english. More... | |
const char * | varjo_GetErrorDesc (varjo_Error error) |
Gets error description for the specified error code. More... | |
VARJO_DEPRECATED_API void | varjo_ClearError (struct varjo_Session *session) |
Resets the error status. More... | |
void | varjo_GazeInit (struct varjo_Session *session) |
Initializes the gaze tracking system. More... | |
varjo_Bool | varjo_IsGazeAllowed (struct varjo_Session *session) |
Is gaze allowed to be used? More... | |
struct varjo_Gaze | varjo_GetGaze (struct varjo_Session *session) |
Gets the current state of the user gaze. More... | |
int32_t | varjo_GetGazeArray (struct varjo_Session *session, struct varjo_Gaze *array, int32_t maxSizeOfArray) |
Gets gaze measurements since last query. More... | |
void | varjo_SyncProperties (struct varjo_Session *session) |
Updates and synchronizes system properties with the system state. More... | |
int32_t | varjo_GetPropertyCount (struct varjo_Session *session) |
Gets the number of system properties. More... | |
varjo_PropertyKey | varjo_GetPropertyKey (struct varjo_Session *session, int32_t index) |
Gets a property key for a property index. More... | |
const char * | varjo_GetPropertyName (struct varjo_Session *session, varjo_PropertyKey propertyKey) |
Gets the name of the property key. More... | |
varjo_Bool | varjo_HasProperty (struct varjo_Session *session, varjo_PropertyKey propertyKey) |
Checks if the key has value in the properties. More... | |
varjo_Bool | varjo_GetPropertyBool (struct varjo_Session *session, varjo_PropertyKey propertyKey) |
Gets a boolean value of a property. More... | |
double | varjo_GetPropertyDouble (struct varjo_Session *session, varjo_PropertyKey propertyKey) |
Gets a floating point value of a property. More... | |
int32_t | varjo_GetPropertyInt (struct varjo_Session *session, varjo_PropertyKey propertyKey) |
Gets an integer value of a property. More... | |
void | varjo_RequestGazeCalibration (struct varjo_Session *session) |
Requests a HMD gaze calibration. More... | |
struct varjo_SwapChainConfig | varjo_GetDefaultSwapChainConfig (struct varjo_Session *session) |
Gets the default swap chain config. More... | |
struct varjo_SwapChainLimits | varjo_GetSwapChainLimits (struct varjo_Session *session) |
Gets swap chain limits. More... | |
void | varjo_GetSupportedTextureFormats (struct varjo_Session *session, varjo_RenderAPI renderApi, int32_t *formatCount, varjo_TextureFormat *formats) |
Gets supported texture formats in the order of most preferred to least preferred. More... | |
varjo_Bool | varjo_IsSwapChainConfigSupported (struct varjo_Session *session, varjo_RenderAPI renderApi, const struct varjo_SwapChainConfig *config) |
Is the given swap chain config supported. More... | |
int32_t | varjo_GetSwapChainCurrentIndex (struct varjo_Session *session) |
Gets the current swap chain texture index. More... | |
struct varjo_Event * | varjo_AllocateEvent () |
Allocates an event. More... | |
void | varjo_FreeEvent (struct varjo_Event *event) |
Free an event. More... | |
varjo_Bool | varjo_PollEvent (struct varjo_Session *session, struct varjo_Event *evt) |
Polls events. More... | |
struct varjo_Event* varjo_AllocateEvent | ( | ) |
Allocates an event.
Helper function if you don't want to do the allocation by yourself.
struct varjo_Matrix varjo_ApplyTransform | ( | struct varjo_Session * | session, |
struct varjo_Matrix * | m1, | ||
struct varjo_Matrix * | m2 | ||
) |
Applies transform using post multiplication.
session | Varjo session handle. |
m1 | First transform. |
m2 | Second transform. |
void varjo_BeginFrame | ( | struct varjo_Session * | session, |
struct varjo_SubmitInfo * | submitInfo | ||
) |
Begin rendering the frame.
This function should be called only from the rendering thread.
session | Varjo session handle. |
submitInfo | Submit info to fill in the frame metadata. |
VARJO_DEPRECATED_API void varjo_ClearError | ( | struct varjo_Session * | session | ) |
Resets the error status.
The errors are persistent - the error code and description refer to the first Varjo API call that has failed and the following API calls may fail as a cascading result. Thus you should clear error status after handling the error.
session | Varjo session handle. |
struct varjo_FrameInfo* varjo_CreateFrameInfo | ( | struct varjo_Session * | session | ) |
Creates a frame info with initial values.
Allocates enough data to hold all of the views.
Use varjo_FreeFrameInfo to free the allocated memory.
session | Varjo session handle. |
struct varjo_Mesh2Df* varjo_CreateOcclusionMesh | ( | struct varjo_Session * | session, |
int32_t | viewIndex, | ||
varjo_WindingOrder | windingOrder | ||
) |
Creates the occlusion mesh for a given view index.
Due to lens distortion some display pixels are not visible in the optical path so the application can stencil out pixels to reduce shading workload and improve performance.
Mesh data is a triangle list where each triplet of vertices forms a triangle.
Use varjo_FreeOcclusionMesh to free the created mesh.
session | Varjo session handle. |
viewIndex | View number to get the occlusion mesh for. Must be in range [0, varjo_GraphicsInfo::viewCount - 1]. |
windingOrder | Winding order of the triangles |
struct varjo_SubmitInfo* varjo_CreateSubmitInfo | ( | struct varjo_Session * | session | ) |
Creates a submit info for ending a frame with default viewport layout.
Other fields areinitialized with default values. Allocates enough data to hold all of the views.
Use varjo_FreeSubmitInfo to free the allocated memory.
session | Varjo session handle. |
void varjo_EndFrame | ( | struct varjo_Session * | session, |
struct varjo_FrameInfo * | frameInfo, | ||
struct varjo_SubmitInfo * | submitInfo | ||
) |
End the current frame.
This function should be called only from the rendering thread.
session | Varjo session handle. |
frameInfo | View and projection matrices the frame was rendered with. |
submitInfo | Textures and viewports to submit. |
varjo_Nanoseconds varjo_FrameGetDisplayTime | ( | struct varjo_Session * | session | ) |
Gets the time when the frame is scheduled to be displayed.
This time refers to the average perceived moment of when the image is shown.
The display time is updated in varjo_WaitSync and is guaranteed to remain constant for the duration of the frame.
This is a helper function for when you don't have access to varjo_FrameInfo.
session | Varjo session handle. |
struct varjo_Matrix varjo_FrameGetPose | ( | struct varjo_Session * | session, |
varjo_PoseType | type | ||
) |
Gets a pose for the current frame.
If it's called before varjo_WaitSync() is complete, it will return new pose. Following calls to varjo_FrameGetPose() will return the same matrix. varjo_WaitSync() will also derive it's matrices from that pose. If varjo_FrameGetPose() is called after varjo_WaitSync() it will derive matrixes from that pose.
session | Varjo session handle. |
type | Type of the pose. |
void varjo_FreeEvent | ( | struct varjo_Event * | event | ) |
void varjo_FreeFrameInfo | ( | struct varjo_FrameInfo * | frameInfo | ) |
Frees an allocated frame info.
frameInfo | Frame info to free. |
void varjo_FreeOcclusionMesh | ( | struct varjo_Mesh2Df * | mesh | ) |
Frees the memory allocated by varjo_CreateOcclusionMesh.
mesh | Occlusion mesh to free. |
void varjo_FreeSubmitInfo | ( | struct varjo_SubmitInfo * | submitInfo | ) |
Frees an allocated submit info.
submitInfo | Submit info to free. |
void varjo_GazeInit | ( | struct varjo_Session * | session | ) |
Initializes the gaze tracking system.
session | Varjo session handle. |
struct varjo_AlignedView varjo_GetAlignedView | ( | double * | projectionMatrix | ) |
Gets an aligned view from a projection matrix.
Note: the projection matrix from varjo_FrameInfo might not always be axis aligned.
projectionMatrix | Projection matrix. |
varjo_Nanoseconds varjo_GetCurrentTime | ( | struct varjo_Session * | session | ) |
Gets the current time in a format that Varjo API uses.
This is a realtime monotonic counter since system-specific starting point and is not affected by time-of-day setting.
session | Varjo session handle. |
struct varjo_SwapChainConfig varjo_GetDefaultSwapChainConfig | ( | struct varjo_Session * | session | ) |
Gets the default swap chain config.
session | Varjo session handle. |
varjo_Error varjo_GetError | ( | struct varjo_Session * | session | ) |
Gets the latest error code.
You should check for errors at least once a frame.
Error status will be cleared after this function.
Use varjo_GetErrorDesc to get more detailed error description.
const char* varjo_GetErrorDesc | ( | varjo_Error | error | ) |
Gets error description for the specified error code.
VARJO_DEPRECATED_API const char* varjo_GetErrorDescription | ( | struct varjo_Session * | session | ) |
Gets the current error description string in english.
struct varjo_Gaze varjo_GetGaze | ( | struct varjo_Session * | session | ) |
Gets the current state of the user gaze.
Gaze system must have been previously initialized by calling varjo_GazeInit.
session | Varjo session handle. |
int32_t varjo_GetGazeArray | ( | struct varjo_Session * | session, |
struct varjo_Gaze * | array, | ||
int32_t | maxSizeOfArray | ||
) |
Gets gaze measurements since last query.
Gaze system must have been previously initialized by calling varjo_GazeInit.
session | Varjo session handle. |
array | Array of varjo_Gaze structures |
maxSizeOfArray | Number of elements in array |
varjo_Bool varjo_GetPropertyBool | ( | struct varjo_Session * | session, |
varjo_PropertyKey | propertyKey | ||
) |
Gets a boolean value of a property.
session | Varjo session handle. |
propertyKey | The property key. |
int32_t varjo_GetPropertyCount | ( | struct varjo_Session * | session | ) |
Gets the number of system properties.
session | Varjo session handle. |
double varjo_GetPropertyDouble | ( | struct varjo_Session * | session, |
varjo_PropertyKey | propertyKey | ||
) |
Gets a floating point value of a property.
session | Varjo session handle. |
propertyKey | The property key. |
int32_t varjo_GetPropertyInt | ( | struct varjo_Session * | session, |
varjo_PropertyKey | propertyKey | ||
) |
Gets an integer value of a property.
session | Varjo session handle. |
propertyKey | The property key. |
varjo_PropertyKey varjo_GetPropertyKey | ( | struct varjo_Session * | session, |
int32_t | index | ||
) |
Gets a property key for a property index.
session | Varjo session handle. |
index | Zero-based index. |
const char* varjo_GetPropertyName | ( | struct varjo_Session * | session, |
varjo_PropertyKey | propertyKey | ||
) |
Gets the name of the property key.
session | Varjo session handle. |
propertyKey | The property key. |
struct varjo_Matrix varjo_GetRelativePoseTransform | ( | struct varjo_Session * | session, |
varjo_PoseType | src, | ||
varjo_PoseType | dest | ||
) |
Gets a relative transformation from source pose to destination pose.
session | Varjo session handle. |
src | Source pose. |
dest | Destination pose. |
void varjo_GetSupportedTextureFormats | ( | struct varjo_Session * | session, |
varjo_RenderAPI | renderApi, | ||
int32_t * | formatCount, | ||
varjo_TextureFormat * | formats | ||
) |
Gets supported texture formats in the order of most preferred to least preferred.
To allocate memory for the formats
output buffer, you should first call this function by passing null formats
and query the count for the formats.
session | Varjo session handle. |
renderApi | Rendering API being used. |
formatCount | Output pointer for the format count. Cannot be null. |
formats | Output pointer for the formats. Can be null. |
int32_t varjo_GetSwapChainCurrentIndex | ( | struct varjo_Session * | session | ) |
Gets the current swap chain texture index.
session | Varjo session handle. |
struct varjo_SwapChainLimits varjo_GetSwapChainLimits | ( | struct varjo_Session * | session | ) |
Gets swap chain limits.
session | Varjo session handle. |
const uint64_t varjo_GetVersion | ( | ) |
Gets the version number of the library.
Use VARJO_MAKE_VERSION macro to create a version that can be then used to test against the returned version number.
eg. VARJO_MAKE_VERSION(0, 7, 0, 0) >= varjo_GetVersion()
const char* varjo_GetVersionString | ( | ) |
Gets the short version of the library.
Eg. "0.7.0.0".
struct varjo_ViewDescription varjo_GetViewDescription | ( | struct varjo_Session * | session, |
int32_t | viewIndex | ||
) |
Gets the display information for a given view.
Use this to retrieve information about which display or eye the given view belongs to.
varjo_ViewDescription also contains the default render texture dimensions.
session | Varjo session handle. |
viewIndex | View number to get the display information for. Must be in range [0, varjo_GraphicsInfo::viewCount - 1]. |
varjo_Bool varjo_HasProperty | ( | struct varjo_Session * | session, |
varjo_PropertyKey | propertyKey | ||
) |
Checks if the key has value in the properties.
session | Varjo session handle. |
propertyKey | The property key. |
varjo_Bool varjo_IsAvailable | ( | ) |
Checks whether Varjo system is available.
If varjo_IsAvailable() returns false, it's guaranteed that the session cannot be initialized. If this returns true, application may try initiating a new session.
This call executes fast and can be called per frame unlike varjo_SessionInit.
varjo_Bool varjo_IsGazeAllowed | ( | struct varjo_Session * | session | ) |
Is gaze allowed to be used?
User can disallow gaze tracking completely.
session | Varjo session handle. |
varjo_Bool varjo_IsSwapChainConfigSupported | ( | struct varjo_Session * | session, |
varjo_RenderAPI | renderApi, | ||
const struct varjo_SwapChainConfig * | config | ||
) |
Is the given swap chain config supported.
session | Varjo session handle. |
renderApi | Rendering API being used. |
config | Config to test. |
void varjo_LayoutDefaultViewports | ( | struct varjo_Session * | session, |
struct varjo_Viewport * | viewports | ||
) |
Layout default viewport configuration.
The default view consists of a single texture that contains all the four viewports.
This is a helper function as the viewport can be freely configured.
session | Varjo session handle. |
viewports | Pointer to varjo_GraphicsInfo::viewCount viewports. |
varjo_Bool varjo_PollEvent | ( | struct varjo_Session * | session, |
struct varjo_Event * | evt | ||
) |
Polls events.
Holds the latest 100 events in the queue. If the queue size exceeds that, starts dropping events starting from the oldest. Make sure to call often enough (eg. once per frame) if you don't want to miss an event.
Use this in a loop to go through all of the queued events.
session | Varjo session handle. |
evt | Event to receive data to. |
void varjo_RequestGazeCalibration | ( | struct varjo_Session * | session | ) |
Requests a HMD gaze calibration.
This attempts to trigger the gaze calibration sequence if the user has allowed gaze tracking from Varjo settings and Varjo system is in a state where it can bring up the calibration UI.
session | Varjo session handle. |
void varjo_ResetPose | ( | struct varjo_Session * | session, |
varjo_Bool | position, | ||
varjo_RotationReset | rotation | ||
) |
Resets pose tracking origin.
This will reset the tracking origin to the current transform of the user. rotation parameter can be used to reset only some components of the transform.
session | Varjo session handle. |
position | Reset position |
rotation | Rotation reset type |
struct varjo_Session* varjo_SessionInit | ( | void | ) |
Initializes a Varjo client session.
varjo_SessionInit initializes a new Varjo session and returns an opaque pointer handle representing the session which should be passed to all Varjo API calls that are related to this session. When done, the session needs to be cleaned up by calling varjo_SessionShutDown.
There can be multiple simultaneous sessions, but generally applications don't need more than one. Single session can be shared between different threads.
void varjo_SessionShutDown | ( | struct varjo_Session * | session | ) |
Shuts down a session and releases all the resources internally allocated by Varjo session.
Session pointer will become invalid after calling this function.
session | Varjo session handle. |
void varjo_SetCenteredProjection | ( | struct varjo_Session * | session, |
varjo_Bool | enabled | ||
) |
Forces the provided projection matrices to be centered.
This may result in suboptimal resolution.
session | Varjo session handle. |
enabled | True, if the matrices need to be centered. False if off-center projection is ok. |
void varjo_SyncProperties | ( | struct varjo_Session * | session | ) |
Updates and synchronizes system properties with the system state.
session | Varjo session handle. |
void varjo_UpdateClipPlaneDistances | ( | struct varjo_Session * | session, |
double * | projectionMatrix, | ||
double | nearClipDistance, | ||
double | farClipDistance | ||
) |
Updates clip plane distances in the projection matrix.
Uses graphics API convention.
session | Varjo session handle. |
projectionMatrix | Projection matrix to modify. |
nearClipDistance | Near clip distance to use. |
farClipDistance | Far clip distance to use. |
void varjo_WaitSync | ( | struct varjo_Session * | session, |
struct varjo_FrameInfo * | frameInfo | ||
) |
Called at the start of a frame.
Obtains required metadata for the frame and blocks until optimal time to start rendering so that the application can use the latest possible pose data. In some cases, compositor may block the call for longer duration. (e.g. if it has something else to display.)
varjo_WaitSync() and varjo_FrameGetPose() will always derive matrixes from the same pose. So it's safe to call varjo_FrameGetPose() before varjo_WaitSync() is complete.
session | Varjo session handle. |
frameInfo | Output pointer for frame info. |