Steven Borkman
4 年前
当前提交
31016ce0
共有 42 个文件被更改,包括 2096 次插入 和 110 次删除
-
2TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity
-
4com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs
-
96com.unity.perception/Tests/Runtime/GroundTruthTests/VisualizationTests.cs
-
11com.unity.perception/Tests/Runtime/GroundTruthTests/VisualizationTests.cs.meta
-
125com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/ControlPanel.cs
-
131com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/HUDPanel.cs
-
41com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/KeyValuePanel.cs
-
168com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/SegmentationMaterial.mat
-
287com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/KeyValuePanel.prefab
-
74com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegRemoveBackgroundShader.shader
-
73com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegmentTexture.prefab
-
1001com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/VisualizationUI.prefab
-
7com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/VisualizationUI.prefab.meta
-
79com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/VisualizationCanvas.cs
-
96com.unity.perception/Tests/Runtime/GroundTruthTests/VisualizationTests.cs
-
11com.unity.perception/Tests/Runtime/GroundTruthTests/VisualizationTests.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/ControlPanel.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Textures.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Textures
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/VisualizationCanvas.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/HUDPanel.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/KeyValuePanel.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/SegmentationMaterial.mat.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/OutlineMaterial.mat
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/OutlineMaterial.mat.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/BoundingBoxPrefab.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/BoundingBoxPrefab.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericSlider.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericSlider.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericToggle.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericToggle.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/Inter-Light.otf
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/Inter-Light.otf.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegmentTexture.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegRemoveBackgroundShader.shader.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/KeyValuePanel.prefab.meta
|
|||
using System.Collections; |
|||
using System.Text.RegularExpressions; |
|||
using NUnit.Framework; |
|||
using UnityEngine; |
|||
using UnityEngine.Perception.GroundTruth; |
|||
using UnityEngine.TestTools; |
|||
|
|||
namespace GroundTruthTests |
|||
{ |
|||
[TestFixture] |
|||
public class VisualizationTests : GroundTruthTestBase |
|||
{ |
|||
[Test] |
|||
public void VisualizedCamera_SetsUpCanvasAndSecondCamera() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(VisualizedCamera_SetsUpCanvasAndSecondCamera); |
|||
object1.SetActive(false); |
|||
var camera = object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
object1.SetActive(true); |
|||
AddTestObjectForCleanup(object1); |
|||
|
|||
Assert.IsNotNull(camera.targetTexture); |
|||
Assert.IsNotNull(GameObject.Find(nameof(VisualizedCamera_SetsUpCanvasAndSecondCamera) + "_VisualizationCamera")); |
|||
Assert.IsNotNull(GameObject.Find(nameof(VisualizedCamera_SetsUpCanvasAndSecondCamera) + "_VisualizationCanvas")); |
|||
} |
|||
[Test] |
|||
public void TwoCamerasVisualizing_CausesWarningAndDisablesVisualization() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(TwoCamerasVisualizing_CausesWarningAndDisablesVisualization); |
|||
object1.SetActive(false); |
|||
object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
AddTestObjectForCleanup(object1); |
|||
|
|||
var object2 = new GameObject(); |
|||
object2.SetActive(false); |
|||
object2.name = nameof(TwoCamerasVisualizing_CausesWarningAndDisablesVisualization) + "2"; |
|||
object2.AddComponent<Camera>(); |
|||
var perceptionCamera2 = object2.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera2.showVisualizations = true; |
|||
AddTestObjectForCleanup(object2); |
|||
|
|||
object1.SetActive(true); |
|||
LogAssert.Expect(LogType.Warning, $"Currently only one PerceptionCamera may be visualized at a time. Disabling visualization on {nameof(TwoCamerasVisualizing_CausesWarningAndDisablesVisualization)}2."); |
|||
object2.SetActive(true); |
|||
} |
|||
[UnityTest] |
|||
public IEnumerator DestroyCamera_RemovesVisualization() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(DestroyCamera_RemovesVisualization); |
|||
object1.SetActive(false); |
|||
object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
object1.SetActive(true); |
|||
AddTestObjectForCleanup(object1); |
|||
|
|||
Assert.IsNotNull(GameObject.Find(nameof(DestroyCamera_RemovesVisualization) + "_VisualizationCamera")); |
|||
Object.DestroyImmediate(object1); |
|||
//wait a frame to allow objects destroyed via Destroy() to be cleaned up
|
|||
yield return null; |
|||
Assert.IsNull(GameObject.Find(nameof(DestroyCamera_RemovesVisualization) + "_VisualizationCamera")); |
|||
} |
|||
[Test] |
|||
public void DestroyAndRecreateCamera_ProperlyVisualizes() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(DestroyAndRecreateCamera_ProperlyVisualizes); |
|||
object1.SetActive(false); |
|||
object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
object1.SetActive(true); |
|||
AddTestObjectForCleanup(object1); |
|||
Object.DestroyImmediate(object1); |
|||
|
|||
var object2 = new GameObject(); |
|||
object2.name = nameof(DestroyAndRecreateCamera_ProperlyVisualizes) + "2"; |
|||
object2.SetActive(false); |
|||
var camera2 = object2.AddComponent<Camera>(); |
|||
var perceptionCamera2 = object2.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera2.showVisualizations = true; |
|||
object2.SetActive(true); |
|||
AddTestObjectForCleanup(object2); |
|||
|
|||
Assert.IsNotNull(camera2.targetTexture); |
|||
Assert.IsNotNull(GameObject.Find(nameof(DestroyAndRecreateCamera_ProperlyVisualizes) + "2_VisualizationCamera")); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2bac8a8673454861a0532ef0a7ee968f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace UnityEngine.Perception.GroundTruth |
|||
{ |
|||
/// <summary>
|
|||
/// The control panel for labeler visualizers. This panel resides in the upper right hand corner of
|
|||
/// the display. Any UI element can be added to the panel, but it contains helper methods to quickly
|
|||
/// create some of the most common control panel display elements: toggles and sliders.
|
|||
/// </summary>
|
|||
public class ControlPanel : MonoBehaviour |
|||
{ |
|||
HashSet<GameObject> m_Controls = new HashSet<GameObject>(); |
|||
|
|||
/// <summary>
|
|||
/// Retrieves a list of the current controls in the control panel.
|
|||
/// </summary>
|
|||
public IEnumerable<GameObject> controls => m_Controls; |
|||
|
|||
/// <summary>
|
|||
/// Adds a new UI control to the control panel. If the control cannot be added and the method will
|
|||
/// return false. Also, all UI elements must have a LayoutElement component and if they do not,
|
|||
/// this method will reject the new element, and return false.
|
|||
/// </summary>
|
|||
/// <param name="uiControl">The control that is to be added to the control panel</param>
|
|||
/// <returns>True if the control could be added, false if it there was a problem adding it</returns>
|
|||
public bool AddNewControl(GameObject uiControl) |
|||
{ |
|||
if (uiControl.GetComponent<RectTransform>() == null) |
|||
{ |
|||
Debug.LogError("Control panel UI control must have a rect transform component."); |
|||
return false; |
|||
} |
|||
|
|||
if (uiControl.GetComponent<LayoutElement>() == null) |
|||
{ |
|||
Debug.LogError("Control panel UI control must contain a layout element component."); |
|||
return false; |
|||
} |
|||
|
|||
if (m_Controls.Add(uiControl)) |
|||
{ |
|||
uiControl.transform.SetParent(this.transform, false); |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Removes the passed in component from the control panel. Returns
|
|||
/// false if the element does not exist. Returns true on a successful removal.
|
|||
/// The caller is responsible for destroying the control.
|
|||
/// </summary>
|
|||
/// <param name="uiControl">The control that needs to be removed from the panel</param>
|
|||
/// <returns>True if the control could be removed, false if there was an issue removing the control</returns>
|
|||
public bool RemoveControl(GameObject uiControl) |
|||
{ |
|||
if (m_Controls.Remove(uiControl)) |
|||
{ |
|||
uiControl.transform.SetParent(null); |
|||
|
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new toggle control with passed in name. The passed in listener will be
|
|||
/// called on toggle clicks. If anything goes wrong this method will return null.
|
|||
/// Returns the control panel element upon a successful add.
|
|||
/// </summary>
|
|||
/// <param name="name">The name of the toggle</param>
|
|||
/// <param name="listener">The callback action that will be triggered when the toggle's state changes</param>
|
|||
/// <returns>The created toggle</returns>
|
|||
public GameObject AddToggleControl(string name, UnityAction<bool> listener) |
|||
{ |
|||
if (listener == null) |
|||
{ |
|||
Debug.LogWarning("Adding toggle to control panel without a listener, nothing will respond to user's clicks"); |
|||
} |
|||
|
|||
var toggle = GameObject.Instantiate(Resources.Load<GameObject>("GenericToggle")); |
|||
toggle.transform.SetParent(this.transform, false); |
|||
toggle.GetComponentInChildren<Text>().text = name; |
|||
toggle.GetComponent<Toggle>().onValueChanged.AddListener(listener); |
|||
|
|||
m_Controls.Add(toggle); |
|||
|
|||
return toggle; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new slider control with the passed in name and default value. The slider's value runs from 0 to 1.
|
|||
/// The passed in listener will be called on slider changes. If anything goes wrong this method will return null.
|
|||
/// Returns the control panel element upon a successful add.
|
|||
/// </summary>
|
|||
/// <param name="name">The name of the slider control</param>
|
|||
/// <param name="defaultValue">The default value of the slider, between 0 and 1</param>
|
|||
/// <param name="listener">The callback action that will be triggered when the slider's value changes</param>
|
|||
/// <returns>The created slider</returns>
|
|||
public GameObject AddSliderControl(string name, float defaultValue, UnityAction<float> listener) |
|||
{ |
|||
if (listener == null) |
|||
{ |
|||
Debug.LogWarning("Adding slider to control panel without a listener, nothing will respond to user's interactions"); |
|||
} |
|||
|
|||
var gameObject = GameObject.Instantiate(Resources.Load<GameObject>("GenericSlider")); |
|||
gameObject.transform.SetParent(this.transform, false); |
|||
gameObject.GetComponentInChildren<Text>().text = name; |
|||
var slider = gameObject.GetComponentInChildren<Slider>(); |
|||
slider.value = defaultValue; |
|||
slider.onValueChanged.AddListener(listener); |
|||
|
|||
m_Controls.Add(gameObject); |
|||
|
|||
return gameObject; |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace UnityEngine.Perception.GroundTruth |
|||
{ |
|||
/// <summary>
|
|||
/// Heads up display panel used to publish a key value pair on the screen. Items added to this need
|
|||
/// to have their values updated every frame, or else, they will be determined to be stale and removed
|
|||
/// from the view and re-used for a new entry.
|
|||
/// </summary>
|
|||
public class HUDPanel : MonoBehaviour |
|||
{ |
|||
Dictionary<string, (bool, KeyValuePanel)> entries = new Dictionary<string, (bool, KeyValuePanel)>(); |
|||
Stack<KeyValuePanel> orphans = new Stack<KeyValuePanel>(); |
|||
|
|||
/// <summary>
|
|||
/// The panel that will hold all of the key value panel elements, this reference is needed to be able to hide the panel
|
|||
/// </summary>
|
|||
public GameObject contentPanel = null; |
|||
/// <summary>
|
|||
/// The scroll rect of the HUD panel, this reference is needed to be able to hide the panel
|
|||
/// </summary>
|
|||
public ScrollRect scrollRect = null; |
|||
/// <summary>
|
|||
/// The background image of the HUD panel, this reference is needed to be able to hide the panel
|
|||
/// </summary>
|
|||
public Image img = null; |
|||
|
|||
void Update() |
|||
{ |
|||
if (entries.Any() != scrollRect.enabled) |
|||
{ |
|||
scrollRect.enabled = !scrollRect.enabled; |
|||
img.enabled = scrollRect.enabled; |
|||
foreach (var i in GetComponentsInChildren<Image>()) |
|||
{ |
|||
i.enabled = scrollRect.enabled; |
|||
} |
|||
} |
|||
|
|||
// Go through everyone that has not been updated and remove them and
|
|||
// if they have been updated mark them dirty for next round
|
|||
var keys = new List<string>(entries.Keys); |
|||
foreach (var key in keys) |
|||
{ |
|||
var entry = entries[key]; |
|||
|
|||
if (!entry.Item1) |
|||
{ |
|||
entry.Item2.gameObject.SetActive(false); |
|||
orphans.Push(entry.Item2); |
|||
} |
|||
else |
|||
{ |
|||
entry.Item1 = false; |
|||
entries[key] = entry; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Updates (or creates) an entry with the passed in key value pair
|
|||
/// </summary>
|
|||
/// <param name="key">The key of the HUD entry</param>
|
|||
/// <param name="value">The value of the entry</param>
|
|||
public void UpdateEntry(string key, string value) |
|||
{ |
|||
(bool, KeyValuePanel) val; |
|||
|
|||
if (!entries.ContainsKey(key)) |
|||
{ |
|||
if (orphans.Any()) |
|||
{ |
|||
val = (true, orphans.Pop()); |
|||
val.Item2.gameObject.SetActive(true); |
|||
} |
|||
else |
|||
{ |
|||
val = (true, GameObject.Instantiate(Resources.Load<GameObject>("KeyValuePanel")).GetComponent<KeyValuePanel>()); |
|||
val.Item2.transform.SetParent(contentPanel.transform, false); |
|||
} |
|||
|
|||
val.Item2.SetKey(key); |
|||
} |
|||
else |
|||
{ |
|||
val = entries[key]; |
|||
val.Item1 = true; |
|||
} |
|||
|
|||
val.Item2.SetValue(value); |
|||
entries[key] = val; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Removes the key value pair from the HUD
|
|||
/// </summary>
|
|||
/// <param name="key">The key of the entry to remove</param>
|
|||
public void RemoveEntry(string key) |
|||
{ |
|||
if (entries.ContainsKey(key)) |
|||
{ |
|||
var entry = entries[key]; |
|||
entry.Item2.gameObject.SetActive(false); |
|||
entries.Remove(key); |
|||
orphans.Push(entry.Item2); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Removes all of the passed in entries from the HUD
|
|||
/// </summary>
|
|||
/// <param name="keys">List of keys to remove from the panel</param>
|
|||
public void RemoveEntries(List<string> keys) |
|||
{ |
|||
foreach (var k in keys) RemoveEntry(k); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Removes all of the passed in entries from the HUD
|
|||
/// </summary>
|
|||
/// <param name="keys">List of keys t remove from the panel</param>
|
|||
public void RemoveEntries(string[] keys) |
|||
{ |
|||
foreach (var k in keys) RemoveEntry(k); |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace UnityEngine.Perception.GroundTruth |
|||
{ |
|||
/// <summary>
|
|||
/// Key value pair panel UI object
|
|||
/// </summary>
|
|||
public class KeyValuePanel : MonoBehaviour |
|||
{ |
|||
/// <summary>
|
|||
/// Key UI text element of the panel
|
|||
/// </summary>
|
|||
public Text key = null; |
|||
/// <summary>
|
|||
/// Value UI text element of the panel
|
|||
/// </summary>
|
|||
public Text value = null; |
|||
|
|||
/// <summary>
|
|||
/// Sets the key of this key value pair
|
|||
/// </summary>
|
|||
/// <param name="k">The key of the key/value pair</param>
|
|||
public void SetKey(string k) |
|||
{ |
|||
if (k == null || k == string.Empty) return; |
|||
key.text = k; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sets the value of this key value pair
|
|||
/// </summary>
|
|||
/// <param name="v">The value of the key/value pair</param>
|
|||
public void SetValue(string v) |
|||
{ |
|||
value.text = v; |
|||
} |
|||
} |
|||
} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_Name: SegmentationMaterial |
|||
m_Shader: {fileID: 4800000, guid: 2466ee374918c4aaea96fd1134177d71, type: 3} |
|||
m_ShaderKeywords: _ALPHATEST_ON |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: |
|||
- SHADOWCASTER |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _AlphaTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BaseMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BaseTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailTex: |
|||
m_Texture: {fileID: 2800000, guid: cadd6a00019fd4eeab962e3a12fabed6, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MaskTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _NormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _AlphaClip: 1 |
|||
- _BackTransparency: 0 |
|||
- _Blend: 2 |
|||
- _BlendOp: 0 |
|||
- _BumpScale: 1 |
|||
- _CameraFadingEnabled: 0 |
|||
- _CameraFarFadeDistance: 2 |
|||
- _CameraNearFadeDistance: 1 |
|||
- _ColorMask: 15 |
|||
- _ColorMode: 0 |
|||
- _Cull: 2 |
|||
- _Cutoff: 0.47 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DistortionBlend: 0.5 |
|||
- _DistortionEnabled: 0 |
|||
- _DistortionStrength: 1 |
|||
- _DistortionStrengthScaled: 0.1 |
|||
- _DstBlend: 1 |
|||
- _EnableExternalAlpha: 0 |
|||
- _EnvironmentReflections: 1 |
|||
- _FlipbookBlending: 0 |
|||
- _FlipbookMode: 0 |
|||
- _GlossMapScale: 0 |
|||
- _Glossiness: 0 |
|||
- _GlossinessSource: 0 |
|||
- _GlossyReflections: 0 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 1 |
|||
- _Parallax: 0.02 |
|||
- _QueueOffset: 0 |
|||
- _ReceiveShadows: 1 |
|||
- _SampleGI: 0 |
|||
- _SegmentTransparency: 0.8 |
|||
- _Shininess: 0 |
|||
- _Smoothness: 0.5 |
|||
- _SmoothnessSource: 0 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SoftParticlesEnabled: 0 |
|||
- _SoftParticlesFarFadeDistance: 1 |
|||
- _SoftParticlesNearFadeDistance: 0 |
|||
- _SpecSource: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 5 |
|||
- _Stencil: 0 |
|||
- _StencilComp: 0 |
|||
- _StencilOp: 0 |
|||
- _StencilReadMask: 0 |
|||
- _StencilWriteMask: 0 |
|||
- _Strength: 0.2 |
|||
- _Surface: 1 |
|||
- _Transparency: 0.445 |
|||
- _UVSec: 0 |
|||
- _UseUIAlphaClip: 0 |
|||
- _WorkflowMode: 1 |
|||
- _ZWrite: 0 |
|||
m_Colors: |
|||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _BaseColorAddSubDiff: {r: -1, g: 1, b: 0, a: 0} |
|||
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _Flip: {r: 1, g: 1, b: 1, a: 1} |
|||
- _RemoveColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _RendererColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _ReplaceColor: {r: 1, g: 1, b: 1, a: 0} |
|||
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} |
|||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} |
|||
--- !u!114 &3089368426582508830 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 11 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
version: 1 |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &3284129489564578195 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 4595725647490753358} |
|||
- component: {fileID: 4496511663627014910} |
|||
- component: {fileID: 6034931589588613035} |
|||
- component: {fileID: 7049261054784314162} |
|||
m_Layer: 5 |
|||
m_Name: Value |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &4595725647490753358 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 3284129489564578195} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0.5, y: 0.5, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 5547799090381645220} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 1, y: 0.5} |
|||
--- !u!222 &4496511663627014910 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 3284129489564578195} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &6034931589588613035 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 3284129489564578195} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 0.7264151, g: 0.70928264, b: 0.70928264, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_FontData: |
|||
m_Font: {fileID: 12800000, guid: 397721830eb764bbc8cd9fecf3ab1290, type: 3} |
|||
m_FontSize: 20 |
|||
m_FontStyle: 0 |
|||
m_BestFit: 0 |
|||
m_MinSize: 2 |
|||
m_MaxSize: 40 |
|||
m_Alignment: 5 |
|||
m_AlignByGeometry: 0 |
|||
m_RichText: 1 |
|||
m_HorizontalOverflow: 1 |
|||
m_VerticalOverflow: 1 |
|||
m_LineSpacing: 1 |
|||
m_Text: VALUE |
|||
--- !u!114 &7049261054784314162 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 3284129489564578195} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreLayout: 0 |
|||
m_MinWidth: -1 |
|||
m_MinHeight: -1 |
|||
m_PreferredWidth: -1 |
|||
m_PreferredHeight: -1 |
|||
m_FlexibleWidth: 1 |
|||
m_FlexibleHeight: -1 |
|||
m_LayoutPriority: 1 |
|||
--- !u!1 &5085956214946841210 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 924712682360615393} |
|||
- component: {fileID: 7386780920487943076} |
|||
- component: {fileID: 1894703116479988963} |
|||
- component: {fileID: 6489701985588846927} |
|||
m_Layer: 5 |
|||
m_Name: Key |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &924712682360615393 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5085956214946841210} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0.5, y: 0.5, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 5547799090381645220} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 0.5} |
|||
--- !u!222 &7386780920487943076 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5085956214946841210} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &1894703116479988963 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5085956214946841210} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 0.7264151, g: 0.70928264, b: 0.70928264, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_FontData: |
|||
m_Font: {fileID: 12800000, guid: 397721830eb764bbc8cd9fecf3ab1290, type: 3} |
|||
m_FontSize: 20 |
|||
m_FontStyle: 0 |
|||
m_BestFit: 0 |
|||
m_MinSize: 2 |
|||
m_MaxSize: 40 |
|||
m_Alignment: 3 |
|||
m_AlignByGeometry: 0 |
|||
m_RichText: 1 |
|||
m_HorizontalOverflow: 1 |
|||
m_VerticalOverflow: 1 |
|||
m_LineSpacing: 1 |
|||
m_Text: 'KEY:' |
|||
--- !u!114 &6489701985588846927 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5085956214946841210} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreLayout: 0 |
|||
m_MinWidth: -1 |
|||
m_MinHeight: -1 |
|||
m_PreferredWidth: -1 |
|||
m_PreferredHeight: -1 |
|||
m_FlexibleWidth: 4 |
|||
m_FlexibleHeight: -1 |
|||
m_LayoutPriority: 1 |
|||
--- !u!1 &9007962583023748487 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 5547799090381645220} |
|||
- component: {fileID: 8878022795811502189} |
|||
- component: {fileID: 5555615362143100286} |
|||
- component: {fileID: 8848784309261800470} |
|||
m_Layer: 5 |
|||
m_Name: KeyValuePanel |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &5547799090381645220 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 9007962583023748487} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 924712682360615393} |
|||
- {fileID: 4595725647490753358} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 1} |
|||
m_AnchorMax: {x: 0, y: 1} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 1} |
|||
--- !u!222 &8878022795811502189 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 9007962583023748487} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &5555615362143100286 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 9007962583023748487} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Padding: |
|||
m_Left: 0 |
|||
m_Right: 0 |
|||
m_Top: 0 |
|||
m_Bottom: 0 |
|||
m_ChildAlignment: 0 |
|||
m_Spacing: 0 |
|||
m_ChildForceExpandWidth: 1 |
|||
m_ChildForceExpandHeight: 1 |
|||
m_ChildControlWidth: 1 |
|||
m_ChildControlHeight: 1 |
|||
m_ChildScaleWidth: 0 |
|||
m_ChildScaleHeight: 0 |
|||
--- !u!114 &8848784309261800470 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 9007962583023748487} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8ffbc2d71e7b74cdc803e4d76cff5db4, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
key: {fileID: 1894703116479988963} |
|||
value: {fileID: 6034931589588613035} |
|
|||
Shader "Perception/SegRemoveBackgroundShader" |
|||
{ |
|||
Properties |
|||
{ |
|||
_MainTex ("Main Texture", 2D) = "defaulttexture" { } |
|||
_RemoveColor ("Remove Color", Color) = (0, 0, 0, 1) |
|||
_SegmentTransparency("Segment Transparency", Range(0.0,1.0)) = 0.5 |
|||
_BackTransparency("Background Transparency", Range(0.0,1.0)) = 0 |
|||
} |
|||
SubShader |
|||
{ |
|||
Tags { "Queue"="Transparent" "RenderType"="Transparent" } |
|||
LOD 100 |
|||
|
|||
ZWrite off |
|||
Blend SrcAlpha OneMinusSrcAlpha |
|||
|
|||
Pass |
|||
{ |
|||
CGPROGRAM |
|||
#pragma vertex vert |
|||
#pragma fragment frag Lambert alpha |
|||
|
|||
#include "UnityCG.cginc" |
|||
|
|||
struct appdata |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
}; |
|||
|
|||
struct v2f |
|||
{ |
|||
float2 uv : TEXCOORD0; |
|||
float4 vertex : SV_POSITION; |
|||
}; |
|||
|
|||
sampler2D _MainTex; |
|||
fixed4 _RemoveColor; |
|||
float _SegmentTransparency; |
|||
float _BackTransparency; |
|||
|
|||
v2f vert (appdata v) |
|||
{ |
|||
v2f o; |
|||
o.vertex = UnityObjectToClipPos(v.vertex); |
|||
o.uv = v.uv; |
|||
return o; |
|||
} |
|||
|
|||
fixed4 frag (v2f i) : SV_Target |
|||
{ |
|||
// sample the texture |
|||
fixed4 col = tex2D(_MainTex, i.uv); |
|||
|
|||
if (abs(col.r - _RemoveColor.r) < .01f) |
|||
{ |
|||
if (abs(col.g - _RemoveColor.g) < .01f) |
|||
{ |
|||
if (abs(col.b - _RemoveColor.b) < .01f) |
|||
{ |
|||
col.a = _BackTransparency; |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (abs(col.a - _BackTransparency) > .01f) col.a = _SegmentTransparency; |
|||
|
|||
return col; |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &6732225215165335482 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 968786849326295845} |
|||
- component: {fileID: 84779842494960409} |
|||
- component: {fileID: 5662008187905630377} |
|||
m_Layer: 5 |
|||
m_Name: SegmentTexture |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &968786849326295845 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 6732225215165335482} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: -1} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 1} |
|||
m_AnchorMax: {x: 0, y: 1} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 100, y: 100} |
|||
m_Pivot: {x: 0, y: 1} |
|||
--- !u!222 &84779842494960409 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 6732225215165335482} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &5662008187905630377 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 6732225215165335482} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 2100000, guid: f81ae556e923c4b1d9a6047faeaa99aa, type: 2} |
|||
m_Color: {r: 0.4, g: 0.4627451, b: 0.73333335, a: 1} |
|||
m_RaycastTarget: 0 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
1001
com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/VisualizationUI.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 5d7678e45cbe34953884861e62372b0d |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.EventSystems; |
|||
|
|||
namespace UnityEngine.Perception.GroundTruth |
|||
{ |
|||
/// <summary>
|
|||
/// The visualization canvas. This canvas should contain all labeler visualization components.
|
|||
/// All visualizlation components should be added to this canvas via teh AddComponent method.
|
|||
/// </summary>
|
|||
public class VisualizationCanvas : MonoBehaviour |
|||
{ |
|||
/// <summary>
|
|||
/// The control panel contains the UI control elements used to interact with the labelers.
|
|||
/// </summary>
|
|||
public ControlPanel controlPanel; |
|||
/// <summary>
|
|||
/// The HUD panel displays realtime key/value pair data on a UI panel.
|
|||
/// </summary>
|
|||
public HUDPanel hudPanel; |
|||
/// <summary>
|
|||
/// Game object which acts as the scene container for all of the dynamic labeler visuals
|
|||
/// </summary>
|
|||
public GameObject dynaicContentHolder; |
|||
|
|||
// Start is called before the first frame update
|
|||
void Start() |
|||
{ |
|||
if (GameObject.Find("EventSystem") == null) |
|||
{ |
|||
var eventSystemGo = new GameObject("EventSystem"); |
|||
eventSystemGo.AddComponent<UnityEngine.EventSystems.EventSystem>(); |
|||
eventSystemGo.AddComponent<StandaloneInputModule>(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Adds a new UI components to the visualization canvas. Pass in fullscreen if the component should take up
|
|||
/// the entire screen. Pass in setAsLowestElement if the component should be rendered behind all other components.
|
|||
/// This method will return false if the element could not be added, true if everything works properly.
|
|||
/// </summary>
|
|||
/// <param name="component">UI component that should be added to this UI canvas</param>
|
|||
/// <param name="fullScreen">Should this component's rect transform be set to fill the entire dimensions of the parent, defaults to true</param>
|
|||
/// <param name="setAsLowestElement">Should this UI component be rendered as the lowest UI component in the scene, defaults to false</param>
|
|||
/// <returns>True if the component was added properly, false if an error occurred.</returns>
|
|||
public bool AddComponent(GameObject component, bool fullScreen = true, bool setAsLowestElement = false) |
|||
{ |
|||
if (component == null) |
|||
{ |
|||
Debug.LogError("Trying to add a null component to VisualizationCanvas"); |
|||
return false; |
|||
} |
|||
|
|||
RectTransform trans = component.GetComponent<RectTransform>(); |
|||
if (trans == null) |
|||
{ |
|||
Debug.LogWarning("Adding UI element without a rect transform, adding one to it"); |
|||
trans = component.AddComponent<RectTransform>(); |
|||
} |
|||
|
|||
if (fullScreen) |
|||
{ |
|||
trans.anchorMin = new Vector2(0, 0); |
|||
trans.anchorMax = new Vector2(1, 1); |
|||
trans.pivot = new Vector2(0.5f, 0.5f); |
|||
|
|||
trans.offsetMax = new Vector2(0, 0); |
|||
trans.offsetMin = new Vector2(0, 0); |
|||
} |
|||
|
|||
trans.SetParent(dynaicContentHolder.transform, false); |
|||
|
|||
if (setAsLowestElement) component.transform.SetAsFirstSibling(); |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Text.RegularExpressions; |
|||
using NUnit.Framework; |
|||
using UnityEngine; |
|||
using UnityEngine.Perception.GroundTruth; |
|||
using UnityEngine.TestTools; |
|||
|
|||
namespace GroundTruthTests |
|||
{ |
|||
[TestFixture] |
|||
public class VisualizationTests : GroundTruthTestBase |
|||
{ |
|||
[Test] |
|||
public void VisualizedCamera_SetsUpCanvasAndSecondCamera() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(VisualizedCamera_SetsUpCanvasAndSecondCamera); |
|||
object1.SetActive(false); |
|||
var camera = object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
object1.SetActive(true); |
|||
AddTestObjectForCleanup(object1); |
|||
|
|||
Assert.IsNotNull(camera.targetTexture); |
|||
Assert.IsNotNull(GameObject.Find(nameof(VisualizedCamera_SetsUpCanvasAndSecondCamera) + "_VisualizationCamera")); |
|||
Assert.IsNotNull(GameObject.Find(nameof(VisualizedCamera_SetsUpCanvasAndSecondCamera) + "_VisualizationCanvas")); |
|||
} |
|||
[Test] |
|||
public void TwoCamerasVisualizing_CausesWarningAndDisablesVisualization() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(TwoCamerasVisualizing_CausesWarningAndDisablesVisualization); |
|||
object1.SetActive(false); |
|||
object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
AddTestObjectForCleanup(object1); |
|||
|
|||
var object2 = new GameObject(); |
|||
object2.SetActive(false); |
|||
object2.name = nameof(TwoCamerasVisualizing_CausesWarningAndDisablesVisualization) + "2"; |
|||
object2.AddComponent<Camera>(); |
|||
var perceptionCamera2 = object2.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera2.showVisualizations = true; |
|||
AddTestObjectForCleanup(object2); |
|||
|
|||
object1.SetActive(true); |
|||
LogAssert.Expect(LogType.Warning, $"Currently only one PerceptionCamera may be visualized at a time. Disabling visualization on {nameof(TwoCamerasVisualizing_CausesWarningAndDisablesVisualization)}2."); |
|||
object2.SetActive(true); |
|||
} |
|||
[UnityTest] |
|||
public IEnumerator DestroyCamera_RemovesVisualization() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(DestroyCamera_RemovesVisualization); |
|||
object1.SetActive(false); |
|||
object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
object1.SetActive(true); |
|||
AddTestObjectForCleanup(object1); |
|||
|
|||
Assert.IsNotNull(GameObject.Find(nameof(DestroyCamera_RemovesVisualization) + "_VisualizationCamera")); |
|||
Object.DestroyImmediate(object1); |
|||
//wait a frame to allow objects destroyed via Destroy() to be cleaned up
|
|||
yield return null; |
|||
Assert.IsNull(GameObject.Find(nameof(DestroyCamera_RemovesVisualization) + "_VisualizationCamera")); |
|||
} |
|||
[Test] |
|||
public void DestroyAndRecreateCamera_ProperlyVisualizes() |
|||
{ |
|||
var object1 = new GameObject(); |
|||
object1.name = nameof(DestroyAndRecreateCamera_ProperlyVisualizes); |
|||
object1.SetActive(false); |
|||
object1.AddComponent<Camera>(); |
|||
var perceptionCamera1 = object1.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera1.showVisualizations = true; |
|||
object1.SetActive(true); |
|||
AddTestObjectForCleanup(object1); |
|||
Object.DestroyImmediate(object1); |
|||
|
|||
var object2 = new GameObject(); |
|||
object2.name = nameof(DestroyAndRecreateCamera_ProperlyVisualizes) + "2"; |
|||
object2.SetActive(false); |
|||
var camera2 = object2.AddComponent<Camera>(); |
|||
var perceptionCamera2 = object2.AddComponent<PerceptionCamera>(); |
|||
perceptionCamera2.showVisualizations = true; |
|||
object2.SetActive(true); |
|||
AddTestObjectForCleanup(object2); |
|||
|
|||
Assert.IsNotNull(camera2.targetTexture); |
|||
Assert.IsNotNull(GameObject.Find(nameof(DestroyAndRecreateCamera_ProperlyVisualizes) + "2_VisualizationCamera")); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2bac8a8673454861a0532ef0a7ee968f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue