3.8. The Teleport Core library

3.8.1. Introduction

Teleport Core is a library of fundamental classes shared by clients and servers.

3.8.2. Commands

Commands are sent from the server to the client on a reliable data channel. All commands derive from teleport::core::Command.

struct Command

A message from a server to a client. The commandPayloadType specifies the size and interpretation of the packet.

Subclassed by teleport::core::AckedCommand, teleport::core::AcknowledgeHandshakeCommand, teleport::core::ApplyAnimationCommand, teleport::core::AssignNodePosePathCommand, teleport::core::NodeStateCommand, teleport::core::NodeVisibilityCommand, teleport::core::PingForLatencyCommand, teleport::core::ReconfigureVideoCommand, teleport::core::SetNodeAnimationSpeedCommand, teleport::core::SetNodeHighlightedCommand, teleport::core::SetupCommand, teleport::core::SetupInputsCommand, teleport::core::ShutdownCommand, teleport::core::UpdateNodeEnabledStateCommand, teleport::core::UpdateNodeMovementCommand

Public Members

CommandPayloadType commandPayloadType

What type of command this is, how to interpret it.

Warning

doxygenstruct: Cannot find class “teleport::core::SetStageSpaceOriginNodeCommand” in doxygen xml output for project “TeleportXR” from directory: /home/runner/work/Teleport/Teleport/build_docs/docs/doxygen/xml

struct AcknowledgeHandshakeCommand : public teleport::core::Command

The message sent by a server to a client on receipt of the client’s handshake, confirming that the session can begin. size is variable, as visible node uid’s are appended.

Public Members

size_t visibleNodeCount = 0

Count of visible node IDs appended to the command payload.

struct SetupCommand : public teleport::core::Command

The setup information sent by the server on connection to a given client.

Public Members

uint32_t debug_stream = 0

1+4=5

uint32_t debug_network_packets = 0

5+4=9

int32_t requiredLatencyMs = 0

9+4=13

uint32_t idle_connection_timeout = 5000

13+4=17

uint64_t session_id = 0

17+8=25 The server’s session id changes when the server session changes. 37 bytes

avs::VideoConfig video_config

25+89=114 Video setup structure. 41+89=130 bytes

float draw_distance = 0.0f

114+4=118 Maximum distance in metres to render locally. 134

avs::AxesStandard axesStandard = avs::AxesStandard::NotInitialized

118+1=119 The axis standard that the server uses, may be different from the client’s. 147

uint8_t audio_input_enabled = 0

119+1=120 Server accepts audio stream from client.

bool using_ssl = true

120+1=121 Not in use, for later.

int64_t startTimestamp_utc_unix_us = 0

121+8=129 UTC Unix Timestamp in microseconds when the server session began.

BackgroundMode backgroundMode

129+1=130 Whether the server supplies a background, and of which type.

vec4_packed backgroundColour

130+16=146 If the background is of the COLOUR type, which colour to use.

avs::uid backgroundTexture = 0

146+8=154

struct SetLightingCommand : public teleport::core::AckedCommand

Sends GI textures. The packet will be sizeof(SetLightingCommand) + num_gi_textures uid’s, each 64 bits.

Public Members

ClientDynamicLighting clientDynamicLighting

If this is nonzero, implicitly gi should be enabled.

struct SetupInputsCommand : public teleport::core::Command

Sends Input definitions. The packet will be sizeof(SetLightingCommand) + num_gi_textures uid’s, each 64 bits.

Public Members

uint16_t numInputs = 0

The number of inputs to follow the command.

struct ReconfigureVideoCommand : public teleport::core::Command

Instructs the client to accept a new video configuration, e.g. if bandwidth requires a change of resolution.

Public Members

avs::VideoConfig video_config

The configuration to use.

struct ShutdownCommand : public teleport::core::Command

Instructs the client to close the connection.

struct NodeVisibilityCommand : public teleport::core::Command

Instructs the client to show or hide the specified nodes.

struct UpdateNodeMovementCommand : public teleport::core::Command

Instructs the client to modify the motion of the specified nodes.

Public Members

size_t updatesCount

How many updates are included.

