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.

The function counts world objects which have at least one of the component types specified by typeMask. If the caller specifies zero as typeMask, then the function returns all objects. See varjo_WorldComponentTypeMask for the list of component types.

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.

Use varjo_WorldGetObjectCount with the same typeMask before calling this function to get the number of objects which will be returned by this function.

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. See varjo_WorldFlags for supported values for worldFlags.

Parameters
sessionVarjo session the world should be initialized for.
worldFlagsConfiguration flags 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. See varjo_WorldObjectMarkerFlags.

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.

varjo_WorldSync must be called to get up to date information about tracked objects from the API. The state of the information about tracked objects only changes when varjo_WorldSync is called. The information about tracked objects does not changed between two consecutive calls to varjo_WorldSync. Typically an application using this API calls varjo_WorldSync once per frame.

Parameters
worldWorld to sync.