private void WriteDataLastFrame(int frame, bool lastFrame) { //proj matrix Matrix4x4 m_matrix = arCamera.projectionMatrix; CameraProjectionMatrix tmp = new CameraProjectionMatrix(); tmp.frame = frame; tmp.cameraProjectionMatrix = m_matrix; //config CameraConfig m_config = GetCameraConfiguration(); ScreenResolution m_res = GetResolution(); //prepare data string matrix = JsonUtility.ToJson(tmp); string config = JsonUtility.ToJson(m_config); string res = JsonUtility.ToJson(m_res); //phrasing string par = "}"; string quote = "\""; string json = $"{matrix}],{quote}cameraConfig{quote}:{config},{quote}resolution{quote}:{res}{par}"; //writing contents += json; JsonFileWriter.WriteDataToFile(path: filePath, text: contents, "", lastFrame: lastFrame); contents = ""; }
private void WriteDataContinously(int frame, bool lastFrame) { //proj matrix Matrix4x4 m_matrix = arCamera.projectionMatrix; CameraProjectionMatrix tmp = new CameraProjectionMatrix(); tmp.frame = frame; tmp.cameraProjectionMatrix = m_matrix; //prepare data string json = JsonUtility.ToJson(tmp); (contents, curTick, write) = DataHelper.JsonContentTicker(lastFrame: lastFrame, curTick: curTick, reqTick: 23, contents: contents, json: json); //write contents if (write) { JsonFileWriter.WriteDataToFile(path: filePath, text: contents, "", lastFrame: lastFrame); contents = ""; } if (lastFrame) { filePath = null; } }