5.5. The Teleport Core library

5.5.1. Introduction

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

5.5.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::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::SetStageSpaceOriginNodeCommand, teleport::core::SetupCommand, teleport::core::SetupInputsCommand, teleport::core::SetupLightingCommand, teleport::core::ShutdownCommand, teleport::core::UpdateNodeEnabledStateCommand, teleport::core::UpdateNodeMovementCommand

Public Members

CommandPayloadType commandPayloadType

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

struct SetStageSpaceOriginNodeCommand : public teleport::core::Command

Sent from server to client to set the origin of the client’s space.

Public Members

avs::uid origin_node = 0

The session uid of the node to use as the origin.

uint64_t valid_counter = 0

A validity value. Larger values indicate newer data, so the client ignores messages with smaller validity than the last one received.

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

13

uint32_t debug_network_packets = 0

21

int32_t requiredLatencyMs = 0

25

uint32_t idle_connection_timeout = 5000

29

uint64_t session_id = 0

The server’s session id changes when the server session changes. 37 bytes.

avs::VideoConfig video_config

Video setup structure. 41+89=130 bytes.

float draw_distance = 0.0f

Maximum distance in metres to render locally. 134.

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

The axis standard that the server uses, may be different from the client’s. 147.

uint8_t audio_input_enabled = 0

148 Server accepts audio stream from client.

bool using_ssl = true

147 Not in use, for later.

int64_t startTimestamp_utc_unix_us = 0

157 UTC Unix Timestamp in microseconds when the server session began.

BackgroundMode backgroundMode

158 Whether the server supplies a background, and of which type.

vec4_packed backgroundColour

174 If the background is of the COLOUR type, which colour to use.

ClientDynamicLighting clientDynamicLighting

Setup for dynamic object lighting. 174+57=231 bytes.

struct SetupLightingCommand : public teleport::core::Command

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

Public Members

uint8_t num_gi_textures = 0

If this is nonzero, implicitly gi should be enabled.

struct SetupInputsCommand : public teleport::core::Command

Sends Input definitions. The packet will be sizeof(SetupLightingCommand) + 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.

5.5.3. Client Messages

struct ClientMessage

A message from a client to a server.

Subclassed by teleport::core::ControllerPosesMessage, teleport::core::DisplayInfoMessage, teleport::core::InputEventsMessage, teleport::core::InputStatesMessage, teleport::core::KeyframeRequestMessage, teleport::core::NodeStatusMessage, teleport::core::OrthogonalAcknowledgementMessage, teleport::core::PongForLatencyMessage, teleport::core::ReceivedResourcesMessage, teleport::core::ResourceRequestMessage

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

Width of the display.

uint32_t height

Height of the display.

float framerate

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 ControllerPosesMessage : 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.

5.5.4. Animation

struct Animation

An animation, comprising a list of keyframes.

struct TransformKeyframeList

A list of keyframes to be used in an animation.

5.5.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(avs::InputId inputID, bool activated)

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

void addAnalogueEvent(avs::InputId inputID, float strength)

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

void addMotionEvent(avs::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 avs::InputEventAnalogue &getLastAnalogueEvent(uint16_t inputID) const

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

const avs::InputEventBinary &getLastBinaryEvent(uint16_t inputID) const

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

5.5.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.