2023-11-10 07:17:23 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class YogaDataLoader
|
|
|
|
|
{
|
|
|
|
|
|
2023-11-14 10:52:43 +00:00
|
|
|
|
public static YogaData LoadData(int index)
|
2023-11-10 07:17:23 +00:00
|
|
|
|
{
|
|
|
|
|
//Resources.Load<TextAsset>("YogaActions/YogaAction" + ActionIndex);
|
|
|
|
|
|
2023-11-14 10:52:43 +00:00
|
|
|
|
Dictionary<int, YogaData> data = new Dictionary<int, YogaData>();
|
2023-11-12 15:09:33 +00:00
|
|
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
2023-11-14 10:52:43 +00:00
|
|
|
|
data[-1] = new YogaData()
|
2023-11-12 15:09:33 +00:00
|
|
|
|
{
|
2023-11-15 17:23:16 +00:00
|
|
|
|
VideoPath = "Video/Action3",
|
|
|
|
|
Action = AvatarAction.HandsUp,
|
|
|
|
|
ModelType = ModelType.MediapipePose,
|
2023-11-12 15:09:33 +00:00
|
|
|
|
MaxActionCount = 1000,
|
2023-11-14 10:52:43 +00:00
|
|
|
|
TotalSeconds = 20.0f,
|
2023-11-15 17:23:16 +00:00
|
|
|
|
MustPoints = new List<string>() { "Nose", "RShoulder", "LShoulder", "RElbow", "LElbow" },
|
2023-11-13 06:43:34 +00:00
|
|
|
|
//AnyPoints = new List<string>() { "RWrist", "LWrist" }
|
2023-11-12 15:09:33 +00:00
|
|
|
|
};
|
|
|
|
|
#endif
|
2023-11-14 10:52:43 +00:00
|
|
|
|
data[1] = new YogaData()
|
2023-11-12 15:09:33 +00:00
|
|
|
|
{
|
|
|
|
|
VideoPath = "Video/Action1",
|
|
|
|
|
Action = AvatarAction.HeadShake,
|
2023-11-15 08:10:56 +00:00
|
|
|
|
ModelType = ModelType.OpenPose,
|
2023-11-12 15:09:33 +00:00
|
|
|
|
MaxActionCount = 4,
|
2023-11-14 10:52:43 +00:00
|
|
|
|
TotalSeconds = 20.0f,
|
2023-11-13 02:53:34 +00:00
|
|
|
|
MustPoints = new List<string>() { "Nose", "REye", "LEye", "Neck" }
|
2023-11-12 15:09:33 +00:00
|
|
|
|
};
|
2023-11-14 10:52:43 +00:00
|
|
|
|
data[2] = new YogaData()
|
2023-11-12 15:09:33 +00:00
|
|
|
|
{
|
|
|
|
|
VideoPath = "Video/Action2",
|
|
|
|
|
Action = AvatarAction.Nod,
|
2023-11-15 08:10:56 +00:00
|
|
|
|
ModelType = ModelType.OpenPose,
|
2023-11-12 15:09:33 +00:00
|
|
|
|
MaxActionCount = 4,
|
2023-11-14 10:52:43 +00:00
|
|
|
|
TotalSeconds = 20.0f,
|
2023-11-13 02:53:34 +00:00
|
|
|
|
MustPoints = new List<string>() { "Nose", "REye", "LEye", "Neck" }
|
2023-11-12 15:09:33 +00:00
|
|
|
|
};
|
2023-11-14 10:52:43 +00:00
|
|
|
|
data[3] = new YogaData()
|
2023-11-12 15:09:33 +00:00
|
|
|
|
{
|
|
|
|
|
VideoPath = "Video/Action3",
|
|
|
|
|
Action = AvatarAction.HandsUp,
|
2023-11-15 17:23:16 +00:00
|
|
|
|
ModelType = ModelType.MediapipePose,
|
2023-11-12 15:09:33 +00:00
|
|
|
|
MaxActionCount = 4,
|
2023-11-14 10:52:43 +00:00
|
|
|
|
TotalSeconds = 12.66f,
|
2023-11-15 17:23:16 +00:00
|
|
|
|
MustPoints = new List<string>() { "Nose", "RShoulder", "LShoulder", "RElbow", "LElbow" }
|
2023-11-12 15:09:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
2023-11-10 07:17:23 +00:00
|
|
|
|
if (data.ContainsKey(index))
|
|
|
|
|
return data[index];
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("YogaDataLoader.LoadData: index out of range");
|
|
|
|
|
}
|
2023-11-12 15:09:33 +00:00
|
|
|
|
|
2023-11-10 07:17:23 +00:00
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 10:52:43 +00:00
|
|
|
|
public class YogaData
|
2023-11-10 07:17:23 +00:00
|
|
|
|
{
|
|
|
|
|
public string VideoPath;
|
|
|
|
|
public AvatarAction Action;
|
2023-11-15 08:10:56 +00:00
|
|
|
|
public ModelType ModelType;
|
2023-11-10 07:17:23 +00:00
|
|
|
|
public int MaxActionCount;
|
2023-11-14 10:52:43 +00:00
|
|
|
|
public float TotalSeconds;
|
2023-11-12 15:09:33 +00:00
|
|
|
|
public List<string> MustPoints = new List<string>();
|
2023-11-13 06:43:34 +00:00
|
|
|
|
public List<string> AnyPoints = new List<string>();
|
2023-11-15 08:10:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ModelType
|
|
|
|
|
{
|
|
|
|
|
OpenPose,
|
|
|
|
|
YoloV7,
|
2023-11-15 17:23:16 +00:00
|
|
|
|
MediapipePose,
|
|
|
|
|
MediapipePersonDetect,
|
2023-11-15 08:10:56 +00:00
|
|
|
|
//,
|
2023-11-10 07:17:23 +00:00
|
|
|
|
}
|