Varjo Native SDK
Varjo_world.h File Reference

Go to the source code of this file.

Functions

struct varjo_World * varjo_WorldInit (struct varjo_Session *session, varjo_WorldFlags worldFlags)
 Initialize a world. More...
 
void varjo_WorldDestroy (struct varjo_World *world)
 Destroy a varjo_World instance. More...
 
void varjo_WorldSync (struct varjo_World *world)
 Sync all objects tracked in the world. More...
 
int64_t varjo_WorldGetObjectCount (struct varjo_World *world, varjo_WorldComponentTypeMask typeMask)
 Get the number of objects in the world. More...
 
int64_t varjo_WorldGetObjects (struct varjo_World *world, struct varjo_WorldObject *objects, int64_t maxObjectCount, varjo_WorldComponentTypeMask typeMask)
 Get a list of objects in the world. More...
 
varjo_Bool varjo_WorldGetPoseComponent (struct varjo_World *world, varjo_WorldObjectId id, struct varjo_WorldPoseComponent *component, varjo_Nanoseconds displayTime)
 Get a pose component. More...
 
varjo_Bool varjo_WorldGetObjectMarkerComponent (struct varjo_World *world, varjo_WorldObjectId id, struct varjo_WorldObjectMarkerComponent *component)
 Get a object marker component. More...
 
void varjo_WorldSetObjectMarkerTimeouts (struct varjo_World *world, varjo_WorldMarkerId *ids, int64_t idCount, varjo_Nanoseconds duration)
 Sets a desired lifetime duration for specified markers. More...
 
void varjo_WorldSetObjectMarkerFlags (struct varjo_World *world, varjo_WorldMarkerId *ids, int64_t idCount, varjo_WorldObjectMarkerFlags flags)
 Sets flags for specifed markers. More...
 

Function Documentation

◆ varjo_WorldDestroy()

void varjo_WorldDestroy ( struct varjo_World *  world)

Destroy a varjo_World instance.

Parameters
worldVarjo world instance to destroy.

◆ varjo_WorldGetObjectCount()

int64_t varjo_WorldGetObjectCount ( struct varjo_World *  world,
varjo_WorldComponentTypeMask  typeMask 
)

Get the number of objects in the world.

Parameters
worldWorld to get the objects from.
typeMaskMask of the desired object types. Zero if you want all of them.
Returns
The number of objects in the world matching the mask.

◆ varjo_WorldGetObjectMarkerComponent()

varjo_Bool varjo_WorldGetObjectMarkerComponent ( struct varjo_World *  world,
varjo_WorldObjectId  id,
struct varjo_WorldObjectMarkerComponent component 
)

Get a object marker component.

varjo_WorldObject::typeMask should be checked before trying to get components.

Parameters
worldWorld to get the component from.
idId of the object.
componentPointer to the component to fill.
Returns
True if the component was found.

◆ varjo_WorldGetObjects()

int64_t varjo_WorldGetObjects ( struct varjo_World *  world,
struct varjo_WorldObject objects,
int64_t  maxObjectCount,
varjo_WorldComponentTypeMask  typeMask 
)

Get a list of objects in the world.

Parameters
worldWorld to get the objects from.
objectsOutput pointer for the objects.
maxObjectCountMaximum object count.
typeMaskMask of the desired object types. Zero if you want all of them.
Returns
The number of objects in the world matching the mask.

◆ varjo_WorldGetPoseComponent()

varjo_Bool varjo_WorldGetPoseComponent ( struct varjo_World *  world,
varjo_WorldObjectId  id,
struct varjo_WorldPoseComponent component,
varjo_Nanoseconds  displayTime 
)

Get a pose component.

varjo_WorldObject::typeMask should be checked before trying to get components. Pose is extrapolated for the given timestamp.

The extrapolated pose may not match the real pose if the tracking system gets better data during the extrapolated time frame.

The timestamp can be in the past to a certain degree, there is a small history kept each time varjo_WorldSync is called.

Use varjo_FrameGetDisplayTime to get the time the frame is going to be displayed. This is going to give the best results in most cases.

Parameters
worldWorld to get the component from.
idId of the object.
componentPointer to the component to fill.
displayTimeAbsolute timestamp the tracking data is needed for.
Returns
True if the component was found.

◆ varjo_WorldInit()

struct varjo_World* varjo_WorldInit ( struct varjo_Session *  session,
varjo_WorldFlags  worldFlags 
)

Initialize a world.

One varjo_Session can have multiple worlds. Each world has it own set of objects and they can overlap if the worlds have the same flags. The same physical object can be represented by a different id in a different varjo_World.

Parameters
sessionVarjo session the world should be initialized for.
worldFlagsFlags for the world initialization.
Returns
An opaque handle to the world object.

◆ varjo_WorldSetObjectMarkerFlags()

void varjo_WorldSetObjectMarkerFlags ( struct varjo_World *  world,
varjo_WorldMarkerId ids,
int64_t  idCount,
varjo_WorldObjectMarkerFlags  flags 
)

Sets flags for specifed markers.

Replaces all flags set previously for the specified markers.

Parameters
worldVarjo world handle.
idsIds of the markers to set the flags for.
idCountNumber of ids to set.
flagsMarker flags to set.

◆ varjo_WorldSetObjectMarkerTimeouts()

void varjo_WorldSetObjectMarkerTimeouts ( struct varjo_World *  world,
varjo_WorldMarkerId ids,
int64_t  idCount,
varjo_Nanoseconds  duration 
)

Sets a desired lifetime duration for specified markers.

Markers that have not been tracked for a period of time exceeding duration will not be returned by varjo_WorldGetObjects.

Once a marker is expired, the world object id associated with it will not be reused.

Parameters
worldVarjo world handle.
idsIds of the markers to use the specified timeout.
idCountNumber of ids to set.
durationA time in nanoseconds for which the system will keep marker information for markers that are not currently visible.

◆ varjo_WorldSync()

void varjo_WorldSync ( struct varjo_World *  world)

Sync all objects tracked in the world.

Gets the latest tracking pose for all objects in the world. varjo_WorldGetObjects will return the latest state for each component type after this call.

Call this function every time you want to get the latest tracking data from Varjo backend.

Parameters
worldWorld to sync.