Varjo Native SDK
Varjo.h
Go to the documentation of this file.
1 // Copyright 2019-2021 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 
27 
33 VARJO_API const char* varjo_GetVersionString();
34 
47 VARJO_API const uint64_t varjo_GetVersion();
48 
63 VARJO_API struct varjo_Session* varjo_SessionInit(void);
64 
75 VARJO_API void varjo_SessionShutDown(struct varjo_Session* session);
76 
86 VARJO_API void varjo_SessionSetPriority(struct varjo_Session* session, int32_t priority);
87 
96 VARJO_API varjo_Nanoseconds varjo_GetCurrentTime(struct varjo_Session* session);
97 
107 VARJO_API struct varjo_FrameInfo* varjo_CreateFrameInfo(struct varjo_Session* session);
108 
114 VARJO_API void varjo_FreeFrameInfo(struct varjo_FrameInfo* frameInfo);
115 
122 VARJO_API void varjo_SetCenteredProjection(struct varjo_Session* session, varjo_Bool enabled);
123 
129 VARJO_API int32_t varjo_GetViewCount(struct varjo_Session* session);
130 
139 VARJO_API struct varjo_AlignedView varjo_GetAlignedView(double* projectionMatrix);
140 
155 VARJO_API void varjo_WaitSync(struct varjo_Session* session, struct varjo_FrameInfo* frameInfo);
156 
169 VARJO_API varjo_Nanoseconds varjo_FrameGetDisplayTime(struct varjo_Session* session);
170 
184 VARJO_API struct varjo_Matrix varjo_FrameGetPose(struct varjo_Session* session, varjo_PoseType type);
185 
198 VARJO_API struct varjo_Matrix varjo_GetTrackingToLocalTransform(struct varjo_Session* session);
199 
208 VARJO_API struct varjo_Matrix varjo_GetRelativePoseTransform(struct varjo_Session* session, varjo_PoseType src, varjo_PoseType dest);
209 
218 VARJO_API struct varjo_Matrix varjo_ApplyTransform(struct varjo_Session* session, struct varjo_Matrix* m1, struct varjo_Matrix* m2);
219 
231 VARJO_API void varjo_ResetPose(struct varjo_Session* session, varjo_Bool position, varjo_RotationReset rotation);
232 
245 VARJO_API struct varjo_ViewDescription varjo_GetViewDescription(struct varjo_Session* session, int32_t viewIndex);
246 
263 VARJO_API struct varjo_Mesh2Df* varjo_CreateOcclusionMesh(struct varjo_Session* session, int32_t viewIndex, varjo_WindingOrder windingOrder);
264 
270 VARJO_API void varjo_FreeOcclusionMesh(struct varjo_Mesh2Df* mesh);
271 
283 VARJO_API varjo_Error varjo_GetError(struct varjo_Session* session);
284 
290 VARJO_API const char* varjo_GetErrorDesc(varjo_Error error);
291 
297 VARJO_API void varjo_GazeInit(struct varjo_Session* session);
298 
306 VARJO_API void varjo_GazeInitWithParameters(struct varjo_Session* session, struct varjo_GazeParameters* parameters, int32_t parameterCount);
307 
316 VARJO_API varjo_Bool varjo_IsGazeAllowed(struct varjo_Session* session);
317 
327 VARJO_API void varjo_RequestGazeCalibration(struct varjo_Session* session);
328 
341  struct varjo_Session* session, struct varjo_GazeCalibrationParameters* parameters, int32_t parameterCount);
342 
351 VARJO_API struct varjo_Gaze varjo_GetGaze(struct varjo_Session* session);
352 
363 VARJO_API varjo_Bool varjo_GetGazeData(struct varjo_Session* session, struct varjo_Gaze* gaze, struct varjo_EyeMeasurements* eyeMeasurements);
364 
375 VARJO_API int32_t varjo_GetGazeArray(struct varjo_Session* session, struct varjo_Gaze* array, int32_t maxSize);
376 
391 VARJO_API int32_t varjo_GetGazeDataArray(
392  struct varjo_Session* session, struct varjo_Gaze* gazeArray, struct varjo_EyeMeasurements* eyeMeasurementsArray, int32_t maxSize);
393 
399 VARJO_API void varjo_SyncProperties(struct varjo_Session* session);
400 
407 VARJO_API int32_t varjo_GetPropertyCount(struct varjo_Session* session);
408 
416 VARJO_API varjo_PropertyKey varjo_GetPropertyKey(struct varjo_Session* session, int32_t index);
417 
425 VARJO_API const char* varjo_GetPropertyName(struct varjo_Session* session, varjo_PropertyKey propertyKey);
426 
434 VARJO_API varjo_Bool varjo_HasProperty(struct varjo_Session* session, varjo_PropertyKey propertyKey);
435 
443 VARJO_API varjo_Bool varjo_GetPropertyBool(struct varjo_Session* session, varjo_PropertyKey propertyKey);
444 
452 VARJO_API double varjo_GetPropertyDouble(struct varjo_Session* session, varjo_PropertyKey propertyKey);
453 
461 VARJO_API int32_t varjo_GetPropertyInt(struct varjo_Session* session, varjo_PropertyKey propertyKey);
462 
474 VARJO_API void varjo_GetPropertyString(struct varjo_Session* session, varjo_PropertyKey propertyKey, char* buffer, uint32_t maxSize);
475 
484 VARJO_API uint32_t varjo_GetPropertyStringSize(struct varjo_Session* session, varjo_PropertyKey propertyKey);
485 
492 VARJO_API struct varjo_SwapChainLimits varjo_GetSwapChainLimits(struct varjo_Session* session);
493 
505 VARJO_API void varjo_GetSupportedTextureFormats(struct varjo_Session* session, varjo_RenderAPI renderApi, int32_t* formatCount, varjo_TextureFormat* formats);
506 
514 VARJO_API struct varjo_Event* varjo_AllocateEvent();
515 
523 VARJO_API void varjo_FreeEvent(struct varjo_Event* event);
524 
538 VARJO_API varjo_Bool varjo_PollEvent(struct varjo_Session* session, struct varjo_Event* evt);
539 
551 VARJO_API void varjo_GetTextureSize(struct varjo_Session* session, varjo_TextureSize_Type type, int32_t viewIndex, int32_t* width, int32_t* height);
552 
567 VARJO_API void varjo_D3D12UpdateVariableRateShadingTexture(struct varjo_Session* session, struct ID3D12GraphicsCommandList* commandList,
568  struct ID3D12Resource* texture, struct varjo_VariableRateShadingConfig* config);
569 
584 VARJO_API void varjo_D3D11UpdateVariableRateShadingTexture(struct varjo_Session* session, struct ID3D11Device* device, struct ID3D11Texture2D* texture,
585  struct varjo_VariableRateShadingConfig* config, struct varjo_ShadingRateTable* shadingRateTable);
586 
602 VARJO_API void varjo_GLUpdateVariableRateShadingTexture(struct varjo_Session* session, unsigned int texture, int width, int height,
603  struct varjo_VariableRateShadingConfig* config, struct varjo_ShadingRateTable* shadingRateTable);
604 
617 VARJO_API varjo_Bool varjo_GetRenderingGaze(struct varjo_Session* session, struct varjo_Gaze* gaze);
618 
633  struct varjo_Session* session, int32_t indexView, struct varjo_Gaze* gaze, struct varjo_FoveatedFovTangents_Hints* hints);
634 
644 VARJO_API struct varjo_FovTangents varjo_GetFovTangents(struct varjo_Session* session, int32_t viewIndex);
645 
646 #if defined __cplusplus
647 }
648 #endif
649 
650 #endif
varjo_Nanoseconds
int64_t varjo_Nanoseconds
Time in nanoseconds.
Definition: Varjo_types.h:142
varjo_GetGazeDataArray
int32_t varjo_GetGazeDataArray(struct varjo_Session *session, struct varjo_Gaze *gazeArray, struct varjo_EyeMeasurements *eyeMeasurementsArray, int32_t maxSize)
Gets gaze measurements since last query.
varjo_D3D11UpdateVariableRateShadingTexture
void varjo_D3D11UpdateVariableRateShadingTexture(struct varjo_Session *session, struct ID3D11Device *device, struct ID3D11Texture2D *texture, struct varjo_VariableRateShadingConfig *config, struct varjo_ShadingRateTable *shadingRateTable)
Updates variable rate shading texture.
varjo_AllocateEvent
struct varjo_Event * varjo_AllocateEvent()
Allocates an event.
varjo_GetPropertyCount
int32_t varjo_GetPropertyCount(struct varjo_Session *session)
Gets the number of system properties.
varjo_GetPropertyInt
int32_t varjo_GetPropertyInt(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets an integer value of a property.
varjo_GetTextureSize
void varjo_GetTextureSize(struct varjo_Session *session, varjo_TextureSize_Type type, int32_t viewIndex, int32_t *width, int32_t *height)
Gets texture size for specific varjo_TextureSize_type and view index.
Varjo_events.h
varjo_ApplyTransform
struct varjo_Matrix varjo_ApplyTransform(struct varjo_Session *session, struct varjo_Matrix *m1, struct varjo_Matrix *m2)
Applies transform using post multiplication.
Varjo_export.h
varjo_FreeEvent
void varjo_FreeEvent(struct varjo_Event *event)
Free an event.
varjo_GetPropertyString
void varjo_GetPropertyString(struct varjo_Session *session, varjo_PropertyKey propertyKey, char *buffer, uint32_t maxSize)
Gets a string value of a property.
varjo_FreeFrameInfo
void varjo_FreeFrameInfo(struct varjo_FrameInfo *frameInfo)
Frees an allocated frame info.
varjo_GazeInitWithParameters
void varjo_GazeInitWithParameters(struct varjo_Session *session, struct varjo_GazeParameters *parameters, int32_t parameterCount)
Initializes the gaze tracking system with provided parameters.
varjo_GazeParameters
Parameters passed to varjo_GazeInitWithParameters function.
Definition: Varjo_types.h:482
varjo_ViewDescription
View description.
Definition: Varjo_types.h:407
varjo_PoseType
int64_t varjo_PoseType
Definition: Varjo_types.h:192
varjo_ShadingRateTable
Definition: Varjo_types.h:544
varjo_D3D12UpdateVariableRateShadingTexture
void varjo_D3D12UpdateVariableRateShadingTexture(struct varjo_Session *session, struct ID3D12GraphicsCommandList *commandList, struct ID3D12Resource *texture, struct varjo_VariableRateShadingConfig *config)
Creates variable rate shading texture.
varjo_Gaze::gaze
struct varjo_Ray gaze
Normalized gaze direction ray.
Definition: Varjo_types.h:420
varjo_RenderAPI
int64_t varjo_RenderAPI
Render API flags.
Definition: Varjo_types.h:230
varjo_Bool
int32_t varjo_Bool
Definition: Varjo_types.h:135
varjo_Gaze
Gaze tracker vectors and tracking state.
Definition: Varjo_types.h:417
varjo_GetPropertyBool
varjo_Bool varjo_GetPropertyBool(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets a boolean value of a property.
varjo_ResetPose
void varjo_ResetPose(struct varjo_Session *session, varjo_Bool position, varjo_RotationReset rotation)
Resets pose tracking origin.
varjo_GetCurrentTime
varjo_Nanoseconds varjo_GetCurrentTime(struct varjo_Session *session)
Gets the current time in a format that Varjo API uses.
varjo_GetViewCount
int32_t varjo_GetViewCount(struct varjo_Session *session)
Gets numbers of views.
varjo_SyncProperties
void varjo_SyncProperties(struct varjo_Session *session)
Updates and synchronizes system properties with the system state.
varjo_WindingOrder
int64_t varjo_WindingOrder
Definition: Varjo_types.h:205
varjo_GetSupportedTextureFormats
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.
varjo_GetErrorDesc
const char * varjo_GetErrorDesc(varjo_Error error)
Gets error description for the specified error code.
varjo_GetGazeData
varjo_Bool varjo_GetGazeData(struct varjo_Session *session, struct varjo_Gaze *gaze, struct varjo_EyeMeasurements *eyeMeasurements)
Gets the current state of the user gaze.
varjo_FovTangents
Definition: Varjo_types.h:510
varjo_HasProperty
varjo_Bool varjo_HasProperty(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Checks if the key has value in the properties.
varjo_GetAlignedView
struct varjo_AlignedView varjo_GetAlignedView(double *projectionMatrix)
Gets an aligned view from a projection matrix.
varjo_PropertyKey
int64_t varjo_PropertyKey
System status properties.
Definition: Varjo_types.h:175
varjo_FrameGetPose
struct varjo_Matrix varjo_FrameGetPose(struct varjo_Session *session, varjo_PoseType type)
Gets a pose for the current frame.
varjo_GazeInit
void varjo_GazeInit(struct varjo_Session *session)
Initializes the gaze tracking system.
varjo_GetPropertyKey
varjo_PropertyKey varjo_GetPropertyKey(struct varjo_Session *session, int32_t index)
Gets a property key for a property index.
varjo_FrameGetDisplayTime
varjo_Nanoseconds varjo_FrameGetDisplayTime(struct varjo_Session *session)
Gets the time when the frame is scheduled to be displayed.
varjo_FrameInfo
Per-frame information.
Definition: Varjo_types.h:397
varjo_SessionInit
struct varjo_Session * varjo_SessionInit(void)
Initializes a Varjo client session.
varjo_GetPropertyName
const char * varjo_GetPropertyName(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets the name of the property key.
varjo_AlignedView
Axis aligned tangents from a projection matrix.
Definition: Varjo_types.h:375
varjo_GetRenderingGaze
varjo_Bool varjo_GetRenderingGaze(struct varjo_Session *session, struct varjo_Gaze *gaze)
Returns gaze which can be used for foveated rendering or to generate variable rate shading texture.
varjo_SwapChainLimits
Minimum and maximum limits for swap chain texture count and size.
Definition: Varjo_types.h:450
varjo_GetGaze
struct varjo_Gaze varjo_GetGaze(struct varjo_Session *session)
Gets the current state of the user gaze.
varjo_CreateFrameInfo
struct varjo_FrameInfo * varjo_CreateFrameInfo(struct varjo_Session *session)
Creates a frame info with initial values.
varjo_TextureFormat
int64_t varjo_TextureFormat
Definition: Varjo_types.h:209
varjo_Event
Event struct used for all the events by the event system.
Definition: Varjo_events.h:129
varjo_GetPropertyStringSize
uint32_t varjo_GetPropertyStringSize(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets the size of a buffer that is big enough to hold the property, including the null terminator.
varjo_SessionSetPriority
void varjo_SessionSetPriority(struct varjo_Session *session, int32_t priority)
Sets session overlay priority.
varjo_GazeCalibrationParameters
Parameters passed to varjo_RequestGazeCalibrationWithParameters function.
Definition: Varjo_types.h:490
varjo_GetRelativePoseTransform
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_IsGazeAllowed
varjo_Bool varjo_IsGazeAllowed(struct varjo_Session *session)
Is gaze allowed to be used?
varjo_GLUpdateVariableRateShadingTexture
void varjo_GLUpdateVariableRateShadingTexture(struct varjo_Session *session, unsigned int texture, int width, int height, struct varjo_VariableRateShadingConfig *config, struct varjo_ShadingRateTable *shadingRateTable)
Updates variable rate shading texture.
varjo_CreateOcclusionMesh
struct varjo_Mesh2Df * varjo_CreateOcclusionMesh(struct varjo_Session *session, int32_t viewIndex, varjo_WindingOrder windingOrder)
Creates the occlusion mesh for a given view index.
varjo_GetTrackingToLocalTransform
struct varjo_Matrix varjo_GetTrackingToLocalTransform(struct varjo_Session *session)
Transform from tracking space to local client space.
varjo_GetViewDescription
struct varjo_ViewDescription varjo_GetViewDescription(struct varjo_Session *session, int32_t viewIndex)
Gets the display information for a given view.
varjo_GetVersionString
const char * varjo_GetVersionString()
Gets the short version of the runtime.
varjo_GetError
varjo_Error varjo_GetError(struct varjo_Session *session)
Gets the latest error code.
Varjo_types.h
varjo_IsAvailable
varjo_Bool varjo_IsAvailable()
Checks whether Varjo system is available.
varjo_Matrix
Double precision 4x4 matrix.
Definition: Varjo_types.h:297
varjo_RequestGazeCalibration
void varjo_RequestGazeCalibration(struct varjo_Session *session)
Requests a HMD gaze calibration.
varjo_PollEvent
varjo_Bool varjo_PollEvent(struct varjo_Session *session, struct varjo_Event *evt)
Polls events.
varjo_VariableRateShadingConfig
Definition: Varjo_types.h:555
varjo_Error
int64_t varjo_Error
Definition: Varjo_types.h:13
varjo_GetFovTangents
struct varjo_FovTangents varjo_GetFovTangents(struct varjo_Session *session, int32_t viewIndex)
Returns tangents for a given view index.
varjo_GetPropertyDouble
double varjo_GetPropertyDouble(struct varjo_Session *session, varjo_PropertyKey propertyKey)
Gets a floating point value of a property.
varjo_RotationReset
int64_t varjo_RotationReset
Rotation reset types.
Definition: Varjo_types.h:167
varjo_GetSwapChainLimits
struct varjo_SwapChainLimits varjo_GetSwapChainLimits(struct varjo_Session *session)
Gets swap chain limits.
varjo_SetCenteredProjection
void varjo_SetCenteredProjection(struct varjo_Session *session, varjo_Bool enabled)
Forces the provided projection matrices to be centered.
varjo_FreeOcclusionMesh
void varjo_FreeOcclusionMesh(struct varjo_Mesh2Df *mesh)
Frees the memory allocated by varjo_CreateOcclusionMesh.
varjo_GetVersion
const uint64_t varjo_GetVersion()
Gets the version number of the runtime.
varjo_GetFoveatedFovTangents
struct varjo_FovTangents varjo_GetFoveatedFovTangents(struct varjo_Session *session, int32_t indexView, struct varjo_Gaze *gaze, struct varjo_FoveatedFovTangents_Hints *hints)
Returns foveated view tangents for a given index and gaze vector.
varjo_SessionShutDown
void varjo_SessionShutDown(struct varjo_Session *session)
Shuts down a session and releases all the resources internally allocated by Varjo session.
varjo_GetGazeArray
int32_t varjo_GetGazeArray(struct varjo_Session *session, struct varjo_Gaze *array, int32_t maxSize)
Gets gaze measurements since last query.
varjo_Mesh2Df
2D triangle list mesh.
Definition: Varjo_types.h:364
varjo_WaitSync
void varjo_WaitSync(struct varjo_Session *session, struct varjo_FrameInfo *frameInfo)
Called at the start of a frame.
varjo_FoveatedFovTangents_Hints
Definition: Varjo_types.h:517
varjo_EyeMeasurements
Gaze tracker estimates of user's eye measurements.
Definition: Varjo_types.h:435
varjo_RequestGazeCalibrationWithParameters
void varjo_RequestGazeCalibrationWithParameters(struct varjo_Session *session, struct varjo_GazeCalibrationParameters *parameters, int32_t parameterCount)
Requests a HMD gaze calibration with provided parameters.
varjo_TextureSize_Type
int64_t varjo_TextureSize_Type
Definition: Varjo_types.h:495