public void TestMinimumGLTF() { var testStr = @" { ""asset"": { ""version"": ""2.0"" } } "; var testRoot = GLTFParser.ParseString(testStr); Assert.AreEqual(testRoot.Asset.Version, "2.0"); }
IEnumerator Start() { var timer = new System.Diagnostics.Stopwatch(); var csv = new StringBuilder(); csv.AppendLine("Name, Time (ms)"); Debug.Log("Start Parsing Benchmark."); foreach (var gltfUrl in GLTFUrls) { var www = UnityWebRequest.Get(gltfUrl); yield return(www.Send()); Debug.LogFormat("Benchmarking: {0}", gltfUrl); long totalTime = 0; for (var i = 0; i < NumberOfIterations; i++) { timer.Start(); GLTFParser.ParseString(www.downloadHandler.text); timer.Stop(); Debug.LogFormat("Iteration {0} took: {1}ms", i, timer.ElapsedMilliseconds); totalTime += timer.ElapsedMilliseconds; } var avgTime = (float)totalTime / NumberOfIterations; Debug.LogFormat("Average parse time {0}ms", avgTime); csv.AppendFormat("{0}, {1}\n", gltfUrl, avgTime); } Debug.Log("End Parsing Benchmark."); Debug.Log("Done."); if (SaveCSV) { var fileName = string.Format("glTFBench_{0}iter", NumberOfIterations); var path = EditorUtility.SaveFilePanel("Save GLTF Benchmark .csv", "", fileName, "csv"); if (path != null) { File.WriteAllText(path, csv.ToString()); Debug.LogFormat("Benchmark written to: {0}", path); } } }