| Tilt Five NDK |

types.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020-2022 Tilt Five, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
21
22#ifndef __cplusplus
23#include <stdbool.h>
24#include <stdint.h>
25#else
26#include <cstdint>
27#endif
28
32
36
38#define T5_MAX_STRING_PARAM_LEN (260)
39
41#define T5_MIN_CAM_IMAGE_BUFFER_WIDTH (768)
42
44#define T5_MIN_CAM_IMAGE_BUFFER_HEIGHT (600)
45
47 typedef struct {
48 float x;
49 float y;
50} T5_Vec2;
51
53 typedef struct {
54 float x;
55 float y;
56 float z;
57} T5_Vec3;
58
60 typedef struct {
61 float w;
62 float x;
63 float y;
64 float z;
65} T5_Quat;
66
71 typedef struct T5_ContextImpl* T5_Context;
72
77 typedef struct T5_GlassesImpl* T5_Glasses;
78
83 typedef uint8_t T5_WandHandle;
84
86 typedef enum {
88 kT5_GraphicsApi_None = 1,
89
91 kT5_GraphicsApi_GL = 2,
92
94 kT5_GraphicsApi_D3D11 = 3,
95} T5_GraphicsApi;
96
98 typedef enum {
100 kT5_GameboardType_None = 1,
101
103 kT5_GameboardType_LE = 2,
104
106 kT5_GameboardType_XE = 3,
107
109 kT5_GameboardType_XE_Raised = 4,
110} T5_GameboardType;
111
113 typedef struct {
116 float viewableExtentPositiveX;
117
120 float viewableExtentNegativeX;
121
124 float viewableExtentPositiveY;
125
128 float viewableExtentNegativeY;
129
132 float viewableExtentPositiveZ;
133} T5_GameboardSize;
134
136 typedef struct {
138 const char* applicationId;
139
141 const char* applicationVersion;
142
146 uint8_t sdkType;
147
149 uint64_t reserved;
150} T5_ClientInfo;
151
153 typedef enum {
155 kT5_ConnectionState_ExclusiveConnection = 1,
156
158 kT5_ConnectionState_ExclusiveReservation = 2,
159
161 kT5_ConnectionState_NotExclusivelyConnected = 3,
162
164 kT5_ConnectionState_Disconnected = 4,
165} T5_ConnectionState;
166
168 typedef enum {
176 kT5_GlassesPoseUsage_GlassesPresentation = 1,
177
183 kT5_GlassesPoseUsage_SpectatorPresentation = 2,
184} T5_GlassesPoseUsage;
185
199 typedef struct {
201 uint64_t timestampNanos;
202
205 T5_Vec3 posGLS_GBD;
206
209 T5_Quat rotToGLS_GBD;
210
212 T5_GameboardType gameboardType;
213} T5_GlassesPose;
214
216 typedef struct {
218 uint8_t cameraIndex;
219
221 bool enabled;
222} T5_CameraStreamConfig;
223
225 typedef struct {
231 void* leftTexHandle;
232
238 void* rightTexHandle;
239
241 uint16_t texWidth_PIX;
242
244 uint16_t texHeight_PIX;
245
247 bool isSrgb;
248
250 bool isUpsideDown;
251
253 struct {
254 float startX_VCI;
255 float startY_VCI;
256 float width_VCI;
257 float height_VCI;
258 } vci;
259
261 T5_Quat rotToLVC_GBD;
262
265 T5_Vec3 posLVC_GBD;
266
268 T5_Quat rotToRVC_GBD;
269
272 T5_Vec3 posRVC_GBD;
273} T5_FrameInfo;
274
276 typedef struct {
279 uint16_t imageWidth;
280
283 uint16_t imageHeight;
284
287 uint16_t imageStride;
288
291 uint8_t cameraIndex;
292
295 uint8_t illuminationMode;
296
299 uint32_t bufferSize;
300
302 uint8_t* pixelData;
303
305 T5_Vec3 posCAM_GBD;
306
308 T5_Quat rotToCAM_GBD;
309} T5_CamImage;
310
312 typedef struct {
314 bool enabled;
315
316} T5_WandStreamConfig;
317
319 typedef enum {
321 kT5_WandStreamEventType_Connect = 1,
322
324 kT5_WandStreamEventType_Disconnect = 2,
325
327 kT5_WandStreamEventType_Desync = 3,
328
330 kT5_WandStreamEventType_Report = 4,
331} T5_WandStreamEventType;
332
334 typedef enum {
336 kT5_Hand_Unknown = 0,
337
339 kT5_Hand_Left = 1,
340
342 kT5_Hand_Right = 2,
343} T5_Hand;
344
346 typedef struct {
348 uint64_t timestampNanos;
349
351 bool analogValid;
352
354 bool batteryValid;
355
357 bool buttonsValid;
358
360 bool poseValid;
361
363 float trigger;
364
366 T5_Vec2 stick;
367
368 // TODO(khunt) : Determine units
370 uint8_t battery;
371
373 struct {
374 bool t5;
375 bool one;
376 bool two;
377 bool three;
378 bool a;
379 bool b;
380 bool x;
381 bool y;
382 } buttons;
383
385 //
388 T5_Quat rotToWND_GBD;
389
391 T5_Vec3 posAim_GBD;
392
394 T5_Vec3 posFingertips_GBD;
395
397 T5_Vec3 posGrip_GBD;
398
400 T5_Hand hand;
401} T5_WandReport;
402
404 typedef struct {
406 T5_WandHandle wandId;
407
409 T5_WandStreamEventType type;
410
412 uint64_t timestampNanos;
413
415 T5_WandReport report;
416} T5_WandStreamEvent;
417
419 typedef enum {
422 kT5_ParamGlasses_Float_IPD = 1,
423
425 kT5_ParamGlasses_UTF8_FriendlyName = 6,
426} T5_ParamGlasses;
427
429 typedef enum {
431 kT5_ParamSys_UTF8_Service_Version = 1,
432
435 kT5_ParamSys_Integer_CPL_AttRequired = 2,
436} T5_ParamSys;
437
T5_ConnectionState
T5_ConnectionState
Glasses connection state.
Definition: types.h:153
T5_ParamGlasses
T5_ParamGlasses
Possible parameters that can be retrieved for glasses.
Definition: types.h:419
T5_WandHandle
uint8_t T5_WandHandle
Opaque handle used with wands.
Definition: types.h:83
T5_Context
struct T5_ContextImpl * T5_Context
Opaque handle used with system-wide functions.
Definition: types.h:71
T5_GraphicsApi
T5_GraphicsApi
Graphics API types.
Definition: types.h:86
T5_Hand
T5_Hand
Wand hand.
Definition: types.h:334
T5_ParamSys
T5_ParamSys
Possible parameters that can be retrieved with System-wide parameters.
Definition: types.h:429
T5_GameboardType
T5_GameboardType
Possible gameboard types.
Definition: types.h:98
T5_WandStreamEventType
T5_WandStreamEventType
Wand stream event type.
Definition: types.h:319
T5_Glasses
struct T5_GlassesImpl * T5_Glasses
Opaque handle used with glasses.
Definition: types.h:77
T5_GlassesPoseUsage
T5_GlassesPoseUsage
Glasses pose usage indicator.
Definition: types.h:168
kT5_ConnectionState_Disconnected
@ kT5_ConnectionState_Disconnected
Glasses were previously exclusively connected, but the device has disconnected.
Definition: types.h:164
kT5_ConnectionState_ExclusiveConnection
@ kT5_ConnectionState_ExclusiveConnection
Glasses are connected for exclusive use.
Definition: types.h:155
kT5_ConnectionState_NotExclusivelyConnected
@ kT5_ConnectionState_NotExclusivelyConnected
Glasses have not been exclusively connected or reserved.
Definition: types.h:161
kT5_ConnectionState_ExclusiveReservation
@ kT5_ConnectionState_ExclusiveReservation
Glasses are reserved for exclusive use.
Definition: types.h:158
kT5_ParamGlasses_Float_IPD
@ kT5_ParamGlasses_Float_IPD
Interpupillary distance - Float, millimeters
Definition: types.h:422
kT5_ParamGlasses_UTF8_FriendlyName
@ kT5_ParamGlasses_UTF8_FriendlyName
User-facing name of the glasses - UTF8.
Definition: types.h:425
kT5_GraphicsApi_None
@ kT5_GraphicsApi_None
No graphics API (for clients that don't send frames)
Definition: types.h:88
kT5_GraphicsApi_D3D11
@ kT5_GraphicsApi_D3D11
Direct3D 11 (Windows Only)
Definition: types.h:94
kT5_GraphicsApi_GL
@ kT5_GraphicsApi_GL
OpenGL.
Definition: types.h:91
kT5_Hand_Right
@ kT5_Hand_Right
Right hand.
Definition: types.h:342
kT5_Hand_Unknown
@ kT5_Hand_Unknown
Hand unknown.
Definition: types.h:336
kT5_Hand_Left
@ kT5_Hand_Left
Left hand.
Definition: types.h:339
kT5_ParamSys_Integer_CPL_AttRequired
@ kT5_ParamSys_Integer_CPL_AttRequired
Non-zero if the control panel requires user interaction (E.g. Important firmware update) - Integer,...
Definition: types.h:435
kT5_ParamSys_UTF8_Service_Version
@ kT5_ParamSys_UTF8_Service_Version
Version of the service software - UTF8.
Definition: types.h:431
kT5_GameboardType_LE
@ kT5_GameboardType_LE
An LE gameboard.
Definition: types.h:103
kT5_GameboardType_XE
@ kT5_GameboardType_XE
An XE gameboard, flap laid flat.
Definition: types.h:106
kT5_GameboardType_None
@ kT5_GameboardType_None
No gameboard.
Definition: types.h:100
kT5_GameboardType_XE_Raised
@ kT5_GameboardType_XE_Raised
An XE gameboard, flap raised at an angle on the kickstand.
Definition: types.h:109
kT5_WandStreamEventType_Connect
@ kT5_WandStreamEventType_Connect
Wand connected.
Definition: types.h:321
kT5_WandStreamEventType_Disconnect
@ kT5_WandStreamEventType_Disconnect
Wand disconnected.
Definition: types.h:324
kT5_WandStreamEventType_Report
@ kT5_WandStreamEventType_Report
Wand report (Pose, Buttons, Trigger, Stick, Battery)
Definition: types.h:330
kT5_WandStreamEventType_Desync
@ kT5_WandStreamEventType_Desync
Stream has desynchronized.
Definition: types.h:327
kT5_GlassesPoseUsage_GlassesPresentation
@ kT5_GlassesPoseUsage_GlassesPresentation
The pose will be used to render images to be presented on the glasses.
Definition: types.h:176
kT5_GlassesPoseUsage_SpectatorPresentation
@ kT5_GlassesPoseUsage_SpectatorPresentation
The pose will be used to render images to be presented on a device other than the glasses,...
Definition: types.h:183
cstdint
T5_Vec2
2D vector
Definition: types.h:47
T5_Vec3
3D vector
Definition: types.h:53
T5_Quat
Quaternion.
Definition: types.h:60
T5_GameboardSize
Physical dimensions of a gameboard.
Definition: types.h:113
T5_GameboardSize::viewableExtentNegativeY
float viewableExtentNegativeY
The distance in meters from the gameboard origin to the edge of the viewable area in the negative Y d...
Definition: types.h:128
T5_GameboardSize::viewableExtentPositiveZ
float viewableExtentPositiveZ
The distance in meters above the gameboard origin that the viewable area extends in the positive Z di...
Definition: types.h:132
T5_GameboardSize::viewableExtentPositiveY
float viewableExtentPositiveY
The distance in meters from the gameboard origin to the edge of the viewable area in the positive Y d...
Definition: types.h:124
T5_GameboardSize::viewableExtentNegativeX
float viewableExtentNegativeX
The distance in meters from the gameboard origin to the edge of the viewable area in the negative X d...
Definition: types.h:120
T5_GameboardSize::viewableExtentPositiveX
float viewableExtentPositiveX
The distance in meters from the gameboard origin to the edge of the viewable area in the positive X d...
Definition: types.h:116
T5_ClientInfo
Client provided information for use with t5CreateGlasses()
Definition: types.h:136
T5_ClientInfo::sdkType
uint8_t sdkType
The SDK type.
Definition: types.h:146
T5_ClientInfo::applicationId
const char * applicationId
The application ID.
Definition: types.h:138
T5_ClientInfo::applicationVersion
const char * applicationVersion
The application version.
Definition: types.h:141
T5_ClientInfo::reserved
uint64_t reserved
RESERVED: Must be set to 0.
Definition: types.h:149
T5_GlassesPose
Glasses pose information to be retrieved with t5GetGlassesPose()
Definition: types.h:199
T5_GlassesPose::timestampNanos
uint64_t timestampNanos
The timestamp of the pose.
Definition: types.h:201
T5_GlassesPose::posGLS_GBD
T5_Vec3 posGLS_GBD
The position of the origin of the GLS (glasses) frame relative to the GBD (gameboard) frame.
Definition: types.h:205
T5_GlassesPose::rotToGLS_GBD
T5_Quat rotToGLS_GBD
The rotation that transforms points in the GBD (gameboard) frame orientation to the GLS (glasses) fra...
Definition: types.h:209
T5_GlassesPose::gameboardType
T5_GameboardType gameboardType
The type of gameboard visible for this pose.
Definition: types.h:212
T5_CameraStreamConfig
Camera stream configuration.
Definition: types.h:216
T5_CameraStreamConfig::cameraIndex
uint8_t cameraIndex
The index of the camera to be modified.
Definition: types.h:218
T5_CameraStreamConfig::enabled
bool enabled
Enable or disable the camera stream. True = enabled.
Definition: types.h:221
T5_FrameInfo
Render information to be used with t5SendFrameToGlasses()
Definition: types.h:225
T5_FrameInfo::rotToLVC_GBD
T5_Quat rotToLVC_GBD
The rotation from GBD to VC, the virtual camera reference frame for the left eye.
Definition: types.h:261
T5_FrameInfo::rightTexHandle
void * rightTexHandle
Texture handle for the right image.
Definition: types.h:238
T5_FrameInfo::posLVC_GBD
T5_Vec3 posLVC_GBD
The position of VC, the virtual camera reference frame, relative to GBD for the left eye.
Definition: types.h:265
T5_FrameInfo::isUpsideDown
bool isUpsideDown
True if the image is 'upside down'.
Definition: types.h:250
T5_FrameInfo::isSrgb
bool isSrgb
True if the texture is srgb. This is only relevant for the OpenGL graphics API.
Definition: types.h:247
T5_FrameInfo::posRVC_GBD
T5_Vec3 posRVC_GBD
The position of VC, the virtual camera reference frame, relative to GBD for the right eye.
Definition: types.h:272
T5_FrameInfo::texWidth_PIX
uint16_t texWidth_PIX
Width of the textures pointed to by leftTexHandle and rightTexHandle.
Definition: types.h:241
T5_FrameInfo::texHeight_PIX
uint16_t texHeight_PIX
Height of the textures pointed to by leftTexHandle and rightTexHandle.
Definition: types.h:244
T5_FrameInfo::leftTexHandle
void * leftTexHandle
Texture handle for the left image.
Definition: types.h:231
T5_FrameInfo::rotToRVC_GBD
T5_Quat rotToRVC_GBD
The rotation from GBD to VC, the virtual camera reference frame for the right eye.
Definition: types.h:268
T5_CamImage
Camera Frame information to be retrieved with t5GetFilledCamImageBuffer()
Definition: types.h:276
T5_CamImage::rotToCAM_GBD
T5_Quat rotToCAM_GBD
The rotation of the camera relative to the GBD.
Definition: types.h:308
T5_CamImage::illuminationMode
uint8_t illuminationMode
The illumination mode for incoming frames. 0 for unknown frame. 1 for Light frames....
Definition: types.h:295
T5_CamImage::pixelData
uint8_t * pixelData
The image buffer being filled by the Tilt Five service.
Definition: types.h:302
T5_CamImage::imageHeight
uint16_t imageHeight
The height of the image in the image buffer. Empty buffers should set these parameters to 0.
Definition: types.h:283
T5_CamImage::imageStride
uint16_t imageStride
The stride of the image in the image buffer. Empty buffers should set these parameters to 0.
Definition: types.h:287
T5_CamImage::bufferSize
uint32_t bufferSize
The total size of the provided image buffer. Must be at least T5_MIN_CAM_IMAGE_BUFFER_WIDTH * T5_MIN_...
Definition: types.h:299
T5_CamImage::posCAM_GBD
T5_Vec3 posCAM_GBD
The position of the camera relative to the GBD.
Definition: types.h:305
T5_CamImage::cameraIndex
uint8_t cameraIndex
The index of the desired camera. 0 for tangible tracking camera, 1 for head tracking camera.
Definition: types.h:291
T5_CamImage::imageWidth
uint16_t imageWidth
The width of the image in the image buffer. Empty buffers should set these parameters to 0.
Definition: types.h:279
T5_WandStreamConfig
Wand stream configuration.
Definition: types.h:312
T5_WandStreamConfig::enabled
bool enabled
Enable or disable the entire stream. True = enabled.
Definition: types.h:314
T5_WandReport
Contains wand related information (Pose, Buttons, Trigger, Stick, Battery)
Definition: types.h:346
T5_WandReport::poseValid
bool poseValid
Validity of pose parameters. True = valid.
Definition: types.h:360
T5_WandReport::batteryValid
bool batteryValid
Validity of battery parameters. True = valid.
Definition: types.h:354
T5_WandReport::timestampNanos
uint64_t timestampNanos
The timestamp of the wand event in nanoseconds.
Definition: types.h:348
T5_WandReport::battery
uint8_t battery
Battery.
Definition: types.h:370
T5_WandReport::rotToWND_GBD
T5_Quat rotToWND_GBD
WND/GBD rotation unit quaternion.
Definition: types.h:388
T5_WandReport::posGrip_GBD
T5_Vec3 posGrip_GBD
Position (Grip) - Vector3f.
Definition: types.h:397
T5_WandReport::trigger
float trigger
Trigger - Analog, Range [0.0 - 1.0], 1.0 = Fully depressed.
Definition: types.h:363
T5_WandReport::posAim_GBD
T5_Vec3 posAim_GBD
Position (Aim Point) - Vector3f.
Definition: types.h:391
T5_WandReport::analogValid
bool analogValid
Validity of analog parameters. True = valid.
Definition: types.h:351
T5_WandReport::hand
T5_Hand hand
Wand hand.
Definition: types.h:400
T5_WandReport::buttonsValid
bool buttonsValid
Validity of button parameters. True = valid.
Definition: types.h:357
T5_WandReport::posFingertips_GBD
T5_Vec3 posFingertips_GBD
Position (Fingertips) - Vector3f.
Definition: types.h:394
T5_WandReport::stick
T5_Vec2 stick
Stick (X/Y) - Analog, Range [-1.0 - 1.0], 0 = Centered, 1.0 = Top/Right.
Definition: types.h:366
T5_WandStreamEvent
Represents an event from the wand stream.
Definition: types.h:404
T5_WandStreamEvent::timestampNanos
uint64_t timestampNanos
The timestamp of the wand event in nanoseconds.
Definition: types.h:412
T5_WandStreamEvent::report
T5_WandReport report
Report (Valid if type = kT5_WandStreamEventType_Report)
Definition: types.h:415
T5_WandStreamEvent::type
T5_WandStreamEventType type
Type of event.
Definition: types.h:409
T5_WandStreamEvent::wandId
T5_WandHandle wandId
Opaque identifier for the wand.
Definition: types.h:406