SDK DOCUMENTATION
Varjo.h
Go to the documentation of this file.
1 // Copyright 2019 Varjo Technologies Oy. All rights reserved.
2 
3 #ifndef VARJO_H
4 #define VARJO_H
5 
6 #include "Varjo_types.h"
7 #include "Varjo_events.h"
8 #include "Varjo_export.h"
9 #include "Varjo_version_defines.h"
10 
11 #if defined __cplusplus
12 extern "C" {
13 #endif
14 
26 VARJO_API varjo_Bool varjo_IsAvailable();
27 
33 VARJO_API const char* varjo_GetVersionString();
34 
44 VARJO_API const uint64_t varjo_GetVersion();
45 
58 VARJO_API struct varjo_Session* varjo_SessionInit(void);
59 
68 VARJO_API void varjo_SessionShutDown(struct varjo_Session* session);
69 
78 VARJO_API varjo_Nanoseconds varjo_GetCurrentTime(struct varjo_Session* session);
79 
89 VARJO_API struct varjo_FrameInfo* varjo_CreateFrameInfo(struct varjo_Session* session);
90 
96 VARJO_API void varjo_FreeFrameInfo(struct varjo_FrameInfo* frameInfo);
97 
108 VARJO_API struct varjo_SubmitInfo* varjo_CreateSubmitInfo(struct varjo_Session* session);
109 
115 VARJO_API void varjo_FreeSubmitInfo(struct varjo_SubmitInfo* submitInfo);
116 
127 VARJO_API void varjo_LayoutDefaultViewports(struct varjo_Session* session, struct varjo_Viewport* viewports);
128 
135 VARJO_API void varjo_SetCenteredProjection(struct varjo_Session* session, varjo_Bool enabled);
136 
145 VARJO_API struct varjo_AlignedView varjo_GetAlignedView(double* projectionMatrix);
146 
156 VARJO_API void varjo_UpdateClipPlaneDistances(struct varjo_Session* session, double* projectionMatrix, double nearClipDistance, double farClipDistance);
157 
172 VARJO_API void varjo_WaitSync(struct varjo_Session* session, struct varjo_FrameInfo* frameInfo);
173 
181 VARJO_API void varjo_BeginFrame(struct varjo_Session* session, struct varjo_SubmitInfo* submitInfo);
182 
191 VARJO_API void varjo_EndFrame(struct varjo_Session* session, struct varjo_FrameInfo* frameInfo, struct varjo_SubmitInfo* submitInfo);
192 
205 VARJO_API varjo_Nanoseconds varjo_FrameGetDisplayTime(struct varjo_Session* session);
206 
220 VARJO_API struct varjo_Matrix varjo_FrameGetPose(struct varjo_Session* session, varjo_PoseType type);
221 
230 VARJO_API struct varjo_Matrix varjo_GetRelativePoseTransform(struct varjo_Session* session, varjo_PoseType src, varjo_PoseType dest);
231 
240 VARJO_API struct varjo_Matrix varjo_ApplyTransform(struct varjo_Session* session, struct varjo_Matrix* m1, struct varjo_Matrix* m2);
241 
253 VARJO_API void varjo_ResetPose(struct varjo_Session* session, varjo_Bool position, varjo_RotationReset rotation);
254 
266 VARJO_API struct varjo_ViewDescription varjo_GetViewDescription(struct varjo_Session* session, int32_t viewIndex);
267 
284 VARJO_API struct varjo_Mesh2Df* varjo_CreateOcclusionMesh(struct varjo_Session* session, int32_t viewIndex, varjo_WindingOrder windingOrder);
285 
291 VARJO_API void varjo_FreeOcclusionMesh(struct varjo_Mesh2Df* mesh);
292 
304 VARJO_API varjo_Error varjo_GetError(struct varjo_Session* session);
305 
312 VARJO_DEPRECATED_API const char* varjo_GetErrorDescription(struct varjo_Session* session);
313 
319 VARJO_API const char* varjo_GetErrorDesc(varjo_Error error);
320 
332 VARJO_DEPRECATED_API void varjo_ClearError(struct varjo_Session* session);
333 
339 VARJO_API void varjo_GazeInit(struct varjo_Session* session);
340 
349 VARJO_API varjo_Bool varjo_IsGazeAllowed(struct varjo_Session* session);
350 
359 VARJO_API struct varjo_Gaze varjo_GetGaze(struct varjo_Session* session);
360 
371 VARJO_API int32_t varjo_GetGazeArray(struct varjo_Session* session, struct varjo_Gaze* array, int32_t maxSizeOfArray);
372 
378 VARJO_API void varjo_SyncProperties(struct varjo_Session* session);
379 
386 VARJO_API int32_t varjo_GetPropertyCount(struct varjo_Session* session);
387 
395 VARJO_API varjo_PropertyKey varjo_GetPropertyKey(struct varjo_Session* session, int32_t index);
396 
404 VARJO_API const char* varjo_GetPropertyName(struct varjo_Session* session, varjo_PropertyKey propertyKey);
405 
413 VARJO_API varjo_Bool varjo_HasProperty(struct varjo_Session* session, varjo_PropertyKey propertyKey);
414 
422 VARJO_API varjo_Bool varjo_GetPropertyBool(struct varjo_Session* session, varjo_PropertyKey propertyKey);
423 
431 VARJO_API double varjo_GetPropertyDouble(struct varjo_Session* session, varjo_PropertyKey propertyKey);
432 
440 VARJO_API int32_t varjo_GetPropertyInt(struct varjo_Session* session, varjo_PropertyKey propertyKey);
441 
451 VARJO_API void varjo_RequestGazeCalibration(struct varjo_Session* session);
452 
459 VARJO_API struct varjo_SwapChainConfig varjo_GetDefaultSwapChainConfig(struct varjo_Session* session);
460 
467 VARJO_API struct varjo_SwapChainLimits varjo_GetSwapChainLimits(struct varjo_Session* session);
468 
480 VARJO_API void varjo_GetSupportedTextureFormats(struct varjo_Session* session, varjo_RenderAPI renderApi, int32_t* formatCount, varjo_TextureFormat* formats);
481 
490 VARJO_API varjo_Bool varjo_IsSwapChainConfigSupported(struct varjo_Session* session, varjo_RenderAPI renderApi, const struct varjo_SwapChainConfig* config);
491 
498 VARJO_API int32_t varjo_GetSwapChainCurrentIndex(struct varjo_Session* session);
499 
507 VARJO_API struct varjo_Event* varjo_AllocateEvent();
508 
516 VARJO_API void varjo_FreeEvent(struct varjo_Event* event);
517 
531 VARJO_API varjo_Bool varjo_PollEvent(struct varjo_Session* session, struct varjo_Event* evt);
532 
533 #if defined __cplusplus
534 }
535 #endif
536 
537 #endif
struct varjo_Matrix varjo_FrameGetPose(struct varjo_Session *session, varjo_PoseType type)
Gets a pose for the current frame.
varjo_Bool varjo_PollEvent(struct varjo_Session *session, struct varjo_Event *evt)
Polls events.
int32_t varjo_Bool
Definition: Varjo_types.h:77
Axis aligned tangents from a projection matrix.
Definition: Varjo_types.h:228
Minimum and maximum limits for swap chain texture count and size.
Definition: Varjo_types.h:298
VARJO_DEPRECATED_API const char * varjo_GetErrorDescription(struct varjo_Session *session)
Gets the current error description string in english.
void varjo_SetCenteredProjection(struct varjo_Session *session, varjo_Bool enabled)
Forces the provided projection matrices to be centered.
#define VARJO_DEPRECATED_API
Definition: Varjo_export.h:29
int64_t varjo_Nanoseconds
Time in nanoseconds.
Definition: Varjo_types.h:84
void varjo_WaitSync(struct varjo_Session *session, struct varjo_FrameInfo *frameInfo)
Called at the start of a frame.
struct varjo_Session * varjo_SessionInit(void)
Initializes a Varjo client session.
const char * varjo_GetPropertyName(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets the name of the property key.
int64_t varjo_RenderAPI
Render API flags.
Definition: Varjo_types.h:147
2D triangle list mesh.
Definition: Varjo_types.h:218
int64_t varjo_PoseType
Definition: Varjo_types.h:119
void varjo_EndFrame(struct varjo_Session *session, struct varjo_FrameInfo *frameInfo, struct varjo_SubmitInfo *submitInfo)
End the current frame.
const char * varjo_GetVersionString()
Gets the short version of the library.
Per-frame information.
Definition: Varjo_types.h:250
int32_t varjo_GetSwapChainCurrentIndex(struct varjo_Session *session)
Gets the current swap chain texture index.
varjo_Error varjo_GetError(struct varjo_Session *session)
Gets the latest error code.
void varjo_BeginFrame(struct varjo_Session *session, struct varjo_SubmitInfo *submitInfo)
Begin rendering the frame.
Gaze tracker vectors and tracking state.
Definition: Varjo_types.h:270
int32_t varjo_GetPropertyCount(struct varjo_Session *session)
Gets the number of system properties.
int64_t varjo_WindingOrder
Definition: Varjo_types.h:132
varjo_Bool varjo_IsSwapChainConfigSupported(struct varjo_Session *session, varjo_RenderAPI renderApi, const struct varjo_SwapChainConfig *config)
Is the given swap chain config supported.
Double precision 4x4 matrix.
Definition: Varjo_types.h:186
int64_t varjo_PropertyKey
System status properties.
Definition: Varjo_types.h:111
varjo_Bool varjo_IsAvailable()
Checks whether Varjo system is available.
void varjo_RequestGazeCalibration(struct varjo_Session *session)
Requests a HMD gaze calibration.
int32_t varjo_GetGazeArray(struct varjo_Session *session, struct varjo_Gaze *array, int32_t maxSizeOfArray)
Gets gaze measurements since last query.
int64_t varjo_TextureFormat
Definition: Varjo_types.h:136
double varjo_GetPropertyDouble(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets a floating point value of a property.
struct varjo_SwapChainLimits varjo_GetSwapChainLimits(struct varjo_Session *session)
Gets swap chain limits.
varjo_Bool varjo_GetPropertyBool(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets a boolean value of a property.
void varjo_ResetPose(struct varjo_Session *session, varjo_Bool position, varjo_RotationReset rotation)
Resets pose tracking origin.
void varjo_SessionShutDown(struct varjo_Session *session)
Shuts down a session and releases all the resources internally allocated by Varjo session...
void varjo_FreeOcclusionMesh(struct varjo_Mesh2Df *mesh)
Frees the memory allocated by varjo_CreateOcclusionMesh.
varjo_Nanoseconds varjo_GetCurrentTime(struct varjo_Session *session)
Gets the current time in a format that Varjo API uses.
struct varjo_SubmitInfo * varjo_CreateSubmitInfo(struct varjo_Session *session)
Creates a submit info for ending a frame with default viewport layout.
void varjo_FreeSubmitInfo(struct varjo_SubmitInfo *submitInfo)
Frees an allocated submit info.
Viewport rectangle that defines viewport area.
Definition: Varjo_types.h:310
struct varjo_AlignedView varjo_GetAlignedView(double *projectionMatrix)
Gets an aligned view from a projection matrix.
void varjo_GazeInit(struct varjo_Session *session)
Initializes the gaze tracking system.
varjo_PropertyKey varjo_GetPropertyKey(struct varjo_Session *session, int32_t index)
Gets a property key for a property index.
const uint64_t varjo_GetVersion()
Gets the version number of the library.
Information required to submit a frame to the Compositor.
Definition: Varjo_types.h:341
struct varjo_Viewport * viewports
Viewports to submit.
Definition: Varjo_types.h:342
int64_t varjo_Error
Definition: Varjo_types.h:12
const char * varjo_GetErrorDesc(varjo_Error error)
Gets error description for the specified error code.
varjo_Bool varjo_HasProperty(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Checks if the key has value in the properties.
int64_t varjo_RotationReset
Rotation reset types.
Definition: Varjo_types.h:103
int32_t varjo_GetPropertyInt(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets an integer value of a property.
struct varjo_SwapChainConfig varjo_GetDefaultSwapChainConfig(struct varjo_Session *session)
Gets the default swap chain config.
varjo_Nanoseconds varjo_FrameGetDisplayTime(struct varjo_Session *session)
Gets the time when the frame is scheduled to be displayed.
Config for swap chain texture size and count.
Definition: Varjo_types.h:288
struct varjo_Event * varjo_AllocateEvent()
Allocates an event.
void varjo_FreeFrameInfo(struct varjo_FrameInfo *frameInfo)
Frees an allocated frame info.
Event struct used for all the events by the event system.
Definition: Varjo_events.h:87
void varjo_UpdateClipPlaneDistances(struct varjo_Session *session, double *projectionMatrix, double nearClipDistance, double farClipDistance)
Updates clip plane distances in the projection matrix.
void varjo_LayoutDefaultViewports(struct varjo_Session *session, struct varjo_Viewport *viewports)
Layout default viewport configuration.
struct varjo_Matrix varjo_ApplyTransform(struct varjo_Session *session, struct varjo_Matrix *m1, struct varjo_Matrix *m2)
Applies transform using post multiplication.
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.
varjo_Bool varjo_IsGazeAllowed(struct varjo_Session *session)
Is gaze allowed to be used?
void varjo_FreeEvent(struct varjo_Event *event)
Free an event.
VARJO_DEPRECATED_API void varjo_ClearError(struct varjo_Session *session)
Resets the error status.
struct varjo_FrameInfo * varjo_CreateFrameInfo(struct varjo_Session *session)
Creates a frame info with initial values.
struct varjo_Gaze varjo_GetGaze(struct varjo_Session *session)
Gets the current state of the user gaze.
View description.
Definition: Varjo_types.h:260
void varjo_SyncProperties(struct varjo_Session *session)
Updates and synchronizes system properties with the system state.
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. ...
struct varjo_Mesh2Df * varjo_CreateOcclusionMesh(struct varjo_Session *session, int32_t viewIndex, varjo_WindingOrder windingOrder)
Creates the occlusion mesh for a given view index.
struct varjo_ViewDescription varjo_GetViewDescription(struct varjo_Session *session, int32_t viewIndex)
Gets the display information for a given view.