struct UpdateNodeEnabledStateCommand : public teleport::core::Command

Instructs the client to modify the enabled state of the specified nodes.

Public Members

size_t updatesCount

How many updates are included.

struct SetNodeHighlightedCommand : public teleport::core::Command

Instructs the client to modify the highlighted state of the specified nodes.

struct UpdateNodeStructureCommand : public teleport::core::NodeStateCommand

Instructs the client to reparent the specified node.

Public Members

avs::uid parentID = 0

The new parent uid.

Pose_packed relativePose

The new relative pose of the child node.

struct AssignNodePosePathCommand : public teleport::core::Command

A command to set the locally-tracked pose of a node, for example, a node can here be linked to a regex path for an OpenXR pose control. If pathLength>0, followed by a number of chars given in pathLength for the utf8 regex path. If pathLength==0, control of the node is returned to the server.

Public Members

uint16_t pathLength

A regular expression that will be used to match the full component path of a client-side pose.

3.8.3. Client Messages

struct ClientMessage

A message from a client to a server.

Subclassed by teleport::core::AcknowledgementMessage, teleport::core::DisplayInfoMessage, teleport::core::Handshake, teleport::core::InputEventsMessage, teleport::core::InputStatesMessage, teleport::core::KeyframeRequestMessage, teleport::core::NodePosesMessage, teleport::core::NodeStatusMessage, teleport::core::OrthogonalAcknowledgementMessage, teleport::core::PongForLatencyMessage, teleport::core::ReceivedResourcesMessage, teleport::core::ResourceLostMessage

Public Members

ClientMessagePayloadType clientMessagePayloadType

Specifies what type of client message this is.

struct DisplayInfo

Information on the resolution of a client’s display.

Public Members

uint32_t width = 0

Width of the display.

uint32_t height = 0

Height of the display.

float framerate = 0.f

Measured recent framerate.

struct NodeStatusMessage : public teleport::core::ClientMessage

Message info struct containing how many nodes have changed to what state; sent alongside two lists of node UIDs.

Public Members

size_t nodesDrawnCount

How many nodes the client is drawing. The node uid’s will be appended first in the packet.

size_t nodesWantToReleaseCount

How many nodes the client has but is no longer drawing. The node uid’s will be appended second in the packet.

struct ReceivedResourcesMessage : public teleport::core::ClientMessage

Message info struct containing how many resources were received; sent alongside a list of UIDs.

Public Members

size_t receivedResourcesCount

How many resources were received. The uid’s will be appended in the packet.

struct NodePosesMessage : public teleport::core::ClientMessage

Message info struct containing head and other node poses. followed by numPoses NodePose structs.

Public Members

Pose_packed headPose

The headset’s pose.

uint16_t numPoses = 0

Poses of the controllers.

3.8.4. Animation

struct Animation

An animation, comprising a list of keyframes.

Public Members

std::vector<uint8_t> compressedData

Animation sheould contain either compressedData, or content in boneKeyframes. Not both.

struct TransformKeyframeList

A list of keyframes to be used in an animation.

3.8.5. Input and control

class Input

A class to store current input states.

Public Functions

void clearEvents()

Clear the current lists of states and events.

void addBinaryEvent(InputId inputID, bool activated)

Add a binary (on/off) event for the specified inputID.

void addAnalogueEvent(InputId inputID, float strength)

Add an analogue [0,1.0] or [-1.0,1.0] event for the specified inputID.

void addMotionEvent(InputId inputID, vec2 motion)

Add a notion (xy) event for the specified inputID.

void setBinaryState(uint16_t inputID, bool activated)

Set a binary state for the specified inputID.

void setAnalogueState(uint16_t inputID, float strength)

Set an analogue state for the specified inputID.

const InputEventAnalogue &getLastAnalogueEvent(uint16_t inputID) const

For debugging only: get the last event at this id.

const InputEventBinary &getLastBinaryEvent(uint16_t inputID) const

For debugging only: get the last event at this id.

3.8.6. Text and Fonts

struct FontAtlas

Each font size represented has a FontMap.

Subclassed by teleport::clientrender::FontAtlas

struct TextCanvas

Current state of a TextCanvas component.