mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 21:15:43 +00:00
92 lines
3.5 KiB
C
92 lines
3.5 KiB
C
#pragma once
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "xr_tracking.h"
|
|
|
|
// Shared with com.droiddeck.launcher.session.xr.XrHost, which reads and writes these through direct
|
|
// ByteBuffers by fixed offset: any layout change must bump the version and update both sides.
|
|
#define DROIDDECK_XR_HOST_VERSION 1u
|
|
#define DROIDDECK_XR_HOST_LAYERS 6
|
|
|
|
#define DROIDDECK_XR_HOST_SURFACE_SWAPCHAIN (1u << 0)
|
|
#define DROIDDECK_XR_HOST_FOCUSED (1u << 1)
|
|
|
|
#define DROIDDECK_XR_HOST_MASK_INPUT (1u << 0)
|
|
|
|
#define DROIDDECK_XR_HOST_LAYER_ALPHA (1u << 0)
|
|
#define DROIDDECK_XR_HOST_LAYER_HEAD_LOCKED (1u << 1)
|
|
|
|
struct DroidDeckXrHostHand {
|
|
DroidDeckXrPose grip;
|
|
DroidDeckXrPose aim;
|
|
float trigger, squeeze, stick[2];
|
|
uint32_t buttons, active;
|
|
uint32_t reserved[2];
|
|
};
|
|
|
|
struct DroidDeckXrHostState {
|
|
uint32_t version, session_state, flags, reserved0;
|
|
int64_t frame, display_time_ns;
|
|
DroidDeckXrPose head;
|
|
DroidDeckXrHostHand hands[2];
|
|
uint32_t reserved[8];
|
|
};
|
|
|
|
struct DroidDeckXrHostHaptic {
|
|
uint64_t id;
|
|
int64_t duration_ns;
|
|
float amplitude, frequency;
|
|
};
|
|
|
|
struct DroidDeckXrHostHandControl {
|
|
uint32_t mask;
|
|
float laser;
|
|
DroidDeckXrHostHaptic haptic;
|
|
uint32_t reserved[2];
|
|
};
|
|
|
|
struct DroidDeckXrHostOrb {
|
|
uint32_t visible;
|
|
float progress, burst, radius;
|
|
DroidDeckXrPose pose;
|
|
};
|
|
|
|
struct DroidDeckXrHostLayer {
|
|
int32_t id;
|
|
uint32_t visible, flags;
|
|
int32_t order;
|
|
DroidDeckXrPose pose;
|
|
float width, height;
|
|
uint32_t reserved[2];
|
|
};
|
|
|
|
struct DroidDeckXrHostControl {
|
|
uint32_t version, reserved0;
|
|
DroidDeckXrHostHandControl hands[2];
|
|
DroidDeckXrHostOrb orb;
|
|
DroidDeckXrHostLayer layers[DROIDDECK_XR_HOST_LAYERS];
|
|
uint32_t reserved[8];
|
|
};
|
|
|
|
static_assert(sizeof(DroidDeckXrHostHand) == 96, "XR host hand layout");
|
|
static_assert(offsetof(DroidDeckXrHostHand, aim) == 32 && offsetof(DroidDeckXrHostHand, trigger) == 64 &&
|
|
offsetof(DroidDeckXrHostHand, stick) == 72 && offsetof(DroidDeckXrHostHand, buttons) == 80 &&
|
|
offsetof(DroidDeckXrHostHand, active) == 84, "XR host hand layout");
|
|
static_assert(offsetof(DroidDeckXrHostState, flags) == 8 && offsetof(DroidDeckXrHostState, frame) == 16 &&
|
|
offsetof(DroidDeckXrHostState, head) == 32, "XR host state layout");
|
|
static_assert(offsetof(DroidDeckXrHostHandControl, laser) == 4 && offsetof(DroidDeckXrHostHandControl, haptic) == 8,
|
|
"XR host hand control layout");
|
|
static_assert(offsetof(DroidDeckXrHostHaptic, duration_ns) == 8 && offsetof(DroidDeckXrHostHaptic, amplitude) == 16,
|
|
"XR host haptic layout");
|
|
static_assert(offsetof(DroidDeckXrHostOrb, progress) == 4 && offsetof(DroidDeckXrHostOrb, pose) == 16, "XR host orb layout");
|
|
static_assert(offsetof(DroidDeckXrHostLayer, order) == 12 && offsetof(DroidDeckXrHostLayer, pose) == 16 &&
|
|
offsetof(DroidDeckXrHostLayer, width) == 48, "XR host layer layout");
|
|
static_assert(sizeof(DroidDeckXrHostState) == 288, "XR host state layout");
|
|
static_assert(offsetof(DroidDeckXrHostState, hands) == 64, "XR host state layout");
|
|
static_assert(sizeof(DroidDeckXrHostHandControl) == 40, "XR host hand control layout");
|
|
static_assert(sizeof(DroidDeckXrHostOrb) == 48, "XR host orb layout");
|
|
static_assert(sizeof(DroidDeckXrHostLayer) == 64, "XR host layer layout");
|
|
static_assert(offsetof(DroidDeckXrHostControl, orb) == 88, "XR host control layout");
|
|
static_assert(offsetof(DroidDeckXrHostControl, layers) == 136, "XR host control layout");
|
|
static_assert(sizeof(DroidDeckXrHostControl) == 552, "XR host control layout");
|