149 lines
5.2 KiB
C++
149 lines
5.2 KiB
C++
//======================================================================================================
|
|
// Copyright 2025, Rokoko Glove OptiTrack Integration
|
|
//======================================================================================================
|
|
/**
|
|
* RokokoData.h defines the data structures for Rokoko Studio LiveFrame_v4 format.
|
|
* These structures match the JSON format used by Rokoko Unity scripts.
|
|
*/
|
|
|
|
#pragma once
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace RokokoData
|
|
{
|
|
// Vector3 structure for position data
|
|
struct Vector3Frame
|
|
{
|
|
float x = 0.0f;
|
|
float y = 0.0f;
|
|
float z = 0.0f;
|
|
};
|
|
|
|
// Vector4 structure for quaternion rotation data
|
|
struct Vector4Frame
|
|
{
|
|
float x = 0.0f;
|
|
float y = 0.0f;
|
|
float z = 0.0f;
|
|
float w = 1.0f;
|
|
};
|
|
|
|
// Actor joint frame containing position and rotation
|
|
struct ActorJointFrame
|
|
{
|
|
Vector3Frame position;
|
|
Vector4Frame rotation;
|
|
};
|
|
|
|
// Body structure containing full skeleton (Unity BodyFrame와 동일)
|
|
// ✅ OPTIMIZATION: Using std::optional instead of shared_ptr for stack allocation (zero heap allocations)
|
|
struct Body
|
|
{
|
|
// 전신 스켈레톤 데이터 (Unity BodyFrame과 동일)
|
|
std::optional<ActorJointFrame> hip;
|
|
std::optional<ActorJointFrame> spine;
|
|
std::optional<ActorJointFrame> chest;
|
|
std::optional<ActorJointFrame> neck;
|
|
std::optional<ActorJointFrame> head;
|
|
|
|
std::optional<ActorJointFrame> leftShoulder;
|
|
std::optional<ActorJointFrame> leftUpperArm;
|
|
std::optional<ActorJointFrame> leftLowerArm;
|
|
std::optional<ActorJointFrame> leftHand;
|
|
|
|
std::optional<ActorJointFrame> rightShoulder;
|
|
std::optional<ActorJointFrame> rightUpperArm;
|
|
std::optional<ActorJointFrame> rightLowerArm;
|
|
std::optional<ActorJointFrame> rightHand;
|
|
|
|
// 다리 데이터 (필요시)
|
|
std::optional<ActorJointFrame> leftUpLeg;
|
|
std::optional<ActorJointFrame> leftLeg;
|
|
std::optional<ActorJointFrame> leftFoot;
|
|
std::optional<ActorJointFrame> leftToe;
|
|
std::optional<ActorJointFrame> leftToeEnd;
|
|
|
|
std::optional<ActorJointFrame> rightUpLeg;
|
|
std::optional<ActorJointFrame> rightLeg;
|
|
std::optional<ActorJointFrame> rightFoot;
|
|
std::optional<ActorJointFrame> rightToe;
|
|
std::optional<ActorJointFrame> rightToeEnd;
|
|
|
|
// Left hand finger joints
|
|
std::optional<ActorJointFrame> leftThumbProximal;
|
|
std::optional<ActorJointFrame> leftThumbMedial;
|
|
std::optional<ActorJointFrame> leftThumbDistal;
|
|
std::optional<ActorJointFrame> leftThumbTip;
|
|
|
|
std::optional<ActorJointFrame> leftIndexProximal;
|
|
std::optional<ActorJointFrame> leftIndexMedial;
|
|
std::optional<ActorJointFrame> leftIndexDistal;
|
|
std::optional<ActorJointFrame> leftIndexTip;
|
|
|
|
std::optional<ActorJointFrame> leftMiddleProximal;
|
|
std::optional<ActorJointFrame> leftMiddleMedial;
|
|
std::optional<ActorJointFrame> leftMiddleDistal;
|
|
std::optional<ActorJointFrame> leftMiddleTip;
|
|
|
|
std::optional<ActorJointFrame> leftRingProximal;
|
|
std::optional<ActorJointFrame> leftRingMedial;
|
|
std::optional<ActorJointFrame> leftRingDistal;
|
|
std::optional<ActorJointFrame> leftRingTip;
|
|
|
|
std::optional<ActorJointFrame> leftLittleProximal;
|
|
std::optional<ActorJointFrame> leftLittleMedial;
|
|
std::optional<ActorJointFrame> leftLittleDistal;
|
|
std::optional<ActorJointFrame> leftLittleTip;
|
|
|
|
// Right hand finger joints (similar structure)
|
|
std::optional<ActorJointFrame> rightThumbProximal;
|
|
std::optional<ActorJointFrame> rightThumbMedial;
|
|
std::optional<ActorJointFrame> rightThumbDistal;
|
|
std::optional<ActorJointFrame> rightThumbTip;
|
|
|
|
std::optional<ActorJointFrame> rightIndexProximal;
|
|
std::optional<ActorJointFrame> rightIndexMedial;
|
|
std::optional<ActorJointFrame> rightIndexDistal;
|
|
std::optional<ActorJointFrame> rightIndexTip;
|
|
|
|
std::optional<ActorJointFrame> rightMiddleProximal;
|
|
std::optional<ActorJointFrame> rightMiddleMedial;
|
|
std::optional<ActorJointFrame> rightMiddleDistal;
|
|
std::optional<ActorJointFrame> rightMiddleTip;
|
|
|
|
std::optional<ActorJointFrame> rightRingProximal;
|
|
std::optional<ActorJointFrame> rightRingMedial;
|
|
std::optional<ActorJointFrame> rightRingDistal;
|
|
std::optional<ActorJointFrame> rightRingTip;
|
|
|
|
std::optional<ActorJointFrame> rightLittleProximal;
|
|
std::optional<ActorJointFrame> rightLittleMedial;
|
|
std::optional<ActorJointFrame> rightLittleDistal;
|
|
std::optional<ActorJointFrame> rightLittleTip;
|
|
};
|
|
|
|
// Actor data structure
|
|
struct ActorData
|
|
{
|
|
std::string id;
|
|
std::string name;
|
|
Body body;
|
|
};
|
|
|
|
// Scene structure containing actors
|
|
struct SceneFrame
|
|
{
|
|
std::vector<ActorData> actors;
|
|
};
|
|
|
|
// Main LiveFrame_v4 structure
|
|
struct LiveFrame_v4
|
|
{
|
|
double timestamp = 0.0;
|
|
SceneFrame scene;
|
|
};
|
|
}
|