Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHUnity committed Apr 23, 2020
1 parent dab4e84 commit 9d60861
Show file tree
Hide file tree
Showing 40 changed files with 171 additions and 87 deletions.
74 changes: 74 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if HDRP_PRESENT
#if HDRP_PRESENT

using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if HDRP_PRESENT
#if HDRP_PRESENT

using UnityEditor.Rendering.HighDefinition;
using UnityEngine.Perception.GroundTruth;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UnityEditorInternal;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Perception.GroundTruth;

Expand Down
2 changes: 1 addition & 1 deletion com.unity.perception/Editor/GroundTruth/LabelingEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UnityEditorInternal;
using UnityEditorInternal;
using UnityEngine;

namespace UnityEditor.Perception.GroundTruth
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if HDRP_PRESENT
#if HDRP_PRESENT

using System;
using UnityEditor.Rendering.HighDefinition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if HDRP_PRESENT
#if HDRP_PRESENT

using System;
using UnityEditor.Rendering.HighDefinition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace UnityEngine.Perception.GroundTruth
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static JToken ToJToken(Vector3 value)
obj.Add(value.z);
return obj;
}

public static JToken ToJToken(Quaternion value)
{
var obj = new JArray();
Expand All @@ -28,6 +29,7 @@ public static JToken ToJToken(Quaternion value)
obj.Add(value.w);
return obj;
}

public static JToken ToJToken(float3x3 value)
{
var obj = new JArray();
Expand All @@ -36,6 +38,7 @@ public static JToken ToJToken(float3x3 value)
obj.Add(ToJToken(value.c2));
return obj;
}

public static JToken ToJToken(float3 value)
{
var obj = new JArray();
Expand All @@ -44,6 +47,7 @@ public static JToken ToJToken(float3 value)
obj.Add(value.z);
return obj;
}

public static JToken ToJToken<T>(T value)
{
switch (value)
Expand Down
2 changes: 1 addition & 1 deletion com.unity.perception/Runtime/GroundTruth/Ego.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using UnityEngine;

namespace UnityEngine.Perception.GroundTruth
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
Expand Down Expand Up @@ -53,8 +53,7 @@ public void Cleanup()
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[]
{
Expand Down Expand Up @@ -85,7 +84,6 @@ protected RendererListDesc CreateRendererListDesc(Camera camera, CullingResults
return result;
}


public static void DrawRendererList(ScriptableRenderContext renderContext, CommandBuffer cmd, RendererList rendererList)
{
if (!rendererList.isValid)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Unity.Entities;
using Unity.Entities;

namespace UnityEngine.Perception.GroundTruth
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading;
using Unity.Entities;

Expand All @@ -22,8 +22,8 @@ public class GroundTruthLabelSetupSystem : ComponentSystem
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/>
Expand Down Expand Up @@ -91,7 +91,6 @@ public void Activate(IGroundTruthGenerator generator)
var gameObject = labeling.gameObject;
InitGameObjectRecursive(gameObject, m_MaterialPropertyBlocks.Value, labeling, info.instanceId);
});

}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if URP_PRESENT
#if URP_PRESENT
using System;
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -47,7 +47,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData

public class GroundTruthRendererFeature : ScriptableRendererFeature
{
public override void Create() { }
public override void Create() {}

public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;

namespace UnityEngine.Perception.GroundTruth
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Unity.Profiling;
using UnityEngine;
Expand Down Expand Up @@ -31,7 +31,7 @@ class InstanceSegmentationCrossPipelinePass : GroundTruthCrossPipelinePass
/// <param name="targetCamera"></param>
/// <exception cref="ArgumentNullException"></exception>
public InstanceSegmentationCrossPipelinePass(Camera targetCamera)
:base(targetCamera)
: base(targetCamera)
{
if (targetCamera == null)
throw new ArgumentNullException(nameof(targetCamera));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if HDRP_PRESENT
#if HDRP_PRESENT

using System;
using JetBrains.Annotations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;

namespace UnityEngine.Perception.GroundTruth
Expand Down
4 changes: 2 additions & 2 deletions com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if HDRP_PRESENT
#if HDRP_PRESENT

using Unity.Collections.LowLevel.Unsafe;
using System;
Expand Down Expand Up @@ -50,7 +50,7 @@ public override void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRend
m_InstanceIdToClassIdLookup.Resize((int)instanceId + 1, NativeArrayOptions.ClearMemory);
}
m_IdBuffersNeedUpdating = true;
m_InstanceIdToClassIdLookup[(int) instanceId] = index + 1;
m_InstanceIdToClassIdLookup[(int)instanceId] = index + 1;
}
}

Expand Down
7 changes: 4 additions & 3 deletions com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
Expand Down Expand Up @@ -93,7 +93,7 @@ public class PerceptionCamera : MonoBehaviour
/// </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;

Expand Down Expand Up @@ -394,6 +394,7 @@ void SetupPasses(CustomPassVolume customPassVolume)
if (produceSegmentationImages)
customPassVolume.customPasses.Add(m_SemanticSegmentationPass);
}

#endif

void ProduceBoundingBoxesAnnotation(NativeArray<RenderedObjectInfo> renderedObjectInfos, List<LabelingConfigurationEntry> labelingConfigurations, int frameCount)
Expand Down Expand Up @@ -592,7 +593,7 @@ static unsafe void FlipImageY(byte[] dataColorBuffer, int height)
{
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++)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using Unity.Collections;
using Unity.Simulation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
// ReSharper disable NonReadonlyMemberInGetHashCode

namespace UnityEngine.Perception.GroundTruth
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if HDRP_PRESENT
#if HDRP_PRESENT

using System;
using UnityEngine.Rendering;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Unity.Entities;

namespace UnityEngine.Perception.GroundTruth
Expand Down
Loading

0 comments on commit 9d60861

Please sign in to comment.