147 lines
5.3 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 <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와 동일)
struct Body
{
// 전신 스켈레톤 데이터 (Unity BodyFrame과 동일)
std::shared_ptr<ActorJointFrame> hip;
std::shared_ptr<ActorJointFrame> spine;
std::shared_ptr<ActorJointFrame> chest;
std::shared_ptr<ActorJointFrame> neck;
std::shared_ptr<ActorJointFrame> head;
std::shared_ptr<ActorJointFrame> leftShoulder;
std::shared_ptr<ActorJointFrame> leftUpperArm;
std::shared_ptr<ActorJointFrame> leftLowerArm;
std::shared_ptr<ActorJointFrame> leftHand;
std::shared_ptr<ActorJointFrame> rightShoulder;
std::shared_ptr<ActorJointFrame> rightUpperArm;
std::shared_ptr<ActorJointFrame> rightLowerArm;
std::shared_ptr<ActorJointFrame> rightHand;
// 다리 데이터 (필요시)
std::shared_ptr<ActorJointFrame> leftUpLeg;
std::shared_ptr<ActorJointFrame> leftLeg;
std::shared_ptr<ActorJointFrame> leftFoot;
std::shared_ptr<ActorJointFrame> leftToe;
std::shared_ptr<ActorJointFrame> leftToeEnd;
std::shared_ptr<ActorJointFrame> rightUpLeg;
std::shared_ptr<ActorJointFrame> rightLeg;
std::shared_ptr<ActorJointFrame> rightFoot;
std::shared_ptr<ActorJointFrame> rightToe;
std::shared_ptr<ActorJointFrame> rightToeEnd;
// Left hand finger joints
std::shared_ptr<ActorJointFrame> leftThumbProximal;
std::shared_ptr<ActorJointFrame> leftThumbMedial;
std::shared_ptr<ActorJointFrame> leftThumbDistal;
std::shared_ptr<ActorJointFrame> leftThumbTip;
std::shared_ptr<ActorJointFrame> leftIndexProximal;
std::shared_ptr<ActorJointFrame> leftIndexMedial;
std::shared_ptr<ActorJointFrame> leftIndexDistal;
std::shared_ptr<ActorJointFrame> leftIndexTip;
std::shared_ptr<ActorJointFrame> leftMiddleProximal;
std::shared_ptr<ActorJointFrame> leftMiddleMedial;
std::shared_ptr<ActorJointFrame> leftMiddleDistal;
std::shared_ptr<ActorJointFrame> leftMiddleTip;
std::shared_ptr<ActorJointFrame> leftRingProximal;
std::shared_ptr<ActorJointFrame> leftRingMedial;
std::shared_ptr<ActorJointFrame> leftRingDistal;
std::shared_ptr<ActorJointFrame> leftRingTip;
std::shared_ptr<ActorJointFrame> leftLittleProximal;
std::shared_ptr<ActorJointFrame> leftLittleMedial;
std::shared_ptr<ActorJointFrame> leftLittleDistal;
std::shared_ptr<ActorJointFrame> leftLittleTip;
// Right hand finger joints (similar structure)
std::shared_ptr<ActorJointFrame> rightThumbProximal;
std::shared_ptr<ActorJointFrame> rightThumbMedial;
std::shared_ptr<ActorJointFrame> rightThumbDistal;
std::shared_ptr<ActorJointFrame> rightThumbTip;
std::shared_ptr<ActorJointFrame> rightIndexProximal;
std::shared_ptr<ActorJointFrame> rightIndexMedial;
std::shared_ptr<ActorJointFrame> rightIndexDistal;
std::shared_ptr<ActorJointFrame> rightIndexTip;
std::shared_ptr<ActorJointFrame> rightMiddleProximal;
std::shared_ptr<ActorJointFrame> rightMiddleMedial;
std::shared_ptr<ActorJointFrame> rightMiddleDistal;
std::shared_ptr<ActorJointFrame> rightMiddleTip;
std::shared_ptr<ActorJointFrame> rightRingProximal;
std::shared_ptr<ActorJointFrame> rightRingMedial;
std::shared_ptr<ActorJointFrame> rightRingDistal;
std::shared_ptr<ActorJointFrame> rightRingTip;
std::shared_ptr<ActorJointFrame> rightLittleProximal;
std::shared_ptr<ActorJointFrame> rightLittleMedial;
std::shared_ptr<ActorJointFrame> rightLittleDistal;
std::shared_ptr<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;
};
}