mirror of
https://github.com/hyblocker/OpenVR-SpaceCalibrator.git
synced 2026-10-23 16:01:03 +02:00
79 lines
1.7 KiB
C++
79 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#ifndef _OPENVR_API
|
|
#include <openvr_driver.h>
|
|
#endif
|
|
|
|
#define OPENVR_SPACECALIBRATOR_PIPE_NAME "\\\\.\\pipe\\OpenVRSpaceCalibratorDriver"
|
|
|
|
namespace protocol
|
|
{
|
|
const uint32_t Version = 1;
|
|
|
|
enum RequestType
|
|
{
|
|
RequestInvalid,
|
|
RequestHandshake,
|
|
RequestSetDeviceTransform,
|
|
};
|
|
|
|
enum ResponseType
|
|
{
|
|
ResponseInvalid,
|
|
ResponseHandshake,
|
|
ResponseSuccess,
|
|
};
|
|
|
|
struct Protocol
|
|
{
|
|
uint32_t version = Version;
|
|
};
|
|
|
|
struct SetDeviceTransform
|
|
{
|
|
uint32_t openVRID;
|
|
bool enabled;
|
|
bool updateTranslation;
|
|
bool updateRotation;
|
|
vr::HmdVector3d_t translation;
|
|
vr::HmdQuaternion_t rotation;
|
|
|
|
SetDeviceTransform(uint32_t id, bool enabled) :
|
|
openVRID(id), enabled(enabled), updateTranslation(false), updateRotation(false) { }
|
|
|
|
SetDeviceTransform(uint32_t id, bool enabled, vr::HmdVector3d_t translation) :
|
|
openVRID(id), enabled(enabled), updateTranslation(true), updateRotation(false), translation(translation) { }
|
|
|
|
SetDeviceTransform(uint32_t id, bool enabled, vr::HmdQuaternion_t rotation) :
|
|
openVRID(id), enabled(enabled), updateTranslation(false), updateRotation(true), rotation(rotation) { }
|
|
|
|
SetDeviceTransform(uint32_t id, bool enabled, vr::HmdVector3d_t translation, vr::HmdQuaternion_t rotation) :
|
|
openVRID(id), enabled(enabled), updateTranslation(true), updateRotation(true), translation(translation), rotation(rotation) { }
|
|
};
|
|
|
|
struct Request
|
|
{
|
|
RequestType type;
|
|
|
|
union {
|
|
SetDeviceTransform setDeviceTransform;
|
|
};
|
|
|
|
Request() : type(RequestInvalid) { }
|
|
Request(RequestType type) : type(type) { }
|
|
};
|
|
|
|
struct Response
|
|
{
|
|
ResponseType type;
|
|
|
|
union {
|
|
Protocol protocol;
|
|
};
|
|
|
|
Response() : type(ResponseInvalid) { }
|
|
Response(ResponseType type) : type(type) { }
|
|
};
|
|
} |