-
Notifications
You must be signed in to change notification settings - Fork 3
/
DepthCameraSensor.cs
47 lines (42 loc) · 1.47 KB
/
DepthCameraSensor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Copyright (c) 2019-2021 LG Electronics, Inc.
*
* This software contains code licensed as described in LICENSE.
*
*/
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using Simulator.Bridge.Data;
using Simulator.Utilities;
using Simulator.PointCloud;
namespace Simulator.Sensors
{
[SensorType("Depth Camera", new[] {typeof(ImageData)})]
public class DepthCameraSensor : CameraSensorBase
{
private ShaderTagId passId;
protected override void Initialize()
{
base.Initialize();
passId = new ShaderTagId("SimulatorDepthPass");
CameraTargetTextureReadWriteType = RenderTextureReadWrite.Linear;
SensorCamera.GetComponent<HDAdditionalCameraData>().customRender += CustomRender;
}
void CustomRender(ScriptableRenderContext context, HDCamera hd)
{
var cmd = CommandBufferPool.Get();
SensorPassRenderer.Render(context, cmd, hd, renderTarget, passId, Color.clear);
if (!Fisheye)
{
PointCloudManager.RenderDepth(context, cmd, hd, renderTarget.ColorHandle, renderTarget.DepthHandle);
}
CommandBufferPool.Release(cmd);
}
public override bool Save(string path, int quality, int compression)
{
// Hide base.Save() since DepthCameraSensor does not support Save function for now.
return false;
}
}
}