浏览代码

Fix warnings 0.2.0 (#39)

* Fixing compilation warnings and ensure warnings are treated as errors in test projects.

* Updating changelog
/0.2.0-staging
GitHub 4 年前
当前提交
e8f1bc9f
共有 11 个文件被更改,包括 45 次插入13 次删除
  1. 4
      TestProjects/PerceptionURP/Assets/ExampleScripts/CustomAnnotationAndMetricReporter.cs
  2. 15
      com.unity.perception/CHANGELOG.md
  3. 4
      com.unity.perception/Documentation~/DatasetCapture.md
  4. 3
      com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs
  5. 5
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
  6. 6
      com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs
  7. 5
      com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs
  8. 1
      TestProjects/PerceptionURP/Assets/csc.rsp
  9. 7
      TestProjects/PerceptionURP/Assets/csc.rsp.meta
  10. 1
      TestProjects/PerceptionHDRP/Assets/csc.rsp
  11. 7
      TestProjects/PerceptionHDRP/Assets/csc.rsp.meta

4
TestProjects/PerceptionURP/Assets/ExampleScripts/CustomAnnotationAndMetricReporter.cs


[RequireComponent(typeof(PerceptionCamera))]
public class CustomAnnotationAndMetricReporter : MonoBehaviour
{
public GameObject light;
public GameObject targetLight;
public GameObject target;
MetricDefinition lightMetricDefinition;

public void Update()
{
//Report the light's position by manually creating the json array string.
var lightPos = light.transform.position;
var lightPos = targetLight.transform.position;
DatasetCapture.ReportMetric(lightMetricDefinition,
$@"[{{ ""x"": {lightPos.x}, ""y"": {lightPos.y}, ""z"": {lightPos.z} }}]");
//compute the location of the object in the camera's local space

15
com.unity.perception/CHANGELOG.md


The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
### Changed
### Deprecated
### Removed
### Fixed
Fixed compilation warnings with latest com.unity.simulation.core package.
### Security
## [0.2.0-preview.2] - 2020-07-15
### Fixed
Fixed bug that prevented RGB captures to be written out to disk

4
com.unity.perception/Documentation~/DatasetCapture.md


[RequireComponent(typeof(PerceptionCamera))]
public class CustomAnnotationAndMetricReporter : MonoBehaviour
{
public GameObject light;
public GameObject targetLight;
public GameObject target;
MetricDefinition lightMetricDefinition;

public void Update()
{
//Report the light's position by manually creating the json array string.
var lightPos = light.transform.position;
var lightPos = targetLight.transform.position;
DatasetCapture.ReportMetric(lightMetricDefinition,
$@"[{{ ""x"": {lightPos.x}, ""y"": {lightPos.y}, ""z"": {lightPos.z} }}]");
//compute the location of the object in the camera's local space

3
com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs


height = targetTexture.height,
path = localPath
};
asyncRequest.Start((r) =>
asyncRequest.Enqueue((r) =>
{
Profiler.BeginSample("Encode");
var pngBytes = ImageConversion.EncodeArrayToPNG(r.data.data.ToArray(), GraphicsFormat.R8G8B8A8_UNorm, (uint)r.data.width, (uint)r.data.height);

r.data.data.Dispose();
return AsyncRequest.Result.Completed;
});
asyncRequest.Execute();
}
/// <inheritdoc/>

5
com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs


bool m_CapturedLastFrame;
Ego m_EgoMarker;
#pragma warning disable 414
#pragma warning restore 414
/// <summary>
/// The <see cref="SensorHandle"/> associated with this camera. Use this to report additional annotations and metrics at runtime.

using (s_WriteFrame.Auto())
{
var dataColorBuffer = (byte[])r.data.colorBuffer;
byte[] encodedData;
using (s_EncodeAndSave.Auto())
{

6
com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs


PendingCaptures = pendingCapturesToWrite,
SimulationState = this
};
req.Start(r =>
req.Enqueue(r =>
req.Execute(AsyncRequest.ExecutionContext.JobSystem);
}
m_SerializeCapturesSampler.End();

MetricFileIndex = m_MetricsFileIndex,
PendingMetrics = pendingMetricsToWrite
};
req.Start(r =>
req.Enqueue(r =>
req.Execute();
}
m_MetricsFileIndex++;

5
com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs


using NUnit.Framework;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Experimental.Rendering;
using UnityEngine.UIElements;
using Object = UnityEngine.Object;
namespace GroundTruthTests

[UnityTest]
public IEnumerator SemanticSegmentationPass_WithTextureOverride_RendersToOverride()
{
int timesSegmentationImageReceived = 0;
var expectedPixelValue = new Color32(0, 0, 255, 255);
var targetTextureOverride = new RenderTexture(2, 2, 1, RenderTextureFormat.R8);

1
TestProjects/PerceptionURP/Assets/csc.rsp


-warnaserror+

7
TestProjects/PerceptionURP/Assets/csc.rsp.meta


fileFormatVersion: 2
guid: 1800f44b598c0b647bf3fad2f5c9b957
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1
TestProjects/PerceptionHDRP/Assets/csc.rsp


-warnaserror+

7
TestProjects/PerceptionHDRP/Assets/csc.rsp.meta


fileFormatVersion: 2
guid: b590f0b421136b44098ad7e92fc45f3e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存