using System; using System.Text; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; namespace Seengene.XDKUnityPluginCloud { #region enum public enum MapQueryStatus { MAP_SUCCESS = 0, MAP_FAIL = 1 } public enum SmoothMoveType { Linear = 0, EaseInOut = 1 } public enum RelocalizeQueryStatus { // BA success, the result is filtered, implies FRAME_SUCCESS // In this status, m_inliers_3d_vector contains the set of all 3D points in the BA window SUCCESS = 0, // relocalization for current frame is successful, but BA failed FRAME_SUCCESS_BA_FAIL = 1, // the requested map is not ready yet on this server // user should request map first MAP_FAIL = 2, // relocalization for current frame is unsuccessful RELOCALIZE_FAIL = 3, // BA session is not found for this query, client should request map again BA_SESSION_EXPIRED = 4 } public enum DebugInfoType { Normal = 0, UpdateFrameNative = 1, GetSpatialMappingNative = 2 } #endregion of enum #region Custom Data Structure /// /// 请求地图,获得session id /// public class RequestMapKeys { // Request public const byte RequestType_MapId = 0; // 地图ID // Response public const byte ResponseType_SessionId = 0; // session id public const byte ResponseType_Status = 1; // 请求地图结果状态码 public const byte ResponseType_Scale = 2; // 地图缩放值,暂时没有使用 } /// /// 请求定位,获得定位结果 /// public class RelocalizeKeys { // Request public const byte RequestType_SessionId = 0; // session id public const byte RequestType_Seq = 1; // 一个session内的顺序码 public const byte RequestType_Pose = 2; // 当前追踪的位姿 public const byte RequestType_Intrinsics = 3; // 当前图像的内参 public const byte RequestType_Image = 4; // 图像数据 public const byte RequestType_MapID = 5; // 地图id(optional for wechat applet) public const byte RequestType_CameraModel = 6; // 相机模型(optional for glass, 0:pinhole 1:fisheye 2:others) public const byte RequestType_DitortionPara = 7; // 相机畸变参数(optional for glass) // Response public const byte ResponseType_Status = 0; // 定位结果状态码 public const byte ResponseType_Seq = 1; // 针对session内这个seq请求的定位结果 public const byte ResponseType_Point2dVec = 2; // 2D点向量 public const byte ResponseType_Point3dVec = 3; // 3D点向量 public const byte ResponseType_TransformLtg = 4; // local to global transform public const byte ResponseType_ExtraMsg = 5; // 其他信息,说明用字符串 } public class AuthorizationResponse { public string sessionID; public Int32 status; public double scale; public AuthorizationResponse() { } public AuthorizationResponse(Int32 status, double scale, string sessionID) { this.status = status; this.scale = scale; this.sessionID = sessionID; } public override string ToString() { return string.Format("AuthorizationResponse status:{0}, scale:{1}, sessionID:{2}", status, scale, sessionID); } } public class RelocationResponse { public Int32 status; public Int32 seq; public List point2d_vec = new List(); public List point3d_vec = new List(); public List transform_ltg = new List(); public string extra_msg; public Matrix4x4 cameraPos; public CameraCalibration cameraCalibration; public string sessionID; public RelocationResponse() { } public RelocationResponse(Int32 status, Int32 seq, List point2d_vec, List point3d_vec, List transform_ltg, string extra_msg, Matrix4x4 cameraPos, CameraCalibration cameraCalibration, string sessionID) { this.status = status; this.seq = seq; this.point2d_vec = point2d_vec; this.point3d_vec = point3d_vec; this.transform_ltg = transform_ltg; this.extra_msg = extra_msg; this.cameraPos = cameraPos; this.cameraCalibration = cameraCalibration; this.sessionID = sessionID; } public override string ToString() { return string.Format("RelocationResponse status:{0}, seq:{1}, point2d_vec:{2}, point3d_vec:{3}, transform_ltg:{4}, extra_msg:{5}", status, seq, XDKTools.ListVectro2ToString(point2d_vec), XDKTools.ListVector3ToString(point3d_vec), XDKTools.ListDoubleToString(transform_ltg), extra_msg); } } [System.Serializable] public class RelocUploadImageItem { public string sessionID; public Int32 seq; public Matrix4x4 cameraPose; public CameraCalibration cameraCalibration; public byte[] imageBytes; public RelocUploadImageItem() { } public RelocUploadImageItem(string sessionID, Int32 seq, Matrix4x4 cameraPose, CameraCalibration cameraCalibration, byte[] imageBytes) { this.sessionID = sessionID; this.seq = seq; this.cameraPose = cameraPose; this.cameraCalibration = cameraCalibration; this.imageBytes = imageBytes; } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("RelocUploadImageItem: "); sb.Append("sessionID: " + sessionID + "; "); sb.Append("seq: " + seq + "; "); sb.Append("cameraPose: " + cameraPose.ToString() + "; "); sb.Append("cameraCalibration: " + cameraCalibration.ToString() + "; "); sb.Append("imageBytes(0-100): " + XDKTools.GetBytesString(imageBytes, 0, 100, ", ") + "; "); return sb.ToString(); } } #endregion of Custom Data Structure #region Cumsom UnityEvent [System.Serializable] public class UnityEventBool : UnityEvent { } #endregion of Cumsom UnityEvent }