Code formatting
This commit is contained in:
Родитель
dab4e84e46
Коммит
9d60861206
|
@ -0,0 +1,74 @@
|
|||
; see http://editorconfig.org/ for docs on this file
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
ignore_if_in_header = This code was generated by a tool|<auto-generated>
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
; uncomment to help with sharing files across os's (i.e. network share or through local vm)
|
||||
#end_of_line = lf
|
||||
; avoid a bom, which causes endless problems with naive text tooling
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
; keeping auto-format enabled helps avoid merge hell for projects without CI-based format validation
|
||||
#disable_auto_format = true
|
||||
|
||||
[*.cs]
|
||||
; uncomment to enable full formatting of c# files
|
||||
formatters = generic, uncrustify
|
||||
|
||||
[*.asmdef]
|
||||
scrape_api = true
|
||||
|
||||
[**/Tests/**.asmdef]
|
||||
scrape_api = false
|
||||
|
||||
[*.Tests.asmdef]
|
||||
scrape_api = false
|
||||
|
||||
[*.md]
|
||||
indent_size = 2
|
||||
; trailing whitespace is unfortunately significant in markdown
|
||||
trim_trailing_whitespace = false
|
||||
; uncomment to enable basic formatting of markdown files
|
||||
#formatters = generic
|
||||
|
||||
[{Makefile,makefile}]
|
||||
; tab characters are part of the Makefile format
|
||||
indent_style = tab
|
||||
|
||||
[*.asmdef]
|
||||
indent_size = 4
|
||||
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
[*.{vcproj,bat,cmd,xaml,tt,t4,ttinclude}]
|
||||
end_of_line = crlf
|
||||
|
||||
; this VS-specific stuff is based on experiments to see how VS will modify a file after it has been manually edited.
|
||||
; the settings are meant to closely match what VS does to minimize unnecessary diffs.
|
||||
[*.{vcxproj,vcxproj.filters}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = crlf
|
||||
charset = utf-8-bom
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
||||
; must be broken out because of 51-char bug (https://github.com/editorconfig/editorconfig-visualstudio/issues/21)
|
||||
[*.{csproj,pyproj,props,targets}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = crlf
|
||||
charset = utf-8-bom
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
||||
[*.{sln,sln.template}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
|
@ -1,4 +1,4 @@
|
|||
#if HDRP_PRESENT
|
||||
#if HDRP_PRESENT
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if HDRP_PRESENT
|
||||
#if HDRP_PRESENT
|
||||
|
||||
using UnityEditor.Rendering.HighDefinition;
|
||||
using UnityEngine.Perception.GroundTruth;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using UnityEditorInternal;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Perception.GroundTruth;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using UnityEditorInternal;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.Perception.GroundTruth
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if HDRP_PRESENT
|
||||
#if HDRP_PRESENT
|
||||
|
||||
using System;
|
||||
using UnityEditor.Rendering.HighDefinition;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if HDRP_PRESENT
|
||||
#if HDRP_PRESENT
|
||||
|
||||
using System;
|
||||
using UnityEditor.Rendering.HighDefinition;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
|
||||
namespace UnityEngine.Perception.GroundTruth
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
obj.Add(value.z);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static JToken ToJToken(Quaternion value)
|
||||
{
|
||||
var obj = new JArray();
|
||||
|
@ -28,6 +29,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
obj.Add(value.w);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static JToken ToJToken(float3x3 value)
|
||||
{
|
||||
var obj = new JArray();
|
||||
|
@ -36,6 +38,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
obj.Add(ToJToken(value.c2));
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static JToken ToJToken(float3 value)
|
||||
{
|
||||
var obj = new JArray();
|
||||
|
@ -44,6 +47,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
obj.Add(value.z);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static JToken ToJToken<T>(T value)
|
||||
{
|
||||
switch (value)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEngine.Perception.GroundTruth
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
|
@ -53,8 +53,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
labelSetupSystem?.Deactivate(this);
|
||||
}
|
||||
|
||||
|
||||
protected RendererListDesc CreateRendererListDesc(Camera camera, CullingResults cullingResult, string overrideMaterialPassName, int overrideMaterialPassIndex, Material overrideMaterial, LayerMask layerMask/*, PerObjectData perObjectData*/)
|
||||
protected RendererListDesc CreateRendererListDesc(Camera camera, CullingResults cullingResult, string overrideMaterialPassName, int overrideMaterialPassIndex, Material overrideMaterial, LayerMask layerMask /*, PerObjectData perObjectData*/)
|
||||
{
|
||||
var shaderPasses = new[]
|
||||
{
|
||||
|
@ -85,7 +84,6 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static void DrawRendererList(ScriptableRenderContext renderContext, CommandBuffer cmd, RendererList rendererList)
|
||||
{
|
||||
if (!rendererList.isValid)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Unity.Entities;
|
||||
using Unity.Entities;
|
||||
|
||||
namespace UnityEngine.Perception.GroundTruth
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Unity.Entities;
|
||||
|
||||
|
@ -22,8 +22,8 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
protected override void OnCreate()
|
||||
{
|
||||
//These are here to inform the system runner the queries we are interested in. Without these calls, OnUpdate() might not be called
|
||||
GetEntityQuery( ComponentType.Exclude<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
|
||||
GetEntityQuery( ComponentType.ReadOnly<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
|
||||
GetEntityQuery(ComponentType.Exclude<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
|
||||
GetEntityQuery(ComponentType.ReadOnly<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
@ -91,7 +91,6 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
var gameObject = labeling.gameObject;
|
||||
InitGameObjectRecursive(gameObject, m_MaterialPropertyBlocks.Value, labeling, info.instanceId);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if URP_PRESENT
|
||||
#if URP_PRESENT
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
@ -47,7 +47,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
|
||||
public class GroundTruthRendererFeature : ScriptableRendererFeature
|
||||
{
|
||||
public override void Create() { }
|
||||
public override void Create() {}
|
||||
|
||||
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEngine.Perception.GroundTruth
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Profiling;
|
||||
using UnityEngine;
|
||||
|
@ -31,7 +31,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
/// <param name="targetCamera"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public InstanceSegmentationCrossPipelinePass(Camera targetCamera)
|
||||
:base(targetCamera)
|
||||
: base(targetCamera)
|
||||
{
|
||||
if (targetCamera == null)
|
||||
throw new ArgumentNullException(nameof(targetCamera));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if HDRP_PRESENT
|
||||
#if HDRP_PRESENT
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEngine.Perception.GroundTruth
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if HDRP_PRESENT
|
||||
#if HDRP_PRESENT
|
||||
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using System;
|
||||
|
@ -50,7 +50,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
m_InstanceIdToClassIdLookup.Resize((int)instanceId + 1, NativeArrayOptions.ClearMemory);
|
||||
}
|
||||
m_IdBuffersNeedUpdating = true;
|
||||
m_InstanceIdToClassIdLookup[(int) instanceId] = index + 1;
|
||||
m_InstanceIdToClassIdLookup[(int)instanceId] = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
|
@ -93,7 +93,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
/// </summary>
|
||||
public event Action<int, NativeArray<RenderedObjectInfo>> renderedObjectInfosCalculated;
|
||||
|
||||
internal event Action<int,NativeArray<uint>> segmentationImageReceived;
|
||||
internal event Action<int, NativeArray<uint>> segmentationImageReceived;
|
||||
|
||||
internal event Action<NativeSlice<uint>, IReadOnlyList<LabelingConfigurationEntry>, int> classCountsReceived;
|
||||
|
||||
|
@ -394,6 +394,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
if (produceSegmentationImages)
|
||||
customPassVolume.customPasses.Add(m_SemanticSegmentationPass);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void ProduceBoundingBoxesAnnotation(NativeArray<RenderedObjectInfo> renderedObjectInfos, List<LabelingConfigurationEntry> labelingConfigurations, int frameCount)
|
||||
|
@ -592,7 +593,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
{
|
||||
var stride = dataColorBuffer.Length / height;
|
||||
var buffer = new NativeArray<byte>(stride, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
|
||||
fixed (byte* colorBufferPtr = &dataColorBuffer[0])
|
||||
fixed(byte* colorBufferPtr = &dataColorBuffer[0])
|
||||
{
|
||||
var unsafePtr = (byte*)buffer.GetUnsafePtr();
|
||||
for (var row = 0; row < height / 2; row++)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Unity.Collections;
|
||||
using Unity.Simulation;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
// ReSharper disable NonReadonlyMemberInGetHashCode
|
||||
|
||||
namespace UnityEngine.Perception.GroundTruth
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using Unity.Burst;
|
||||
using Unity.Collections;
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if HDRP_PRESENT
|
||||
#if HDRP_PRESENT
|
||||
|
||||
using System;
|
||||
using UnityEngine.Rendering;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using Unity.Entities;
|
||||
|
||||
namespace UnityEngine.Perception.GroundTruth
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Unity.Simulation;
|
||||
|
@ -270,7 +270,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
/// <param name="sensorSpatialData">Spatial data describing the sensor and the ego containing it.</param>
|
||||
/// <param name="additionalSensorValues">Additional values to be emitted as json name/value pairs on the sensor object under the capture.</param>
|
||||
/// <exception cref="InvalidOperationException">Thrown if ReportCapture is being called when ShouldCaptureThisFrame is false or it has already been called this frame.</exception>
|
||||
public void ReportCapture(string filename, SensorSpatialData sensorSpatialData, params (string, object)[] additionalSensorValues)
|
||||
public void ReportCapture(string filename, SensorSpatialData sensorSpatialData, params(string, object)[] additionalSensorValues)
|
||||
{
|
||||
if (!ShouldCaptureThisFrame)
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
/// <param name="left">The first SensorHandle.</param>
|
||||
/// <param name="right">The second SensorHandle.</param>
|
||||
/// <returns>Returns true if the two SensorHandles refer to the same sensor.</returns>
|
||||
public static bool operator ==(SensorHandle left, SensorHandle right)
|
||||
public static bool operator==(SensorHandle left, SensorHandle right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
/// <param name="left">The first SensorHandle.</param>
|
||||
/// <param name="right">The second SensorHandle.</param>
|
||||
/// <returns>Returns false if the two SensorHandles refer to the same sensor.</returns>
|
||||
public static bool operator !=(SensorHandle left, SensorHandle right)
|
||||
public static bool operator!=(SensorHandle left, SensorHandle right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
@ -660,19 +660,18 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
/// <param name="left">The first EgoHandle.</param>
|
||||
/// <param name="right">The second EgoHandle.</param>
|
||||
/// <returns>Returns true if the two EgoHandles refer to the same ego.</returns>
|
||||
public static bool operator ==(EgoHandle left, EgoHandle right)
|
||||
public static bool operator==(EgoHandle left, EgoHandle right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="EgoHandle"/> instances for inequality.
|
||||
/// </summary>
|
||||
/// <param name="left">The first EgoHandle.</param>
|
||||
/// <param name="right">The second EgoHandle.</param>
|
||||
/// <returns>Returns true if the two EgoHandles refer to the same ego.</returns>
|
||||
public static bool operator !=(EgoHandle left, EgoHandle right)
|
||||
public static bool operator!=(EgoHandle left, EgoHandle right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
@ -692,6 +691,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Equals(MetricDefinition other)
|
||||
{
|
||||
|
@ -802,5 +802,4 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
return sensorSpatialData;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
public float Timestamp;
|
||||
public Guid SequenceId;
|
||||
public (string, object)[] AdditionalSensorValues;
|
||||
public List<(Annotation, AnnotationData )> Annotations = new List<(Annotation, AnnotationData)>();
|
||||
public List<(Annotation, AnnotationData)> Annotations = new List<(Annotation, AnnotationData)>();
|
||||
public bool CaptureReported;
|
||||
|
||||
public PendingCapture(Guid id, SensorHandle sensorHandle, SensorData sensorData, Guid sequenceId, int frameCount, int step, float timestamp)
|
||||
|
@ -211,7 +211,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
}
|
||||
}
|
||||
|
||||
internal void ReportCapture(SensorHandle sensorHandle, string filename, SensorSpatialData sensorSpatialData, params (string, object)[] additionalSensorValues)
|
||||
internal void ReportCapture(SensorHandle sensorHandle, string filename, SensorSpatialData sensorSpatialData, params(string, object)[] additionalSensorValues)
|
||||
{
|
||||
var sensorData = m_Sensors[sensorHandle];
|
||||
var pendingCapture = GetOrCreatePendingCaptureForThisFrame(sensorHandle, out _);
|
||||
|
@ -411,7 +411,8 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
do
|
||||
{
|
||||
sensorData.sequenceTimeNextCapture += sensorData.period;
|
||||
} while (sensorData.sequenceTimeNextCapture <= UnscaledSequenceTime);
|
||||
}
|
||||
while (sensorData.sequenceTimeNextCapture <= UnscaledSequenceTime);
|
||||
|
||||
sensorData.lastCaptureFrameCount = Time.frameCount;
|
||||
m_Sensors[activeSensor] = sensorData;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
@ -293,7 +293,7 @@ namespace UnityEngine.Perception.GroundTruth
|
|||
|
||||
if (pendingCapture.AdditionalSensorValues != null)
|
||||
{
|
||||
foreach (var (name, value) in pendingCapture.AdditionalSensorValues)
|
||||
foreach (var(name, value) in pendingCapture.AdditionalSensorValues)
|
||||
sensorJObject.Add(name, DatasetJsonUtility.ToJToken(value));
|
||||
}
|
||||
|
||||
|
|
|
@ -64,11 +64,11 @@ namespace EditorTests.BuildTests
|
|||
}
|
||||
else if (targetPath.EndsWith(".unity"))
|
||||
if (targetPath.EndsWith(".unity"))
|
||||
{
|
||||
Debug.Log("Scenes Path : " + targetPath);
|
||||
{
|
||||
Debug.Log("Scenes Path : " + targetPath);
|
||||
|
||||
m_EditorBuildSettingsScenes.Add(new EditorBuildSettingsScene(targetPath, true));
|
||||
}
|
||||
m_EditorBuildSettingsScenes.Add(new EditorBuildSettingsScene(targetPath, true));
|
||||
}
|
||||
}
|
||||
EditorBuildSettings.scenes = m_EditorBuildSettingsScenes.ToArray();
|
||||
}
|
||||
|
@ -88,4 +88,3 @@ namespace EditorTests.BuildTests
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
|
@ -55,7 +55,7 @@ namespace GroundTruthTests
|
|||
}, new uint[]
|
||||
{
|
||||
1,
|
||||
0
|
||||
0
|
||||
},
|
||||
2,
|
||||
BoundingBoxOrigin.BottomLeft,
|
||||
|
@ -144,7 +144,7 @@ namespace GroundTruthTests
|
|||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator ProducesCorrectBoundingBoxes([ValueSource(nameof(ProducesCorrectBoundingBoxesTestCases))]ProducesCorrectBoundingBoxesData producesCorrectBoundingBoxesData)
|
||||
public IEnumerator ProducesCorrectBoundingBoxes([ValueSource(nameof(ProducesCorrectBoundingBoxesTestCases))] ProducesCorrectBoundingBoxesData producesCorrectBoundingBoxesData)
|
||||
{
|
||||
var label = "label";
|
||||
var label2 = "label2";
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace GroundTruthTests
|
|||
var jsonActual = DatasetJsonUtility.ToJToken(new Vector3(x, y, z));
|
||||
Assert.AreEqual(jsonExpected, jsonActual.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase(-2f, 0f, 3f, 4f, @"[
|
||||
-2.0,
|
||||
|
@ -52,6 +53,7 @@ namespace GroundTruthTests
|
|||
var jsonActual = DatasetJsonUtility.ToJToken(new Quaternion(x, y, z, w)).ToString();
|
||||
Assert.AreEqual(jsonExpected, jsonActual);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase(0.1f, 0.2f, 0.3f, 4f, 5f, 6f, 70f, 80f, 90f, @"[
|
||||
[
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -47,7 +47,7 @@ namespace GroundTruthTests
|
|||
|
||||
//TestHelper.LoadAndStartRenderDocCapture(out EditorWindow gameView);
|
||||
var startFrameCount = Time.frameCount;
|
||||
var expectedFramesAndCounts= new Dictionary<int, int>()
|
||||
var expectedFramesAndCounts = new Dictionary<int, int>()
|
||||
{
|
||||
{Time.frameCount , 0},
|
||||
{startFrameCount + 1, 1},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -71,7 +71,7 @@ namespace GroundTruthTests
|
|||
|
||||
//Put a plane in front of the camera
|
||||
var planeObject = GameObject.CreatePrimitive(PrimitiveType.Plane);
|
||||
planeObject.transform.SetPositionAndRotation(new Vector3(0, 0, 10), Quaternion.Euler(90, 0, 0) );
|
||||
planeObject.transform.SetPositionAndRotation(new Vector3(0, 0, 10), Quaternion.Euler(90, 0, 0));
|
||||
planeObject.transform.localScale = new Vector3(10, -1, 10);
|
||||
planeObject.AddComponent<Labeling>();
|
||||
AddTestObjectForCleanup(planeObject);
|
||||
|
@ -86,6 +86,7 @@ namespace GroundTruthTests
|
|||
|
||||
Assert.AreEqual(4, timesSegmentationImageReceived);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator SegmentationPassProducesCorrectValuesEachFrame()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
@ -25,7 +25,8 @@ namespace GroundTruthTests
|
|||
var period = .4f;
|
||||
SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime);
|
||||
|
||||
float[] deltaTimeSamplesExpected = {
|
||||
float[] deltaTimeSamplesExpected =
|
||||
{
|
||||
firstCaptureTime,
|
||||
period,
|
||||
period,
|
||||
|
@ -50,7 +51,8 @@ namespace GroundTruthTests
|
|||
Time.timeScale = timeScale;
|
||||
SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime);
|
||||
|
||||
float[] deltaTimeSamplesExpected = {
|
||||
float[] deltaTimeSamplesExpected =
|
||||
{
|
||||
timeScale * firstCaptureTime,
|
||||
timeScale * period,
|
||||
timeScale * period,
|
||||
|
@ -95,7 +97,8 @@ namespace GroundTruthTests
|
|||
var ego = SimulationManager.RegisterEgo("ego");
|
||||
var firstCaptureTime = 2f;
|
||||
var period = 1f;
|
||||
float[] newTimeScalesPerFrame = {
|
||||
float[] newTimeScalesPerFrame =
|
||||
{
|
||||
2f,
|
||||
10f,
|
||||
.01f,
|
||||
|
@ -103,7 +106,8 @@ namespace GroundTruthTests
|
|||
};
|
||||
SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime);
|
||||
|
||||
float[] deltaTimeSamplesExpected = {
|
||||
float[] deltaTimeSamplesExpected =
|
||||
{
|
||||
newTimeScalesPerFrame[0] * firstCaptureTime,
|
||||
newTimeScalesPerFrame[1] * period,
|
||||
newTimeScalesPerFrame[2] * period,
|
||||
|
@ -144,14 +148,15 @@ namespace GroundTruthTests
|
|||
var sensor3 = SimulationManager.RegisterSensor(ego, "cam", "3", 1, 1);
|
||||
sensor3.Enabled = false;
|
||||
|
||||
(float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[] samplesExpected = {
|
||||
(float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[] samplesExpected =
|
||||
{
|
||||
((float)firstCaptureTime1, true, true),
|
||||
(4, true, false),
|
||||
(2, false, true),
|
||||
(2, true, false),
|
||||
(4, true, true)
|
||||
};
|
||||
var samplesActual = new (float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[samplesExpected.Length];
|
||||
var samplesActual = new(float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[samplesExpected.Length];
|
||||
for (int i = 0; i < samplesActual.Length; i++)
|
||||
{
|
||||
yield return null;
|
||||
|
@ -164,7 +169,7 @@ namespace GroundTruthTests
|
|||
[Test]
|
||||
public void Enabled_StartsTrue()
|
||||
{
|
||||
var sensor1 = SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "cam", "1", 1,1);
|
||||
var sensor1 = SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "cam", "1", 1, 1);
|
||||
Assert.IsTrue(sensor1.Enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
@ -167,7 +167,7 @@ namespace GroundTruthTests
|
|||
[UnityTest]
|
||||
public IEnumerator StartNewSequence_ProperlyIncrementsSequence()
|
||||
{
|
||||
var timingsExpected = new (int step, int timestamp, bool expectNewSequence)[]
|
||||
var timingsExpected = new(int step, int timestamp, bool expectNewSequence)[]
|
||||
{
|
||||
(0, 0, true),
|
||||
(1, 2, false),
|
||||
|
@ -240,7 +240,7 @@ namespace GroundTruthTests
|
|||
var filename = "my/file.png";
|
||||
var annotationDefinitionGuid = Guid.NewGuid();
|
||||
|
||||
var annotationDefinitionsJsonExpected=
|
||||
var annotationDefinitionsJsonExpected =
|
||||
$@"{{
|
||||
""version"": ""{SimulationManager.SchemaVersion}"",
|
||||
""annotation_definitions"": [
|
||||
|
@ -252,7 +252,7 @@ namespace GroundTruthTests
|
|||
}}
|
||||
]
|
||||
}}";
|
||||
var annotationsJsonExpected=
|
||||
var annotationsJsonExpected =
|
||||
$@" ""annotations"": [
|
||||
{{
|
||||
""id"": <guid>,
|
||||
|
@ -333,7 +333,7 @@ namespace GroundTruthTests
|
|||
var ego = SimulationManager.RegisterEgo("");
|
||||
var annotationDefinition = SimulationManager.RegisterAnnotationDefinition("");
|
||||
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
|
||||
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportAnnotationFile(annotationDefinition, ""));
|
||||
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportAnnotationFile(annotationDefinition, ""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -342,7 +342,7 @@ namespace GroundTruthTests
|
|||
var ego = SimulationManager.RegisterEgo("");
|
||||
var annotationDefinition = SimulationManager.RegisterAnnotationDefinition("");
|
||||
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
|
||||
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportAnnotationValues(annotationDefinition, new int[0]));
|
||||
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportAnnotationValues(annotationDefinition, new int[0]));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -351,7 +351,7 @@ namespace GroundTruthTests
|
|||
var ego = SimulationManager.RegisterEgo("");
|
||||
var annotationDefinition = SimulationManager.RegisterAnnotationDefinition("");
|
||||
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
|
||||
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportAnnotationAsync(annotationDefinition));
|
||||
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportAnnotationAsync(annotationDefinition));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -417,7 +417,6 @@ namespace GroundTruthTests
|
|||
StringAssert.Contains(expectedAnnotation, EscapeGuids(File.ReadAllText(capturesPath)));
|
||||
}
|
||||
|
||||
|
||||
public struct TestValues
|
||||
{
|
||||
public string a;
|
||||
|
@ -479,7 +478,7 @@ namespace GroundTruthTests
|
|||
{
|
||||
var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
var annotationDefinitionsJsonExpected=
|
||||
var annotationDefinitionsJsonExpected =
|
||||
$@"{{
|
||||
""version"": ""{SimulationManager.SchemaVersion}"",
|
||||
""annotation_definitions"": [
|
||||
|
@ -508,7 +507,7 @@ namespace GroundTruthTests
|
|||
{
|
||||
var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
var annotationDefinitionsJsonExpected=
|
||||
var annotationDefinitionsJsonExpected =
|
||||
$@"{{
|
||||
""version"": ""{SimulationManager.SchemaVersion}"",
|
||||
""annotation_definitions"": [
|
||||
|
@ -544,7 +543,7 @@ namespace GroundTruthTests
|
|||
var ego = SimulationManager.RegisterEgo("");
|
||||
var metricDefinition = SimulationManager.RegisterMetricDefinition("");
|
||||
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
|
||||
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportMetric(metricDefinition, new int[0]));
|
||||
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportMetric(metricDefinition, new int[0]));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -553,7 +552,7 @@ namespace GroundTruthTests
|
|||
var ego = SimulationManager.RegisterEgo("");
|
||||
var metricDefinition = SimulationManager.RegisterMetricDefinition("");
|
||||
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
|
||||
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportMetricAsync(metricDefinition));
|
||||
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportMetricAsync(metricDefinition));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -739,7 +738,7 @@ namespace GroundTruthTests
|
|||
{
|
||||
var metricDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
var metricDefinitionsJsonExpected=
|
||||
var metricDefinitionsJsonExpected =
|
||||
$@"{{
|
||||
""version"": ""{SimulationManager.SchemaVersion}"",
|
||||
""metric_definitions"": [
|
||||
|
@ -784,7 +783,7 @@ namespace GroundTruthTests
|
|||
public void CreateAnnotationOrMetric_WithSpecValues_WritesProperTypes(
|
||||
[Values(AdditionalInfoKind.Annotation, AdditionalInfoKind.Metric)] AdditionalInfoKind additionalInfoKind)
|
||||
{
|
||||
var specValues = new []
|
||||
var specValues = new[]
|
||||
{
|
||||
new TestSpec
|
||||
{
|
||||
|
@ -815,7 +814,7 @@ namespace GroundTruthTests
|
|||
jsonContainerName = "metric_definitions";
|
||||
}
|
||||
|
||||
var annotationDefinitionsJsonExpected=
|
||||
var annotationDefinitionsJsonExpected =
|
||||
$@"{{
|
||||
""version"": ""{SimulationManager.SchemaVersion}"",
|
||||
""{jsonContainerName}"": [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GroundTruthTests
|
||||
|
@ -15,6 +15,7 @@ namespace GroundTruthTests
|
|||
labeling.labels.Add(label);
|
||||
return planeObject;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static void LoadAndStartRenderDocCapture(out UnityEditor.EditorWindow gameView)
|
||||
{
|
||||
|
@ -24,6 +25,7 @@ namespace GroundTruthTests
|
|||
gameView = UnityEditor.EditorWindow.GetWindow(type);
|
||||
UnityEditorInternal.RenderDoc.BeginCaptureRenderDoc(gameView);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче