diff --git a/Assets/AVProLiveCamera.meta b/Assets/AVProLiveCamera.meta new file mode 100644 index 0000000..50651ee --- /dev/null +++ b/Assets/AVProLiveCamera.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 236351d716bcbf24aae1016b3cbebe81 diff --git a/Assets/AVProLiveCamera/Demos.meta b/Assets/AVProLiveCamera/Demos.meta new file mode 100644 index 0000000..a265850 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 14bbad8fb9df5b640878a1899629e4d8 diff --git a/Assets/AVProLiveCamera/Demos/AVProLiveCameraCameraExplorerDemo.cs b/Assets/AVProLiveCamera/Demos/AVProLiveCameraCameraExplorerDemo.cs new file mode 100644 index 0000000..7d87d65 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/AVProLiveCameraCameraExplorerDemo.cs @@ -0,0 +1,631 @@ +using UnityEngine; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Demos +{ + public class AVProLiveCameraCameraExplorerDemo : MonoBehaviour + { + internal class UIData + { + public Vector2 scrollPos; + public Vector2 scrollVideoInputPos; + public bool showSettings; + public bool showModes; + public bool showFrameRates; + public Material material; + } + + public GUISkin _guiSkin; + public bool _updateDeviceSettings = false; + private List _instances = new List(16); + private Vector2 _horizScrollPos = Vector2.zero; + + private GUIStyle _buttonStyle; + + private Texture _zoomedTexture = null; + private AVProLiveCameraDevice _zoomedDevice = null; + private const float ZoomTime = 0.25f; + private float _zoomTimer; + private bool _zoomUp; + private Rect _zoomSrcDest; + private Material _zoomedMaterial; + + private static int _propApplyGamma; + private static Shader _shaderGammaConversion; + private static Shader _shaderGammaConversionTransparent; + + void Awake() + { + if (_propApplyGamma == 0) + { + _propApplyGamma = Shader.PropertyToID("_ApplyGamma"); + } + } + + public void Start() + { + Application.runInBackground = true; + + if (_shaderGammaConversion == null) + { + _shaderGammaConversion = Shader.Find("Hidden/AVProLiveCamera/IMGUI"); + } + if (_shaderGammaConversionTransparent == null) + { + _shaderGammaConversionTransparent = Shader.Find("Hidden/AVProLiveCamera/IMGUI Transparent"); + } + + EnumerateDevices(true); + + int numDevices = AVProLiveCameraManager.Instance.NumDevices; + for (int i = 0; i < numDevices; i++) + { + AVProLiveCameraDevice device = AVProLiveCameraManager.Instance.GetDevice(i); + + // Optionally update various camera internals, depending on which features are required + device.UpdateHotSwap = AVProLiveCameraManager.Instance._supportHotSwapping; + device.UpdateFrameRates = true; + device.UpdateSettings = _updateDeviceSettings; + } + } + + void OnDestroy() + { + for (int i = 0; i < _instances.Count; i++) + { + UIData uidata = _instances[i]; + if (uidata.material != null) + { +#if UNITY_EDITOR + Material.DestroyImmediate(uidata.material); +#else + Material.Destroy(uidata.material); +#endif + uidata.material = null; + } + } + } + + private void EnumerateDevices(bool logDevices) + { + // Enumerate all cameras + int numDevices = AVProLiveCameraManager.Instance.NumDevices; + if (logDevices) + { + print("num devices: " + numDevices); + } + for (int i = 0; i < numDevices; i++) + { + AVProLiveCameraDevice device = AVProLiveCameraManager.Instance.GetDevice(i); + + if (logDevices) + { + // Enumerate video inputs (only for devices with multiple analog input sources, eg TV cards) + print("device " + i + ": " + device.Name + " (" + device.GUID + ") has " + device.NumVideoInputs + " videoInputs"); + for (int j = 0; j < device.NumVideoInputs; j++) + { + print(" videoInput " + j + ": " + device.GetVideoInputName(j)); + } + + // Enumerate camera modes + print("device " + i + ": " + device.Name + " (" + device.GUID + ") has " + device.NumModes + " modes"); + for (int j = 0; j < device.NumModes; j++) + { + AVProLiveCameraDeviceMode mode = device.GetMode(j); + print(" mode " + j + ": " + mode.Width + "x" + mode.Height + " @" + mode.FPS.ToString("F2") + "fps [" + mode.Format + "]"); + } + + // Enumerate camera settings + print("device " + i + ": " + device.Name + " (" + device.GUID + ") has " + device.NumSettings + " video settings"); + for (int j = 0; j < device.NumSettings; j++) + { + AVProLiveCameraSettingBase settingBase = device.GetVideoSettingByIndex(j); + switch (settingBase.DataTypeValue) + { + case AVProLiveCameraSettingBase.DataType.Boolean: + { + AVProLiveCameraSettingBoolean settingBool = (AVProLiveCameraSettingBoolean)settingBase; + print(string.Format(" setting {0}: {1}({2}) value:{3} default:{4} canAuto:{5} isAuto:{6}", j, settingBase.Name, settingBase.PropertyIndex, settingBool.CurrentValue, settingBool.DefaultValue, settingBase.CanAutomatic, settingBase.IsAutomatic)); + } + break; + case AVProLiveCameraSettingBase.DataType.Float: + { + AVProLiveCameraSettingFloat settingFloat = (AVProLiveCameraSettingFloat)settingBase; + print(string.Format(" setting {0}: {1}({2}) value:{3} default:{4} range:{5}-{6} canAuto:{7} isAuto:{8}", j, settingBase.Name, settingBase.PropertyIndex, settingFloat.CurrentValue, settingFloat.DefaultValue, settingFloat.MinValue, settingFloat.MaxValue, settingBase.CanAutomatic, settingBase.IsAutomatic)); + } + break; + } + } + } + + _instances.Add(new UIData() + { + scrollPos = Vector2.zero, + scrollVideoInputPos = Vector2.zero, + showSettings = false, + showModes = false, + showFrameRates = false, + material = null + }); + } + } + + private void UpdateCameras() + { + { +#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + GL.IssuePluginEvent(AVProLiveCameraPlugin.GetRenderEventFunc(), AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateAllTextures); +#else + GL.IssuePluginEvent(AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateAllTextures); +#endif + } + + // Update all cameras + int numDevices = AVProLiveCameraManager.Instance.NumDevices; + for (int i = 0; i < numDevices; i++) + { + AVProLiveCameraDevice device = AVProLiveCameraManager.Instance.GetDevice(i); + + // Update the actual image + device.Update(false); + device.Render(); + } + } + + private static Shader GetRequiredShader(AVProLiveCameraDevice device) + { + Shader result = null; + + if (QualitySettings.activeColorSpace == ColorSpace.Linear) + { + if (device != null && device.SupportsTransparency) + { + result = _shaderGammaConversionTransparent; + } + else + { + result = _shaderGammaConversion; + } + } + + return result; + } + + private static Material UpdateMaterial(AVProLiveCameraDevice device, Material material) + { + // Get required shader + Shader currentShader = null; + if (material != null) + { + currentShader = material.shader; + } + Shader nextShader = GetRequiredShader(device); + + // If the shader requirement has changed + if (currentShader != nextShader) + { + // Destroy existing material + if (material != null) + { +#if UNITY_EDITOR + Material.DestroyImmediate(material); +#else + Material.Destroy(material); +#endif + material = null; + } + + // Create new material + if (nextShader != null) + { + material = new Material(nextShader); + if (material.HasProperty(_propApplyGamma)) + { + if (QualitySettings.activeColorSpace == ColorSpace.Linear) + { + material.EnableKeyword("APPLY_GAMMA"); + } + else + { + material.DisableKeyword("APPLY_GAMMA"); + } + } + } + } + return material; + } + + private void UpdateMaterials() + { + for (int i = 0; i < _instances.Count; i++) + { + AVProLiveCameraDevice device = AVProLiveCameraManager.Instance.GetDevice(i); + UIData uidata = _instances[i]; + uidata.material = UpdateMaterial(device, uidata.material); + } + } + + private int _lastFrameCount; + void OnRenderObject() + { + if (_lastFrameCount != Time.frameCount) + { + _lastFrameCount = Time.frameCount; + + UpdateCameras(); + } + } + + public void Update() + { + UpdateMaterials(); + + // Handle mouse click to unzoom + if (_zoomedTexture != null) + { + if (_zoomUp) + { + if (Input.GetMouseButtonDown(0) && + _zoomTimer > 0.1f) // Add a threshold here so the OnGUI mouse event doesn't conflict with this one + { + _zoomUp = false; + } + else + { + _zoomTimer = Mathf.Min(ZoomTime, _zoomTimer + Time.deltaTime); + } + + } + else + { + if (_zoomTimer <= 0.0f) + { + _zoomedTexture = null; + _zoomedDevice = null; + } + _zoomTimer = Mathf.Max(0f, _zoomTimer - Time.deltaTime); + } + } + } + + public void NewDeviceAdded() + { + EnumerateDevices(false); + } + + public void OnGUI() + { + if (_guiSkin != null) + { + if (_buttonStyle == null) + { + _buttonStyle = _guiSkin.FindStyle("LeftButton"); + } + GUI.skin = _guiSkin; + } + if (_buttonStyle == null) + { + _buttonStyle = GUI.skin.button; + } + + _horizScrollPos = GUILayout.BeginScrollView(_horizScrollPos, false, false); + GUILayout.BeginHorizontal(); + for (int i = 0; i < AVProLiveCameraManager.Instance.NumDevices; i++) + { + GUILayout.BeginVertical("box", GUILayout.MaxWidth(300)); + + AVProLiveCameraDevice device = AVProLiveCameraManager.Instance.GetDevice(i); + UIData uiData = _instances[i]; + + GUI.enabled = device.IsConnected; + + Rect cameraRect = GUILayoutUtility.GetRect(300, 168); + if (GUI.Button(cameraRect, "")) + { + if (_zoomedTexture == null) + { + _zoomedTexture = device.OutputTexture; + _zoomedDevice = device; + _zoomSrcDest = cameraRect; + _zoomedMaterial = uiData.material; + _zoomUp = true; + } + } + + // Thumbnail image + if (device.OutputTexture != null && _zoomedTexture != device.OutputTexture) + { + if (uiData.material != null) + { + DrawTexture(cameraRect, device.OutputTexture, ScaleMode.ScaleToFit, uiData.material); + } + else + { + GUI.DrawTexture(cameraRect, device.OutputTexture, ScaleMode.ScaleToFit, device.SupportsTransparency); + } + } + + GUILayout.Box("Camera " + i + ": " + device.Name); + if (!device.IsRunning) + { + GUILayout.BeginHorizontal(); + GUI.color = Color.green; + if (GUILayout.Button("Start")) + { + if (_zoomedTexture == null) + { + device.Start(-1); + } + } + GUI.color = Color.white; + } + else + { + GUILayout.Box(string.Format("{0}x{1} {2}", device.CurrentWidth, device.CurrentHeight, device.CurrentFormat)); + GUILayout.BeginHorizontal(); + GUILayout.Box(string.Format("Capture {0}hz Display {1}hz", device.CaptureFPS.ToString("F2"), device.DisplayFPS.ToString("F2"))); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUI.color = Color.red; + if (GUILayout.Button("Stop")) + { + if (_zoomedTexture == null) + { + device.Close(); + } + } + GUI.color = Color.white; + } + GUI.enabled = device.CanShowConfigWindow(); + if (GUILayout.Button("Configure", GUILayout.ExpandWidth(false))) + { + if (_zoomedTexture == null) + { + device.ShowConfigWindow(); + } + } + GUI.enabled = true; + GUILayout.EndHorizontal(); + + if (device.NumVideoInputs > 0) + { + GUILayout.Label("Select a video input:"); + uiData.scrollVideoInputPos = GUILayout.BeginScrollView(uiData.scrollVideoInputPos, false, false); + for (int j = 0; j < device.NumVideoInputs; j++) + { + if (GUILayout.Button(device.GetVideoInputName(j))) + { + if (_zoomedTexture == null) + { + // Start selected device + device.Close(); + device.Start(-1, j); + } + } + } + GUILayout.EndScrollView(); + } + + GUILayout.BeginHorizontal(); + if (device.Deinterlace != GUILayout.Toggle(device.Deinterlace, "Deinterlace", GUILayout.ExpandWidth(true))) + { + device.Deinterlace = !device.Deinterlace; + if (device.IsRunning) + { + device.Close(); + device.Start(-1, -1); + } + } + device.AllowTransparency = GUILayout.Toggle(device.AllowTransparency, "Transparent", GUILayout.ExpandWidth(true)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + device.FlipX = GUILayout.Toggle(device.FlipX, "Flip X", GUILayout.ExpandWidth(true)); + device.FlipY = GUILayout.Toggle(device.FlipY, "Flip Y", GUILayout.ExpandWidth(true)); + GUILayout.EndHorizontal(); + + uiData.scrollPos = GUILayout.BeginScrollView(uiData.scrollPos, false, false); + + if (device.NumSettings > 0) + { + GUI.color = Color.cyan; + uiData.showSettings = GUILayout.Toggle(uiData.showSettings, "Settings ▶", GUILayout.ExpandWidth(true)); + GUI.color = Color.white; + if (uiData.showSettings) + { + device.UpdateSettings = GUILayout.Toggle(device.UpdateSettings, "Update Settings", GUILayout.ExpandWidth(true)); + + for (int j = 0; j < device.NumSettings; j++) + { + AVProLiveCameraSettingBase settingBase = device.GetVideoSettingByIndex(j); + GUILayout.BeginHorizontal(); + GUI.enabled = !settingBase.IsAutomatic; + if (GUILayout.Button("D", GUILayout.ExpandWidth(false))) + { + settingBase.SetDefault(); + } + GUI.enabled = true; + GUILayout.Label(settingBase.Name, GUILayout.ExpandWidth(false)); + GUI.enabled = !settingBase.IsAutomatic; + switch (settingBase.DataTypeValue) + { + case AVProLiveCameraSettingBase.DataType.Boolean: + AVProLiveCameraSettingBoolean settingBool = (AVProLiveCameraSettingBoolean)settingBase; + settingBool.CurrentValue = GUILayout.Toggle(settingBool.CurrentValue, "", GUILayout.ExpandWidth(true)); + break; + case AVProLiveCameraSettingBase.DataType.Float: + AVProLiveCameraSettingFloat settingFloat = (AVProLiveCameraSettingFloat)settingBase; + settingFloat.CurrentValue = GUILayout.HorizontalSlider(settingFloat.CurrentValue, settingFloat.MinValue, settingFloat.MaxValue, GUILayout.ExpandWidth(true)); + + GUI.enabled = settingBase.CanAutomatic; + settingBase.IsAutomatic = GUILayout.Toggle(settingBase.IsAutomatic, "", GUILayout.Width(32.0f)); + GUI.enabled = true; + + break; + + } + GUI.enabled = true; + GUILayout.EndHorizontal(); + } + + if (GUILayout.Button("Defaults")) + { + for (int j = 0; j < device.NumSettings; j++) + { + AVProLiveCameraSettingBase settingBase = device.GetVideoSettingByIndex(j); + settingBase.SetDefault(); + } + } + } + } + + GUI.color = Color.cyan; + uiData.showModes = GUILayout.Toggle(uiData.showModes, "Modes ▶", GUILayout.ExpandWidth(true)); + GUI.color = Color.white; + if (uiData.showModes) + { + for (int j = 0; j < device.NumModes; j++) + { + AVProLiveCameraDeviceMode mode = device.GetMode(j); + bool isSelected = (device.CurrentMode == mode); + if (isSelected) + { + GUI.color = Color.green; + } + if (GUILayout.Button("" + mode.Width + "x" + mode.Height + " [" + mode.Format + "]", _buttonStyle)) + { + if (_zoomedTexture == null) + { + // Start selected device + device.Close(); + Debug.Log("Selecting mode: " + j); + device.Start(mode); + } + } + if (isSelected) + { + GUI.color = Color.white; + } + } + } + + if (device.IsRunning && device.CurrentMode != null) + { + GUI.color = Color.cyan; + uiData.showFrameRates = GUILayout.Toggle(uiData.showFrameRates, "Frame Rates ▶", GUILayout.ExpandWidth(true)); + GUI.color = Color.white; + if (uiData.showFrameRates) + { + for (int j = 0; j < device.CurrentMode.FrameRates.Length; j++) + { + bool isSelected = (device.CurrentMode.FrameRateIndex == j); + if (isSelected) + { + GUI.color = Color.green; + } + if (GUILayout.Button(device.CurrentMode.FrameRates[j].ToString("F2") + "hz ", _buttonStyle)) + { + device.CurrentMode.FrameRateIndex = j; + if (_zoomedTexture == null) + { + // Start selected device + AVProLiveCameraDeviceMode mode = device.CurrentMode; + device.Close(); + Debug.Log("Selecting mode: " + j); + device.Start(mode); + } + } + if (isSelected) + { + GUI.color = Color.white; + } + } + } + } + + GUILayout.EndScrollView(); + + + GUILayout.EndVertical(); + } + + GUILayout.EndHorizontal(); + GUILayout.EndScrollView(); + + // Show zoomed camera image + if (_zoomedTexture != null) + { + Rect fullScreenRect = new Rect(0f, 0f, Screen.width, Screen.height); + + float t = Mathf.Clamp01(_zoomTimer / ZoomTime); + t = Mathf.SmoothStep(0f, 1f, t); + Rect r = new Rect(); + r.x = Mathf.Lerp(_zoomSrcDest.x, fullScreenRect.x, t); + r.y = Mathf.Lerp(_zoomSrcDest.y, fullScreenRect.y, t); + r.width = Mathf.Lerp(_zoomSrcDest.width, fullScreenRect.width, t); + r.height = Mathf.Lerp(_zoomSrcDest.height, fullScreenRect.height, t); + + if (_zoomedMaterial != null) + { + DrawTexture(r, _zoomedTexture, ScaleMode.ScaleToFit, _zoomedMaterial); + } + else + { + GUI.DrawTexture(r, _zoomedTexture, ScaleMode.ScaleToFit, _zoomedDevice.SupportsTransparency); + } + } + } + + private static void DrawTexture(Rect screenRect, Texture texture, ScaleMode scaleMode, Material material) + { + if (Event.current.type == EventType.Repaint) + { + float textureWidth = texture.width; + float textureHeight = texture.height; + + float aspectRatio = (float)textureWidth / (float)textureHeight; + Rect sourceRect = new Rect(0f, 0f, 1f, 1f); + switch (scaleMode) + { + case ScaleMode.ScaleAndCrop: + { + float screenRatio = screenRect.width / screenRect.height; + if (screenRatio > aspectRatio) + { + float adjust = aspectRatio / screenRatio; + sourceRect = new Rect(0f, (1f - adjust) * 0.5f, 1f, adjust); + } + else + { + float adjust = screenRatio / aspectRatio; + sourceRect = new Rect(0.5f - adjust * 0.5f, 0f, adjust, 1f); + } + } + break; + case ScaleMode.ScaleToFit: + { + float screenRatio = screenRect.width / screenRect.height; + if (screenRatio > aspectRatio) + { + float adjust = aspectRatio / screenRatio; + screenRect = new Rect(screenRect.xMin + screenRect.width * (1f - adjust) * 0.5f, screenRect.yMin, adjust * screenRect.width, screenRect.height); + } + else + { + float adjust = screenRatio / aspectRatio; + screenRect = new Rect(screenRect.xMin, screenRect.yMin + screenRect.height * (1f - adjust) * 0.5f, screenRect.width, adjust * screenRect.height); + } + } + break; + case ScaleMode.StretchToFill: + break; + } + Graphics.DrawTexture(screenRect, texture, sourceRect, 0, 0, 0, 0, GUI.color, material); + } + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Demos/AVProLiveCameraCameraExplorerDemo.cs.meta b/Assets/AVProLiveCamera/Demos/AVProLiveCameraCameraExplorerDemo.cs.meta new file mode 100644 index 0000000..608214d --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/AVProLiveCameraCameraExplorerDemo.cs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 1 +guid: 8c2b450a9ff3efa4eaeb0bbce06b7e0a +MonoImporter: + importerVersion: 1 + executionOrder: 300 diff --git a/Assets/AVProLiveCamera/Demos/BackgroundDemo.unity b/Assets/AVProLiveCamera/Demos/BackgroundDemo.unity new file mode 100644 index 0000000..1177acd --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/BackgroundDemo.unity @@ -0,0 +1,662 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientLight: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 0} + m_ObjectHideFlags: 0 +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + m_LightProbes: {fileID: 0} + m_Lightmaps: [] + m_LightmapsMode: 1 + m_BakedColorSpace: 0 + m_UseDualLightmapsInForward: 0 + m_LightmapEditorSettings: + m_Resolution: 50 + m_LastUsedResolution: 0 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_BounceBoost: 1 + m_BounceIntensity: 1 + m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1} + m_SkyLightIntensity: 0 + m_Quality: 0 + m_Bounces: 1 + m_FinalGatherRays: 1000 + m_FinalGatherContrastThreshold: .0500000007 + m_FinalGatherGradientThreshold: 0 + m_FinalGatherInterpolationPoints: 15 + m_AOAmount: 0 + m_AOMaxDistance: .100000001 + m_AOContrast: 1 + m_LODSurfaceMappingDistance: 1 + m_Padding: 0 + m_TextureCompression: 0 + m_LockAtlas: 0 +--- !u!196 &5 +NavMeshSettings: + m_ObjectHideFlags: 0 + m_BuildSettings: + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + widthInaccuracy: 16.666666 + heightInaccuracy: 10 + tileSizeHint: 0 + m_NavMesh: {fileID: 0} +--- !u!1 &388216232 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 388216233} + m_Layer: 0 + m_Name: Scene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &388216233 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 388216232} + 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: 467570699} + - {fileID: 1070519234} + - {fileID: 1272989668} + m_Father: {fileID: 0} + m_RootOrder: 5 +--- !u!1 &467570695 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 467570699} + - 33: {fileID: 467570698} + - 65: {fileID: 467570697} + - 23: {fileID: 467570696} + - 114: {fileID: 467570700} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &467570696 +Renderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 467570695} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!65 &467570697 +BoxCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 467570695} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &467570698 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 467570695} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &467570699 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 467570695} + m_LocalRotation: {x: .0431016572, y: .560662985, z: .485635698, w: .669296145} + m_LocalPosition: {x: -19.2999992, y: 0, z: 34.0999985} + m_LocalScale: {x: 17.7022991, y: 17.7023048, z: 17.7023067} + m_Children: [] + m_Father: {fileID: 388216233} + m_RootOrder: 0 +--- !u!114 &467570700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 467570695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d4bdfefe1f4eb024290dff9bd495c741, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &891186130 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 891186135} + - 33: {fileID: 891186134} + - 64: {fileID: 891186133} + - 23: {fileID: 891186132} + - 114: {fileID: 891186131} + m_Layer: 0 + m_Name: BackgroundQuad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &891186131 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 891186130} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0127c5b720f8b0e41ba028a98f32e5a3, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 1853813574} + _mesh: {fileID: 891186132} + _texturePropertyName: _MainTex +--- !u!23 &891186132 +Renderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 891186130} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 2100000, guid: c0e82b9b62861fd42b64a9b40658734f, type: 2} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!64 &891186133 +MeshCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 891186130} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_SmoothSphereCollisions: 0 + m_Convex: 0 + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &891186134 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 891186130} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &891186135 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 891186130} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1070519232 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1070519234} + - 108: {fileID: 1070519233} + m_Layer: 0 + m_Name: Directional light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1070519233 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1070519232} + m_Enabled: 1 + serializedVersion: 3 + m_Type: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: .5 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_Strength: 1 + m_Bias: .0500000007 + m_Softness: 4 + m_SoftnessFade: 1 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_ActuallyLightmapped: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 1 + m_ShadowSamples: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_IndirectIntensity: 1 + m_AreaSize: {x: 1, y: 1} +--- !u!4 &1070519234 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1070519232} + m_LocalRotation: {x: .408217937, y: -.234569728, z: .109381661, w: .875426114} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 388216233} + m_RootOrder: 1 +--- !u!1 &1272989664 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1272989668} + - 33: {fileID: 1272989667} + - 65: {fileID: 1272989666} + - 23: {fileID: 1272989665} + - 114: {fileID: 1272989669} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1272989665 +Renderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1272989664} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!65 &1272989666 +BoxCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1272989664} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1272989667 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1272989664} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1272989668 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1272989664} + m_LocalRotation: {x: -.277639687, y: .872926652, z: .195401758, w: .350333422} + m_LocalPosition: {x: 23, y: 6.4000001, z: 34.0999985} + m_LocalScale: {x: 17.7022991, y: 17.7023048, z: 17.7023067} + m_Children: [] + m_Father: {fileID: 388216233} + m_RootOrder: 2 +--- !u!114 &1272989669 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1272989664} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d4bdfefe1f4eb024290dff9bd495c741, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1311781458 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1311781460} + - 114: {fileID: 1311781459} + m_Layer: 0 + m_Name: LiveCameraManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1311781459 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1311781458} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edba0400f2985f145bfd6428f24d2110, type: 3} + m_Name: + m_EditorClassIdentifier: + _supportHotSwapping: 0 + _supportInternalFormatConversion: 1 + _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, type: 3} +--- !u!4 &1311781460 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1311781458} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 3 +--- !u!1 &1615292674 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1615292676} + - 114: {fileID: 1615292675} + - 114: {fileID: 1615292677} + m_Layer: 0 + m_Name: Demo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1615292675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1615292674} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad43af36df273084f8ac3b1fa71ae729, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 1853813574} + _liveCameraManager: {fileID: 1311781459} + _guiSkin: {fileID: 11400000, guid: eb821627fb1a0c044a6fd7a6dabe3147, type: 2} +--- !u!4 &1615292676 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1615292674} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 4 +--- !u!114 &1615292677 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1615292674} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93971dd2c54fc5a46adae88ce8a1c7dd, type: 3} + m_Name: + m_EditorClassIdentifier: + _title: Background + _description: This demo shows how to use a shader to always draw the AVProLiveCamera + feed in the background behind all other content. This is useful for augmented + reality. +--- !u!1 &1853813573 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1853813575} + - 114: {fileID: 1853813574} + m_Layer: 0 + m_Name: LiveCamera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1853813574 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1853813573} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1015dbb0b69fdd446b617191771ffcce, type: 3} + m_Name: + m_EditorClassIdentifier: + _deviceSelection: 0 + _desiredDeviceNames: + - Logitech HD Pro Webcam C920 + - Decklink Video Capture + - Logitech Webcam Pro 9000 + _desiredDeviceIndex: 0 + _modeSelection: 0 + _desiredAnyResolution: 1 + _desiredResolutions: + - {x: 1920, y: 1080} + - {x: 1280, y: 720} + - {x: 640, y: 360} + - {x: 640, y: 480} + _desiredModeIndex: -1 + _maintainAspectRatio: 0 + _desiredFrameRate: 0 + _desiredFormatAny: 1 + _desiredTransparencyFormat: 0 + _desiredFormat: 4 + _videoInputSelection: 0 + _desiredVideoInputs: 0600000003000000 + _desiredVideoInputIndex: 0 + _playOnStart: 0 + _deinterlace: 0 + _allowTransparency: 1 + _flipX: 0 + _flipY: 0 + _updateHotSwap: 0 + _updateFrameRates: 0 + _updateSettings: 0 +--- !u!4 &1853813575 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1853813573} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &2100879869 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2100879874} + - 20: {fileID: 2100879873} + - 81: {fileID: 2100879870} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2100879870 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2100879869} + m_Enabled: 1 +--- !u!20 &2100879873 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2100879869} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: .110294104, g: .110294104, b: .110294104, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &2100879874 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2100879869} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/AVProLiveCamera/Demos/BackgroundDemo.unity.meta b/Assets/AVProLiveCamera/Demos/BackgroundDemo.unity.meta new file mode 100644 index 0000000..e05240b --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/BackgroundDemo.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8959a3c97de238b429512756c923ad53 +DefaultImporter: + userData: diff --git a/Assets/AVProLiveCamera/Demos/CameraExplorerDemo.unity b/Assets/AVProLiveCamera/Demos/CameraExplorerDemo.unity new file mode 100644 index 0000000..2e1e85e --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/CameraExplorerDemo.unity @@ -0,0 +1,201 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientLight: {r: .197816864, g: .218168095, b: .23880595, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 0} + m_ObjectHideFlags: 0 +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + m_LightProbes: {fileID: 0} + m_Lightmaps: [] + m_LightmapsMode: 1 + m_BakedColorSpace: 0 + m_UseDualLightmapsInForward: 0 + m_LightmapEditorSettings: + m_Resolution: 50 + m_LastUsedResolution: 0 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_BounceBoost: 1 + m_BounceIntensity: 1 + m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1} + m_SkyLightIntensity: 0 + m_Quality: 0 + m_Bounces: 1 + m_FinalGatherRays: 1000 + m_FinalGatherContrastThreshold: .0500000007 + m_FinalGatherGradientThreshold: 0 + m_FinalGatherInterpolationPoints: 15 + m_AOAmount: 0 + m_AOMaxDistance: .100000001 + m_AOContrast: 1 + m_LODSurfaceMappingDistance: 1 + m_Padding: 0 + m_TextureCompression: 0 + m_LockAtlas: 0 +--- !u!1 &12 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 20} + - 20: {fileID: 21} + - 81: {fileID: 34} + - 114: {fileID: 13} + - 114: {fileID: 14} + - 114: {fileID: 15} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &13 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8c2b450a9ff3efa4eaeb0bbce06b7e0a, type: 3} + m_Name: + m_EditorClassIdentifier: + _guiSkin: {fileID: 11400000, guid: eb821627fb1a0c044a6fd7a6dabe3147, type: 2} + _updateDeviceSettings: 0 +--- !u!114 &14 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edba0400f2985f145bfd6428f24d2110, type: 3} + m_Name: + m_EditorClassIdentifier: + _supportHotSwapping: 0 + _supportInternalFormatConversion: 1 + _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, type: 3} +--- !u!114 &15 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93971dd2c54fc5a46adae88ce8a1c7dd, type: 3} + m_Name: + m_EditorClassIdentifier: + _title: Camera Explorer + _description: The demo allows you to explore all of the cameras connected to the + system. This demo doesn`t use any of the drag `n drop components (except the + required AVProLiveCameraManager component) and demonstrates how easily the a + demo can be written using a few lines of scripting. The demo is created by a + single 120 line script file, most of which is GUI related. The demo also supports + hot-swapping, allowing detection of device removal or connection. +--- !u!4 &20 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -5.12457037, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!20 &21 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: .141791046, g: .141791046, b: .141791046, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!81 &34 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 +--- !u!196 &48 +NavMeshSettings: + m_ObjectHideFlags: 0 + m_BuildSettings: + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + widthInaccuracy: 16.666666 + heightInaccuracy: 10 + tileSizeHint: 0 + m_NavMesh: {fileID: 0} diff --git a/Assets/AVProLiveCamera/Demos/CameraExplorerDemo.unity.meta b/Assets/AVProLiveCamera/Demos/CameraExplorerDemo.unity.meta new file mode 100644 index 0000000..ca2223f --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/CameraExplorerDemo.unity.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 73ac7f3f82bc7a046b28b1ff30066b81 diff --git a/Assets/AVProLiveCamera/Demos/CameraGrabDemo.unity b/Assets/AVProLiveCamera/Demos/CameraGrabDemo.unity new file mode 100644 index 0000000..4f25049 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/CameraGrabDemo.unity @@ -0,0 +1,243 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientLight: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 0} + m_ObjectHideFlags: 0 +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + m_LightProbes: {fileID: 0} + m_Lightmaps: [] + m_LightmapsMode: 1 + m_BakedColorSpace: 0 + m_UseDualLightmapsInForward: 0 + m_LightmapEditorSettings: + m_Resolution: 50 + m_LastUsedResolution: 0 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_BounceBoost: 1 + m_BounceIntensity: 1 + m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1} + m_SkyLightIntensity: 0 + m_Quality: 0 + m_Bounces: 1 + m_FinalGatherRays: 1000 + m_FinalGatherContrastThreshold: .0500000007 + m_FinalGatherGradientThreshold: 0 + m_FinalGatherInterpolationPoints: 15 + m_AOAmount: 0 + m_AOMaxDistance: .100000001 + m_AOContrast: 1 + m_LODSurfaceMappingDistance: 1 + m_Padding: 0 + m_TextureCompression: 0 + m_LockAtlas: 0 +--- !u!1 &5 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 6} + - 20: {fileID: 7} + - 81: {fileID: 8} + - 114: {fileID: 13} + - 114: {fileID: 11} + - 114: {fileID: 15} + - 114: {fileID: 12} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!20 &7 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: .089663595, g: .0954245925, b: .104477584, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!81 &8 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 +--- !u!114 &11 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0a335bb4a52eaa74d869f7e12790b858, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 13} + _scaleMode: 2 + _color: {r: 1, g: 1, b: 1, a: 1} + _depth: 0 + _fullScreen: 1 + _x: 0 + _y: 0 + _width: 1 + _height: 1 + _flipX: 0 + _flipY: 0 +--- !u!114 &12 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edba0400f2985f145bfd6428f24d2110, type: 3} + m_Name: + m_EditorClassIdentifier: + _supportHotSwapping: 0 + _supportInternalFormatConversion: 0 + _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, type: 3} +--- !u!114 &13 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1015dbb0b69fdd446b617191771ffcce, type: 3} + m_Name: + m_EditorClassIdentifier: + _deviceSelection: 0 + _desiredDeviceNames: + - Logitech Webcam Pro 9000 + - Decklink Video Capture + _desiredDeviceIndex: -1 + _modeSelection: 0 + _desiredAnyResolution: 1 + _desiredResolutions: + - {x: 1280, y: 720} + - {x: 640, y: 480} + _desiredModeIndex: -1 + _maintainAspectRatio: 0 + _desiredFrameRate: 0 + _desiredFormatAny: 1 + _desiredTransparencyFormat: 0 + _desiredFormat: 4 + _videoInputSelection: 0 + _desiredVideoInputs: + _desiredVideoInputIndex: 0 + _playOnStart: 1 + _deinterlace: 0 + _allowTransparency: 1 + _flipX: 0 + _flipY: 0 + _updateHotSwap: 0 + _updateFrameRates: 0 + _updateSettings: 0 +--- !u!196 &14 +NavMeshSettings: + m_ObjectHideFlags: 0 + m_BuildSettings: + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + widthInaccuracy: 16.666666 + heightInaccuracy: 10 + tileSizeHint: 0 + m_NavMesh: {fileID: 0} +--- !u!114 &15 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8fe2a09a366a1ec4cbe1afa8968d5075, type: 3} + m_Name: + m_EditorClassIdentifier: + _camera: {fileID: 13} diff --git a/Assets/AVProLiveCamera/Demos/CameraGrabDemo.unity.meta b/Assets/AVProLiveCamera/Demos/CameraGrabDemo.unity.meta new file mode 100644 index 0000000..2de59bb --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/CameraGrabDemo.unity.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4ad90cf118427b141a4517986b716f0d diff --git a/Assets/AVProLiveCamera/Demos/DefaultCameraDemo.unity b/Assets/AVProLiveCamera/Demos/DefaultCameraDemo.unity new file mode 100644 index 0000000..c96940f --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/DefaultCameraDemo.unity @@ -0,0 +1,261 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientLight: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 0} + m_ObjectHideFlags: 0 +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + m_LightProbes: {fileID: 0} + m_Lightmaps: [] + m_LightmapsMode: 1 + m_BakedColorSpace: 0 + m_UseDualLightmapsInForward: 0 + m_LightmapEditorSettings: + m_Resolution: 50 + m_LastUsedResolution: 0 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_BounceBoost: 1 + m_BounceIntensity: 1 + m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1} + m_SkyLightIntensity: 0 + m_Quality: 0 + m_Bounces: 1 + m_FinalGatherRays: 1000 + m_FinalGatherContrastThreshold: .0500000007 + m_FinalGatherGradientThreshold: 0 + m_FinalGatherInterpolationPoints: 15 + m_AOAmount: 0 + m_AOMaxDistance: .100000001 + m_AOContrast: 1 + m_LODSurfaceMappingDistance: 1 + m_Padding: 0 + m_TextureCompression: 0 + m_LockAtlas: 0 +--- !u!1 &5 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 6} + - 20: {fileID: 7} + - 81: {fileID: 8} + - 114: {fileID: 13} + - 114: {fileID: 11} + - 114: {fileID: 12} + - 114: {fileID: 15} + - 114: {fileID: 16} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!20 &7 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: .089663595, g: .0954245925, b: .104477584, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!81 &8 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 +--- !u!114 &11 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0a335bb4a52eaa74d869f7e12790b858, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 13} + _scaleMode: 2 + _color: {r: 1, g: 1, b: 1, a: 1} + _depth: 5 + _fullScreen: 1 + _x: 0 + _y: 0 + _width: 1 + _height: 1 + _flipX: 0 + _flipY: 0 +--- !u!114 &12 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edba0400f2985f145bfd6428f24d2110, type: 3} + m_Name: + m_EditorClassIdentifier: + _supportHotSwapping: 0 + _supportInternalFormatConversion: 1 + _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, type: 3} +--- !u!114 &13 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1015dbb0b69fdd446b617191771ffcce, type: 3} + m_Name: + m_EditorClassIdentifier: + _deviceSelection: 0 + _desiredDeviceNames: + - Logitech Webcam Pro 9000 + - Decklink Video Capture + _desiredDeviceIndex: 0 + _modeSelection: 0 + _desiredAnyResolution: 1 + _desiredResolutions: + - {x: 1280, y: 720} + - {x: 640, y: 480} + _desiredModeIndex: -1 + _maintainAspectRatio: 0 + _desiredFrameRate: 0 + _desiredFormatAny: 1 + _desiredTransparencyFormat: 0 + _desiredFormat: 4 + _videoInputSelection: 0 + _desiredVideoInputs: + _desiredVideoInputIndex: 0 + _playOnStart: 0 + _deinterlace: 0 + _allowTransparency: 1 + _flipX: 0 + _flipY: 0 + _updateHotSwap: 0 + _updateFrameRates: 0 + _updateSettings: 0 +--- !u!196 &14 +NavMeshSettings: + m_ObjectHideFlags: 0 + m_BuildSettings: + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + widthInaccuracy: 16.666666 + heightInaccuracy: 10 + tileSizeHint: 0 + m_NavMesh: {fileID: 0} +--- !u!114 &15 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93971dd2c54fc5a46adae88ce8a1c7dd, type: 3} + m_Name: + m_EditorClassIdentifier: + _title: Default Camera + _description: This is the most basic demo as it requires no scripting at all. The + demo simply draws the default camera on the system to the screen using the Unity + GUI. +--- !u!114 &16 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad43af36df273084f8ac3b1fa71ae729, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 13} + _liveCameraManager: {fileID: 12} + _guiSkin: {fileID: 11400000, guid: eb821627fb1a0c044a6fd7a6dabe3147, type: 2} diff --git a/Assets/AVProLiveCamera/Demos/DefaultCameraDemo.unity.meta b/Assets/AVProLiveCamera/Demos/DefaultCameraDemo.unity.meta new file mode 100644 index 0000000..7cab625 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/DefaultCameraDemo.unity.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 72eafba68ee153c468671ca31619a900 diff --git a/Assets/AVProLiveCamera/Demos/GUI.meta b/Assets/AVProLiveCamera/Demos/GUI.meta new file mode 100644 index 0000000..b26fca5 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 3b6604afd73dc004ca8fdf810f5b7d8f diff --git a/Assets/AVProLiveCamera/Demos/GUI/ConfigSkin.guiskin b/Assets/AVProLiveCamera/Demos/GUI/ConfigSkin.guiskin new file mode 100644 index 0000000..8f44451 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/ConfigSkin.guiskin @@ -0,0 +1,1549 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 1 + m_Script: {fileID: 12001, guid: 0000000000000000e000000000000000, type: 0} + m_Name: ConfigSkin + m_EditorClassIdentifier: + m_Font: {fileID: 12800000, guid: 1102003ee10456942bffb2b369d6a7b8, type: 3} + m_box: + m_Name: box + m_Normal: + m_Background: {fileID: 2800000, guid: 7fbbedb31432e4d408b2e3fbd0dbd862, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 18 + m_FontStyle: 0 + m_Alignment: 1 + m_WordWrap: 1 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_button: + m_Name: button + m_Normal: + m_Background: {fileID: 2800000, guid: b6b9f1741e3bb6241aab55422ae1f133, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 5fa7bcd58e1876e41952c9349da60879, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 5fa7bcd58e1876e41952c9349da60879, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 4 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 6 + m_Right: 6 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 16 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_toggle: + m_Name: toggle + m_Normal: + m_Background: {fileID: 2800000, guid: ccce2d09cdddb2d4da068267090c1548, type: 3} + m_TextColor: {r: .768656731, g: .768656731, b: .768656731, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: b6b9f1741e3bb6241aab55422ae1f133, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 4 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 6 + m_Right: 6 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 16 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + m_label: + m_Name: label + m_Normal: + m_Background: {fileID: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 16 + m_FontStyle: 0 + m_Alignment: 5 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_textField: + m_Name: textfield + m_Normal: + m_Background: {fileID: 2800000, guid: ccce2d09cdddb2d4da068267090c1548, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: .899999976, g: .899999976, b: .899999976, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnNormal: + m_Background: {fileID: 11025, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 3 + m_Right: 3 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 52 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_textArea: + m_Name: textarea + m_Normal: + m_Background: {fileID: 11024, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: .90196079, g: .90196079, b: .90196079, a: 1} + m_Hover: + m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: .799999952, g: .799999952, b: .799999952, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 11025, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 3 + m_Right: 3 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 1 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_window: + m_Name: window + m_Normal: + m_Background: {fileID: 11023, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 11022, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 8 + m_Right: 8 + m_Top: 18 + m_Bottom: 8 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 10 + m_Right: 10 + m_Top: 20 + m_Bottom: 10 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: -18} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalSlider: + m_Name: horizontalslider + m_Normal: + m_Background: {fileID: 2800000, guid: 5fa7bcd58e1876e41952c9349da60879, type: 3} + m_TextColor: {r: .50746268, g: .143907323, b: .143907323, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 3 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: -1 + m_Right: -1 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -2 + m_Bottom: -3 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 30 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalSliderThumb: + m_Name: horizontalsliderthumb + m_Normal: + m_Background: {fileID: 2800000, guid: e8b5fb4ca0fdd2c4eadc7cbe065543a4, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: e8b5fb4ca0fdd2c4eadc7cbe065543a4, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 2800000, guid: e8b5fb4ca0fdd2c4eadc7cbe065543a4, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 4 + m_Right: 4 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 7 + m_Right: 7 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: -1 + m_Right: -1 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 30 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalSlider: + m_Name: verticalslider + m_Normal: + m_Background: {fileID: 11021, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 3 + m_Bottom: 3 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: -1 + m_Bottom: -1 + m_Overflow: + m_Left: -2 + m_Right: -3 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 12 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 1 + m_verticalSliderThumb: + m_Name: verticalsliderthumb + m_Normal: + m_Background: {fileID: 11011, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 11012, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 11010, guid: 0000000000000000e000000000000000, type: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 7 + m_Bottom: 7 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -1 + m_Bottom: -1 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 12 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 1 + m_horizontalScrollbar: + m_Name: horizontalscrollbar + m_Normal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 9 + m_Right: 9 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 1 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 15 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalScrollbarThumb: + m_Name: horizontalscrollbarthumb + m_Normal: + m_Background: {fileID: 2800000, guid: e8b5fb4ca0fdd2c4eadc7cbe065543a4, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 6 + m_Right: 6 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -1 + m_Bottom: 1 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 13 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalScrollbarLeftButton: + m_Name: horizontalscrollbarleftbutton + m_Normal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_horizontalScrollbarRightButton: + m_Name: horizontalscrollbarrightbutton + m_Normal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalScrollbar: + m_Name: verticalscrollbar + m_Normal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 9 + m_Bottom: 9 + m_Margin: + m_Left: 1 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 1 + m_Bottom: 1 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 15 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalScrollbarThumb: + m_Name: verticalscrollbarthumb + m_Normal: + m_Background: {fileID: 2800000, guid: e8b5fb4ca0fdd2c4eadc7cbe065543a4, type: 3} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 6 + m_Bottom: 6 + m_Overflow: + m_Left: -1 + m_Right: -1 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 15 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 1 + m_verticalScrollbarUpButton: + m_Name: verticalscrollbarupbutton + m_Normal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_verticalScrollbarDownButton: + m_Name: verticalscrollbardownbutton + m_Normal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_ScrollView: + m_Name: scrollview + m_Normal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_CustomStyles: + - m_Name: ContrastLabel + m_Normal: + m_Background: {fileID: 2800000, guid: 7fbbedb31432e4d408b2e3fbd0dbd862, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: spectrumHorizSlider + m_Normal: + m_Background: {fileID: 2800000, guid: be0cffc23968d704980274205bc44645, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 3 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: -1 + m_Right: -1 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -2 + m_Bottom: -3 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 2 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 30 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: sceneSelection + m_Normal: + m_Background: {fileID: 2800000, guid: b6b9f1741e3bb6241aab55422ae1f133, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 5fa7bcd58e1876e41952c9349da60879, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 3 + m_Right: 3 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 10 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 16 + m_Bottom: 12 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: -2 + m_Bottom: -3 + m_Font: {fileID: 0} + m_FontSize: 0 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 1 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 208.009995 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: labelCentred + m_Normal: + m_Background: {fileID: 2800000, guid: 7fbbedb31432e4d408b2e3fbd0dbd862, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 5fa7bcd58e1876e41952c9349da60879, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 18 + m_Right: 18 + m_Top: 3 + m_Bottom: 3 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: -2 + m_Font: {fileID: 0} + m_FontSize: 31 + m_FontStyle: 0 + m_Alignment: 1 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + - m_Name: labelHeading + m_Normal: + m_Background: {fileID: 2800000, guid: b6b9f1741e3bb6241aab55422ae1f133, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 2800000, guid: 5fa7bcd58e1876e41952c9349da60879, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 15 + m_Right: 0 + m_Top: 23 + m_Bottom: 17 + m_Padding: + m_Left: 0 + m_Right: 46 + m_Top: 9 + m_Bottom: 6 + m_Overflow: + m_Left: 18 + m_Right: 4 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 22 + m_FontStyle: 1 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 3 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 0 + m_StretchHeight: 0 + - m_Name: BlackBox + m_Normal: + m_Background: {fileID: 2800000, guid: 41dc463a61e06694b85593cb70e17848, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_Active: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 2800000, guid: 89756d2e84d7799499b64043123ddf38, type: 3} + m_TextColor: {r: 1, g: 1, b: 1, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 6 + m_Right: 6 + m_Top: 6 + m_Bottom: 6 + m_Margin: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 4 + m_Padding: + m_Left: 4 + m_Right: 4 + m_Top: 4 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 18 + m_FontStyle: 0 + m_Alignment: 1 + m_WordWrap: 1 + m_RichText: 1 + m_TextClipping: 1 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + m_Settings: + m_DoubleClickSelectsWord: 1 + m_TripleClickSelectsLine: 1 + m_CursorColor: {r: 1, g: 1, b: 1, a: 1} + m_CursorFlashSpeed: -1 + m_SelectionColor: {r: 1, g: .384039074, b: 0, a: .699999988} diff --git a/Assets/AVProLiveCamera/Demos/GUI/ConfigSkin.guiskin.meta b/Assets/AVProLiveCamera/Demos/GUI/ConfigSkin.guiskin.meta new file mode 100644 index 0000000..bf3603a --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/ConfigSkin.guiskin.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: eb821627fb1a0c044a6fd7a6dabe3147 diff --git a/Assets/AVProLiveCamera/Demos/GUI/Inconsolata.otf b/Assets/AVProLiveCamera/Demos/GUI/Inconsolata.otf new file mode 100644 index 0000000..3488898 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/Inconsolata.otf differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/Inconsolata.otf.meta b/Assets/AVProLiveCamera/Demos/GUI/Inconsolata.otf.meta new file mode 100644 index 0000000..ea59d6d --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/Inconsolata.otf.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1102003ee10456942bffb2b369d6a7b8 +TrueTypeFontImporter: + serializedVersion: 2 + fontSize: 16 + fontColor: {r: 1, g: 1, b: 1, a: 1} + forceTextureCase: -2 + renderMode: 0 + style: 0 + includeFontData: 1 + use2xBehaviour: 0 + fontNames: [] + customCharacters: diff --git a/Assets/AVProLiveCamera/Demos/GUI/black.png b/Assets/AVProLiveCamera/Demos/GUI/black.png new file mode 100644 index 0000000..8cde491 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/black.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/black.png.meta b/Assets/AVProLiveCamera/Demos/GUI/black.png.meta new file mode 100644 index 0000000..92b2daa --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/black.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 41dc463a61e06694b85593cb70e17848 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray.png b/Assets/AVProLiveCamera/Demos/GUI/gray.png new file mode 100644 index 0000000..9ad6115 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/gray.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray.png.meta b/Assets/AVProLiveCamera/Demos/GUI/gray.png.meta new file mode 100644 index 0000000..5ae7cfc --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/gray.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 89756d2e84d7799499b64043123ddf38 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray25.png b/Assets/AVProLiveCamera/Demos/GUI/gray25.png new file mode 100644 index 0000000..e986d47 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/gray25.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray25.png.meta b/Assets/AVProLiveCamera/Demos/GUI/gray25.png.meta new file mode 100644 index 0000000..c987003 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/gray25.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 5fa7bcd58e1876e41952c9349da60879 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray50.png b/Assets/AVProLiveCamera/Demos/GUI/gray50.png new file mode 100644 index 0000000..b97d737 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/gray50.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray50.png.meta b/Assets/AVProLiveCamera/Demos/GUI/gray50.png.meta new file mode 100644 index 0000000..a9ae4b6 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/gray50.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: b6b9f1741e3bb6241aab55422ae1f133 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray80.png b/Assets/AVProLiveCamera/Demos/GUI/gray80.png new file mode 100644 index 0000000..7da5ca4 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/gray80.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/gray80.png.meta b/Assets/AVProLiveCamera/Demos/GUI/gray80.png.meta new file mode 100644 index 0000000..bdcab01 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/gray80.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: ccce2d09cdddb2d4da068267090c1548 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUI/spectrum.png b/Assets/AVProLiveCamera/Demos/GUI/spectrum.png new file mode 100644 index 0000000..af4fbb0 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/spectrum.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/spectrum.png.meta b/Assets/AVProLiveCamera/Demos/GUI/spectrum.png.meta new file mode 100644 index 0000000..1fc19b3 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/spectrum.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: be0cffc23968d704980274205bc44645 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUI/transpBlack.png b/Assets/AVProLiveCamera/Demos/GUI/transpBlack.png new file mode 100644 index 0000000..23648d5 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/transpBlack.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/transpBlack.png.meta b/Assets/AVProLiveCamera/Demos/GUI/transpBlack.png.meta new file mode 100644 index 0000000..945c864 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/transpBlack.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 7fbbedb31432e4d408b2e3fbd0dbd862 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUI/transpWhite.png b/Assets/AVProLiveCamera/Demos/GUI/transpWhite.png new file mode 100644 index 0000000..6ffa8a1 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/GUI/transpWhite.png differ diff --git a/Assets/AVProLiveCamera/Demos/GUI/transpWhite.png.meta b/Assets/AVProLiveCamera/Demos/GUI/transpWhite.png.meta new file mode 100644 index 0000000..f846104 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUI/transpWhite.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: e8b5fb4ca0fdd2c4eadc7cbe065543a4 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Demos/GUIDemo.unity b/Assets/AVProLiveCamera/Demos/GUIDemo.unity new file mode 100644 index 0000000..5e61af4 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUIDemo.unity @@ -0,0 +1,780 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientLight: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 0} + m_ObjectHideFlags: 0 +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + m_LightProbes: {fileID: 0} + m_Lightmaps: [] + m_LightmapsMode: 1 + m_BakedColorSpace: 0 + m_UseDualLightmapsInForward: 0 + m_LightmapEditorSettings: + m_Resolution: 50 + m_LastUsedResolution: 0 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_BounceBoost: 1 + m_BounceIntensity: 1 + m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1} + m_SkyLightIntensity: 0 + m_Quality: 0 + m_Bounces: 1 + m_FinalGatherRays: 1000 + m_FinalGatherContrastThreshold: .0500000007 + m_FinalGatherGradientThreshold: 0 + m_FinalGatherInterpolationPoints: 15 + m_AOAmount: 0 + m_AOMaxDistance: .100000001 + m_AOContrast: 1 + m_LODSurfaceMappingDistance: 1 + m_Padding: 0 + m_TextureCompression: 0 + m_LockAtlas: 0 +--- !u!196 &5 +NavMeshSettings: + m_ObjectHideFlags: 0 + m_BuildSettings: + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + widthInaccuracy: 16.666666 + heightInaccuracy: 10 + tileSizeHint: 0 + m_NavMesh: {fileID: 0} +--- !u!1 &295334171 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 295334173} + - 114: {fileID: 295334172} + - 114: {fileID: 295334174} + m_Layer: 0 + m_Name: Demo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &295334172 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 295334171} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93971dd2c54fc5a46adae88ce8a1c7dd, type: 3} + m_Name: + m_EditorClassIdentifier: + _title: uGUI + _description: This demo uses the uGUI component to draw an AVProLiveCamera to the + Unity GUI canvas +--- !u!4 &295334173 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 295334171} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 90} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 +--- !u!114 &295334174 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 295334171} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad43af36df273084f8ac3b1fa71ae729, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 1853813574} + _liveCameraManager: {fileID: 1311781459} + _guiSkin: {fileID: 11400000, guid: eb821627fb1a0c044a6fd7a6dabe3147, type: 2} +--- !u!1 &492034146 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 492034150} + - 114: {fileID: 492034149} + - 114: {fileID: 492034148} + - 114: {fileID: 492034147} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &492034147 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 492034146} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AllowActivationOnStandalone: 0 +--- !u!114 &492034148 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 492034146} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_AllowActivationOnMobileDevice: 0 +--- !u!114 &492034149 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 492034146} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &492034150 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 492034146} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 4 +--- !u!1 &1052703744 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1052703747} + - 222: {fileID: 1052703746} + - 114: {fileID: 1052703745} + m_Layer: 0 + m_Name: AVPro Live Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1052703745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1052703744} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0da62b8b54c37da4a8826e97a78df85f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_liveCamera: {fileID: 1853813574} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + _setNativeSize: 0 + _keepAspectRatio: 1 + _defaultTexture: {fileID: 0} +--- !u!222 &1052703746 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1052703744} +--- !u!224 &1052703747 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1052703744} + 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: [] + m_Father: {fileID: 1936782191} + m_RootOrder: 0 + m_AnchorMin: {x: .5, y: .5} + m_AnchorMax: {x: .5, y: .5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1036, y: 624} + m_Pivot: {x: .5, y: .5} +--- !u!1 &1260960674 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1260960675} + - 223: {fileID: 1260960678} + - 114: {fileID: 1260960677} + - 114: {fileID: 1260960676} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1260960675 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1260960674} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1936782191} + m_Father: {fileID: 0} + m_RootOrder: 3 + 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} +--- !u!114 &1260960676 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1260960674} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1260960677 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1260960674} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1260960678 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1260960674} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 1 + m_Camera: {fileID: 2100879873} + m_PlaneDistance: 100 + m_PixelPerfect: 1 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!1 &1311781458 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1311781460} + - 114: {fileID: 1311781459} + m_Layer: 0 + m_Name: LiveCameraManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1311781459 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1311781458} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edba0400f2985f145bfd6428f24d2110, type: 3} + m_Name: + m_EditorClassIdentifier: + _supportHotSwapping: 0 + _supportInternalFormatConversion: 1 + _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, type: 3} +--- !u!4 &1311781460 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1311781458} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &1349168039 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1349168042} + - 222: {fileID: 1349168041} + - 114: {fileID: 1349168040} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1349168040 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1349168039} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Button +--- !u!222 &1349168041 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1349168039} +--- !u!224 &1349168042 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1349168039} + 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: [] + m_Father: {fileID: 1627917853} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!1 &1627917852 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1627917853} + - 222: {fileID: 1627917856} + - 114: {fileID: 1627917855} + - 114: {fileID: 1627917854} + m_Layer: 5 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1627917853 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1627917852} + 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: 1349168042} + m_Father: {fileID: 1936782191} + m_RootOrder: 1 + m_AnchorMin: {x: .5, y: .5} + m_AnchorMax: {x: .5, y: .5} + m_AnchoredPosition: {x: 435.5, y: -371} + m_SizeDelta: {x: 165, y: 78} + m_Pivot: {x: .5, y: .5} +--- !u!114 &1627917854 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1627917852} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1} + m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} + m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} + m_ColorMultiplier: 1 + m_FadeDuration: .100000001 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1627917855} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1627917855 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1627917852} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1627917856 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1627917852} +--- !u!1 &1853813573 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1853813575} + - 114: {fileID: 1853813574} + m_Layer: 0 + m_Name: LiveCamera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1853813574 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1853813573} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1015dbb0b69fdd446b617191771ffcce, type: 3} + m_Name: + m_EditorClassIdentifier: + _deviceSelection: 0 + _desiredDeviceNames: + - Logitech HD Pro Webcam C920 + - Decklink Video Capture + - Logitech Webcam Pro 9000 + _desiredDeviceIndex: -1 + _modeSelection: 0 + _desiredAnyResolution: 1 + _desiredResolutions: + - {x: 1920, y: 1080} + - {x: 1280, y: 720} + - {x: 640, y: 360} + - {x: 640, y: 480} + _desiredModeIndex: -1 + _maintainAspectRatio: 0 + _desiredFrameRate: 0 + _desiredFormatAny: 1 + _desiredTransparencyFormat: 0 + _desiredFormat: 4 + _videoInputSelection: 0 + _desiredVideoInputs: 0600000003000000 + _desiredVideoInputIndex: 0 + _playOnStart: 0 + _deinterlace: 0 + _allowTransparency: 1 + _flipX: 0 + _flipY: 0 + _updateHotSwap: 0 + _updateFrameRates: 0 + _updateSettings: 0 +--- !u!4 &1853813575 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1853813573} + 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: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1936782188 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1936782191} + - 222: {fileID: 1936782190} + - 114: {fileID: 1936782189} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1936782189 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1936782188} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .204584777, g: .349140972, b: .632352948, a: .392156869} + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1936782190 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1936782188} +--- !u!224 &1936782191 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1936782188} + 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: 1052703747} + - {fileID: 1627917853} + m_Father: {fileID: 1260960675} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -33, y: 15} + m_SizeDelta: {x: -771, y: -206} + m_Pivot: {x: .5, y: .5} +--- !u!1 &2100879869 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2100879874} + - 20: {fileID: 2100879873} + - 81: {fileID: 2100879870} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2100879870 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2100879869} + m_Enabled: 1 +--- !u!20 &2100879873 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2100879869} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: .110294104, g: .110294104, b: .110294104, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &2100879874 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2100879869} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/AVProLiveCamera/Demos/GUIDemo.unity.meta b/Assets/AVProLiveCamera/Demos/GUIDemo.unity.meta new file mode 100644 index 0000000..36b0c9c --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/GUIDemo.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 53ab13897a3dfd44ea5420ed9e0956c0 +DefaultImporter: + userData: diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.meta b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.meta new file mode 100644 index 0000000..ec48061 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 96c680413dbb26841956448d7fde3c21 diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.unity b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.unity new file mode 100644 index 0000000..eb335c1 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.unity @@ -0,0 +1,609 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientLight: {r: .197816864, g: .218168095, b: .23880595, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 0} + m_ObjectHideFlags: 0 +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + m_LightProbes: {fileID: 0} + m_Lightmaps: [] + m_LightmapsMode: 1 + m_BakedColorSpace: 0 + m_UseDualLightmapsInForward: 0 + m_LightmapEditorSettings: + m_Resolution: 50 + m_LastUsedResolution: 0 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_BounceBoost: 1 + m_BounceIntensity: 1 + m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1} + m_SkyLightIntensity: 0 + m_Quality: 0 + m_Bounces: 1 + m_FinalGatherRays: 1000 + m_FinalGatherContrastThreshold: .0500000007 + m_FinalGatherGradientThreshold: 0 + m_FinalGatherInterpolationPoints: 15 + m_AOAmount: 0 + m_AOMaxDistance: .100000001 + m_AOContrast: 1 + m_LODSurfaceMappingDistance: 1 + m_Padding: 0 + m_TextureCompression: 0 + m_LockAtlas: 0 +--- !u!1 &5 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 13} + - 108: {fileID: 36} + m_Layer: 0 + m_Name: Directional light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &7 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 15} + - 33: {fileID: 27} + - 23: {fileID: 23} + m_Layer: 0 + m_Name: MovingSphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &9 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 17} + - 33: {fileID: 28} + - 23: {fileID: 24} + m_Layer: 0 + m_Name: GroundPlane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &10 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 18} + m_Layer: 0 + m_Name: Scene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &11 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 19} + - 33: {fileID: 29} + - 23: {fileID: 25} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &12 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 20} + - 20: {fileID: 21} + - 81: {fileID: 34} + - 114: {fileID: 47} + - 114: {fileID: 45} + - 114: {fileID: 44} + - 114: {fileID: 43} + - 114: {fileID: 46} + - 114: {fileID: 49} + - 114: {fileID: 50} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &13 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_LocalRotation: {x: .312182873, y: -.252416253, z: .643252194, w: .651962042} + m_LocalPosition: {x: -.039727211, y: -1.38006473, z: -3.30654716} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 18} + m_RootOrder: 2 +--- !u!4 &15 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 7} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -11.6859341, y: -1.15999997, z: -1.63695955} + m_LocalScale: {x: 2, y: 2, z: 2} + m_Children: [] + m_Father: {fileID: 18} + m_RootOrder: 4 +--- !u!4 &17 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 9} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5.0832119, y: -7.68132067, z: 7.11912489} + m_LocalScale: {x: 91.2526932, y: 3.77962542, z: 23.1667786} + m_Children: [] + m_Father: {fileID: 18} + m_RootOrder: 3 +--- !u!4 &18 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 10} + 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: 19} + - {fileID: 1149800889} + - {fileID: 13} + - {fileID: 17} + - {fileID: 15} + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!4 &19 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 11} + m_LocalRotation: {x: -.405039281, y: .0907986313, z: -.0404641367, w: -.90887922} + m_LocalPosition: {x: 1.95000005, y: -6.48000002, z: -1.29999995} + m_LocalScale: {x: 4.72751474, y: 4.72751427, z: 4.72751427} + m_Children: [] + m_Father: {fileID: 18} + m_RootOrder: 0 +--- !u!4 &20 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -5.12457037, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!20 &21 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: .692247748, g: .750983894, b: .843283594, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!23 &23 +Renderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 7} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 2100000, guid: 5fc1a71e55ce15e4d97e8e5778771e99, type: 2} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!23 &24 +Renderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 9} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 2100000, guid: 910a2dff7334ff4478c38439fd536ff1, type: 2} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!23 &25 +Renderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 11} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 2100000, guid: 5fc1a71e55ce15e4d97e8e5778771e99, type: 2} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &27 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 7} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &28 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 9} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &29 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 11} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!81 &34 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 +--- !u!108 &36 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 5} + m_Enabled: 1 + serializedVersion: 3 + m_Type: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: .430000007 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_Strength: .344000012 + m_Bias: .0500000007 + m_Softness: 4 + m_SoftnessFade: 1 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_ActuallyLightmapped: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 1 + m_ShadowSamples: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_IndirectIntensity: 1 + m_AreaSize: {x: 1, y: 1} +--- !u!114 &43 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ab0eec4b8427f0d479209659cc24a999, type: 3} + m_Name: + m_EditorClassIdentifier: + _sphere: {fileID: 15} + _speed: .300000012 +--- !u!114 &44 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b3f963f7811140b46977bceaf97cc51f, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 47} + _material: {fileID: 2100000, guid: 5fc1a71e55ce15e4d97e8e5778771e99, type: 2} + _texturePropertyName: _MainTex +--- !u!114 &45 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0a335bb4a52eaa74d869f7e12790b858, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 47} + _scaleMode: 2 + _color: {r: 1, g: 1, b: 1, a: 1} + _depth: 0 + _fullScreen: 0 + _x: 0 + _y: .875 + _width: .125 + _height: .125 + _flipX: 0 + _flipY: 0 +--- !u!114 &46 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edba0400f2985f145bfd6428f24d2110, type: 3} + m_Name: + m_EditorClassIdentifier: + _supportHotSwapping: 0 + _supportInternalFormatConversion: 1 + _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, type: 3} +--- !u!114 &47 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1015dbb0b69fdd446b617191771ffcce, type: 3} + m_Name: + m_EditorClassIdentifier: + _deviceSelection: 0 + _desiredDeviceNames: + - Logitech Webcam Pro 9000 + - Decklink Video Capture + _desiredDeviceIndex: 0 + _modeSelection: 0 + _desiredAnyResolution: 1 + _desiredResolutions: + - {x: 1280, y: 720} + - {x: 640, y: 480} + _desiredModeIndex: -1 + _maintainAspectRatio: 0 + _desiredFrameRate: 0 + _desiredFormatAny: 1 + _desiredTransparencyFormat: 0 + _desiredFormat: 4 + _videoInputSelection: 0 + _desiredVideoInputs: + _desiredVideoInputIndex: 0 + _playOnStart: 0 + _deinterlace: 0 + _allowTransparency: 1 + _flipX: 0 + _flipY: 0 + _updateHotSwap: 0 + _updateFrameRates: 0 + _updateSettings: 0 +--- !u!196 &48 +NavMeshSettings: + m_ObjectHideFlags: 0 + m_BuildSettings: + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + widthInaccuracy: 16.666666 + heightInaccuracy: 10 + tileSizeHint: 0 + m_NavMesh: {fileID: 0} +--- !u!114 &49 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93971dd2c54fc5a46adae88ce8a1c7dd, type: 3} + m_Name: + m_EditorClassIdentifier: + _title: Material Mapping + _description: 'This demo shows how to integrate AVProLiveCamera into your 3D scene. No + scripting is required as you can just use either of the 2 included components: + AVProLiveCameraMaterialApply, AVProLiveCameraMeshApply.' +--- !u!114 &50 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 12} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad43af36df273084f8ac3b1fa71ae729, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 47} + _liveCameraManager: {fileID: 46} + _guiSkin: {fileID: 11400000, guid: eb821627fb1a0c044a6fd7a6dabe3147, type: 2} +--- !u!1 &1149800888 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1149800889} + - 33: {fileID: 1149800893} + - 23: {fileID: 1149800891} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1149800889 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1149800888} + m_LocalRotation: {x: 0, y: -.257712901, z: 0, w: .966221571} + m_LocalPosition: {x: -4.82999992, y: -5.02199984, z: -1.29999995} + m_LocalScale: {x: 4.7275157, y: 4.72751379, z: 4.72751427} + m_Children: [] + m_Father: {fileID: 18} + m_RootOrder: 1 +--- !u!23 &1149800891 +Renderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1149800888} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 2100000, guid: 5fc1a71e55ce15e4d97e8e5778771e99, type: 2} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &1149800893 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1149800888} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.unity.meta b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.unity.meta new file mode 100644 index 0000000..d67119e --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo.unity.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: cb94fe34c6daf5648b6897d447486722 diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/AVProLiveCameraMaterialMappingDemo.cs b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/AVProLiveCameraMaterialMappingDemo.cs new file mode 100644 index 0000000..f197a28 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/AVProLiveCameraMaterialMappingDemo.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Demos +{ + public class AVProLiveCameraMaterialMappingDemo : MonoBehaviour + { + public Transform _sphere; + private float _t = 0.0f; + public float _speed = 1.0f; + + void Update() + { + if (_sphere != null) + { + _t += Time.deltaTime * _speed; + float t = Mathf.PingPong(_t, 5.0f) / 5.0f; + t = Mathf.SmoothStep(0, 1, t); + //t = Mathf.SmoothStep(0, 1, t); + //t = Mathf.SmoothStep(0, 1, t); + float x = Mathf.Lerp(25.33046f, -25.0f, t); + _sphere.position = new Vector3(x, _sphere.position.y, _sphere.position.z); + } + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/AVProLiveCameraMaterialMappingDemo.cs.meta b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/AVProLiveCameraMaterialMappingDemo.cs.meta new file mode 100644 index 0000000..592ee5e --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/AVProLiveCameraMaterialMappingDemo.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: ab0eec4b8427f0d479209659cc24a999 diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoShiny.mat b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoShiny.mat new file mode 100644 index 0000000..82c0cee --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoShiny.mat @@ -0,0 +1,87 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: DemoShiny + m_Shader: {fileID: 4, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: [] + m_CustomRenderQueue: -1 + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 2800000, guid: 5f2eadb05f184a944ba5c187ca9cbdc8, type: 3} + m_Scale: {x: 5, y: 5} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DecalTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _Cube + second: + m_Texture: {fileID: 8900000, guid: 078ad85ef67da7a4e89beb4b275b54db, type: 2} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _Shininess + second: 1 + data: + first: + name: _InvFade + second: 1 + data: + first: + name: _Parallax + second: .0390298516 + m_Colors: + data: + first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} + data: + first: + name: _Emission + second: {r: 0, g: 0, b: 0, a: 0} + data: + first: + name: _SpecColor + second: {r: .711294293, g: .751809001, b: .768656731, a: 1} + data: + first: + name: _TintColor + second: {r: .5, g: .5, b: .5, a: .5} + data: + first: + name: _ReflectColor + second: {r: 1, g: 1, b: 1, a: .5} +--- !u!1002 &2100001 +EditorExtensionImpl: + serializedVersion: 6 diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoShiny.mat.meta b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoShiny.mat.meta new file mode 100644 index 0000000..8ac2e1f --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoShiny.mat.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 5fc1a71e55ce15e4d97e8e5778771e99 diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoYellow.mat b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoYellow.mat new file mode 100644 index 0000000..cc6d974 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoYellow.mat @@ -0,0 +1,29 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: DemoYellow + m_Shader: {fileID: 7, guid: 0000000000000000e000000000000000, type: 0} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: {} + m_Colors: + data: + first: + name: _Color + second: {r: 1, g: .840187848, b: .725490212, a: 1} +--- !u!1002 &2100001 +EditorExtensionImpl: + serializedVersion: 6 diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoYellow.mat.meta b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoYellow.mat.meta new file mode 100644 index 0000000..6fef805 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/DemoYellow.mat.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 910a2dff7334ff4478c38439fd536ff1 diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/fabricbumps.gif b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/fabricbumps.gif new file mode 100644 index 0000000..806d521 Binary files /dev/null and b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/fabricbumps.gif differ diff --git a/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/fabricbumps.gif.meta b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/fabricbumps.gif.meta new file mode 100644 index 0000000..d2ae456 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/MaterialMappingDemo/fabricbumps.gif.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 1 +guid: 5f2eadb05f184a944ba5c187ca9cbdc8 +TextureImporter: + importerVersion: 2 + maxTextureSize: 1024 + textureFormat: -1 + grayscaleToAlpha: 0 + npotScale: 1 + generateCubemap: 0 + isReadable: 0 + textureType: 1 + mipmaps: + generation: 1 + correctGamma: 0 + border: 0 + filter: 0 + fadeout: 0 + fadeoutStart: 1 + fadeoutEnd: 3 + bumpmap: + generation: 1 + external: 1 + bumpyness: 0.1277311 + filter: 0 + textureSettings: + filterMode: -1 + anisoLevel: -1 + mipmapBias: -1 + wrapMode: -1 diff --git a/Assets/AVProLiveCamera/Demos/Materials.meta b/Assets/AVProLiveCamera/Demos/Materials.meta new file mode 100644 index 0000000..7a63ac8 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3388031e2a15e0649981799779b66d68 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/AVProLiveCamera/Demos/Materials/FillBackground.mat b/Assets/AVProLiveCamera/Demos/Materials/FillBackground.mat new file mode 100644 index 0000000..1f07bff --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Materials/FillBackground.mat @@ -0,0 +1,28 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: FillBackground + m_Shader: {fileID: 4800000, guid: 14851b8a808c53b49bb32085e4dc0f75, type: 3} + m_ShaderKeywords: [] + m_CustomRenderQueue: -1 + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: {} + m_Colors: + data: + first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/AVProLiveCamera/Demos/Materials/FillBackground.mat.meta b/Assets/AVProLiveCamera/Demos/Materials/FillBackground.mat.meta new file mode 100644 index 0000000..45f687f --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Materials/FillBackground.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c0e82b9b62861fd42b64a9b40658734f +NativeFormatImporter: + userData: diff --git a/Assets/AVProLiveCamera/Demos/Scripts.meta b/Assets/AVProLiveCamera/Demos/Scripts.meta new file mode 100644 index 0000000..acc7a25 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Scripts.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7173f72e9e0f002439cfdcba33e882f7 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/AVProLiveCamera/Demos/Scripts/AutoRotate.cs b/Assets/AVProLiveCamera/Demos/Scripts/AutoRotate.cs new file mode 100644 index 0000000..5d3305f --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Scripts/AutoRotate.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Demos +{ + [RequireComponent(typeof(Transform))] + public class AutoRotate : MonoBehaviour + { + private float x, y, z; + + void Awake() + { + float s = 32f; + x = Random.Range(-s, s); + y = Random.Range(-s, s); + z = Random.Range(-s, s); + } + void Update() + { + this.transform.Rotate(x * Time.deltaTime, y * Time.deltaTime, z * Time.deltaTime); + } + } +} diff --git a/Assets/AVProLiveCamera/Demos/Scripts/AutoRotate.cs.meta b/Assets/AVProLiveCamera/Demos/Scripts/AutoRotate.cs.meta new file mode 100644 index 0000000..437088f --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Scripts/AutoRotate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d4bdfefe1f4eb024290dff9bd495c741 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/AVProLiveCamera/Demos/Scripts/QuickDeviceMenu.cs b/Assets/AVProLiveCamera/Demos/Scripts/QuickDeviceMenu.cs new file mode 100644 index 0000000..b021403 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Scripts/QuickDeviceMenu.cs @@ -0,0 +1,194 @@ +using UnityEngine; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Demos +{ + public class QuickDeviceMenu : MonoBehaviour + { + public AVProLiveCamera _liveCamera; + public AVProLiveCameraManager _liveCameraManager; + public GUISkin _guiSkin; + private Vector2 _scrollResolutions = Vector2.zero; + private bool _isHidden = false; + + private void Update() + { + if (Input.GetKeyDown(KeyCode.Space)) + { + ToggleVisible(); + } + } + + private void ToggleVisible() + { + _isHidden = !_isHidden; + this.useGUILayout = !_isHidden; // NOTE: this reduces garbage generation to zero + } + + void OnGUI() + { + if (_isHidden) + { + return; + } + + GUI.skin = _guiSkin; + + if (_liveCameraManager.NumDevices > 0) + { + GUILayout.BeginArea(new Rect(0f, 0f, Screen.width, Screen.height)); + if (GUILayout.Button("Press SPACE to hide/show QuickDeviceMenu (improves performance)", GUILayout.ExpandWidth(false))) + { + ToggleVisible(); + } + GUILayout.EndArea(); + + // NOTE: This is just a spacing element to leave space for the above message + GUILayout.Label(" "); + + GUILayout.BeginHorizontal(); + + // Select device + GUILayout.BeginVertical(); + GUILayout.Button("SELECT DEVICE"); + for (int i = 0; i < _liveCameraManager.NumDevices; i++) + { + string name = _liveCameraManager.GetDevice(i).Name; + + GUI.color = Color.white; + if (_liveCamera.Device != null && _liveCamera.Device.IsRunning) + { + if (_liveCamera.Device.Name == name) + { + GUI.color = Color.green; + } + } + + if (GUILayout.Button(name)) + { + _liveCamera._deviceSelection = AVProLiveCamera.SelectDeviceBy.Index; + _liveCamera._desiredDeviceIndex = i; + _liveCamera.Begin(); + } + } + GUI.color = Color.white; + GUILayout.EndVertical(); + + if (_liveCamera.Device != null && _liveCamera.Device.IsRunning) + { + GUILayout.BeginVertical(); + GUILayout.Button("RESOLUTION"); + _scrollResolutions = GUILayout.BeginScrollView(_scrollResolutions, false, false, GUIStyle.none, GUI.skin.verticalScrollbar); + List usedNames = new List(32); + for (int i = 0; i < _liveCamera.Device.NumModes; i++) + { + AVProLiveCameraDeviceMode mode = _liveCamera.Device.GetMode(i); + string name = string.Format("{0}x{1}", mode.Width, mode.Height); + if (!usedNames.Contains(name)) + { + GUI.color = Color.white; + if (_liveCamera.Device.CurrentWidth == mode.Width && _liveCamera.Device.CurrentHeight == mode.Height) + { + GUI.color = Color.green; + } + + usedNames.Add(name); + if (GUILayout.Button(name)) + { + _liveCamera._modeSelection = AVProLiveCamera.SelectModeBy.Index; + _liveCamera._desiredModeIndex = i; + _liveCamera.Begin(); + } + } + } + GUI.color = Color.white; + GUILayout.EndScrollView(); + GUILayout.EndVertical(); + + // Select frame rate + usedNames.Clear(); + GUILayout.BeginVertical(); + GUILayout.Button("FPS"); + for (int i = 0; i < _liveCamera.Device.NumModes; i++) + { + string matchName = string.Format("{0}x{1}", _liveCamera.Device.CurrentWidth, _liveCamera.Device.CurrentHeight); + + AVProLiveCameraDeviceMode mode = _liveCamera.Device.GetMode(i); + + string resName = string.Format("{0}x{1}", mode.Width, mode.Height); + if (resName == matchName) + { + foreach (float frameRate in mode.FrameRates) + { + string name = string.Format("{0}", frameRate.ToString("F2")); + if (!usedNames.Contains(name)) + { + GUI.color = Color.white; + if (_liveCamera.Device.CurrentFrameRate.ToString("F2") == frameRate.ToString("F2")) + { + GUI.color = Color.green; + } + + usedNames.Add(name); + if (GUILayout.Button(name)) + { + _liveCamera._modeSelection = AVProLiveCamera.SelectModeBy.Index; + _liveCamera._desiredModeIndex = i; + _liveCamera._desiredFrameRate = frameRate; + _liveCamera.Begin(); + } + } + } + } + } + GUI.color = Color.white; + GUILayout.EndVertical(); + + // Select format + usedNames.Clear(); + GUILayout.BeginVertical(); + GUILayout.Button("FORMAT"); + for (int i = 0; i < _liveCamera.Device.NumModes; i++) + { + string matchName = string.Format("{0}x{1}", _liveCamera.Device.CurrentWidth, _liveCamera.Device.CurrentHeight);//, _liveCamera.Device.CurrentFrameRate.ToString("F2")); + + AVProLiveCameraDeviceMode mode = _liveCamera.Device.GetMode(i); + + string resName = string.Format("{0}x{1}", mode.Width, mode.Height);//, mode.FPS.ToString("F2")); + if (resName == matchName) + { + string name = string.Format("{0}", mode.Format); + if (!usedNames.Contains(name)) + { + GUI.color = Color.white; + if (_liveCamera.Device.CurrentDeviceFormat == mode.Format) + { + GUI.color = Color.green; + } + + usedNames.Add(name); + if (GUILayout.Button(name)) + { + _liveCamera._modeSelection = AVProLiveCamera.SelectModeBy.Index; + _liveCamera._desiredModeIndex = i; + _liveCamera.Begin(); + } + } + } + } + GUI.color = Color.white; + GUILayout.EndVertical(); + } + GUILayout.EndHorizontal(); + } + else + { + GUILayout.Label("No webcam / capture devices found"); + } + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Demos/Scripts/QuickDeviceMenu.cs.meta b/Assets/AVProLiveCamera/Demos/Scripts/QuickDeviceMenu.cs.meta new file mode 100644 index 0000000..d4e4a7a --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Scripts/QuickDeviceMenu.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad43af36df273084f8ac3b1fa71ae729 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/AVProLiveCamera/Demos/Shared.meta b/Assets/AVProLiveCamera/Demos/Shared.meta new file mode 100644 index 0000000..d8d5272 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Shared.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b74d90960cdf23c458316e24071c41dd diff --git a/Assets/AVProLiveCamera/Demos/Shared/DemoInfo.cs b/Assets/AVProLiveCamera/Demos/Shared/DemoInfo.cs new file mode 100644 index 0000000..b97e4d2 --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Shared/DemoInfo.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Demos +{ + public class DemoInfo : MonoBehaviour + { + public string _title; + public string _description; + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Demos/Shared/DemoInfo.cs.meta b/Assets/AVProLiveCamera/Demos/Shared/DemoInfo.cs.meta new file mode 100644 index 0000000..c8f8ccd --- /dev/null +++ b/Assets/AVProLiveCamera/Demos/Shared/DemoInfo.cs.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 93971dd2c54fc5a46adae88ce8a1c7dd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} diff --git a/Assets/AVProLiveCamera/Docs.meta b/Assets/AVProLiveCamera/Docs.meta new file mode 100644 index 0000000..619598d --- /dev/null +++ b/Assets/AVProLiveCamera/Docs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 00b1f707248166f44af361952d4e0134 +folderAsset: yes +timeCreated: 1530212878 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProLiveCamera/Docs/AVProLiveCamera-UserManual.pdf b/Assets/AVProLiveCamera/Docs/AVProLiveCamera-UserManual.pdf new file mode 100644 index 0000000..aed679d Binary files /dev/null and b/Assets/AVProLiveCamera/Docs/AVProLiveCamera-UserManual.pdf differ diff --git a/Assets/AVProLiveCamera/Docs/AVProLiveCamera-UserManual.pdf.meta b/Assets/AVProLiveCamera/Docs/AVProLiveCamera-UserManual.pdf.meta new file mode 100644 index 0000000..9050f49 --- /dev/null +++ b/Assets/AVProLiveCamera/Docs/AVProLiveCamera-UserManual.pdf.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 4eb7bcacdee87bd4cba19dba292c795a diff --git a/Assets/AVProLiveCamera/Editor.meta b/Assets/AVProLiveCamera/Editor.meta new file mode 100644 index 0000000..cd9e3eb --- /dev/null +++ b/Assets/AVProLiveCamera/Editor.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: cf69c5cb9dee2344181e287f64b91f28 diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraEditor.cs b/Assets/AVProLiveCamera/Editor/AVProLiveCameraEditor.cs new file mode 100644 index 0000000..5389c58 --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraEditor.cs @@ -0,0 +1,471 @@ +using UnityEngine; +using UnityEditor; +using System.Collections; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Editor +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(AVProLiveCamera))] + public class AVProLiveCameraEditor : UnityEditor.Editor + { + private AVProLiveCamera _camera; + private SerializedProperty _propDeviceSelection; + private SerializedProperty _propDesiredDeviceNames; + private SerializedProperty _propDesiredDeviceIndex; + private SerializedProperty _propDeinterlace; + private SerializedProperty _propPlayOnStart; + private SerializedProperty _propClockMode; + private SerializedProperty _propPreferPreviewPin; + private SerializedProperty _propFlipX; + private SerializedProperty _propFlipY; + private SerializedProperty _propAllowTransparency; + private SerializedProperty _propYCbCrRange; + private SerializedProperty _propHotSwap; + private SerializedProperty _propFrameRates; + private SerializedProperty _propSettings; + + private static bool _preview = true; + private static bool _showSettings = false; + + private const string SettingsPrefix = "AVProLiveCamera-LiveCameraEditor-"; + + public override bool RequiresConstantRepaint() + { + return (_camera != null && _camera.isActiveAndEnabled && _camera.Device != null && _preview); + } + + void OnEnable() + { + _camera = (this.target) as AVProLiveCamera; + _propDeviceSelection = serializedObject.FindProperty("_deviceSelection"); + _propDesiredDeviceNames = serializedObject.FindProperty("_desiredDeviceNames"); + _propDesiredDeviceIndex = serializedObject.FindProperty("_desiredDeviceIndex"); + _propPlayOnStart = serializedObject.FindProperty("_playOnStart"); + _propDeinterlace = serializedObject.FindProperty("_deinterlace"); + _propClockMode = serializedObject.FindProperty("_clockMode"); + _propPreferPreviewPin = serializedObject.FindProperty("_preferPreviewPin"); + _propFlipX = serializedObject.FindProperty("_flipX"); + _propFlipY = serializedObject.FindProperty("_flipY"); + _propAllowTransparency = serializedObject.FindProperty("_allowTransparency"); + _propYCbCrRange = serializedObject.FindProperty("_yCbCrRange"); + _propHotSwap = serializedObject.FindProperty("_updateHotSwap"); + _propFrameRates = serializedObject.FindProperty("_updateFrameRates"); + _propSettings = serializedObject.FindProperty("_updateSettings"); + LoadSettings(); + } + + void OnDisable() + { + _camera = null; + SaveSettings(); + } + + private static void LoadSettings() + { + _preview = EditorPrefs.GetBool(SettingsPrefix + "ExpandPreview", true); + _showSettings = EditorPrefs.GetBool(SettingsPrefix + "ExpandSettings", false); + } + + private static void SaveSettings() + { + EditorPrefs.SetBool(SettingsPrefix + "ExpandPreview", _preview); + EditorPrefs.SetBool(SettingsPrefix + "ExpandSettings", _showSettings); + } + + private void DrawLiveControls() + { + if (Application.isPlaying) + { + if (_camera.Device != null && _camera.Device.IsActive) + { + GUILayout.BeginVertical(GUI.skin.box); + _preview = GUILayout.Toggle(_preview, "Live Preview"); + + AVProLiveCameraDevice device = _camera.Device; + + if (_preview && device.OutputTexture != null) + { + Rect textureRect = GUILayoutUtility.GetRect(64.0f, 64.0f, GUILayout.MinWidth(64.0f), GUILayout.MinHeight(64.0f)); + GUI.DrawTexture(textureRect, device.OutputTexture, ScaleMode.ScaleToFit, false); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Select Texture", GUILayout.ExpandWidth(false))) + { + Selection.activeObject = device.OutputTexture; + } + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + } + + GUILayout.Label("Device: " + device.Name); + GUILayout.Label(string.Format("Mode: {0}x{1} {2}", device.CurrentWidth, device.CurrentHeight, device.CurrentFormat)); + + if (device.FramesTotal > 30) + { + GUILayout.Label("Displaying at " + device.DisplayFPS.ToString("F1") + " fps"); + } + else + { + GUILayout.Label("Displaying at ... fps"); + } + + if (device.IsRunning) + { + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Stop Device")) + { + device.Close(); + } + if (device.IsPaused) + { + if (GUILayout.Button("Unpause Stream")) + { + device.Play(); + } + } + else + { + if (GUILayout.Button("Pause Stream")) + { + device.Pause(); + } + } + GUILayout.EndHorizontal(); + } + else + { + if (GUILayout.Button("Start Device")) + { + _camera.Begin(); + } + } + + GUI.enabled = device.CanShowConfigWindow(); + if (GUILayout.Button("Show Config Window")) + { + device.ShowConfigWindow(); + } + GUI.enabled = true; + + GUILayout.EndVertical(); + + EditorGUILayout.Space(); + + GUILayout.BeginVertical(GUI.skin.box); + _showSettings = GUILayout.Toggle(_showSettings, "Show Device Settings"); + if (_showSettings && device.NumSettings > 0) + { + EditorGUILayout.PrefixLabel("Device Settings", EditorStyles.boldLabel); + EditorGUI.BeginChangeCheck(); + for (int j = 0; j < device.NumSettings; j++) + { + AVProLiveCameraSettingBase settingBase = device.GetVideoSettingByIndex(j); + GUILayout.BeginHorizontal(); + GUI.enabled = !settingBase.IsAutomatic; + if (GUILayout.Button("D", GUILayout.ExpandWidth(false))) + { + settingBase.SetDefault(); + } + GUI.enabled = true; + GUILayout.Label(settingBase.Name, GUILayout.ExpandWidth(false), GUILayout.MaxWidth(96.0f)); + GUI.enabled = !settingBase.IsAutomatic; + switch (settingBase.DataTypeValue) + { + case AVProLiveCameraSettingBase.DataType.Boolean: + AVProLiveCameraSettingBoolean settingBool = (AVProLiveCameraSettingBoolean)settingBase; + settingBool.CurrentValue = GUILayout.Toggle(settingBool.CurrentValue, "", GUILayout.ExpandWidth(true)); + break; + case AVProLiveCameraSettingBase.DataType.Float: + AVProLiveCameraSettingFloat settingFloat = (AVProLiveCameraSettingFloat)settingBase; + float sliderValue = GUILayout.HorizontalSlider(settingFloat.CurrentValue, settingFloat.MinValue, settingFloat.MaxValue, GUILayout.ExpandWidth(true)); + if (GUI.enabled) + settingFloat.CurrentValue = sliderValue; + + GUILayout.Label(((long)settingFloat.CurrentValue).ToString(), GUILayout.Width(32.0f), GUILayout.ExpandWidth(false)); + GUI.enabled = settingBase.CanAutomatic; + settingBase.IsAutomatic = GUILayout.Toggle(settingBase.IsAutomatic, "", GUILayout.Width(32.0f)); + GUI.enabled = true; + break; + + } + GUI.enabled = true; + GUILayout.EndHorizontal(); + } + if (GUILayout.Button("Defaults")) + { + for (int j = 0; j < device.NumSettings; j++) + { + AVProLiveCameraSettingBase settingBase = device.GetVideoSettingByIndex(j); + settingBase.SetDefault(); + } + } + if (EditorGUI.EndChangeCheck() || (Time.frameCount % 30) == 0) + { + // This is an expensive function call so we want to limit it + device.Update_Settings(); + } + } + //EditorGUILayout.Toggle("Running:", device.IsRunning); + GUILayout.EndVertical(); + EditorGUILayout.Space(); + } + } + } + + private void DrawDeviceSelection() + { + GUILayout.BeginVertical(GUI.skin.box); + + EditorGUILayout.PropertyField(_propDeviceSelection, new GUIContent("Device Select By")); + + AVProLiveCamera.SelectDeviceBy newDeviceSelection = _camera._deviceSelection; + switch (newDeviceSelection) + { + case AVProLiveCamera.SelectDeviceBy.Default: + break; + case AVProLiveCamera.SelectDeviceBy.Name: + if (_camera._deviceSelection != newDeviceSelection && _camera._desiredDeviceNames.Count == 0) + { + _propDesiredDeviceNames.arraySize++; + serializedObject.ApplyModifiedProperties(); + _propDesiredDeviceNames.GetArrayElementAtIndex(0).stringValue = "Enter Device Name"; + serializedObject.ApplyModifiedProperties(); + } + EditorGUILayout.BeginVertical(); + for (int index = 0; index < _camera._desiredDeviceNames.Count; index++) + { + EditorGUILayout.BeginHorizontal(); + + + /*EditorGUILayout.BeginHorizontal(GUILayout.Width(96)); + if (index != 0) + { + if (GUILayout.Button("Up")) + { + string temp = _camera._desiredDeviceNames[index - 1]; + _camera._desiredDeviceNames[index - 1] = _camera._desiredDeviceNames[index]; + _camera._desiredDeviceNames[index] = temp; + HandleUtility.Repaint(); + } + } + if (index + 1 < _camera._desiredDeviceNames.Count) + { + if (GUILayout.Button("Down")) + { + string temp = _camera._desiredDeviceNames[index + 1]; + _camera._desiredDeviceNames[index + 1] = _camera._desiredDeviceNames[index]; + _camera._desiredDeviceNames[index] = temp; + HandleUtility.Repaint(); + } + } + EditorGUILayout.EndHorizontal();*/ + + if (GUILayout.Button("-")) + { + _propDesiredDeviceNames.DeleteArrayElementAtIndex(index); + break; + } + else + { + SerializedProperty propDesiredDeviceName = _propDesiredDeviceNames.GetArrayElementAtIndex(index); + EditorGUILayout.PropertyField(propDesiredDeviceName, new GUIContent(""), GUILayout.ExpandWidth(true)); + } + EditorGUILayout.EndHorizontal(); + } + if (GUILayout.Button("+")) + { + _propDesiredDeviceNames.arraySize++; + this.Repaint(); + } + EditorGUILayout.EndVertical(); + break; + case AVProLiveCamera.SelectDeviceBy.Index: + { + EditorGUILayout.PropertyField(_propDesiredDeviceIndex, new GUIContent(" ")); + } + break; + } + + SerializedProperty propModeSelection = serializedObject.FindProperty("_modeSelection"); + EditorGUILayout.PropertyField(propModeSelection, new GUIContent("Mode Select By")); + + AVProLiveCamera.SelectModeBy newResolutionSelection = _camera._modeSelection; + switch (newResolutionSelection) + { + case AVProLiveCamera.SelectModeBy.Default: + break; + case AVProLiveCamera.SelectModeBy.Resolution: + if (_camera._modeSelection != newResolutionSelection && _camera._desiredResolutions.Count == 0) + { + serializedObject.FindProperty("_desiredResolutions").arraySize++; + } + EditorGUILayout.BeginVertical(); + + GUILayout.Label("Resolution", EditorStyles.boldLabel); + + SerializedProperty propDesiredAnyResolution = serializedObject.FindProperty("_desiredAnyResolution"); + EditorGUILayout.PropertyField(propDesiredAnyResolution, new GUIContent("Automatic Resolution")); + if (!propDesiredAnyResolution.boolValue) + { + for (int index = 0; index < _camera._desiredResolutions.Count; index++) + { + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("-")) + { + serializedObject.FindProperty("_desiredResolutions").DeleteArrayElementAtIndex(index); + break; + } + else + { + SerializedProperty propResX = serializedObject.FindProperty("_desiredResolutions").GetArrayElementAtIndex(index).FindPropertyRelative("x"); + EditorGUILayout.PropertyField(propResX, new GUIContent(""), GUILayout.Width(64f)); + + EditorGUILayout.LabelField("x", "", GUILayout.Width(24)); + + SerializedProperty propResY = serializedObject.FindProperty("_desiredResolutions").GetArrayElementAtIndex(index).FindPropertyRelative("y"); + EditorGUILayout.PropertyField(propResY, new GUIContent(""), GUILayout.Width(64f)); + } + EditorGUILayout.EndHorizontal(); + } + if (GUILayout.Button("+")) + { + serializedObject.FindProperty("_desiredResolutions").arraySize++; + this.Repaint(); + } + + SerializedProperty propMaintainAspect = serializedObject.FindProperty("_maintainAspectRatio"); + EditorGUILayout.PropertyField(propMaintainAspect); + } + + GUILayout.Label("Frame Rate", EditorStyles.boldLabel); + + SerializedProperty propDesiredFrameRate = serializedObject.FindProperty("_desiredFrameRate"); + EditorGUILayout.PropertyField(propDesiredFrameRate, new GUIContent("Frame Rate")); + if (propDesiredFrameRate.floatValue <= 0f) + { + GUILayout.Label("Highest frame rate will be used"); + } + + GUILayout.Label("Format", EditorStyles.boldLabel); + + SerializedProperty propDesiredFormatAny = serializedObject.FindProperty("_desiredFormatAny"); + EditorGUILayout.PropertyField(propDesiredFormatAny, new GUIContent("Automatic Format")); + + if (!propDesiredFormatAny.boolValue) + { + SerializedProperty propDesiredFormat = serializedObject.FindProperty("_desiredFormat"); + EditorGUILayout.PropertyField(propDesiredFormat, new GUIContent("Specific Format")); + } + else + { + SerializedProperty propSupportsTransparency = serializedObject.FindProperty("_desiredTransparencyFormat"); + EditorGUILayout.PropertyField(propSupportsTransparency, new GUIContent("Transparency")); + } + + EditorGUILayout.EndVertical(); + break; + case AVProLiveCamera.SelectModeBy.Index: + { + SerializedProperty propDesiredModeIndex = serializedObject.FindProperty("_desiredModeIndex"); + EditorGUILayout.PropertyField(propDesiredModeIndex, new GUIContent(" ")); + } + break; + } + + SerializedProperty propInputSelection = serializedObject.FindProperty("_videoInputSelection"); + EditorGUILayout.PropertyField(propInputSelection, new GUIContent("Video Input Select By")); + + AVProLiveCamera.SelectDeviceBy newVideoInputSelection = _camera._videoInputSelection; + switch (newVideoInputSelection) + { + case AVProLiveCamera.SelectDeviceBy.Default: + break; + case AVProLiveCamera.SelectDeviceBy.Name: + if (_camera._videoInputSelection != newVideoInputSelection && _camera._desiredVideoInputs.Count == 0) + { + _camera._desiredVideoInputs.Add(AVProLiveCameraPlugin.VideoInput.Video_Serial_Digital); + } + EditorGUILayout.BeginVertical(); + for (int index = 0; index < _camera._desiredVideoInputs.Count; index++) + { + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("-")) + { + serializedObject.FindProperty("_desiredVideoInputs").DeleteArrayElementAtIndex(index); + break; + } + else + { + SerializedProperty propDesiredVideoInput = serializedObject.FindProperty("_desiredVideoInputs").GetArrayElementAtIndex(index); + EditorGUILayout.PropertyField(propDesiredVideoInput, new GUIContent(" ")); + } + EditorGUILayout.EndHorizontal(); + } + if (GUILayout.Button("+")) + { + serializedObject.FindProperty("_desiredVideoInputs").arraySize++; + this.Repaint(); + } + EditorGUILayout.EndVertical(); + break; + case AVProLiveCamera.SelectDeviceBy.Index: + { + SerializedProperty propDesiredVideoInputIndex = serializedObject.FindProperty("_desiredVideoInputIndex"); + EditorGUILayout.PropertyField(propDesiredVideoInputIndex, new GUIContent(" ")); + } + break; + } + + EditorGUILayout.PropertyField(_propPreferPreviewPin); + EditorGUILayout.PropertyField(_propClockMode); + EditorGUILayout.PropertyField(_propDeinterlace); + + if (Application.isPlaying) + { + if (GUILayout.Button("Select Device")) + { + _camera.Begin(); + } + } + GUILayout.EndVertical(); + } + + public override void OnInspectorGUI() + { + if (_camera == null) + return; + + serializedObject.Update(); + + DrawLiveControls(); + + if (!Application.isPlaying) + { + EditorGUILayout.PropertyField(_propPlayOnStart); + } + + DrawDeviceSelection(); + + GUI.enabled = true; + + EditorGUILayout.PropertyField(_propAllowTransparency); + EditorGUILayout.PropertyField(_propYCbCrRange); + EditorGUILayout.PropertyField(_propFlipX); + EditorGUILayout.PropertyField(_propFlipY); + EditorGUILayout.PropertyField(_propHotSwap); + EditorGUILayout.PropertyField(_propFrameRates); + EditorGUILayout.PropertyField(_propSettings); + + if (GUI.changed) + { + EditorUtility.SetDirty(_camera); + } + + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraEditor.cs.meta b/Assets/AVProLiveCamera/Editor/AVProLiveCameraEditor.cs.meta new file mode 100644 index 0000000..af502e5 --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraEditor.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: b02279f9635348941bc04813c75c85da diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraManagerEditor.cs b/Assets/AVProLiveCamera/Editor/AVProLiveCameraManagerEditor.cs new file mode 100644 index 0000000..1e8865c --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraManagerEditor.cs @@ -0,0 +1,56 @@ +using UnityEngine; +using UnityEditor; +using System.Collections; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Editor +{ + [CustomEditor(typeof(AVProLiveCameraManager))] + public class AVProLiveCameraManagerEditor : UnityEditor.Editor + { + private AVProLiveCameraManager _manager; + + void OnEnable() + { + _manager = (this.target) as AVProLiveCameraManager; + } + + void OnDisable() + { + _manager = null; + } + + public override void OnInspectorGUI() + { + if (_manager == null) + return; + + if (!Application.isPlaying) + { + DrawDefaultInspector(); + } + else + { + EditorGUILayout.Space(); + + int numDevices = _manager.NumDevices; + EditorGUILayout.PrefixLabel("Devices: "); + for (int deviceIndex = 0; deviceIndex < numDevices; deviceIndex++) + { + EditorGUILayout.BeginHorizontal(); + AVProLiveCameraDevice device = _manager.GetDevice(deviceIndex); + EditorGUILayout.LabelField(deviceIndex.ToString() + ") " + device.Name, ""); + if (device.IsRunning) + EditorGUILayout.LabelField("Display at " + device.DisplayFPS.ToString("F1") + " FPS", ""); + else + EditorGUILayout.LabelField("Stopped", ""); + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.Space(); + } + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraManagerEditor.cs.meta b/Assets/AVProLiveCamera/Editor/AVProLiveCameraManagerEditor.cs.meta new file mode 100644 index 0000000..5dcfa72 --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraManagerEditor.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: fe8ef0a86b6c724419b47464ac009053 diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraMaterialApplyEditor.cs b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMaterialApplyEditor.cs new file mode 100644 index 0000000..74fdd84 --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMaterialApplyEditor.cs @@ -0,0 +1,95 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2015-2020 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Editor +{ + /// + /// Editor for the AVProLiveCameraMaterialApply component + /// + [CanEditMultipleObjects] + [CustomEditor(typeof(AVProLiveCameraMaterialApply))] + public class AVProLiveCameraMaterialApplyEditor : UnityEditor.Editor + { + private readonly static GUIContent _guiTextTextureProperty = new GUIContent("Texture Property"); + //private readonly static string DefaultTextureUniformName = "_MainTex"; + private readonly static string HDRPTextureUniformName = "_BaseColorMap"; + + private SerializedProperty _propLiveCamera; + private SerializedProperty _propMaterial; + private SerializedProperty _propTexturePropertyName; + private GUIContent[] _materialTextureProperties = new GUIContent[0]; + + void OnEnable() + { + _propLiveCamera = serializedObject.FindProperty("_liveCamera"); + _propMaterial = serializedObject.FindProperty("_material"); + _propTexturePropertyName = serializedObject.FindProperty("_texturePropertyName"); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + EditorGUI.BeginDisabledGroup(Application.isPlaying); + + EditorGUILayout.PropertyField(_propLiveCamera); + EditorGUILayout.PropertyField(_propMaterial); + + bool isHDRP = false; + int texturePropertyIndex = -1; + + // TODO: don't do this every frame (expensive) + if (_propMaterial.objectReferenceValue != null) + { + Material mat = (Material)(_propMaterial.objectReferenceValue); + MaterialProperty[] matProps = MaterialEditor.GetMaterialProperties(new Material[] { mat } ); + + List items = new List(8); + foreach (MaterialProperty matProp in matProps) + { + if (matProp.type == MaterialProperty.PropType.Texture) + { + if (matProp.name == _propTexturePropertyName.stringValue) + { + texturePropertyIndex = items.Count; + } + if (matProp.name == HDRPTextureUniformName) + { + isHDRP = true; + } + items.Add(new GUIContent(matProp.name)); + } + } + _materialTextureProperties = items.ToArray(); + } + + EditorGUILayout.Space(); + + EditorGUILayout.PropertyField(_propTexturePropertyName, _guiTextTextureProperty); + + if (isHDRP && _propTexturePropertyName.stringValue != HDRPTextureUniformName) + { + EditorGUILayout.HelpBox("Select _BaseColorMap for HDRP", MessageType.Info); + } + if (texturePropertyIndex < 0) + { + EditorGUILayout.HelpBox("Texture property name '" + _propTexturePropertyName.stringValue + "' not found in material", MessageType.Warning); + } + + int newTexturePropertyIndex = EditorGUILayout.Popup(texturePropertyIndex, _materialTextureProperties); + if (newTexturePropertyIndex >=0 && newTexturePropertyIndex != texturePropertyIndex) + { + _propTexturePropertyName.stringValue = _materialTextureProperties[newTexturePropertyIndex].text; + } + + EditorGUI.EndDisabledGroup(); + + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraMaterialApplyEditor.cs.meta b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMaterialApplyEditor.cs.meta new file mode 100644 index 0000000..c844b1d --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMaterialApplyEditor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 464bc47a03461a74b800245c53727e36 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraMeshApplyEditor.cs b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMeshApplyEditor.cs new file mode 100644 index 0000000..cec5386 --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMeshApplyEditor.cs @@ -0,0 +1,96 @@ +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2015-2020 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Editor +{ + /// + /// Editor for the AVProLiveCameraMaterialApply component + /// + [CanEditMultipleObjects] + [CustomEditor(typeof(AVProLiveCameraMeshApply))] + public class AVProLiveCameraMeshApplyEditor : UnityEditor.Editor + { + private readonly static GUIContent _guiTextTextureProperty = new GUIContent("Texture Property"); + //private readonly static string DefaultTextureUniformName = "_MainTex"; + private readonly static string HDRPTextureUniformName = "_BaseColorMap"; + + private SerializedProperty _propLiveCamera; + private SerializedProperty _propMesh; + private SerializedProperty _propTexturePropertyName; + private GUIContent[] _materialTextureProperties = new GUIContent[0]; + + void OnEnable() + { + _propLiveCamera = serializedObject.FindProperty("_liveCamera"); + _propMesh = serializedObject.FindProperty("_mesh"); + _propTexturePropertyName = serializedObject.FindProperty("_texturePropertyName"); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + EditorGUI.BeginDisabledGroup(Application.isPlaying); + + EditorGUILayout.PropertyField(_propLiveCamera); + EditorGUILayout.PropertyField(_propMesh); + + bool isHDRP = false; + int texturePropertyIndex = -1; + + // TODO: don't do this every frame (expensive) + if (_propMesh.objectReferenceValue != null) + { + MeshRenderer renderer = (MeshRenderer)(_propMesh.objectReferenceValue); + Material[] materials = renderer.sharedMaterials; + MaterialProperty[] matProps = MaterialEditor.GetMaterialProperties(materials); + + List items = new List(16); + foreach (MaterialProperty matProp in matProps) + { + if (matProp.type == MaterialProperty.PropType.Texture) + { + if (matProp.name == _propTexturePropertyName.stringValue) + { + texturePropertyIndex = items.Count; + } + if (matProp.name == HDRPTextureUniformName) + { + isHDRP = true; + } + items.Add(new GUIContent(matProp.name)); + } + } + _materialTextureProperties = items.ToArray(); + } + + EditorGUILayout.Space(); + + EditorGUILayout.PropertyField(_propTexturePropertyName, _guiTextTextureProperty); + + if (isHDRP && _propTexturePropertyName.stringValue != HDRPTextureUniformName) + { + EditorGUILayout.HelpBox("Select _BaseColorMap for HDRP", MessageType.Info); + } + if (texturePropertyIndex < 0) + { + EditorGUILayout.HelpBox("Texture property name '" + _propTexturePropertyName.stringValue + "' not found in material", MessageType.Warning); + } + + int newTexturePropertyIndex = EditorGUILayout.Popup(texturePropertyIndex, _materialTextureProperties); + if (newTexturePropertyIndex >=0 && newTexturePropertyIndex != texturePropertyIndex) + { + _propTexturePropertyName.stringValue = _materialTextureProperties[newTexturePropertyIndex].text; + } + + EditorGUI.EndDisabledGroup(); + + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraMeshApplyEditor.cs.meta b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMeshApplyEditor.cs.meta new file mode 100644 index 0000000..0bab12c --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraMeshApplyEditor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3faa838331f2b8f43b2b498095867a61 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraUGUIComponentEditor.cs b/Assets/AVProLiveCamera/Editor/AVProLiveCameraUGUIComponentEditor.cs new file mode 100644 index 0000000..73ca330 --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraUGUIComponentEditor.cs @@ -0,0 +1,152 @@ +#if UNITY_5_4_OR_NEWER || (UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_5) + #define UNITY_FEATURE_UGUI +#endif + +using UnityEngine; +using UnityEditor; +#if UNITY_FEATURE_UGUI +using UnityEngine.UI; +using UnityEditor.UI; + +//----------------------------------------------------------------------------- +// Copyright 2014-2018 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera.Editor +{ + /// + /// Editor class used to edit UI Images. + /// + [CustomEditor(typeof(AVProLiveCameraUGUIComponent), true)] + [CanEditMultipleObjects] + public class AVProLiveCameraUGUIComponentEditor : GraphicEditor + { + SerializedProperty m_Camera; + SerializedProperty m_UVRect; + SerializedProperty m_DefaultTexture; + SerializedProperty m_SetNativeSize; + SerializedProperty m_KeepAspectRatio; + GUIContent m_UVRectContent; + + [MenuItem("GameObject/UI/AVPro Live Camera uGUI", false, 0)] + public static void CreateGameObject() + { + GameObject parent = Selection.activeGameObject; + RectTransform parentCanvasRenderer = (parent != null) ? parent.GetComponent() : null; + if (parentCanvasRenderer) + { + GameObject go = new GameObject("AVPro Live Camera"); + go.transform.SetParent(parent.transform, false); + go.AddComponent(); + go.AddComponent(); + go.AddComponent(); + Selection.activeGameObject = go; + } + else + { + EditorUtility.DisplayDialog("AVPro Live Camera", "You must make the AVPro Live Camera uGUI object as a child of a Canvas.", "Ok"); + } + } + + public override bool RequiresConstantRepaint() + { + AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; + return (rawImage != null && rawImage.HasValidTexture()); + } + + protected override void OnEnable() + { + base.OnEnable(); + + // Note we have precedence for calling rectangle for just rect, even in the Inspector. + // For example in the Camera component's Viewport Rect. + // Hence sticking with Rect here to be consistent with corresponding property in the API. + m_UVRectContent = new GUIContent("UV Rect"); + + m_Camera = serializedObject.FindProperty("m_liveCamera"); + m_UVRect = serializedObject.FindProperty("m_UVRect"); + m_SetNativeSize = serializedObject.FindProperty("_setNativeSize"); + m_KeepAspectRatio = serializedObject.FindProperty("_keepAspectRatio"); + + m_DefaultTexture = serializedObject.FindProperty("_defaultTexture"); + + SetShowNativeSize(true); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + EditorGUILayout.PropertyField(m_Camera); + EditorGUILayout.PropertyField(m_DefaultTexture); + AppearanceControlsGUI(); + EditorGUILayout.PropertyField(m_UVRect, m_UVRectContent); + + EditorGUILayout.PropertyField(m_SetNativeSize); + EditorGUILayout.PropertyField(m_KeepAspectRatio); + + SetShowNativeSize(false); + NativeSizeButtonGUI(); + + serializedObject.ApplyModifiedProperties(); + } + + void SetShowNativeSize(bool instant) + { + base.SetShowNativeSize(m_Camera.objectReferenceValue != null, instant); + } + + /// + /// Allow the texture to be previewed. + /// + + public override bool HasPreviewGUI() + { + AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; + return rawImage != null; + } + + /// + /// Draw the Image preview. + /// + + public override void OnPreviewGUI(Rect drawArea, GUIStyle background) + { + AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; + Texture tex = rawImage.mainTexture; + + if (tex == null) + return; + + // Create the texture rectangle that is centered inside rect. + Rect outerRect = drawArea; + EditorGUI.DrawTextureTransparent(outerRect, tex, ScaleMode.ScaleToFit);//, outer.width / outer.height); + //SpriteDrawUtility.DrawSprite(tex, rect, outer, rawImage.uvRect, rawImage.canvasRenderer.GetColor()); + } + + /// + /// Info String drawn at the bottom of the Preview + /// + + public override string GetInfoString() + { + AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; + + string text = string.Empty; + if (rawImage.HasValidTexture()) + { + text += string.Format("Video Size: {0}x{1}\n", + Mathf.RoundToInt(Mathf.Abs(rawImage.mainTexture.width)), + Mathf.RoundToInt(Mathf.Abs(rawImage.mainTexture.height))); + } + + // Image size Text + text += string.Format("Display Size: {0}x{1}", + Mathf.RoundToInt(Mathf.Abs(rawImage.rectTransform.rect.width)), + Mathf.RoundToInt(Mathf.Abs(rawImage.rectTransform.rect.height))); + + return text; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Editor/AVProLiveCameraUGUIComponentEditor.cs.meta b/Assets/AVProLiveCamera/Editor/AVProLiveCameraUGUIComponentEditor.cs.meta new file mode 100644 index 0000000..16fddb8 --- /dev/null +++ b/Assets/AVProLiveCamera/Editor/AVProLiveCameraUGUIComponentEditor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b8922fa7e9f324e4a8bd1a7fbd85af94 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/AVProLiveCamera/Resources.meta b/Assets/AVProLiveCamera/Resources.meta new file mode 100644 index 0000000..16fc13e --- /dev/null +++ b/Assets/AVProLiveCamera/Resources.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 35b53ce01ac6cab4daf5283235822b81 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/AVProLiveCamera/Resources/AVProLiveCameraIcon.png b/Assets/AVProLiveCamera/Resources/AVProLiveCameraIcon.png new file mode 100644 index 0000000..9e49c02 Binary files /dev/null and b/Assets/AVProLiveCamera/Resources/AVProLiveCameraIcon.png differ diff --git a/Assets/AVProLiveCamera/Resources/AVProLiveCameraIcon.png.meta b/Assets/AVProLiveCamera/Resources/AVProLiveCameraIcon.png.meta new file mode 100644 index 0000000..196db62 --- /dev/null +++ b/Assets/AVProLiveCamera/Resources/AVProLiveCameraIcon.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 69ab7b920ec13a9499cf847d04474e5c +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 256 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/AVProLiveCamera/Scripts.meta b/Assets/AVProLiveCamera/Scripts.meta new file mode 100644 index 0000000..8e61fa2 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 20def7cb1be9cd443a46cdcfaed8f71f diff --git a/Assets/AVProLiveCamera/Scripts/Components.meta b/Assets/AVProLiveCamera/Scripts/Components.meta new file mode 100644 index 0000000..f2703ea --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 6a2c6a51ad553fb49a603e9de724bc1a diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCamera.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCamera.cs new file mode 100644 index 0000000..443028e --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCamera.cs @@ -0,0 +1,526 @@ +using UnityEngine; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + [AddComponentMenu("AVPro Live Camera/Live Camera")] + public class AVProLiveCamera : MonoBehaviour + { + // Selected + protected AVProLiveCameraDevice _device = null; + protected AVProLiveCameraDeviceMode _mode = null; + protected int _videoInput = -1; + + [Header("Device Selection")] + + // Device selection + public SelectDeviceBy _deviceSelection = SelectDeviceBy.Default; + public List _desiredDeviceNames = new List(4); + public int _desiredDeviceIndex = 0; + + // Mode selection + public SelectModeBy _modeSelection = SelectModeBy.Default; + public bool _desiredAnyResolution = true; + public List _desiredResolutions = new List(2); + public int _desiredModeIndex = -1; + public bool _maintainAspectRatio = false; + public float _desiredFrameRate = 0f; + public bool _desiredFormatAny = true; + public bool _desiredTransparencyFormat = false; + public AVProLiveCameraPlugin.VideoFrameFormat _desiredFormat = AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_HDYC; + + // Video Input selection + public SelectDeviceBy _videoInputSelection = SelectDeviceBy.Default; + public List _desiredVideoInputs = new List(4); + public int _desiredVideoInputIndex = 0; + + [Header("Device Start")] + [SerializeField] bool _preferPreviewPin = false; + [SerializeField] AVProLiveCameraDevice.ClockMode _clockMode = AVProLiveCameraDevice.ClockMode.None; + public bool _deinterlace = false; + public bool _playOnStart = true; + + [Header("Display")] + public bool _allowTransparency = true; + public bool _flipX; + public bool _flipY; + [SerializeField] YCbCrRange _yCbCrRange = YCbCrRange.Limited; + + [Header("Update")] + public bool _updateHotSwap = false; + public bool _updateFrameRates = false; + public bool _updateSettings = false; + +#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + private System.IntPtr _renderFunc; +#endif + + public AVProLiveCameraDevice Device + { + get { return _device; } + } + + public AVProLiveCameraDevice.ClockMode Clock + { + get { return _clockMode; } + set { if (_device != null) { _device.Clock = value; } _clockMode = value; } + } + + public YCbCrRange YCbCrRange + { + get { return _yCbCrRange; } + set { if (Device != null) { _device.YCbCrRange = value; } _yCbCrRange = value; } + } + + public bool PreferPreviewPin + { + get { return _preferPreviewPin; } + set { _preferPreviewPin = value; } + } + + public Texture OutputTexture + { + get { if (_device != null) return _device.OutputTexture; return null; } + } + + public enum SelectDeviceBy + { + Default, + Name, + Index, + } + + public enum SelectModeBy + { + Default, + Resolution, + Index, + } + + void Reset() + { + _videoInput = -1; + _mode = null; + _device = null; + _flipX = _flipY = false; + _allowTransparency = false; + _yCbCrRange = YCbCrRange.Limited; + + _deviceSelection = SelectDeviceBy.Default; + _modeSelection = SelectModeBy.Default; + _videoInputSelection = SelectDeviceBy.Default; + _desiredDeviceNames = new List(4); + _desiredResolutions = new List(2); + _desiredVideoInputs = new List(4); + _desiredDeviceNames.Add("Logitech BRIO"); + _desiredDeviceNames.Add("Integrated Webcam"); + _desiredDeviceNames.Add("OBS-Camera"); + _desiredDeviceNames.Add("XSplit VCam"); + _desiredDeviceNames.Add("Logitech HD Pro Webcam C922"); + _desiredDeviceNames.Add("Logitech HD Pro Webcam C920"); + _desiredDeviceNames.Add("HD Pro Webcam C922"); + _desiredDeviceNames.Add("HD Pro Webcam C920"); + _desiredDeviceNames.Add("Decklink Video Capture"); + _desiredDeviceNames.Add("Logitech Webcam Pro 9000"); + _desiredResolutions.Add(new Vector2(1920, 1080)); + _desiredResolutions.Add(new Vector2(1280, 720)); + _desiredResolutions.Add(new Vector2(640, 360)); + _desiredResolutions.Add(new Vector2(640, 480)); + _desiredVideoInputs.Add(AVProLiveCameraPlugin.VideoInput.Video_Serial_Digital); + _desiredVideoInputs.Add(AVProLiveCameraPlugin.VideoInput.Video_SVideo); + _desiredVideoInputIndex = 0; + _maintainAspectRatio = false; + _desiredTransparencyFormat = false; + _desiredAnyResolution = true; + _desiredFrameRate = 0f; + _desiredFormatAny = true; + _desiredFormat = AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_HDYC; + _desiredModeIndex = -1; + _desiredDeviceIndex = 0; + } + + public void Start() + { + if (null == FindObjectOfType(typeof(AVProLiveCameraManager))) + { + throw new System.Exception("You need to add AVProLiveCameraManager component to your scene or change the script execution ordering of AVProLiveCameraManager."); + } + + SelectDeviceAndMode(); + + if (_playOnStart) + { + Begin(); + } + } + + public void Begin() + { + SelectDeviceAndMode(); + + if (_device != null) + { + if (_renderRoutine != null) + { + StopCoroutine(_renderRoutine); + _renderRoutine = null; + } + + _device.Deinterlace = _deinterlace; + _device.AllowTransparency = _allowTransparency; + _device.YCbCrRange = _yCbCrRange; + _device.FlipX = _flipX; + _device.FlipY = _flipY; + _device.Clock = _clockMode; + _device.PreferPreviewPin = _preferPreviewPin; + if (!_device.Start(_mode, _videoInput)) + { + Debug.LogWarning("[AVPro Live Camera] Device failed to start."); + _device.Close(); + _device = null; + _mode = null; + _videoInput = -1; + } + else + { + if (_renderRoutine == null && this.gameObject.activeInHierarchy) + { + _renderRoutine = StartCoroutine(RenderRoutine()); + } + } + } + } + + private void Update() + { + if (_device != null) + { + if (_flipX != _device.FlipX) + _device.FlipX = _flipX; + if (_flipY != _device.FlipY) + _device.FlipY = _flipY; + if (_allowTransparency != _device.AllowTransparency) + _device.AllowTransparency = _allowTransparency; + if (_yCbCrRange != _device.YCbCrRange) + _device.YCbCrRange = _yCbCrRange; + + _device.UpdateHotSwap = _updateHotSwap; + _device.UpdateFrameRates = _updateFrameRates; + _device.UpdateSettings = _updateSettings; + + _device.Update(false); + } + } + + private int _lastFrameCount; + private bool Render() + { + bool result = false; + if (_device != null) + { + // Prevent this function being executed again this frame if the camera frame has been updated this frame already + if (_lastFrameCount != Time.frameCount) + { + if (_device != null) + { + if (_device.Render()) + { + _lastFrameCount = Time.frameCount; + result = true; + } + else + { + _lastFrameUpdated = AVProLiveCameraPlugin.GetLastFrameUploaded(_device.DeviceIndex); + } + + { + int eventId = AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateOneTexture | _device.DeviceIndex; +#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + GL.IssuePluginEvent(_renderFunc, eventId); +#else + GL.IssuePluginEvent(eventId); +#endif + } + } + } + } + return result; + } + + private YieldInstruction _wait = new WaitForEndOfFrame(); + private Coroutine _renderRoutine; + private int _lastFrameUpdated; + + private System.Collections.IEnumerator RenderRoutine() + { + while (Application.isPlaying) + { + yield return null; + + if (this.enabled) + { + bool hasUpdatedThisFrame = Render(); + + // NOTE: in editor, if the game view isn't visible then WaitForEndOfFrame will never complete + yield return _wait; + + if (!hasUpdatedThisFrame) + { + // Try again to get the frame + if (!Render()) + { + //Debug.Log("frame dropped :("); + } + } + else + { + // If nothing has updated, send another event + int lastFrameUpdated = AVProLiveCameraPlugin.GetLastFrameUploaded(_device.DeviceIndex); + if (_lastFrameUpdated == lastFrameUpdated) + { + int eventId = AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateOneTexture | _device.DeviceIndex; +#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + GL.IssuePluginEvent(_renderFunc, eventId); +#else + GL.IssuePluginEvent(eventId); +#endif + } + } + } + } + + _renderRoutine = null; + } + + public void OnDestroy() + { + if (_renderRoutine != null) + { + StopCoroutine(_renderRoutine); + _renderRoutine = null; + } + + if (_device != null) + _device.Close(); + _device = null; + } + + public void SelectDeviceAndMode() + { + _device = null; + _mode = null; + _videoInput = -1; + + _device = SelectDevice(); + if (_device != null) + { + _mode = SelectMode(); + _videoInput = SelectVideoInputIndex(); + } + else + { + Debug.LogWarning("[AVProLiveCamera] Could not find the device."); + } + } + + private AVProLiveCameraDeviceMode SelectMode() + { + AVProLiveCameraDeviceMode result = null; + + switch (_modeSelection) + { + default: + case SelectModeBy.Default: + result = null; + break; + case SelectModeBy.Resolution: + if (_desiredResolutions.Count > 0) + { + result = GetClosestMode(_device, _desiredAnyResolution, _desiredResolutions, _maintainAspectRatio, _desiredFrameRate, _desiredFormatAny, _desiredTransparencyFormat, _desiredFormat); + if (result == null) + { + Debug.LogWarning("[AVProLiveCamera] Could not find desired mode, using default mode."); + } + } + break; + case SelectModeBy.Index: + if (_desiredModeIndex >= 0) + { + result = _device.GetMode(_desiredModeIndex); + if (result == null) + { + Debug.LogWarning("[AVProLiveCamera] Could not find desired mode, using default mode."); + } + } + break; + } + + if (result != null) + { + if (_desiredFrameRate <= 0) + { + result.SelectHighestFrameRate(); + } + else + { + result.SelectClosestFrameRate(_desiredFrameRate); + } + } + + return result; + } + + private AVProLiveCameraDevice SelectDevice() + { + AVProLiveCameraDevice result = null; + + switch (_deviceSelection) + { + default: + case SelectDeviceBy.Default: + result = AVProLiveCameraManager.Instance.GetDevice(0); + break; + case SelectDeviceBy.Name: + if (_desiredDeviceNames.Count > 0) + { + result = GetFirstDevice(_desiredDeviceNames); + } + break; + case SelectDeviceBy.Index: + if (_desiredDeviceIndex >= 0) + { + result = AVProLiveCameraManager.Instance.GetDevice(_desiredDeviceIndex); + } + break; + } + + return result; + } + + private int SelectVideoInputIndex() + { + int result = -1; + + switch (_videoInputSelection) + { + default: + case SelectDeviceBy.Default: + result = -1; + break; + case SelectDeviceBy.Name: + if (_desiredVideoInputs.Count > 0 && _device.NumVideoInputs > 0) + { + foreach (AVProLiveCameraPlugin.VideoInput videoInput in _desiredVideoInputs) + { + for (int i = 0; i < _device.NumVideoInputs; i++) + { + if (videoInput.ToString().Replace("_", " ") == _device.GetVideoInputName(i)) + { + result = i; + break; + } + } + if (result >= 0) + break; + } + } + break; + case SelectDeviceBy.Index: + if (_desiredVideoInputIndex >= 0) + { + result = _desiredVideoInputIndex; + } + break; + } + + return result; + } + + void OnEnable() + { +#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + if (_renderFunc == System.IntPtr.Zero) + { + _renderFunc = AVProLiveCameraPlugin.GetRenderEventFunc(); + } +#endif + if (_device != null) + { + _device.IsActive = true; + if (_renderRoutine == null && _device.IsRunning) + { + _renderRoutine = StartCoroutine(RenderRoutine()); + } + } + } + + void OnDisable() + { + if (_device != null) + { + _device.IsActive = false; + if (_renderRoutine != null) + { + StopCoroutine(_renderRoutine); + _renderRoutine = null; + } + } + } + + private static AVProLiveCameraDeviceMode GetClosestMode(AVProLiveCameraDevice device, bool anyResolution, List resolutions, bool maintainApectRatio, float frameRate, bool anyPixelFormat, bool transparentPixelFormat, AVProLiveCameraPlugin.VideoFrameFormat pixelFormat) + { + AVProLiveCameraDeviceMode result = null; + if (anyResolution) + { + result = device.GetClosestMode(-1, -1, maintainApectRatio, frameRate, anyPixelFormat, transparentPixelFormat, pixelFormat); + } + else + { + for (int i = 0; i < resolutions.Count; i++) + { + result = device.GetClosestMode(Mathf.FloorToInt(resolutions[i].x), Mathf.FloorToInt(resolutions[i].y), maintainApectRatio, frameRate, anyPixelFormat, transparentPixelFormat, pixelFormat); + if (result != null) + break; + } + } + return result; + } + + private static AVProLiveCameraDevice GetFirstDevice(List names) + { + AVProLiveCameraDevice result = null; + for (int i = 0; i < names.Count; i++) + { + result = AVProLiveCameraManager.Instance.GetDevice(names[i]); + if (result != null) + break; + } + return result; + } + +#if UNITY_EDITOR && !UNITY_WEBPLAYER + [ContextMenu("Save PNG")] + private void SavePNG() + { + if (OutputTexture != null && _device != null) + { + Texture2D tex = new Texture2D(OutputTexture.width, OutputTexture.height, TextureFormat.ARGB32, false); + RenderTexture.active = (RenderTexture)OutputTexture; + tex.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0, false); + tex.Apply(false, false); + + byte[] pngBytes = tex.EncodeToPNG(); + System.IO.File.WriteAllBytes("AVProLiveCamera-image" + Random.Range(0, 65536).ToString("X") + ".png", pngBytes); + + RenderTexture.active = null; + Texture2D.Destroy(tex); + tex = null; + } + } +#endif + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCamera.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCamera.cs.meta new file mode 100644 index 0000000..7943089 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCamera.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1015dbb0b69fdd446b617191771ffcce +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 200 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraApplyUITextureNGUI.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraApplyUITextureNGUI.cs new file mode 100644 index 0000000..2bbd04e --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraApplyUITextureNGUI.cs @@ -0,0 +1,94 @@ +using UnityEngine; +using System.Collections; + +//----------------------------------------------------------------------------- +// Copyright 2014-2018 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + #if NGUI + [AddComponentMenu("AVPro Live Camera/Apply to NGUI UITexture")] + public class AVProLiveCameraApplyUITextureNGUI : MonoBehaviour + { + public UITexture _uiTexture; + public AVProLiveCamera _liveCamera; + public Texture2D _defaultTexture; + private AVProLiveCamera _currentCamera; + private static Texture2D _blackTexture; + [SerializeField] bool _makePixelPerfect = false; + + void Awake() + { + if (_blackTexture == null) + CreateTexture(); + } + + void Start() + { + if (_defaultTexture == null) + { + _defaultTexture = _blackTexture; + } + + Update(); + } + + void Update() + { + if (_liveCamera != null) + { + if (_liveCamera.OutputTexture != null) + { + _currentCamera = _liveCamera; + + if (_makePixelPerfect) + { + _currentCamera.OutputTexture.filterMode = FilterMode.Point; + _uiTexture.mainTexture = _currentCamera.OutputTexture; + _uiTexture.MakePixelPerfect(); + } + else + { + _uiTexture.mainTexture = _currentCamera.OutputTexture; + } + } + } + else + { + _currentCamera = null; + _uiTexture.mainTexture = _defaultTexture; + } + } + + public void OnDisable() + { + //_uiTexture.mainTexture = null; + //_currentCamera = null; + } + + void OnDestroy() + { + _defaultTexture = null; + + if (_blackTexture != null) + { + Texture2D.Destroy(_blackTexture); + _blackTexture = null; + } + + _uiTexture.mainTexture = null; + } + + private static void CreateTexture() + { + _blackTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false, false); + _blackTexture.name = "AVProLiveCamera-BlackTexture"; + _blackTexture.filterMode = FilterMode.Point; + _blackTexture.wrapMode = TextureWrapMode.Clamp; + _blackTexture.SetPixel(0, 0, Color.black); + _blackTexture.Apply(false, true); + } + } + #endif +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraApplyUITextureNGUI.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraApplyUITextureNGUI.cs.meta new file mode 100644 index 0000000..babcfdf --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraApplyUITextureNGUI.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8faeeff5f7583e40823deb8860119cd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGUIDisplay.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGUIDisplay.cs new file mode 100644 index 0000000..3360be7 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGUIDisplay.cs @@ -0,0 +1,237 @@ +using UnityEngine; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + [AddComponentMenu("AVPro Live Camera/IMGUI Display")] + public class AVProLiveCameraGUIDisplay : MonoBehaviour + { + public AVProLiveCamera _liveCamera; + + public ScaleMode _scaleMode = ScaleMode.ScaleToFit; + public Color _color = Color.white; + public int _depth = 0; + + public bool _fullScreen = true; + public float _x = 0.0f; + public float _y = 0.0f; + public float _width = 1.0f; + public float _height = 1.0f; + + public bool _flipX; + public bool _flipY; + + private static int _propApplyGamma; + private static int _propFlip; + private static Shader _shaderGammaConversion; + private static Shader _shaderGammaConversionTransparent; + private Material _material; + + //------------------------------------------------------------------------- + + void Awake() + { + if (_propApplyGamma == 0) + { + _propApplyGamma = Shader.PropertyToID("_ApplyGamma"); + _propFlip = Shader.PropertyToID("_Flip"); + } + } + + void Start() + { + // Disabling this lets you skip the GUI layout phase. + this.useGUILayout = false; + + if (_shaderGammaConversion == null) + { + _shaderGammaConversion = Shader.Find("Hidden/AVProLiveCamera/IMGUI"); + } + if (_shaderGammaConversionTransparent == null) + { + _shaderGammaConversionTransparent = Shader.Find("Hidden/AVProLiveCamera/IMGUI Transparent"); + } + } + + void OnDestroy() + { + // Destroy existing material + if (_material != null) + { +#if UNITY_EDITOR + Material.DestroyImmediate(_material); +#else + Material.Destroy(_material); +#endif + _material = null; + } + } + + private Shader GetRequiredShader() + { + Shader result = null; + + if (QualitySettings.activeColorSpace == ColorSpace.Linear) + { + if (_liveCamera != null && _liveCamera.Device != null && _liveCamera.Device.SupportsTransparency) + { + result = _shaderGammaConversionTransparent; + } + else + { + result = _shaderGammaConversion; + } + } + + return result; + } + + + void Update() + { + // Get required shader + Shader currentShader = null; + if (_material != null) + { + currentShader = _material.shader; + } + Shader nextShader = GetRequiredShader(); + + // If the shader requirement has changed + if (currentShader != nextShader) + { + // Destroy existing material + if (_material != null) + { +#if UNITY_EDITOR + Material.DestroyImmediate(_material); +#else + Material.Destroy(_material); +#endif + _material = null; + } + + // Create new material + if (nextShader != null) + { + _material = new Material(nextShader); + if (_material.HasProperty(_propApplyGamma)) + { + if (QualitySettings.activeColorSpace == ColorSpace.Linear) + { + _material.EnableKeyword("APPLY_GAMMA"); + } + else + { + _material.DisableKeyword("APPLY_GAMMA"); + } + } + } + } + } + + public void OnGUI() + { + if (_liveCamera == null) + return; + + _x = Mathf.Clamp01(_x); + _y = Mathf.Clamp01(_y); + _width = Mathf.Clamp01(_width); + _height = Mathf.Clamp01(_height); + + if (_liveCamera.OutputTexture != null) + { + GUI.depth = _depth; + GUI.color = _color; + + Rect rect; + if (_fullScreen) + rect = new Rect(0.0f, 0.0f, Screen.width, Screen.height); + else + rect = new Rect(_x * (Screen.width - 1), _y * (Screen.height - 1), _width * Screen.width, _height * Screen.height); + + if (_material != null) + { + Vector2 flip = Vector2.one; + if (_flipX) + { + flip.x = -1f; + } + if (_flipY) + { + flip.y = -1f; + } + _material.SetVector(_propFlip, flip); + DrawTexture(rect, _liveCamera.OutputTexture, _scaleMode, _material); + } + else + { + if (_flipX || _flipY) + { + Vector2 pivot = new Vector2(rect.x + (rect.width / 2), rect.y + (rect.height / 2)); + Vector2 scale = Vector2.one; + if (_flipX) + scale.x = -1.0f; + if (_flipY) + scale.y = -1.0f; + GUIUtility.ScaleAroundPivot(scale, pivot); + } + + GUI.DrawTexture(rect, _liveCamera.OutputTexture, _scaleMode, _liveCamera.Device.SupportsTransparency); + } + } + } + + private static void DrawTexture(Rect screenRect, Texture texture, ScaleMode scaleMode, Material material) + { + if (Event.current.type == EventType.Repaint) + { + float textureWidth = texture.width; + float textureHeight = texture.height; + + float aspectRatio = (float)textureWidth / (float)textureHeight; + Rect sourceRect = new Rect(0f, 0f, 1f, 1f); + switch (scaleMode) + { + case ScaleMode.ScaleAndCrop: + { + float screenRatio = screenRect.width / screenRect.height; + if (screenRatio > aspectRatio) + { + float adjust = aspectRatio / screenRatio; + sourceRect = new Rect(0f, (1f - adjust) * 0.5f, 1f, adjust); + } + else + { + float adjust = screenRatio / aspectRatio; + sourceRect = new Rect(0.5f - adjust * 0.5f, 0f, adjust, 1f); + } + } + break; + case ScaleMode.ScaleToFit: + { + float screenRatio = screenRect.width / screenRect.height; + if (screenRatio > aspectRatio) + { + float adjust = aspectRatio / screenRatio; + screenRect = new Rect(screenRect.xMin + screenRect.width * (1f - adjust) * 0.5f, screenRect.yMin, adjust * screenRect.width, screenRect.height); + } + else + { + float adjust = screenRatio / aspectRatio; + screenRect = new Rect(screenRect.xMin, screenRect.yMin + screenRect.height * (1f - adjust) * 0.5f, screenRect.width, adjust * screenRect.height); + } + } + break; + case ScaleMode.StretchToFill: + break; + } + Graphics.DrawTexture(screenRect, texture, sourceRect, 0, 0, 0, 0, GUI.color, material); + } + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGUIDisplay.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGUIDisplay.cs.meta new file mode 100644 index 0000000..327bbed --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGUIDisplay.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0a335bb4a52eaa74d869f7e12790b858 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGrabber.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGrabber.cs new file mode 100644 index 0000000..e4bd516 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGrabber.cs @@ -0,0 +1,117 @@ +#define TEXTURETEST +using UnityEngine; +using System.Collections; +using System.Runtime.InteropServices; + +//----------------------------------------------------------------------------- +// Copyright 2014-2018 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + [AddComponentMenu("AVPro Live Camera/Grabber")] + public class AVProLiveCameraGrabber : MonoBehaviour + { + public AVProLiveCamera _camera; + private AVProLiveCameraDevice _device; + + private Color32[] _frameData; + private int _frameWidth; + private int _frameHeight; + private GCHandle _frameHandle; + private System.IntPtr _framePointer; + private uint _lastFrame; + +#if TEXTURETEST + private Texture2D _testTexture; +#endif + + void Update() + { + if (_camera != null) + _device = _camera.Device; + + if (_device != null && _device.IsActive && !_device.IsPaused) + { + if (_device.CurrentWidth > _frameWidth || + _device.CurrentHeight > _frameHeight) + { + CreateBuffer(_device.CurrentWidth, _device.CurrentHeight); + } + uint lastFrame = AVProLiveCameraPlugin.GetLastFrame(_device.DeviceIndex); + if (lastFrame != _lastFrame) + { + _lastFrame = lastFrame; + bool result = AVProLiveCameraPlugin.GetFrameAsColor32(_device.DeviceIndex, _framePointer, _frameWidth, _frameHeight); + if (result) + { +#if TEXTURETEST + _testTexture.SetPixels32(_frameData); + _testTexture.Apply(false, false); +#endif + } + } + } + } + + private void CreateBuffer(int width, int height) + { + // Free buffer if it's too small + if (_frameHandle.IsAllocated && _frameData != null) + { + if (_frameData.Length < _frameWidth * _frameHeight) + { + FreeBuffer(); + } + } + + if (_frameData == null) + { + _frameWidth = width; + _frameHeight = height; + _frameData = new Color32[_frameWidth * _frameHeight]; + _frameHandle = GCHandle.Alloc(_frameData, GCHandleType.Pinned); + _framePointer = _frameHandle.AddrOfPinnedObject(); + +#if TEXTURETEST + _testTexture = new Texture2D(_frameWidth, _frameHeight, TextureFormat.ARGB32, false, false); + _testTexture.Apply(false, false); +#endif + } + } + + private void FreeBuffer() + { + if (_frameHandle.IsAllocated) + { + _framePointer = System.IntPtr.Zero; + _frameHandle.Free(); + _frameData = null; + } + +#if TEXTURETEST + if (_testTexture) + { + Texture2D.DestroyImmediate(_testTexture); + _testTexture = null; + } +#endif + } + + void OnDestroy() + { + FreeBuffer(); + } + +#if TEXTURETEST + void OnGUI() + { + if (_testTexture) + { + GUI.depth = 1; + GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), _testTexture, ScaleMode.ScaleToFit, false); + } + } +#endif + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGrabber.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGrabber.cs.meta new file mode 100644 index 0000000..ed22e66 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraGrabber.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8fe2a09a366a1ec4cbe1afa8968d5075 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraManager.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraManager.cs new file mode 100644 index 0000000..7d2f46c --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraManager.cs @@ -0,0 +1,328 @@ +using UnityEngine; +using System.Text; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + [AddComponentMenu("AVPro Live Camera/Manager (required)")] + public class AVProLiveCameraManager : MonoBehaviour + { + private static AVProLiveCameraManager _instance; + + public bool _supportHotSwapping = false; + + // If this is false then only modes that are natively supported are returned (eg RGB32) + // If this is true then all modes are returned and colour format conversion is attempted + public bool _supportInternalFormatConversion = true; + + // Format conversion + public Shader _shaderBGRA32; + public Shader _shaderMONO8; + public Shader _shaderYUY2; + public Shader _shaderUYVY; + public Shader _shaderYVYU; + public Shader _shaderHDYC; + public Shader _shaderI420; + public Shader _shaderYV12; + public Shader _shaderDeinterlace; + + private bool _isInitialised; + private List _devices; + + //------------------------------------------------------------------------- + + public static AVProLiveCameraManager Instance + { + get + { + if (_instance == null) + { + _instance = (AVProLiveCameraManager)GameObject.FindObjectOfType(typeof(AVProLiveCameraManager)); + if (_instance == null) + { + Debug.LogError("[AVProLiveCamera] AVProLiveCameraManager component required"); + return null; + } + else + { + if (!_instance._isInitialised) + _instance.Init(); + } + } + + return _instance; + } + } + + public int NumDevices + { + get { if (_devices != null) return _devices.Count; return 0; } + } + + //------------------------------------------------------------------------- + + void Start() + { + if (!_isInitialised) + { + _instance = this; + Init(); + } + } + + void OnDestroy() + { + Deinit(); + } + + protected bool Init() + { + try + { + if (AVProLiveCameraPlugin.Init(_supportInternalFormatConversion)) + { + Debug.Log("[AVProLiveCamera] version " + AVProLiveCameraPlugin.GetPluginVersionString() + " initialised. " + SystemInfo.graphicsDeviceName); + } + else + { + Debug.LogError("[AVProLiveCamera] failed to initialise."); + this.enabled = false; + Deinit(); + return false; + } + } + catch (System.DllNotFoundException e) + { + Debug.Log("[AVProLiveCamera] Unity couldn't find the DLL, did you move the 'Plugins' folder to the root of your project?"); + throw e; + } + + GetConversionMethod(); + EnumDevices(); + + _isInitialised = true; + + return _isInitialised; + } + + + private void GetConversionMethod() + { + bool swapRedBlue = false; + if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 11")) + { + swapRedBlue = true; + } + + if (swapRedBlue) + { + Shader.DisableKeyword("SWAP_RED_BLUE_OFF"); + Shader.EnableKeyword("SWAP_RED_BLUE_ON"); + } + else + { + Shader.DisableKeyword("SWAP_RED_BLUE_ON"); + Shader.EnableKeyword("SWAP_RED_BLUE_OFF"); + } + + Shader.DisableKeyword("AVPRO_GAMMACORRECTION"); + Shader.EnableKeyword("AVPRO_GAMMACORRECTION_OFF"); + if (QualitySettings.activeColorSpace == ColorSpace.Linear) + { + Shader.DisableKeyword("AVPRO_GAMMACORRECTION_OFF"); + Shader.EnableKeyword("AVPRO_GAMMACORRECTION"); + } + } + + private void Update() + { + if (_supportHotSwapping) + { + if (AVProLiveCameraPlugin.UpdateDevicesConnected()) + { + // Add any new devices + AddNewDevices(); + } + } + } + + /* + private void OnRenderObject() + { + #if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + GL.IssuePluginEvent(_renderFunc, AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateAllTextures); + #else + GL.IssuePluginEvent(AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateAllTextures); + #endif + }*/ + + private void AddNewDevices() + { + bool isDeviceAdded = false; + + int numDevices = AVProLiveCameraPlugin.GetNumDevices(); + for (int i = 0; i < numDevices; i++) + { + string deviceGUID; + if (!AVProLiveCameraPlugin.GetDeviceGUID(i, out deviceGUID)) + continue; + + AVProLiveCameraDevice device = FindDeviceWithGUID(deviceGUID); + if (device == null) + { + string deviceName; + if (!AVProLiveCameraPlugin.GetDeviceName(i, out deviceName)) + continue; + + int numModes = AVProLiveCameraPlugin.GetNumModes(i); + if (numModes > 0) + { + device = new AVProLiveCameraDevice(deviceName.ToString(), deviceGUID.ToString(), i); + _devices.Add(device); + isDeviceAdded = true; + } + } + } + + if (isDeviceAdded) + { + this.SendMessage("NewDeviceAdded", null, SendMessageOptions.DontRequireReceiver); + } + } + + private AVProLiveCameraDevice FindDeviceWithGUID(string guid) + { + AVProLiveCameraDevice result = null; + + foreach (AVProLiveCameraDevice device in _devices) + { + if (device.GUID == guid) + { + result = device; + break; + } + } + + return result; + } + + private void EnumDevices() + { + ClearDevices(); + _devices = new List(8); + int numDevices = AVProLiveCameraPlugin.GetNumDevices(); + for (int i = 0; i < numDevices; i++) + { + string deviceName; + if (!AVProLiveCameraPlugin.GetDeviceName(i, out deviceName)) + continue; + + string deviceGUID; + if (!AVProLiveCameraPlugin.GetDeviceGUID(i, out deviceGUID)) + continue; + + int numModes = AVProLiveCameraPlugin.GetNumModes(i); + if (numModes > 0) + { + AVProLiveCameraDevice device = new AVProLiveCameraDevice(deviceName.ToString(), deviceGUID.ToString(), i); + _devices.Add(device); + } + } + } + + private void ClearDevices() + { + if (_devices != null) + { + for (int i = 0; i < _devices.Count; i++) + { + _devices[i].Close(); + _devices[i].Dispose(); + } + _devices.Clear(); + _devices = null; + } + } + + public void Deinit() + { + ClearDevices(); + _instance = null; + _isInitialised = false; + + AVProLiveCameraPlugin.Deinit(); + } + + public Shader GetDeinterlaceShader() + { + return _shaderDeinterlace; + } + + public Shader GetPixelConversionShader(AVProLiveCameraPlugin.VideoFrameFormat format) + { + Shader result = null; + switch (format) + { + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YUY2: + result = _shaderYUY2; + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_UYVY: + result = _shaderUYVY; + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YVYU: + result = _shaderYVYU; + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_HDYC: + result = _shaderHDYC; + break; + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_BGRA32: + result = _shaderBGRA32; + break; + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_MONO8: + result = _shaderMONO8; + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_I420: + result = _shaderI420; + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_YV12: + result = _shaderYV12; + break; + default: + Debug.LogError("[AVProLiveCamera] Unknown video format '" + format); + break; + } + return result; + } + + public AVProLiveCameraDevice GetDevice(int index) + { + AVProLiveCameraDevice result = null; + + if (index >= 0 && index < _devices.Count) + result = _devices[index]; + + return result; + } + + public AVProLiveCameraDevice GetDevice(string name) + { + AVProLiveCameraDevice result = null; + int numDevices = NumDevices; + for (int i = 0; i < numDevices; i++) + { + AVProLiveCameraDevice device = GetDevice(i); + if (device.Name == name) + { + result = device; + break; + } + } + return result; + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraManager.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraManager.cs.meta new file mode 100644 index 0000000..c2ab54c --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraManager.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: edba0400f2985f145bfd6428f24d2110 +MonoImporter: + serializedVersion: 2 + defaultReferences: + - _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + - _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + - _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + - _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + - _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + - _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + - _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + - _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + - _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, + type: 3} + executionOrder: -100 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMaterialApply.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMaterialApply.cs new file mode 100644 index 0000000..7c28aac --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMaterialApply.cs @@ -0,0 +1,102 @@ +using UnityEngine; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + [AddComponentMenu("AVPro Live Camera/Material Apply")] + public class AVProLiveCameraMaterialApply : MonoBehaviour + { + [SerializeField] AVProLiveCamera _liveCamera = null; + [SerializeField] Material _material = null; + [SerializeField] string _texturePropertyName = "_MainTex"; + + private int _propTexture = -1; + private Texture _lastTexture; + + public AVProLiveCamera LiveCamera + { + get { return _liveCamera; } + set + { + if (_liveCamera != value) + { + _liveCamera = value; + Update(); + } + } + } + + public Material Material + { + get { return _material; } + set + { + if (_material != value) + { + ApplyMapping(null); + _material = value; + Update(); + } + } + } + + public string TexturePropertyName + { + get { return _texturePropertyName; } + set + { + if (_texturePropertyName != value) + { + ApplyMapping(null); + _texturePropertyName = value; + _propTexture = Shader.PropertyToID(_texturePropertyName); + Update(); + } + } + } + + void Awake() + { + _propTexture = Shader.PropertyToID(_texturePropertyName); + } + + void Update() + { + if (_liveCamera != null && _liveCamera.OutputTexture != null) + { + ApplyMapping(_liveCamera.OutputTexture); + } + else + { + ApplyMapping(null); + } + } + + void ApplyMapping(Texture texture) + { + if (_lastTexture != texture) + { + if (_material != null) + { + if (_propTexture != -1) + { + if (!_material.HasProperty(_propTexture)) + { + Debug.LogError(string.Format("[AVProLiveCamera] Material {0} doesn't have texture property {1}", _material.name, _texturePropertyName), this); + } + _material.SetTexture(_propTexture, texture); + _lastTexture = texture; + } + } + } + } + + void OnDisable() + { + ApplyMapping(null); + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMaterialApply.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMaterialApply.cs.meta new file mode 100644 index 0000000..b6c7ee9 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMaterialApply.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b3f963f7811140b46977bceaf97cc51f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMeshApply.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMeshApply.cs new file mode 100644 index 0000000..48a2182 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMeshApply.cs @@ -0,0 +1,102 @@ +using UnityEngine; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + [AddComponentMenu("AVPro Live Camera/Mesh Apply")] + public class AVProLiveCameraMeshApply : MonoBehaviour + { + [SerializeField] AVProLiveCamera _liveCamera = null; + [SerializeField] MeshRenderer _mesh = null; + [SerializeField] string _texturePropertyName = "_MainTex"; + + private int _propTexture = -1; + private Texture _lastTexture; + + public AVProLiveCamera LiveCamera + { + get { return _liveCamera; } + set + { + if (_liveCamera != value) + { + _liveCamera = value; + Update(); + } + } + } + + public MeshRenderer Mesh + { + get { return _mesh; } + set + { + if (_mesh != value) + { + ApplyMapping(null); + _mesh = value; + Update(); + } + } + } + + public string TexturePropertyName + { + get { return _texturePropertyName; } + set + { + if (_texturePropertyName != value) + { + ApplyMapping(null); + _texturePropertyName = value; + _propTexture = Shader.PropertyToID(_texturePropertyName); + Update(); + } + } + } + + void Awake() + { + _propTexture = Shader.PropertyToID(_texturePropertyName); + } + + void Update() + { + if (_liveCamera != null && _liveCamera.OutputTexture != null) + { + ApplyMapping(_liveCamera.OutputTexture); + } + else + { + ApplyMapping(null); + } + } + + void ApplyMapping(Texture texture) + { + if (_lastTexture != texture) + { + if (_mesh != null) + { + if (_propTexture != -1) + { + Material[] materials = _mesh.materials; + for (int i = 0; i < materials.Length; i++) + { + materials[i].SetTexture(_propTexture, texture); + } + _lastTexture = texture; + } + } + } + } + + void OnDisable() + { + ApplyMapping(null); + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMeshApply.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMeshApply.cs.meta new file mode 100644 index 0000000..e95f51b --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraMeshApply.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0127c5b720f8b0e41ba028a98f32e5a3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraUGUIComponent.cs b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraUGUIComponent.cs new file mode 100644 index 0000000..2948c66 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraUGUIComponent.cs @@ -0,0 +1,308 @@ +#if UNITY_5_4_OR_NEWER || (UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_5) + #define UNITY_FEATURE_UGUI +#endif + +#if UNITY_FEATURE_UGUI +using System.Collections.Generic; +using UnityEngine.Serialization; +using UnityEngine; +using UnityEngine.UI; + +//----------------------------------------------------------------------------- +// Copyright 2014-2018 RenderHeads Ltd. All rights reserverd. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + [AddComponentMenu("AVPro Live Camera/uGUI Component")] + public class AVProLiveCameraUGUIComponent : UnityEngine.UI.MaskableGraphic + { + [SerializeField] + public AVProLiveCamera m_liveCamera; + + [SerializeField] + public Rect m_UVRect = new Rect(0f, 0f, 1f, 1f); + + [SerializeField] + public bool _setNativeSize = false; + + [SerializeField] + public bool _keepAspectRatio = true; + + [SerializeField] + public Texture _defaultTexture; + + private int _lastWidth; + private int _lastHeight; + private Texture _lastTexture; + + /// + /// Returns the texture used to draw this Graphic. + /// + public override Texture mainTexture + { + get + { + Texture result = Texture2D.whiteTexture; + if (HasValidTexture()) + { + result = m_liveCamera.OutputTexture; + } + else + { + if (_defaultTexture != null) + { + result = _defaultTexture; + } + } + return result; + } + } + + public bool HasValidTexture() + { + return (m_liveCamera != null && m_liveCamera.OutputTexture != null); + } + + void Update() + { + if (mainTexture == null) + { + return; + } + + if (_setNativeSize) + { + SetNativeSize(); + } + if (HasValidTexture()) + { + if (mainTexture.width != _lastWidth || + mainTexture.height != _lastHeight) + { + _lastWidth = mainTexture.width; + _lastHeight = mainTexture.height; + SetVerticesDirty(); + SetMaterialDirty(); + } + } + + if (mainTexture != _lastTexture) + { + SetMaterialDirty(); + _lastTexture = mainTexture; + } + } + + /// + /// Texture to be used. + /// + public AVProLiveCamera source + { + get + { + return m_liveCamera; + } + set + { + if (m_liveCamera == value) + return; + + m_liveCamera = value; + //SetVerticesDirty(); + SetMaterialDirty(); + } + } + + /// + /// UV rectangle used by the texture. + /// + public Rect uvRect + { + get + { + return m_UVRect; + } + set + { + if (m_UVRect == value) + return; + m_UVRect = value; + SetVerticesDirty(); + } + } + + /// + /// Adjust the scale of the Graphic to make it pixel-perfect. + /// + + [ContextMenu("Set Native Size")] + public override void SetNativeSize() + { + Texture tex = mainTexture; + if (tex != null) + { + int w = Mathf.RoundToInt(tex.width * uvRect.width); + int h = Mathf.RoundToInt(tex.height * uvRect.height); + rectTransform.anchorMax = rectTransform.anchorMin; + rectTransform.sizeDelta = new Vector2(w, h); + } + } + + // OnFillVBO deprecated by 5.2 + // OnPopulateMesh(Mesh mesh) deprecated by 5.2 patch 1 +#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + /* protected override void OnPopulateMesh(Mesh mesh) + { + List verts = new List(); + _OnFillVBO( verts ); + + var quad = new UIVertex[4]; + for (int i = 0; i < vbo.Count; i += 4) + { + vbo.CopyTo(i, quad, 0, 4); + vh.AddUIVertexQuad(quad); + } + vh.FillMesh( toFill ); + }*/ + protected override void OnPopulateMesh(VertexHelper vh) + { + vh.Clear(); + + List aVerts = new List(); + _OnFillVBO(aVerts); + + List aIndicies = new List(new int[] { 0, 1, 2, 2, 3, 0 }); + vh.AddUIVertexStream(aVerts, aIndicies); + } +#else + protected override void OnFillVBO(List vbo) + { + _OnFillVBO( vbo ); + } +#endif + + /// + /// Update all renderer data. + /// + protected void _OnFillVBO(List vbo) + { + /*Texture tex = mainTexture; + + int texWidth = 4; + int texHeight = 4; + + if (HasValidTexture()) + { + + } + if (tex != null) + { + texWidth = tex.width; + texHeight = tex.height; + }*/ + + { + /*Vector4 v = Vector4.zero; + + int w = Mathf.RoundToInt(tex.width * uvRect.width); + int h = Mathf.RoundToInt(tex.height * uvRect.height); + + float paddedW = ((w & 1) == 0) ? w : w + 1; + float paddedH = ((h & 1) == 0) ? h : h + 1; + + v.x = 0f; + v.y = 0f; + v.z = w / paddedW; + v.w = h / paddedH; + + v.x -= rectTransform.pivot.x; + v.y -= rectTransform.pivot.y; + v.z -= rectTransform.pivot.x; + v.w -= rectTransform.pivot.y; + + v.x *= rectTransform.rect.width; + v.y *= rectTransform.rect.height; + v.z *= rectTransform.rect.width; + v.w *= rectTransform.rect.height;*/ + + Vector4 v = GetDrawingDimensions(_keepAspectRatio); + + vbo.Clear(); + + var vert = UIVertex.simpleVert; + + vert.position = new Vector2(v.x, v.y); + vert.uv0 = new Vector2(m_UVRect.xMin, m_UVRect.yMin); + vert.color = color; + vbo.Add(vert); + + vert.position = new Vector2(v.x, v.w); + vert.uv0 = new Vector2(m_UVRect.xMin, m_UVRect.yMax); + vert.color = color; + vbo.Add(vert); + + vert.position = new Vector2(v.z, v.w); + vert.uv0 = new Vector2(m_UVRect.xMax, m_UVRect.yMax); + vert.color = color; + vbo.Add(vert); + + vert.position = new Vector2(v.z, v.y); + vert.uv0 = new Vector2(m_UVRect.xMax, m_UVRect.yMin); + vert.color = color; + vbo.Add(vert); + } + } + + //Added this method from Image.cs to do the keep aspect ratio + private Vector4 GetDrawingDimensions(bool shouldPreserveAspect) + { + Vector4 returnSize = Vector4.zero; + + if (mainTexture) + { + var padding = Vector4.zero; + var textureSize = new Vector2(mainTexture.width, mainTexture.height); + + Rect r = GetPixelAdjustedRect(); + + int spriteW = Mathf.RoundToInt(textureSize.x); + int spriteH = Mathf.RoundToInt(textureSize.y); + + var size = new Vector4(padding.x / spriteW, + padding.y / spriteH, + (spriteW - padding.z) / spriteW, + (spriteH - padding.w) / spriteH); + + if (shouldPreserveAspect && textureSize.sqrMagnitude > 0.0f) + { + var spriteRatio = textureSize.x / textureSize.y; + var rectRatio = r.width / r.height; + + if (spriteRatio > rectRatio) + { + var oldHeight = r.height; + r.height = r.width * (1.0f / spriteRatio); + r.y += (oldHeight - r.height) * rectTransform.pivot.y; + } + else + { + var oldWidth = r.width; + r.width = r.height * spriteRatio; + r.x += (oldWidth - r.width) * rectTransform.pivot.x; + } + } + + returnSize = new Vector4(r.x + r.width * size.x, + r.y + r.height * size.y, + r.x + r.width * size.z, + r.y + r.height * size.w); + + } + + return returnSize; + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraUGUIComponent.cs.meta b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraUGUIComponent.cs.meta new file mode 100644 index 0000000..24368cb --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Components/AVProLiveCameraUGUIComponent.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0da62b8b54c37da4a8826e97a78df85f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 69ab7b920ec13a9499cf847d04474e5c, type: 3} + userData: diff --git a/Assets/AVProLiveCamera/Scripts/Interface.meta b/Assets/AVProLiveCamera/Scripts/Interface.meta new file mode 100644 index 0000000..6468719 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Interface.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: e187405658fcc4640af18423f71d2868 diff --git a/Assets/AVProLiveCamera/Scripts/Interface/AVProLiveCameraPlugin.cs b/Assets/AVProLiveCamera/Scripts/Interface/AVProLiveCameraPlugin.cs new file mode 100644 index 0000000..5d7919b --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Interface/AVProLiveCameraPlugin.cs @@ -0,0 +1,347 @@ +using System.Text; +using System.Runtime.InteropServices; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + public enum YCbCrRange + { + Limited, + Full, + }; + + public class AVProLiveCameraPlugin + { + public enum VideoFrameFormat + { + RAW_BGRA32, + + YUV_422_YUY2, + YUV_422_UYVY, + YUV_422_YVYU, + YUV_422_HDYC, + + YUV_420_PLANAR_YV12, + YUV_420_PLANAR_I420, + + RAW_RGB24, + RAW_MONO8, + + RGB_10BPP, + YUV_10BPP_V210, + + MPEG, + } + + public enum VideoInput + { + None, + Video_Tuner, + Video_Composite, + Video_SVideo, + Video_RGB, + Video_YRYBY, + Video_Serial_Digital, + Video_Parallel_Digital, + Video_SCSI, + Video_AUX, + Video_1394, + Video_USB, + Video_Decoder, + Video_Encoder, + Video_SCART, + Video_Black, + } + + // Used by GL.IssuePluginEvent + public const int PluginID = 0xFA20000; + public enum PluginEvent + { + UpdateAllTextures = 0x0001000, + UpdateOneTexture = 0x0002000, + } + +#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1) + [DllImport("AVProLiveCamera")] + public static extern System.IntPtr GetRenderEventFunc(); +#endif + + ////////////////////////////////////////////////////////////////////////// + // System Initialisation + + [DllImport("AVProLiveCamera")] + public static extern bool Init(bool supportInternalConversion); + + + [DllImport("AVProLiveCamera")] + public static extern void Deinit(); + + [DllImport("AVProLiveCamera")] + private static extern System.IntPtr GetPluginVersion(); + + public static string GetPluginVersionString() + { + return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(GetPluginVersion()); + } + + ////////////////////////////////////////////////////////////////////////// + // Device Enumeration & Configuration + + [DllImport("AVProLiveCamera")] + public static extern int GetNumDevices(); + + [DllImport("AVProLiveCamera")] + public static extern bool HasDeviceConfigWindow(int index); + + [DllImport("AVProLiveCamera")] + public static extern bool ShowDeviceConfigWindow(int index); + + [DllImport("AVProLiveCamera", CharSet = CharSet.Unicode)] + private static extern bool GetDeviceName(int index, StringBuilder nameBuffer, int nameBufferLength); + + public static bool GetDeviceName(int index, out string name) + { + StringBuilder nameStr = new StringBuilder(512); + if (GetDeviceName(index, nameStr, nameStr.Capacity)) + { + name = nameStr.ToString(); + return true; + } + name = string.Empty; + return false; + } + + [DllImport("AVProLiveCamera", CharSet = CharSet.Unicode)] + private static extern bool GetDeviceGUID(int index, StringBuilder nameBuffer, int nameBufferLength); + + public static bool GetDeviceGUID(int index, out string name) + { + StringBuilder nameStr = new StringBuilder(512); + if (GetDeviceGUID(index, nameStr, nameStr.Capacity)) + { + name = nameStr.ToString(); + return true; + } + name = string.Empty; + return false; + } + + [DllImport("AVProLiveCamera")] + public static extern bool IsDeviceConnected(int index); + + [DllImport("AVProLiveCamera")] + public static extern bool UpdateDevicesConnected(); + + + [DllImport("AVProLiveCamera")] + public static extern int GetNumModes(int index); + + [DllImport("AVProLiveCamera")] + private static extern bool GetModeInfo(int deviceIndex, int modeIndex, out int width, out int height, out int frameRateCount, out int frameRateIndex, StringBuilder format); + + [DllImport("AVProLiveCamera")] + private static extern bool GetModeFrameRates(int deviceIndex, int modeIndex, int frameRateCount, [MarshalAs(UnmanagedType.LPArray)] float[] frameRates); + + public static bool GetModeInfo(int deviceIndex, int modeIndex, out int width, out int height, out float[] frameRates, out int frameRateIndex, out string format) + { + StringBuilder formatStr = new StringBuilder(512); + + int frameRateCount = 0; + if (GetModeInfo(deviceIndex, modeIndex, out width, out height, out frameRateCount, out frameRateIndex, formatStr)) + { + format = formatStr.ToString(); + if (frameRateCount > 0 && frameRateCount < 1024) + { + frameRates = new float[frameRateCount]; + if (GetModeFrameRates(deviceIndex, modeIndex, frameRateCount, frameRates)) + { + return true; + } + else + { + UnityEngine.Debug.LogWarning("[AVProLiveCamera] Failed to retrieve frame rates"); + } + } + else + { + UnityEngine.Debug.LogWarning("[AVProLiveCamera] FrameRates out of range"); + } + } + else + { + UnityEngine.Debug.LogWarning("[AVProLiveCamera] Failed to retrieve mode info"); + } + frameRates = null; + format = string.Empty; + return false; + } + + [DllImport("AVProLiveCamera")] + public static extern int GetNumVideoInputs(int deviceIndex); + + [DllImport("AVProLiveCamera")] + private static extern bool GetVideoInputName(int deviceIndex, int inputIndex, StringBuilder name); + + public static bool GetVideoInputName(int deviceIndex, int inputIndex, out string name) + { + StringBuilder nameStr = new StringBuilder(512); + if (GetVideoInputName(deviceIndex, inputIndex, nameStr)) + { + name = nameStr.ToString(); + return true; + } + name = string.Empty; + return false; + } + + [DllImport("AVProLiveCamera")] + public static extern void SetVideoInputByIndex(int deviceIndex, int inputIndex); + + + ////////////////////////////////////////////////////////////////////////// + // Device Settings + + [DllImport("AVProLiveCamera")] + public static extern int GetNumDeviceVideoSettings(int deviceIndex); + + [DllImport("AVProLiveCamera")] + private static extern bool GetDeviceVideoSettingInfo(int deviceIndex, int settingIndex, out int settingType, out int dataType, StringBuilder name, out bool canAutomatic); + + public static bool GetDeviceVideoSettingInfo(int deviceIndex, int settingIndex, out int settingType, out int dataType, out string name, out bool canAutomatic) + { + StringBuilder nameStr = new StringBuilder(512); + if (GetDeviceVideoSettingInfo(deviceIndex, settingIndex, out settingType, out dataType, nameStr, out canAutomatic)) + { + name = nameStr.ToString(); + return true; + } + name = string.Empty; + return false; + } + + [DllImport("AVProLiveCamera")] + public static extern bool GetDeviceVideoSettingBoolean(int deviceIndex, int settingIndex, out bool defaultValue, out bool currentValue, out bool isAutomatic); + + [DllImport("AVProLiveCamera")] + public static extern bool GetDeviceVideoSettingFloat(int deviceIndex, int settingIndex, out float defaultValue, out float currentValue, out float minValue, out float maxValue, out bool isAutomatic); + + [DllImport("AVProLiveCamera")] + public static extern bool UpdateDeviceVideoSettingValue(int deviceIndex, int settingIndex, out float currentValue, out bool isAutomatic); + + [DllImport("AVProLiveCamera")] + public static extern void ApplyDeviceVideoSettingValue(int deviceIndex, int settingIndex, float currentValue, bool isAutomatic); + + [DllImport("AVProLiveCamera")] + public static extern void SetDeviceClockMode(int deviceIndex, bool useDefaultClock); + + ////////////////////////////////////////////////////////////////////////// + // Open & Close Devices + + [DllImport("AVProLiveCamera")] + public static extern bool StartDevice(int index, int modeIndex, int frameRateIndex, int videoInputIndex, bool preferPreviewPin); + + [DllImport("AVProLiveCamera")] + public static extern void StopDevice(int index); + + ////////////////////////////////////////////////////////////////////////// + // Play & Pause + + [DllImport("AVProLiveCamera")] + public static extern bool Play(int index); + + [DllImport("AVProLiveCamera")] + public static extern void Pause(int index); + + [DllImport("AVProLiveCamera")] + public static extern void Stop(int index); + + ////////////////////////////////////////////////////////////////////////// + // Current State of Device + + [DllImport("AVProLiveCamera")] + public static extern int GetWidth(int index); + + [DllImport("AVProLiveCamera")] + public static extern int GetHeight(int index); + + [DllImport("AVProLiveCamera")] + public static extern float GetFrameRate(int index); + + [DllImport("AVProLiveCamera")] + public static extern long GetFrameDurationHNS(int index); + + [DllImport("AVProLiveCamera")] + public static extern int GetFormat(int index); + + [DllImport("AVProLiveCamera")] + private static extern bool GetDeviceFormat(int index, StringBuilder format); + + public static string GetDeviceFormat(int deviceIndex) + { + string result = "Unknown"; + StringBuilder nameStr = new StringBuilder(512); + if (GetDeviceFormat(deviceIndex, nameStr)) + { + result = nameStr.ToString(); + } + return result; + } + + [DllImport("AVProLiveCamera")] + public static extern bool IsFrameTopDown(int index); + + [DllImport("AVProLiveCamera")] + public static extern uint GetLastFrame(int index); + + ////////////////////////////////////////////////////////////////////////// + // Frame Updating + + [DllImport("AVProLiveCamera")] + public static extern bool SetActive(int index, bool active); + + [DllImport("AVProLiveCamera")] + public static extern bool IsNextFrameReadyForGrab(int index); + + [DllImport("AVProLiveCamera")] + public static extern int GetLastFrameUploaded(int handle); + + [DllImport("AVProLiveCamera")] + public static extern bool UpdateTextureGL(int index, int textureID); + + [DllImport("AVProLiveCamera")] + public static extern bool GetFramePixels(int index, System.IntPtr buffer, int bufferIndex, int bufferWidth, int bufferHeight); + + [DllImport("AVProLiveCamera")] + public static extern void SetTexturePointer(int index, int bufferIndex, System.IntPtr texturePtr); + + [DllImport("AVProLiveCamera")] + public static extern bool GetFrameAsColor32(int index, System.IntPtr bufferPtr, int bufferWidth, int bufferHeight); + + ////////////////////////////////////////////////////////////////////////// + // Live Stats + + [DllImport("AVProLiveCamera")] + public static extern float GetCaptureFrameRate(int deviceIndex); + + [DllImport("AVProLiveCamera")] + public static extern uint GetCaptureFramesDropped(int deviceIndex); + + ////////////////////////////////////////////////////////////////////////// + // Internal Frame Buffering + + [DllImport("AVProLiveCamera")] + public static extern void SetFrameBufferSize(int deviceIndex, int read, int write); + + [DllImport("AVProLiveCamera")] + public static extern long GetLastFrameBufferedTime(int deviceIndex); + + [DllImport("AVProLiveCamera")] + public static extern System.IntPtr GetLastFrameBuffered(int deviceIndex); + + [DllImport("AVProLiveCamera")] + public static extern System.IntPtr GetFrameFromBufferAtTime(int deviceIndex, long time); + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Interface/AVProLiveCameraPlugin.cs.meta b/Assets/AVProLiveCamera/Scripts/Interface/AVProLiveCameraPlugin.cs.meta new file mode 100644 index 0000000..11687cb --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Interface/AVProLiveCameraPlugin.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 85c1348d501b0fe4d91f4b0ed7d6d9d4 diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper.meta b/Assets/AVProLiveCamera/Scripts/Wrapper.meta new file mode 100644 index 0000000..0e49502 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 451a0b7e73c47ad468d1ae117b94c9aa diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDevice.cs b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDevice.cs new file mode 100644 index 0000000..28482c1 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDevice.cs @@ -0,0 +1,1027 @@ +using UnityEngine; +using System.Text; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + public class AVProLiveCameraDevice : System.IDisposable + { + private const int MaxVideoResolution = 16384; + private int _deviceIndex; + private List _modes; + private List _settings; + private Dictionary _settingsByType; + private List _videoInputs; + private AVProLiveCameraFormatConverter _formatConverter; + private AVProLiveCameraDeviceMode _mode; + private int _width; + private int _height; + private float _frameRate; + private long _frameDurationHNS; + private string _format; + private string _deviceFormat; + private int _frameCount; + private float _startFrameTime; + private int _lastModeIndex = -1; + private int _lastVideoInputIndex = -1; + private bool _isActive = false; + private bool _isTopDown; + private bool _flipX; + private bool _flipY; + private bool _allowTransparency = true; + private YCbCrRange _yCbCrRange = YCbCrRange.Limited; + private ClockMode _clockMode = ClockMode.None; + private bool _preferPreviewPin = false; + + public enum ClockMode + { + None, + Default, + } + + public enum SettingsEnum + { + // Video "proc amp" settings + Brightness = 0, + Contrast, + Hue, + Saturation, + Sharpness, + Gamma, + ColorEnable, + WhiteBalance, + BacklightCompensation, + Gain, + DigitalMultiplier, + DigitalMultiplierLimit, + WhiteBalanceComponent, + PowerlineFrequency, + + // Camera control settings + Pan = 1000, + Tilt, + Roll, + Zoom, + Exposure, + Iris, + Focus, + ScanMode, + Privacy, + PanTilt, + PanRelative, + TiltRelative, + RollRelative, + ZoomRelative, + ExposureRelative, + IrisRelative, + FocusRelative, + PanTiltRelative, + FocalLength, + AutoExposurePriority, + + // Logitech specific settings + Logitech_Version = 2000, + Logitech_DigitalPan, + Logitech_DigitalTilt, + Logitech_DigitalZoom, + Logitech_DigitalPanTiltZoom, + Logitech_ExposureTime, + Logitech_FaceTracking, + Logitech_LED, + Logitech_FindFace, + } + + public bool IsActive + { + get + { + return _isActive; + } + set + { + _isActive = value; + if (_deviceIndex >= 0) + AVProLiveCameraPlugin.SetActive(_deviceIndex, _isActive); + } + } + + public int DeviceIndex + { + get { return _deviceIndex; } + } + + public string Name + { + get; + private set; + } + + public string GUID + { + get; + private set; + } + + public int NumModes + { + get { return _modes.Count; } + } + + public int NumSettings + { + get { return _settings.Count; } + } + + public int NumVideoInputs + { + get { return _videoInputs.Count; } + } + + public Texture OutputTexture + { + get { if (_formatConverter != null && _formatConverter.ValidPicture) return _formatConverter.OutputTexture; return null; } + } + + public AVProLiveCameraDeviceMode CurrentMode + { + get { return _mode; } + } + + public int CurrentWidth + { + get { return _width; } + } + + public int CurrentHeight + { + get { return _height; } + } + + public string CurrentFormat + { + get { return _format; } + } + + public string CurrentDeviceFormat + { + get { return _deviceFormat; } + } + + public bool SupportsTransparency + { + get { return (_deviceFormat == "BGRA32" || _deviceFormat == "ARGB32" || _deviceFormat == "RGB32"); } + } + + public float CurrentFrameRate + { + get { return _frameRate; } + } + + public long CurrentFrameDurationHNS + { + get { return _frameDurationHNS; } + } + + public bool IsRunning + { + get; + private set; + } + + public bool IsPaused + { + get; + private set; + } + + public bool IsPicture + { + get; + private set; + } + + public float CaptureFPS + { + get; + private set; + } + + public float DisplayFPS + { + get; + private set; + } + + public float CaptureFramesDropped + { + get; + private set; + } + + public int FramesTotal + { + get; + private set; + } + + public bool Deinterlace + { + get; + set; + } + + public ClockMode Clock + { + get { return _clockMode; } + set { _clockMode = value; if (IsRunning) AVProLiveCameraPlugin.SetDeviceClockMode(_deviceIndex, _clockMode == ClockMode.Default); } + } + + public bool PreferPreviewPin + { + get { return _preferPreviewPin; } + set { _preferPreviewPin = value; } + } + + public bool IsConnected + { + get; + private set; + } + + public bool FlipX + { + get { return _flipX; } + set { _flipX = value; if (_formatConverter != null) _formatConverter.FlipX = _flipX; } + } + + public bool FlipY + { + get { return _flipY; } + set { _flipY = value; if (_formatConverter != null) _formatConverter.FlipY = _isTopDown != _flipY; } + } + + public bool AllowTransparency + { + get { return _allowTransparency; } + set { _allowTransparency = value; if (_formatConverter != null) _formatConverter.AllowTransparency = _allowTransparency; } + } + + public YCbCrRange YCbCrRange + { + get { return _yCbCrRange; } + set { _yCbCrRange = value; if (_formatConverter != null) _formatConverter.YCbCrRange = _yCbCrRange; } + } + + public bool UpdateHotSwap + { + get; + set; + } + + public bool UpdateFrameRates + { + get; + set; + } + + public bool UpdateSettings + { + get; + set; + } + + public AVProLiveCameraDevice(string name, string guid, int index) + { + IsRunning = false; + IsPaused = true; + IsPicture = false; + IsConnected = true; + UpdateHotSwap = false; + UpdateFrameRates = false; + UpdateSettings = false; + Name = name; + GUID = guid; + _deviceIndex = index; + _modes = new List(64); + _videoInputs = new List(8); + _settings = new List(16); + _settingsByType = new Dictionary(16); + _formatConverter = new AVProLiveCameraFormatConverter(_deviceIndex); + EnumModes(); + EnumVideoInputs(); + EnumVideoSettings(); + } + + public void Dispose() + { + if (_formatConverter != null) + { + _formatConverter.Dispose(); + _formatConverter = null; + } + } + + public bool CanShowConfigWindow() + { + return AVProLiveCameraPlugin.HasDeviceConfigWindow(_deviceIndex); + } + + public bool ShowConfigWindow() + { + return AVProLiveCameraPlugin.ShowDeviceConfigWindow(_deviceIndex); + } + + public bool Start(AVProLiveCameraDeviceMode mode, int videoInputIndex = -1) + { + // Resolve the internal mode index + int internalModeIndex = -1; + if (mode != null) + { + internalModeIndex = mode.InternalIndex; + } + // Resolve the frame rate index + int modeFrameRateIndex = -1; + if (mode != null) + { + modeFrameRateIndex = mode.FrameRateIndex; + } + + // Start the device + if (AVProLiveCameraPlugin.StartDevice(_deviceIndex, internalModeIndex, modeFrameRateIndex, videoInputIndex, _preferPreviewPin)) + { + int modeIndex = -1; + if (mode != null) + { + for (int i = 0; i < _modes.Count; i++) + { + if (_modes[i] == mode) + { + modeIndex = i; + break; + } + } + } + Debug.Log("[AVProLiveCamera] Started device using mode index " + modeIndex + " (internal index " + internalModeIndex + ")"); + + // Get format mode properties + int width = AVProLiveCameraPlugin.GetWidth(_deviceIndex); + int height = AVProLiveCameraPlugin.GetHeight(_deviceIndex); + AVProLiveCameraPlugin.VideoFrameFormat format = (AVProLiveCameraPlugin.VideoFrameFormat)AVProLiveCameraPlugin.GetFormat(_deviceIndex); + _mode = mode; + _width = width; + _height = height; + _format = format.ToString(); + _deviceFormat = AVProLiveCameraPlugin.GetDeviceFormat(_deviceIndex); + _frameRate = AVProLiveCameraPlugin.GetFrameRate(_deviceIndex); + _frameDurationHNS = AVProLiveCameraPlugin.GetFrameDurationHNS(_deviceIndex); + + // The default mode has been used so try to work out which one this is + if (_mode == null) + { + foreach (AVProLiveCameraDeviceMode m in _modes) + { + if (m.Width == _width && + m.Height == _height && + m.Format == _deviceFormat) + { + _mode = m; + break; + } + } + } + + // Validate properties + if (width <= 0 || width > MaxVideoResolution || height <= 0 || height > MaxVideoResolution) + { + Debug.LogWarning("[AVProLiveCamera] invalid width or height"); + Close(); + return false; + } + + // Create format converter + _isTopDown = AVProLiveCameraPlugin.IsFrameTopDown(_deviceIndex); + _formatConverter.YCbCrRange = _yCbCrRange; + bool allowTransparency = (SupportsTransparency && AllowTransparency); + if (!_formatConverter.Build(width, height, format, allowTransparency, _flipX, _isTopDown != _flipY, Deinterlace)) + { + Debug.LogWarning("[AVProLiveCamera] unable to convert camera format"); + Close(); + return false; + } + + // Set clock mode + AVProLiveCameraPlugin.SetDeviceClockMode(_deviceIndex, _clockMode == ClockMode.Default); + + // Run camera + IsActive = true; + IsRunning = false; + IsPicture = false; + IsPaused = true; + _lastModeIndex = modeIndex; + _lastVideoInputIndex = videoInputIndex; + Play(); + + return IsRunning; + } + + Debug.LogWarning("[AVProLiveCamera] unable to start camera"); + Close(); + return false; + } + + public bool Start(int modeIndex = -1, int videoInputIndex = -1) + { + AVProLiveCameraDeviceMode mode = null; + if (modeIndex >= 0) + { + if (modeIndex < _modes.Count) + { + mode = _modes[modeIndex]; + } + else + { + Debug.LogError("[AVProLiveCamera] Mode index out of range, using default resolution"); + } + } + + return Start(mode, videoInputIndex); + } + + public void SetVideoInputByIndex(int index) + { + AVProLiveCameraPlugin.SetVideoInputByIndex(_deviceIndex, index); + } + + public void Play() + { + if (IsActive && (IsPaused || !IsRunning)) + { + if (AVProLiveCameraPlugin.Play(_deviceIndex)) + { + ResetDisplayFPS(); + IsPaused = false; + IsRunning = true; + } + else + { + Debug.LogWarning("[AVProLiveCamera] failed to play camera"); + } + } + } + + public void Pause() + { + if (IsActive && IsRunning) + { + AVProLiveCameraPlugin.Pause(_deviceIndex); + IsPaused = true; + } + } + + public void Stop() + { + if (IsActive && IsRunning) + { + AVProLiveCameraPlugin.Stop(_deviceIndex); + IsRunning = false; + IsPaused = true; + } + } + + private void Update_HotSwap() + { + bool isConnected = AVProLiveCameraPlugin.IsDeviceConnected(_deviceIndex); + // If there is a change in the connection + if (IsConnected != isConnected) + { + if (!isConnected) + { + Debug.Log("[AVProLiveCamera] device #" + _deviceIndex + " '" + Name + "' disconnected"); + Pause(); + } + else + { + Debug.Log("[AVProLiveCamera] device #" + _deviceIndex + " '" + Name + "' reconnected"); + if (IsRunning) + { + Start(_lastModeIndex, _lastVideoInputIndex); + } + } + + IsConnected = isConnected; + } + } + + private void Update_FrameRates() + { + CaptureFPS = AVProLiveCameraPlugin.GetCaptureFrameRate(_deviceIndex); + CaptureFramesDropped = AVProLiveCameraPlugin.GetCaptureFramesDropped(_deviceIndex); + } + + public void Update(bool force) + { + if (UpdateHotSwap) + { + Update_HotSwap(); + } + + if (_deviceIndex >= 0) + { + _frameRate = AVProLiveCameraPlugin.GetFrameRate(_deviceIndex); + } + + if (IsRunning) + { + if (UpdateFrameRates) + { + Update_FrameRates(); + } + if (UpdateSettings) + { + Update_Settings(); + } + } + } + + public bool Render() + { + bool result = false; + if (IsRunning) + { + if (_formatConverter != null) + { + if (_formatConverter.Update()) + { + UpdateDisplayFPS(); + result = true; + } + } + } + return result; + } + + public void Update_Settings() + { + for (int i = 0; i < _settings.Count; i++) + { + _settings[i].Update(); + } + } + + protected void ResetDisplayFPS() + { + _frameCount = 0; + FramesTotal = 0; + DisplayFPS = 0.0f; + _startFrameTime = 0.0f; + } + + public void UpdateDisplayFPS() + { + _frameCount++; + FramesTotal++; + + float timeNow = Time.realtimeSinceStartup; + float timeDelta = timeNow - _startFrameTime; + if (timeDelta >= 0.5f) + { + DisplayFPS = (float)_frameCount / timeDelta; + _frameCount = 0; + _startFrameTime = timeNow; + } + } + + public void Close() + { + ResetDisplayFPS(); + _mode = null; + _width = _height = 0; + _lastVideoInputIndex = _lastModeIndex = -1; + _frameDurationHNS = 0; + _frameRate = 0.0f; + _format = _deviceFormat = string.Empty; + IsRunning = false; + IsPaused = true; + AVProLiveCameraPlugin.StopDevice(_deviceIndex); + } + + public string GetVideoInputName(int index) + { + string result = string.Empty; + + if (index >= 0 && index < _videoInputs.Count) + result = _videoInputs[index]; + + return result; + } + + public AVProLiveCameraDeviceMode GetMode(int index) + { + AVProLiveCameraDeviceMode result = null; + + if (index >= 0 && index < _modes.Count) + { + result = _modes[index]; + } + + return result; + } + + public AVProLiveCameraDeviceMode GetHighestResolutionMode(float minimumFrameRate) + { + AVProLiveCameraDeviceMode result = null; + + float highestRes = 0f; + for (int i = 0; i < NumModes; i++) + { + AVProLiveCameraDeviceMode mode = GetMode(i); + + if (mode.FPS >= minimumFrameRate && (mode.Width * mode.Height > highestRes)) + { + result = mode; + highestRes = mode.Width * mode.Height; + } + } + + return result; + } + + private static bool CompareMode(string internalMode, AVProLiveCameraPlugin.VideoFrameFormat pluginMode) + { + if (internalMode == pluginMode.ToString()) + { + return true; + } + + bool result = false; + + switch (pluginMode) + { + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_BGRA32: + result = (internalMode == "BGRA32" || internalMode == "ARGB32" || internalMode == "RGB32"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YUY2: + result = (internalMode == "YUV_YUY2"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_UYVY: + result = (internalMode == "YUV_UYVY"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YVYU: + result = (internalMode == "YUV_YVYU"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_HDYC: + result = (internalMode == "YUV_UYVY_HDYC"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_YV12: + result = (internalMode == "YUV_PLANAR_YV12"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_I420: + result = (internalMode == "YUV_PLANAR_I420"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_RGB24: + result = (internalMode == "RGB24"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_MONO8: + result = (internalMode == "MONO8" || internalMode == "Mono_Y800"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.RGB_10BPP: + result = (internalMode == "RGB_10BPP" || internalMode == "RGBX_10BPP" || internalMode == "RGBXLE_10BPP"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_10BPP_V210: + result = (internalMode == "YUV_10BPP_V210"); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.MPEG: + result = (internalMode == "MJPG"); + break; + } + + return result; + } + + public AVProLiveCameraDeviceMode GetClosestMode(int width, int height, bool maintainAspectRatio, float frameRate, bool anyPixelFormat, bool transparentPixelFormat, AVProLiveCameraPlugin.VideoFrameFormat pixelFormat) + { + AVProLiveCameraDeviceMode result = null; + + if (width < -1 || height < -1) + return result; + + List bestModes = new List(); + + // Try to find exact match to resolution, or any resolution if width or height == -1 + { + for (int i = 0; i < NumModes; i++) + { + AVProLiveCameraDeviceMode mode = GetMode(i); + + if ((width < 0 || mode.Width == width) && + (height < 0 || mode.Height == height)) + { + bestModes.Add(mode); + } + } + } + + // If we haven't found an exact match, find by closest area + if (bestModes.Count == 0) + { + float aspect = (float)width * (float)height; + int area = width * height; + float lowestAreaDifference = float.MaxValue; + for (int i = 0; i < NumModes; i++) + { + AVProLiveCameraDeviceMode mode = GetMode(i); + + // Maintain aspect ratio or not + float modeAspect = (float)mode.Width / (float)mode.Height; + bool consider = true; + if (maintainAspectRatio && !Mathf.Approximately(modeAspect, aspect)) + consider = false; + + if (consider) + { + int modeArea = mode.Width * mode.Height; + int areaDifference = Mathf.Abs(area - modeArea); + if (areaDifference < lowestAreaDifference) + { + result = mode; + lowestAreaDifference = areaDifference; + } + } + } + + // Now that we know the closest resolution, collect all modes with that resolution + if (result != null) + { + for (int i = 0; i < NumModes; i++) + { + AVProLiveCameraDeviceMode mode = GetMode(i); + if (mode.Width == result.Width && mode.Height == result.Height) + { + bestModes.Add(mode); + } + } + result = null; + } + } + + // Pick best based on pixel format or frame rate + if (bestModes.Count > 0) + { + if (bestModes.Count == 1) + { + result = bestModes[0]; + } + else + { + // If the pixel format isn't a concern, then make sure to filter the frame rates + if (anyPixelFormat) + { + bool findHighestFrameRate = (frameRate <= 0f); + if (findHighestFrameRate) + { + float highestFps = 0f; + for (int i = 0; i < bestModes.Count; i++) + { + AVProLiveCameraDeviceMode mode = bestModes[i]; + if (mode.HighestFrameRate() > highestFps) + { + highestFps = mode.HighestFrameRate(); + } + } + // Remove modes that didn't have the higest fps + for (int i = 0; i < bestModes.Count; i++) + { + AVProLiveCameraDeviceMode mode = bestModes[i]; + if (mode.FPS < highestFps) + { + bestModes.RemoveAt(i); + i = -1; + } + } + } + else + { + float lowestDelta = 1000f; + float closestFps = 0f; + // Find the closest FPS + for (int i = 0; i < bestModes.Count; i++) + { + AVProLiveCameraDeviceMode mode = bestModes[i]; + float fps = mode.GetClosestFrameRate(frameRate); + float d = Mathf.Abs(fps - frameRate); + if (d < lowestDelta) + { + closestFps = fps; + lowestDelta = d; + } + } + // Remove modes that have a different frameRate + for (int i = 0; i < bestModes.Count; i++) + { + AVProLiveCameraDeviceMode mode = bestModes[i]; + if (!mode.HasFrameRate(closestFps)) + { + bestModes.RemoveAt(i); + i = -1; + } + } + } + } + + if (result == null) + { + if (bestModes.Count == 0) + { + result = null; + } + else if (bestModes.Count == 1) + { + result = bestModes[0]; + } + else + { + if (transparentPixelFormat) + { + string[] bestFormats = { "ARGB32", "RGB32", "UNKNOWN" }; + int bestScore = 100; + for (int i = 0; i < bestModes.Count; i++) + { + int index = System.Array.IndexOf(bestFormats, bestModes[i].Format); + if (index >= 0 && index < bestScore) + { + result = bestModes[i]; + bestScore = index; + } + } + } + else if (anyPixelFormat) + { + string[] bestFormats = { "YUV_UYVY_HDYC", "YUV_UYVY", "YUV_YVYU", "YUV_YUY2", "ARGB32", "RGB32", "RGB24", "MJPG", "UNKNOWN" }; + int bestScore = 100; + for (int i = 0; i < bestModes.Count; i++) + { + int index = System.Array.IndexOf(bestFormats, bestModes[i].Format); + if (index >= 0 && index < bestScore) + { + result = bestModes[i]; + bestScore = index; + } + } + } + else + { + for (int i = 0; i < bestModes.Count; i++) + { + if (CompareMode(bestModes[i].Format, pixelFormat)) + { + result = bestModes[i]; + break; + } + } + } + } + } + } + } + + if (result != null) + { + //Debug.Log(string.Format("Selected mode {0}: {1}x{2} {3} {4}", result.Index, result.Width , result.Height, result.FPS, result.Format)); + } + + return result; + } + + public AVProLiveCameraSettingBase GetVideoSettingByType(SettingsEnum type) + { + AVProLiveCameraSettingBase result = null; + if (!_settingsByType.TryGetValue((int)type, out result)) + { + result = null; + } + return result; + } + + public AVProLiveCameraSettingBase GetVideoSettingByIndex(int index) + { + AVProLiveCameraSettingBase result = null; + + if (index >= 0 && index < _settings.Count) + result = _settings[index]; + + return result; + } + + private void SortModes() + { + _modes.Sort(delegate (AVProLiveCameraDeviceMode x, AVProLiveCameraDeviceMode y) + { + int result = 0; + + // Sort by resolution + if (x.Width * x.Height < y.Width * y.Height) + result = -1; + else if (y.Width * y.Height < x.Width * x.Height) + result = 1; + + // Sort by framerate + if (result == 0) + { + if (x.FPS < y.FPS) + result = -1; + else if (y.FPS < x.FPS) + result = 1; + } + + // Sort by format + if (result == 0) + { + result = x.Format.CompareTo(y.Format); + } + + return result; + }); + } + + private void EnumModes() + { + int numModes = AVProLiveCameraPlugin.GetNumModes(_deviceIndex); + for (int i = 0; i < numModes; i++) + { + int width, height; + string format; + float[] frameRates; + int frameRateIndex; + if (AVProLiveCameraPlugin.GetModeInfo(_deviceIndex, i, out width, out height, out frameRates, out frameRateIndex, out format)) + { + AVProLiveCameraDeviceMode mode = new AVProLiveCameraDeviceMode(this, i, width, height, frameRates, frameRateIndex, format.ToString()); + _modes.Add(mode); + } + } + SortModes(); + } + + private void EnumVideoInputs() + { + int numVideoInputs = AVProLiveCameraPlugin.GetNumVideoInputs(_deviceIndex); + for (int i = 0; i < numVideoInputs; i++) + { + string name; + if (AVProLiveCameraPlugin.GetVideoInputName(_deviceIndex, i, out name)) + { + _videoInputs.Add(name); + } + } + } + + private void EnumVideoSettings() + { + int numVideoSettings = AVProLiveCameraPlugin.GetNumDeviceVideoSettings(_deviceIndex); + for (int i = 0; i < numVideoSettings; i++) + { + int settingType; + int dataType; + string name; + bool canAutomatic; + if (AVProLiveCameraPlugin.GetDeviceVideoSettingInfo(_deviceIndex, i, out settingType, out dataType, out name, out canAutomatic)) + { + AVProLiveCameraSettingBase setting = null; + + // Data type is boolean + if (dataType == 0) + { + bool defaultValue; + bool currentValue; + bool isAutomatic; + if (AVProLiveCameraPlugin.GetDeviceVideoSettingBoolean(_deviceIndex, i, out defaultValue, out currentValue, out isAutomatic)) + { + setting = new AVProLiveCameraSettingBoolean(_deviceIndex, i, settingType, name, canAutomatic, isAutomatic, defaultValue, currentValue); + } + } + // Data type is float + else if (dataType == 1) + { + bool isAutomatic; + float defaultValue; + float currentValue; + float minValue, maxValue; + if (AVProLiveCameraPlugin.GetDeviceVideoSettingFloat(_deviceIndex, i, out defaultValue, out currentValue, out minValue, out maxValue, out isAutomatic)) + { + setting = new AVProLiveCameraSettingFloat(_deviceIndex, i, settingType, name, canAutomatic, isAutomatic, defaultValue, currentValue, minValue, maxValue); + } + } + + if (setting != null) + { + _settings.Add(setting); + _settingsByType.Add(settingType, setting); + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDevice.cs.meta b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDevice.cs.meta new file mode 100644 index 0000000..0d6c500 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDevice.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 7f73ae973323450439d2f0989433ef9b diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDeviceMode.cs b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDeviceMode.cs new file mode 100644 index 0000000..6e0238c --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDeviceMode.cs @@ -0,0 +1,137 @@ +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + public class AVProLiveCameraDeviceMode + { + private AVProLiveCameraDevice _device; + private int _internalIndex; + private int _width, _height; + private int _frameRateIndex; + private float[] _frameRates; + private string _format; + + public int Width + { + get { return _width; } + } + + public int Height + { + get { return _height; } + } + + public float[] FrameRates + { + get { return _frameRates; } + } + + public int FrameRateIndex + { + get { return _frameRateIndex; } + set { if (value >= 0 && value < _frameRates.Length) _frameRateIndex = value; } + } + + public float FPS + { + get { return _frameRates[_frameRateIndex]; } + } + + public string Format + { + get { return _format; } + } + + public int InternalIndex + { + get { return _internalIndex; } + } + + public AVProLiveCameraDevice Device + { + get { return _device; } + } + + public void SelectHighestFrameRate() + { + _frameRateIndex = 0; + for (int i = 0; i < _frameRates.Length; i++) + { + if (_frameRates[i] > FPS) + { + _frameRateIndex = i; + } + } + } + + internal bool HasFrameRate(float frameRate) + { + bool result = false; + for (int i = 0; i < _frameRates.Length; i++) + { + if (_frameRates[i] == frameRate) + { + result = true; + break; + } + } + return result; + } + + internal float HighestFrameRate() + { + float highestFps = 0f; + for (int i = 0; i < _frameRates.Length; i++) + { + if (_frameRates[i] > highestFps) + { + highestFps = _frameRates[i]; + } + } + return highestFps; + } + + internal float GetClosestFrameRate(float frameRate) + { + float result = float.MinValue; + float lowestDelta = 10000f; + for (int i = 0; i < _frameRates.Length; i++) + { + float d = UnityEngine.Mathf.Abs(_frameRates[i] - frameRate); + if (d < lowestDelta) + { + result = _frameRates[i]; + lowestDelta = d; + } + } + return result; + } + + public void SelectClosestFrameRate(float frameRate) + { + float lowestDelta = 10000f; + for (int i = 0; i < _frameRates.Length; i++) + { + float d = UnityEngine.Mathf.Abs(_frameRates[i] - frameRate); + if (d < lowestDelta) + { + _frameRateIndex = i; + lowestDelta = d; + } + } + } + + public AVProLiveCameraDeviceMode(AVProLiveCameraDevice device, int internalIndex, int width, int height, float[] frameRates, int defaultFrameRateIndex, string format) + { + _device = device; + _internalIndex = internalIndex; + _width = width; + _height = height; + _frameRates = frameRates; + _frameRateIndex = defaultFrameRateIndex; + _format = format; + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDeviceMode.cs.meta b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDeviceMode.cs.meta new file mode 100644 index 0000000..82bc8f8 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraDeviceMode.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 8cb524bebfe77d54fb1ce26df88e2335 diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraFormatConverter.cs b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraFormatConverter.cs new file mode 100644 index 0000000..f5772a5 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraFormatConverter.cs @@ -0,0 +1,525 @@ +using UnityEngine; +using System.Text; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + public class AVProLiveCameraFormatConverter : System.IDisposable + { + private int _deviceIndex; + + // Format conversion and texture output + private RenderTexture _finalTexture; + private Material _conversionMaterial; + private Material _deinterlaceMaterial; + + // Conversion params + private int _width; + private int _height; + private bool _flipX; + private bool _flipY; + private bool _allowTransparency; + private bool _deinterlace; + private YCbCrRange _yCbCrRange; + private AVProLiveCameraPlugin.VideoFrameFormat _format; + + private List _buffers; + private Vector4[] _uvs; + private bool _requiresTextureCrop; + private int _lastFrameUpdated = 0; + //private AVProLiveCameraManager _manager; + + private int _propMainTex; + private int _propTextureScaleOffset; + private int _propTextureWidth; + private int _propTextureU; + private int _propTextureV; + + public Texture OutputTexture + { + get { return _finalTexture; } + } + + public bool FlipX + { + get { return _flipX; } + set { if (_flipX != value) SetFlip(value, _flipY); } + } + + public bool FlipY + { + get { return _flipY; } + set { if (_flipY != value) SetFlip(_flipX, value); } + } + + public bool AllowTransparency + { + get { return _allowTransparency; } + set { if (_allowTransparency != value) SetTransparency(value); } + } + + public YCbCrRange YCbCrRange + { + get { return _yCbCrRange; } + set { if (_yCbCrRange != value) SetYCbCrRange(value); } + } + + public bool ValidPicture { get; private set; } + + public AVProLiveCameraFormatConverter(int deviceIndex) + { + ValidPicture = false; + _deviceIndex = deviceIndex; + _buffers = new List(4); + + _propMainTex = Shader.PropertyToID("_MainTex"); + _propTextureScaleOffset = Shader.PropertyToID("_TextureScaleOffset"); + _propTextureWidth = Shader.PropertyToID("_TextureWidth"); + _propTextureU = Shader.PropertyToID("_MainU"); + _propTextureV = Shader.PropertyToID("_MainV"); + } + + public void Reset() + { + ValidPicture = false; + _lastFrameUpdated = 0; + } + + public bool Build(int width, int height, AVProLiveCameraPlugin.VideoFrameFormat format, bool allowTransparency, bool flipX, bool flipY, bool deinterlace = false) + { + Reset(); + + _width = width; + _height = height; + _deinterlace = deinterlace; + _format = format; + _flipX = flipX; + _flipY = flipY; + //_manager = AVProLiveCameraManager.Instance; + + if (CreateMaterials()) + { + CreateBuffers(); + CreateRenderTexture(); + + switch (_format) + { + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_BGRA32: + _conversionMaterial.SetTexture(_propMainTex, _buffers[0]._texture); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_MONO8: + _conversionMaterial.SetFloat(_propTextureWidth, _finalTexture.width); + _conversionMaterial.SetTexture(_propMainTex, _buffers[0]._texture); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YUY2: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_UYVY: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YVYU: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_HDYC: + _conversionMaterial.SetFloat(_propTextureWidth, _finalTexture.width); + _conversionMaterial.SetTexture(_propMainTex, _buffers[0]._texture); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_YV12: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_I420: + _conversionMaterial.SetFloat(_propTextureWidth, _finalTexture.width); + _conversionMaterial.SetTexture(_propMainTex, _buffers[0]._texture); + _conversionMaterial.SetTexture(_propTextureU, _buffers[1]._texture); + _conversionMaterial.SetTexture(_propTextureV, _buffers[2]._texture); + break; + } + + SetFlip(_flipX, _flipY); + SetTransparency(allowTransparency); + SetYCbCrRange(_yCbCrRange); + } + else + { + Debug.LogWarning("[AVPro LiveCamera] couldn't create conversion materials"); + return false; + } + + return true; + } + + private bool IsNewSourceTextureAvailable() + { + bool result = false; + + int lastFrameUpdated = AVProLiveCameraPlugin.GetLastFrameUploaded(_deviceIndex); + if (_lastFrameUpdated != lastFrameUpdated) + { + _lastFrameUpdated = lastFrameUpdated; + result = true; + } + return result; + } + + public bool Update() + { + //RenderTexture prev = RenderTexture.active; + bool isTextureUpdated = IsNewSourceTextureAvailable(); + + if (isTextureUpdated) + { + if (!_deinterlaceMaterial) + { + // Format convert + if (DoFormatConversion(_finalTexture)) + { + ValidPicture = true; + } + } + else + { + // Format convert and Deinterlace + RenderTexture tempTarget = RenderTexture.GetTemporary(_width, _height, 0, _finalTexture.format); + if (DoFormatConversion(tempTarget)) + { + DoDeinterlace(tempTarget, _finalTexture); + ValidPicture = true; + } + RenderTexture.ReleaseTemporary(tempTarget); + } + } + //RenderTexture.active = prev; + + return (ValidPicture && isTextureUpdated); + } + + public void Dispose() + { + ValidPicture = false; + + if (_conversionMaterial != null) + { + _conversionMaterial.mainTexture = null; + Material.Destroy(_conversionMaterial); + _conversionMaterial = null; + } + + if (_deinterlaceMaterial != null) + { + _deinterlaceMaterial.mainTexture = null; + Material.Destroy(_deinterlaceMaterial); + _deinterlaceMaterial = null; + } + + if (_finalTexture != null) + { + RenderTexture.ReleaseTemporary(_finalTexture); + _finalTexture = null; + } + + foreach (AVProLiveCameraPixelBuffer buffer in _buffers) + { + buffer.Close(); + } + _buffers.Clear(); + } + + private void CreateBuffers() + { + foreach (AVProLiveCameraPixelBuffer buffer in _buffers) + { + buffer.Close(); + } + _buffers.Clear(); + + _requiresTextureCrop = false; + switch (_format) + { + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_BGRA32: + if (_buffers.Count < 1) + _buffers.Add(new AVProLiveCameraPixelBuffer(_deviceIndex, _buffers.Count)); + _buffers[0].Build(_width, _height); + _requiresTextureCrop = _buffers[0].RequiresTextureCrop(); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.RAW_MONO8: + if (_buffers.Count < 1) + _buffers.Add(new AVProLiveCameraPixelBuffer(_deviceIndex, _buffers.Count)); + _buffers[0].Build(_width / 4, _height); + _requiresTextureCrop = _buffers[0].RequiresTextureCrop(); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YUY2: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_UYVY: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_YVYU: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_422_HDYC: + if (_buffers.Count < 1) + _buffers.Add(new AVProLiveCameraPixelBuffer(_deviceIndex, _buffers.Count)); + _buffers[0].Build(_width / 2, _height); // YCbCr422 modes need half width + _requiresTextureCrop = _buffers[0].RequiresTextureCrop(); + break; + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_YV12: + case AVProLiveCameraPlugin.VideoFrameFormat.YUV_420_PLANAR_I420: + while (_buffers.Count < 3) + { + _buffers.Add(new AVProLiveCameraPixelBuffer(_deviceIndex, _buffers.Count)); + } + _buffers[0].Build(_width / 4, _height); // Y + _buffers[1].Build(_width / 8, _height / 2); // Cr + _buffers[2].Build(_width / 8, _height / 2); // Cb + _requiresTextureCrop = true; + break; + } + } + + private bool CreateMaterials() + { + Shader shader = AVProLiveCameraManager.Instance.GetPixelConversionShader(_format); + if (shader) + { + if (_conversionMaterial != null) + { + if (_conversionMaterial.shader != shader) + { + Material.Destroy(_conversionMaterial); + _conversionMaterial = null; + } + } + + if (_conversionMaterial == null) + { + _conversionMaterial = new Material(shader); + _conversionMaterial.name = "AVProLiveCamera-Material"; + _conversionMaterial.SetVector(_propTextureScaleOffset, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + } + } + + if (_deinterlace) + { + shader = AVProLiveCameraManager.Instance.GetDeinterlaceShader(); + if (shader) + { + if (_deinterlaceMaterial != null) + { + if (_deinterlaceMaterial.shader != shader) + { + Material.Destroy(_deinterlaceMaterial); + _deinterlaceMaterial = null; + } + } + + if (_deinterlaceMaterial == null) + { + _deinterlaceMaterial = new Material(shader); + _deinterlaceMaterial.name = "AVProLiveCamera-DeinterlaceMaterial"; + } + } + } + + return (_conversionMaterial != null) && (!_deinterlace || _deinterlaceMaterial != null); + } + + private void CreateRenderTexture() + { + // Create RenderTexture for post transformed frames + // If there is already a renderTexture, only destroy it smaller than desired size + if (_finalTexture != null) + { + if (_finalTexture.width != _width || _finalTexture.height != _height) + { + RenderTexture.ReleaseTemporary(_finalTexture); + _finalTexture = null; + } + } + if (_finalTexture == null) + { + ValidPicture = false; + _finalTexture = RenderTexture.GetTemporary(_width, _height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB); + _finalTexture.wrapMode = TextureWrapMode.Clamp; + _finalTexture.filterMode = FilterMode.Bilinear; + _finalTexture.name = "AVProLiveCamera-FinalTexture"; + _finalTexture.Create(); + } + } + + private bool DoFormatConversion(RenderTexture target) + { + if (_buffers == null || _buffers.Count == 0) + return false; + + target.DiscardContents(); + + if (!_requiresTextureCrop) + { + RenderTexture prev = RenderTexture.active; + Graphics.Blit(_buffers[0]._texture, target, _conversionMaterial, 0); + RenderTexture.active = prev; + } + else + { + RenderTexture prev = RenderTexture.active; + RenderTexture.active = target; + _conversionMaterial.SetPass(0); + + GL.PushMatrix(); + GL.LoadOrtho(); + DrawQuad(); + GL.PopMatrix(); + + RenderTexture.active = prev; + } + + return true; + } + + private void DoDeinterlace(RenderTexture source, RenderTexture target) + { + target.DiscardContents(); + RenderTexture prev = RenderTexture.active; + Graphics.Blit(source, target, _deinterlaceMaterial); + RenderTexture.active = prev; + } + + private void SetFlip(bool flipX, bool flipY) + { + _flipX = flipX; + _flipY = flipY; + + if (_requiresTextureCrop) + { + if (_buffers != null) + { + BuildUVs(_flipX, _flipY); + } + } + else + { + if (_conversionMaterial != null) + { + // Flip and then offset back to get back to normalised range + Vector2 scale = new Vector2(1f, 1f); + Vector2 offset = new Vector2(0f, 0f); + if (_flipX) + { + scale = new Vector2(-1f, scale.y); + offset = new Vector2(1f, offset.y); + } + if (_flipY) + { + scale = new Vector2(scale.x, -1f); + offset = new Vector2(offset.x, 1f); + } + + _conversionMaterial.SetVector(_propTextureScaleOffset, new Vector4(scale.x, scale.y, offset.x, offset.y)); + + // Horizontal flipping requires changes to how YUV pixels are read + if (_flipX) + { + _conversionMaterial.DisableKeyword("HORIZONTAL_FLIP_OFF"); + _conversionMaterial.EnableKeyword("HORIZONTAL_FLIP_ON"); + } + else + { + _conversionMaterial.DisableKeyword("HORIZONTAL_FLIP_ON"); + _conversionMaterial.EnableKeyword("HORIZONTAL_FLIP_OFF"); + } + } + } + } + + private void SetTransparency(bool enabled) + { + _allowTransparency = enabled; + if (_conversionMaterial != null) + { + if (enabled) + { + _conversionMaterial.DisableKeyword("AVPRO_TRANSPARENCY_OFF"); + _conversionMaterial.EnableKeyword("AVPRO_TRANSPARENCY_ON"); + } + else + { + _conversionMaterial.DisableKeyword("AVPRO_TRANSPARENCY_ON"); + _conversionMaterial.EnableKeyword("AVPRO_TRANSPARENCY_OFF"); + } + } + } + + private void SetYCbCrRange(YCbCrRange range) + { + _yCbCrRange = range; + if (_conversionMaterial != null) + { + if (range == YCbCrRange.Limited) + { + _conversionMaterial.DisableKeyword("YCBCR_RANGE_FULL"); + _conversionMaterial.EnableKeyword("YCBCR_RANGE_LIMITED"); + } + else + { + _conversionMaterial.DisableKeyword("YCBCR_RANGE_LIMITED"); + _conversionMaterial.EnableKeyword("YCBCR_RANGE_FULL"); + } + } + } + + private void BuildUVs(bool invertX, bool invertY) + { + _uvs = new Vector4[_buffers.Count]; + + for (int i = 0; i < _buffers.Count; i++) + { + float x1, x2; + float y1, y2; + if (invertX) + { + x1 = 1.0f; x2 = 0.0f; + } + else + { + x1 = 0.0f; x2 = 1.0f; + } + if (invertY) + { + y1 = 1.0f; y2 = 0.0f; + } + else + { + y1 = 0.0f; y2 = 1.0f; + } + + // Alter UVs if we're only using a portion of the texture + if (_buffers[i]._innerWidth != _buffers[i]._texture.width) + { + float xd = _buffers[i]._innerWidth / (float)_buffers[i]._texture.width; + x1 *= xd; x2 *= xd; + } + if (_buffers[i]._innerHeight != _buffers[i]._texture.height) + { + float yd = _buffers[i]._innerHeight / (float)_buffers[i]._texture.height; + y1 *= yd; y2 *= yd; + } + + _uvs[i] = new Vector4(x1, y1, x2, y2); + } + } + + private void DrawQuad() + { + GL.Begin(GL.QUADS); + + for (int i = 0; i < _buffers.Count; i++) + GL.MultiTexCoord2(i, _uvs[i].x, _uvs[i].y); + GL.Vertex3(0.0f, 0.0f, 0.1f); + + for (int i = 0; i < _buffers.Count; i++) + GL.MultiTexCoord2(i, _uvs[i].z, _uvs[i].y); + GL.Vertex3(1.0f, 0.0f, 0.1f); + + for (int i = 0; i < _buffers.Count; i++) + GL.MultiTexCoord2(i, _uvs[i].z, _uvs[i].w); + GL.Vertex3(1.0f, 1.0f, 0.1f); + + for (int i = 0; i < _buffers.Count; i++) + GL.MultiTexCoord2(i, _uvs[i].x, _uvs[i].w); + GL.Vertex3(0.0f, 1.0f, 0.1f); + + GL.End(); + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraFormatConverter.cs.meta b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraFormatConverter.cs.meta new file mode 100644 index 0000000..a8e63c7 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraFormatConverter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 5621433699e111d44847a7dd1c8ec102 diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraPixelBuffer.cs b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraPixelBuffer.cs new file mode 100644 index 0000000..349f09b --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraPixelBuffer.cs @@ -0,0 +1,110 @@ +using UnityEngine; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + public class AVProLiveCameraPixelBuffer + { + // Format conversion and texture output + public Texture2D _texture; + public int _innerWidth; + public int _innerHeight; + + // Conversion params + public int _width; + public int _height; + public TextureFormat _format; + private int _deviceIndex; + private int _bufferIndex; + + public AVProLiveCameraPixelBuffer(int deviceIndex, int bufferIndex) + { + _deviceIndex = deviceIndex; + _bufferIndex = bufferIndex; + } + + public bool Build(int width, int height, TextureFormat format = TextureFormat.RGBA32) + { + _width = width; + _height = height; + _format = format; + + if (CreateTexture()) + { + AVProLiveCameraPlugin.SetTexturePointer(_deviceIndex, _bufferIndex, _texture.GetNativeTexturePtr()); + return true; + } + return false; + } + + public void Close() + { + if (_texture != null) + { + Texture2D.Destroy(_texture); + _texture = null; + } + } + + public bool RequiresTextureCrop() + { + bool result = false; + if (_texture != null) + { + result = (_width != _texture.width || _height != _texture.height); + } + return result; + } + + private bool CreateTexture() + { + // Calculate texture size + int textureWidth = _width; + int textureHeight = _height; + _innerWidth = textureWidth; + _innerHeight = textureHeight; + + // Unity 2019.1 no longer supports devices that require power-of-two textures +#if !UNITY_2019_1_OR_NEWER + bool requiresPOT = (SystemInfo.npotSupport == NPOTSupport.None); + + // If the texture isn't a power of 2 + if (requiresPOT) + { + if (!Mathf.IsPowerOfTwo(_width) || !Mathf.IsPowerOfTwo(_height)) + { + // We use a power-of-2 texture as Unity makes these internally anyway and not doing it seems to break things for texture updates + textureWidth = Mathf.NextPowerOfTwo(textureWidth); + textureHeight = Mathf.NextPowerOfTwo(textureHeight); + } + } +#endif + + // Create texture that stores the initial raw frame + // If there is already a texture, only destroy it if it isn't of desired size + if (_texture != null) + { + if (_texture.width != textureWidth || + _texture.height != textureHeight || + _texture.format != _format) + { + Texture2D.Destroy(_texture); + _texture = null; + } + } + if (_texture == null) + { + _texture = new Texture2D(textureWidth, textureHeight, _format, false, true); + _texture.wrapMode = TextureWrapMode.Clamp; + _texture.filterMode = FilterMode.Point; + _texture.name = "AVProLiveCamera-BufferTexture"; + _texture.Apply(false, true); + } + + return (_texture != null); + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraPixelBuffer.cs.meta b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraPixelBuffer.cs.meta new file mode 100644 index 0000000..e1ff2f2 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraPixelBuffer.cs.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f7c08df0fabefdd4899c6ce5729f2a59 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraSettings.cs b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraSettings.cs new file mode 100644 index 0000000..0788488 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraSettings.cs @@ -0,0 +1,190 @@ +using UnityEngine; +using System.Text; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2012-2022 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProLiveCamera +{ + public class AVProLiveCameraSettingBase + { + protected int _deviceIndex; + protected int _settingIndex; + + public enum DataType + { + Boolean, + Float, + Enum, + } + + public DataType DataTypeValue + { + get; + protected set; + } + + public int PropertyIndex + { + get; + protected set; + } + + public string Name + { + get; + protected set; + } + + public bool CanAutomatic + { + get; + protected set; + } + + protected bool _isAutomatic; + public bool IsAutomatic + { + get { return _isAutomatic; } + set { if (value != _isAutomatic) IsDirty = true; _isAutomatic = value; } + } + + public bool IsDirty + { + get; + protected set; + } + + public virtual void SetDefault() + { + + } + + public virtual void Update() + { + + } + } + + public class AVProLiveCameraSettingBoolean : AVProLiveCameraSettingBase + { + private bool _currentValue; + public bool CurrentValue + { + get { return _currentValue; } + set { if (!_isAutomatic) { if (value != _currentValue) IsDirty = true; _currentValue = value; } } + } + + public bool DefaultValue + { + get; + private set; + } + + public override void SetDefault() + { + CurrentValue = DefaultValue; + } + + public override void Update() + { + float currentValue = _currentValue ? 1.0f : 0.0f; + if (IsDirty) + { + AVProLiveCameraPlugin.ApplyDeviceVideoSettingValue(_deviceIndex, _settingIndex, currentValue, _isAutomatic); + IsDirty = false; + } + else + { + AVProLiveCameraPlugin.UpdateDeviceVideoSettingValue(_deviceIndex, _settingIndex, out currentValue, out _isAutomatic); + _currentValue = currentValue > 0.0f; + } + } + + public AVProLiveCameraSettingBoolean(int deviceIndex, int settingIndex, int propertyIndex, string name, bool canAutomatic, bool isAutomatic, bool defaultValue, bool currentValue) + { + _deviceIndex = deviceIndex; + _settingIndex = settingIndex; + DataTypeValue = DataType.Boolean; + PropertyIndex = propertyIndex; + Name = name; + CanAutomatic = canAutomatic; + + IsAutomatic = isAutomatic; + DefaultValue = defaultValue; + CurrentValue = currentValue; + + IsDirty = false; + } + } + + public class AVProLiveCameraSettingFloat : AVProLiveCameraSettingBase + { + private float _currentValue; + public float CurrentValue + { + get { return _currentValue; } + set { if (!_isAutomatic) { if (value != _currentValue) IsDirty = true; _currentValue = value; } } + } + + public float DefaultValue + { + get; + private set; + } + public float MinValue + { + get; + private set; + } + public float MaxValue + { + get; + private set; + } + + public float CurrentValueNormalised + { + set { CurrentValue = Mathf.Lerp(MinValue, MaxValue, value); } + get { return (_currentValue - MinValue) / (MaxValue - MinValue); } + } + + public override void SetDefault() + { + CurrentValue = DefaultValue; + } + + public override void Update() + { + if (IsDirty) + { + AVProLiveCameraPlugin.ApplyDeviceVideoSettingValue(_deviceIndex, _settingIndex, _currentValue, _isAutomatic); + IsDirty = false; + } + else + { + AVProLiveCameraPlugin.UpdateDeviceVideoSettingValue(_deviceIndex, _settingIndex, out _currentValue, out _isAutomatic); + } + } + + public AVProLiveCameraSettingFloat(int deviceIndex, int settingIndex, int propertyIndex, string name, bool canAutomatic, bool isAutomatic, float defaultValue, float currentValue, float minValue, float maxValue) + { + _deviceIndex = deviceIndex; + _settingIndex = settingIndex; + DataTypeValue = DataType.Float; + PropertyIndex = propertyIndex; + Name = name; + CanAutomatic = canAutomatic; + + IsAutomatic = isAutomatic; + MinValue = minValue; + MaxValue = maxValue; + DefaultValue = defaultValue; + CurrentValue = currentValue; + + IsDirty = false; + } + } +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraSettings.cs.meta b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraSettings.cs.meta new file mode 100644 index 0000000..84337a1 --- /dev/null +++ b/Assets/AVProLiveCamera/Scripts/Wrapper/AVProLiveCameraSettings.cs.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5c6408d675adfbf4abd4f5081b1d9419 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} diff --git a/Assets/AVProLiveCamera/Shaders.meta b/Assets/AVProLiveCamera/Shaders.meta new file mode 100644 index 0000000..5d89a69 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d3aa682939d7529449d7a3ece6d1669f diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Deinterlace.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Deinterlace.shader new file mode 100644 index 0000000..3f6260a --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Deinterlace.shader @@ -0,0 +1,42 @@ +Shader "Hidden/AVProLiveCamera/Deinterlace" { +Properties { + _MainTex ("Base (RGB)", 2D) = "white" {} +} + +SubShader { + + Pass { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + + +CGPROGRAM +#pragma vertex vert_img +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#include "UnityCG.cginc" + +uniform sampler2D _MainTex; +uniform half4 _MainTex_TexelSize; + +fixed4 frag (v2f_img i) : COLOR +{ + float4 c0 = tex2D(_MainTex, i.uv); + + float2 h = float2(0 , _MainTex_TexelSize.y); + + float4 c1 = tex2D(_MainTex, i.uv - h); + float4 c2 = tex2D(_MainTex, i.uv + h); + + return (c0*2+c1+c2)/4; +} +ENDCG + + } +} + +Fallback off + +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Deinterlace.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Deinterlace.shader.meta new file mode 100644 index 0000000..c5484b7 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Deinterlace.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 33f55a5d4bd45ae40abfc13543f7bada diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUI.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUI.shader new file mode 100644 index 0000000..5af1cfc --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUI.shader @@ -0,0 +1,77 @@ +Shader "Hidden/AVProLiveCamera/IMGUI" +{ + Properties + { + _MainTex("Texture", 2D) = "white" {} + [Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0 + } + + SubShader + { + Tags { "ForceSupported" = "True" "RenderType" = "Overlay" } + + Lighting Off + Cull Off + ZWrite Off + ZTest Always + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile __ APPLY_GAMMA + + #include "UnityCG.cginc" + #include "AVProLiveCamera_Shared.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + uniform sampler2D _MainTex; + uniform float4 _MainTex_ST; + uniform float2 _Flip; + + v2f vert(appdata_t v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + if (_Flip.x < 0.0) + { + o.texcoord.x = (1.0 - o.texcoord.x); + } + if (_Flip.y < 0.0) + { + o.texcoord.y = (1.0 - o.texcoord.y); + } + o.color = v.color; + + return o; + } + + fixed4 frag(v2f i) : SV_Target + { + fixed4 col = tex2D(_MainTex, i.texcoord.xy); +#if APPLY_GAMMA + col.rgb = linearToGammaFast(col.rgb); +#endif + return col * i.color; + } + ENDCG + } + } + + Fallback off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUI.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUI.shader.meta new file mode 100644 index 0000000..2995e46 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUI.shader.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d88cdfb4126deda438d3b218a2c74545 +ShaderImporter: + defaultTextures: [] + userData: diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUITransparent.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUITransparent.shader new file mode 100644 index 0000000..a578b3f --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUITransparent.shader @@ -0,0 +1,78 @@ +Shader "Hidden/AVProLiveCamera/IMGUI Transparent" +{ + Properties + { + _MainTex("Texture", 2D) = "white" {} + [Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0 + } + + SubShader + { + Tags { "ForceSupported" = "True" "RenderType" = "Overlay" } + + Lighting Off + Cull Off + ZWrite Off + ZTest Always + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile __ APPLY_GAMMA + + #include "UnityCG.cginc" + #include "AVProLiveCamera_Shared.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + uniform sampler2D _MainTex; + uniform float4 _MainTex_ST; + uniform float2 _Flip; + + v2f vert(appdata_t v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + if (_Flip.x < 0.0) + { + o.texcoord.x = (1.0 - o.texcoord.x); + } + if (_Flip.y < 0.0) + { + o.texcoord.y = (1.0 - o.texcoord.y); + } + o.color = v.color; + + return o; + } + + fixed4 frag(v2f i) : SV_Target + { + fixed4 col = tex2D(_MainTex, i.texcoord.xy); +#if APPLY_GAMMA + col.rgb = linearToGammaFast(col.rgb); +#endif + return col * i.color; + } + ENDCG + } + } + + Fallback off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUITransparent.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUITransparent.shader.meta new file mode 100644 index 0000000..04cc5a9 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_IMGUITransparent.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2c185ab56a3b58f4ba582e6a79d73f01 +timeCreated: 1558433529 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_BGRA2RGBA.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_BGRA2RGBA.shader new file mode 100644 index 0000000..90c4a3e --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_BGRA2RGBA.shader @@ -0,0 +1,78 @@ +Shader "Hidden/AVProLiveCamera/CompositeBGRA_2_RGBA" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _TextureScaleOffset ("Texure Scale Offset", Vector) = (1.0, 1.0, 0.0, 0.0) + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma exclude_renderers flash xbox360 ps3 gles + //#pragma fragmentoption ARB_precision_hint_fastest + #pragma fragmentoption ARB_precision_hint_nicest + #pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF + #pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF + #pragma multi_compile AVPRO_TRANSPARENCY_ON AVPRO_TRANSPARENCY_OFF + #include "UnityCG.cginc" + #include "AVProLiveCamera_Shared.cginc" + + uniform sampler2D _MainTex; + uniform float4 _TextureScaleOffset; + uniform float4 _MainTex_TexelSize; + + struct v2f { + float4 pos : POSITION; + float2 uv : TEXCOORD0; + }; + + v2f vert( appdata_img v ) + { + v2f o; + o.pos = UnityObjectToClipPos (v.vertex); + o.uv.xy = (v.texcoord.xy * _TextureScaleOffset.xy + _TextureScaleOffset.zw); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + return o; + } + + float4 frag (v2f i) : COLOR + { + float4 oCol = tex2D(_MainTex, i.uv.xy ); + #if defined(SWAP_RED_BLUE_ON) + oCol = oCol.bgra; + #endif + + #if defined(AVPRO_GAMMACORRECTION) + oCol.rgb = TransferSRGB_GammaToLinear(oCol.rgb); + #endif + + #if defined(AVPRO_TRANSPARENCY_ON) + return oCol.rgba; + #else + return float4(oCol.rgb, 1.0); + #endif + } + ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_BGRA2RGBA.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_BGRA2RGBA.shader.meta new file mode 100644 index 0000000..3b0ff50 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_BGRA2RGBA.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: 55de6cd535b200d4c9e41052d04ec1e5 diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_Mono8.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_Mono8.shader new file mode 100644 index 0000000..2c98eec --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_Mono8.shader @@ -0,0 +1,86 @@ +Shader "Hidden/AVProLiveCamera/CompositeMono8_2_RGBA" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _TextureScaleOffset ("Texure Scale Offset", Vector) = (1.0, 1.0, 0.0, 0.0) + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + +CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF +#pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF +#include "UnityCG.cginc" +#include "AVProLiveCamera_Shared.cginc" +uniform sampler2D _MainTex; +uniform float _TextureWidth; +uniform float4 _TextureScaleOffset; +uniform float4 _MainTex_TexelSize; + +struct v2f { + float4 pos : POSITION; + float3 uv : TEXCOORD0; +}; + +v2f vert( appdata_img v ) +{ + v2f o; + o.pos = UnityObjectToClipPos (v.vertex); + o.uv.xy = (v.texcoord.xy * _TextureScaleOffset.xy + _TextureScaleOffset.zw); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + o.uv.z = v.vertex.x * _TextureWidth * 0.25; + + return o; +} + +float4 frag (v2f i) : COLOR +{ + float4 col = tex2D(_MainTex, i.uv.xy ); +#if defined(SWAP_RED_BLUE_ON) + col = col.bgra; +#endif + + float l = col.a; + if (frac(i.uv.z) < 0.25) + l = col.b; + else if (frac(i.uv.z) < 0.5) + l = col.g; + else if (frac(i.uv.z) < 0.75) + l = col.r; + + col.rgb = l; + +#if defined(AVPRO_GAMMACORRECTION) + col.rgb = TransferSRGB_GammaToLinear(col.rgb); +#endif + + col.a = 1.0; + return col; +} +ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_Mono8.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_Mono8.shader.meta new file mode 100644 index 0000000..46b6176 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_RAW_Mono8.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 48acad89159eb1e448777379baab7384 diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Shared.cginc b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Shared.cginc new file mode 100644 index 0000000..bb763ed --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Shared.cginc @@ -0,0 +1,96 @@ + +// BT470 +inline float4 +convertYUV(float y, float u, float v) +{ + float rr = saturate(y + 1.402 * (u - 0.5)); + float gg = saturate(y - 0.344 * (v - 0.5) - 0.714 * (u - 0.5)); + float bb = saturate(y + 1.772 * (v - 0.5)); + return float4(rr, gg, bb, 1.0); +} + +// BT709-limited +inline float4 +convertYUV_BT709_Limited_RGB(float y, float u, float v) +{ + float rr = saturate( 1.164 * (y - (16.0 / 255.0)) + 1.793 * (u - 0.5) ); + float gg = saturate( 1.164 * (y - (16.0 / 255.0)) - 0.534 * (u - 0.5) - 0.213 * (v - 0.5) ); + float bb = saturate( 1.164 * (y - (16.0 / 255.0)) + 2.115 * (v - 0.5) ); + return float4(rr, gg, bb, 1.0); +} + +// BT709-full +inline float4 +convertYUV_BT709_Full_RGB(float y, float u, float v) +{ + float rr = saturate( y + 1.793 * (u - 0.5) ); + float gg = saturate( y - 0.534 * (u - 0.5) - 0.213 * (v - 0.5) ); + float bb = saturate( y + 2.115 * (v - 0.5) ); + return float4(rr, gg, bb, 1.0); +} + +// https://chilliant.blogspot.co.uk/2012/08/srgb-approximations-for-hlsl.html?m=1 +inline float +linearToGammaFloatAccurate(float x) +{ + float result; + if (x <= 0.0031308F) + result = x * 12.92F; + else + result = 1.055F * pow(x, 0.4166667F) - 0.055F; + return result; +} + +inline half3 +linearToGammaAccurate(half3 col) +{ + return half3(linearToGammaFloatAccurate(col.r), linearToGammaFloatAccurate(col.g), linearToGammaFloatAccurate(col.b)); +} + +inline half3 +linearToGammaFast(half3 col) +{ + return max(1.055h * pow(col, 0.416666667h) - 0.055h, 0.h); +} + +inline float +TransferSRGB_GammaToLinearFloat(float x) +{ + if (x <= 0.04045) + x = x / 12.92; + else + x = pow((x + 0.055) / 1.055, 2.4); + return x; +} + +inline float +TransferRec709_LinearToGammaFloat(float x) +{ + if (x < 0.018) + x = x * 4.5; + else + x = (1.099 * pow(x, 0.45)) - 0.099; + return x; +} + +inline float +TransferRec709_GammaToLinearFloat(float x) +{ + if (x < 0.081) + x = x / 4.5; + else + x = pow((x + 0.099) / 1.099, 2.22222222); + return x; +} + +inline float3 +TransferSRGB_GammaToLinear(float3 col) +{ + return float3(TransferSRGB_GammaToLinearFloat(col.r), TransferSRGB_GammaToLinearFloat(col.g), TransferSRGB_GammaToLinearFloat(col.b)); +} + +inline float3 +TransferRec709_GammaToLinear(float3 col) +{ + return float3(TransferRec709_GammaToLinearFloat(col.r), TransferRec709_GammaToLinearFloat(col.g), TransferRec709_GammaToLinearFloat(col.b)); +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Shared.cginc.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Shared.cginc.meta new file mode 100644 index 0000000..62e4993 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_Shared.cginc.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6288fbbb30bbdbd448898996fed3ea37 diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_HDYC2RGBA.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_HDYC2RGBA.shader new file mode 100644 index 0000000..488c27c --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_HDYC2RGBA.shader @@ -0,0 +1,107 @@ +Shader "Hidden/AVProLiveCamera/CompositeHDYC_2_RGBA" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _TextureWidth ("Texure Width", Float) = 256.0 + _TextureScaleOffset ("Texure Scale Offset", Vector) = (1.0, 1.0, 0.0, 0.0) + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + +CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF +#pragma multi_compile HORIZONTAL_FLIP_ON HORIZONTAL_FLIP_OFF +#pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF +#pragma multi_compile YCBCR_RANGE_LIMITED YCBCR_RANGE_FULL +#include "UnityCG.cginc" +#include "AVProLiveCamera_Shared.cginc" + +uniform sampler2D _MainTex; +uniform float4 _MainTex_TexelSize; +uniform float _TextureWidth; +uniform float4 _TextureScaleOffset; + +struct v2f { + float4 pos : POSITION; + float3 uv : TEXCOORD0; +}; + +v2f vert( appdata_img v ) +{ + v2f o; + o.pos = UnityObjectToClipPos (v.vertex); + o.uv.xy = (v.texcoord.xy * _TextureScaleOffset.xy + _TextureScaleOffset.zw); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + o.uv.z = v.vertex.x * _TextureWidth * 0.5; + + return o; +} + +float4 frag (v2f i) : COLOR +{ + float4 col = tex2D(_MainTex, i.uv.xy); +#if defined(SWAP_RED_BLUE_ON) + col = col.bgra; +#endif + +#if defined(HORIZONTAL_FLIP_ON) + col = col.bgra; +#endif + + //uyvy + float y = col.y; + float u = col.x; + float v = col.z; + + if (frac(i.uv.z) > 0.5 ) + { + // ODD PIXELS + y = col.w; + + /*float4 col2 = tex2D(_MainTex, i.uv.xy + float2(_MainTex_TexelSize.x, 0.0)); +#if defined(SWAP_RED_BLUE_ON) + col2 = col2.bgra; +#endif + u = (col.x + col2.x) * 0.5; + v = (col.z + col2.z) * 0.5;*/ + } + +#if defined(YCBCR_RANGE_LIMITED) + float4 oCol = convertYUV_BT709_Limited_RGB(y, u, v); +#else + float4 oCol = convertYUV_BT709_Full_RGB(y, u, v); +#endif + +#if defined(AVPRO_GAMMACORRECTION) + oCol.rgb = TransferSRGB_GammaToLinear(oCol.rgb); +#endif + + return float4(oCol.rgb, 1.0); +} +ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_HDYC2RGBA.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_HDYC2RGBA.shader.meta new file mode 100644 index 0000000..deb632f --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_HDYC2RGBA.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: d15eca7ae06474249b354472a6bf9265 diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_I420.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_I420.shader new file mode 100644 index 0000000..6541d2f --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_I420.shader @@ -0,0 +1,137 @@ +Shader "Hidden/AVProLiveCamera/CompositeYUV_I420" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _MainU ("Base (RGB)", 2D) = "white" {} + _MainV ("Base (RGB)", 2D) = "white" {} + _TextureWidth ("Texure Width", Float) = 256.0 + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + +CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF +#pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF +#pragma multi_compile YCBCR_RANGE_LIMITED YCBCR_RANGE_FULL +#include "UnityCG.cginc" +#include "AVProLiveCamera_Shared.cginc" + +uniform sampler2D _MainTex; +uniform sampler2D _MainU; +uniform sampler2D _MainV; +float _TextureWidth; +float4 _MainTex_ST; +float4 _MainU_ST; +float4 _MainTex_TexelSize; + +struct myappdata { + float4 vertex : POSITION; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; +}; + +struct v2f { + float4 pos : SV_POSITION; + float3 uv : TEXCOORD0; + float2 uv2 : TEXCOORD1; +}; + +v2f vert( myappdata v ) +{ + v2f o; + o.pos = UnityObjectToClipPos(v.vertex); + o.uv.xy = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uv2.xy = TRANSFORM_TEX(v.texcoord1, _MainU); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + o.uv.z = (v.vertex.x * _TextureWidth * 0.2); + + return o; +} + +float4 frag (v2f i) : COLOR +{ + float4 lumaPacked = tex2D(_MainTex, i.uv); +#if defined(SWAP_RED_BLUE_ON) + //lumaPacked = lumaPacked.bgra; +#endif + + float f = (i.uv.x * _TextureWidth * 0.25); + float fr = frac(f); + float y = lumaPacked.r; + if (fr >= 0.25) + y = lumaPacked.g; + if (fr >= 0.5) + y = lumaPacked.b; + if (fr >= 0.75) + y = lumaPacked.a; + + float4 uPacked = tex2D(_MainU, i.uv2); + float4 vPacked = tex2D(_MainV, i.uv2); +#if defined(SWAP_RED_BLUE_ON) + //uPacked = uPacked.bgra; + //vPacked = vPacked.bgra; +#endif + + fr = frac(i.uv.x * _TextureWidth * 0.25 * 0.5); + float u = uPacked.r; + float v = vPacked.r; + if (fr >= 0.25) + { + u = uPacked.g; + v = vPacked.g; + } + if (fr >= 0.5) + { + u = uPacked.b; + v = vPacked.b; + } + if (fr >= 0.75) + { + u = uPacked.a; + v = vPacked.a; + } + +#if defined(YCBCR_RANGE_LIMITED) + float4 oCol = convertYUV_BT709_Limited_RGB(y, u, v); +#else + float4 oCol = convertYUV_BT709_Full_RGB(y, u, v); +#endif + +#if defined(SWAP_RED_BLUE_ON) + oCol = oCol.bgra; +#endif + +#if defined(AVPRO_GAMMACORRECTION) + oCol.rgb = TransferSRGB_GammaToLinear(oCol.rgb); +#endif + + return oCol; +} + +ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_I420.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_I420.shader.meta new file mode 100644 index 0000000..45d7448 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_I420.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3e319fd1d6f9b4a47b871fb185c665e7 diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_UYVY2RGBA.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_UYVY2RGBA.shader new file mode 100644 index 0000000..c75a2d2 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_UYVY2RGBA.shader @@ -0,0 +1,107 @@ +Shader "Hidden/AVProLiveCamera/CompositeUYVY_2_RGBA" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _TextureWidth ("Texure Width", Float) = 256.0 + _TextureScaleOffset ("Texure Scale Offset", Vector) = (1.0, 1.0, 0.0, 0.0) + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + +CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF +#pragma multi_compile HORIZONTAL_FLIP_ON HORIZONTAL_FLIP_OFF +#pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF +#pragma multi_compile YCBCR_RANGE_LIMITED YCBCR_RANGE_FULL +#include "UnityCG.cginc" +#include "AVProLiveCamera_Shared.cginc" + +uniform sampler2D _MainTex; +uniform float _TextureWidth; +uniform float4 _TextureScaleOffset; +uniform float4 _MainTex_TexelSize; + +struct v2f { + float4 pos : POSITION; + float3 uv : TEXCOORD0; +}; + +v2f vert( appdata_img v ) +{ + v2f o; + o.pos = UnityObjectToClipPos (v.vertex); + o.uv.xy = (v.texcoord.xy * _TextureScaleOffset.xy + _TextureScaleOffset.zw); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + o.uv.z = v.vertex.x * _TextureWidth * 0.5; + + return o; +} + +float4 frag (v2f i) : COLOR +{ + float4 col = tex2D(_MainTex, i.uv.xy); +#if defined(SWAP_RED_BLUE_ON) + col = col.bgra; +#endif + +#if defined(HORIZONTAL_FLIP_ON) + col = col.bgra; +#endif + + //uyvy + float y = col.w; + float u = col.x; + float v = col.z; + + if (frac(i.uv.z) < 0.5 ) + { + // ODD PIXELS + y = col.y; + + /*float4 col2 = tex2D(_MainTex, i.uv.xy + float2(_MainTex_TexelSize.x, 0.0)); +#if defined(SWAP_RED_BLUE_ON) + col2 = col2.bgra; +#endif + u = (col.x + col2.x) * 0.5; + v = (col.z + col2.z) * 0.5;*/ + } + +#if defined(YCBCR_RANGE_LIMITED) + float4 oCol = convertYUV_BT709_Limited_RGB(y, u, v); +#else + float4 oCol = convertYUV_BT709_Full_RGB(y, u, v); +#endif + +#if defined(AVPRO_GAMMACORRECTION) + oCol.rgb = TransferSRGB_GammaToLinear(oCol.rgb); +#endif + + return float4(oCol.rgb, 1); +} +ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_UYVY2RGBA.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_UYVY2RGBA.shader.meta new file mode 100644 index 0000000..53cfa40 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_UYVY2RGBA.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: cae66dddac87aba4d8af6f0f8829133b diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YUY22RGBA.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YUY22RGBA.shader new file mode 100644 index 0000000..94870aa --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YUY22RGBA.shader @@ -0,0 +1,109 @@ +Shader "Hidden/AVProLiveCamera/CompositeYUY2_2_RGBA" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _TextureWidth ("Texure Width", Float) = 256.0 + _TextureScaleOffset ("Texure Scale Offset", Vector) = (1.0, 1.0, 0.0, 0.0) + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + +CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF +#pragma multi_compile HORIZONTAL_FLIP_ON HORIZONTAL_FLIP_OFF +#pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF +#pragma multi_compile YCBCR_RANGE_LIMITED YCBCR_RANGE_FULL +#include "UnityCG.cginc" +#include "AVProLiveCamera_Shared.cginc" + +uniform sampler2D _MainTex; +uniform float _TextureWidth; +uniform float4 _TextureScaleOffset; +uniform float4 _MainTex_TexelSize; + +struct v2f { + float4 pos : POSITION; + float3 uv : TEXCOORD0; +}; + +v2f vert( appdata_img v ) +{ + v2f o; + o.pos = UnityObjectToClipPos (v.vertex); + o.uv.xy = (v.texcoord.xy * _TextureScaleOffset.xy + _TextureScaleOffset.zw); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + o.uv.z = v.vertex.x * _TextureWidth * 0.5; + + return o; +} + +float4 frag (v2f i) : COLOR +{ + float4 col = tex2D(_MainTex, i.uv.xy); + +#if defined(SWAP_RED_BLUE_ON) + col = col.bgra; +#endif + +#if defined(HORIZONTAL_FLIP_ON) + col = col.bgra; +#endif + + //yuyv + float y = col.z; + float u = col.w; + float v = col.y; + + if (frac(i.uv.z) > 0.5 ) + { + // ODD PIXELS + y = col.x; + + /*float4 col2 = tex2D(_MainTex, i.uv.xy + float2(_MainTex_TexelSize.x, 0.0)); +#if defined(SWAP_RED_BLUE_ON) + col2 = col2.bgra; +#endif + u = (col.y + col2.y) * 0.5; + v = (col.w + col2.w) * 0.5;*/ + } + +#if defined(YCBCR_RANGE_LIMITED) + float4 oCol = convertYUV_BT709_Limited_RGB(y, u, v); +#else + float4 oCol = convertYUV_BT709_Full_RGB(y, u, v); +#endif + +#if defined(AVPRO_GAMMACORRECTION) + oCol.rgb = TransferSRGB_GammaToLinear(oCol.rgb); +#endif + + return float4(oCol.rgb, 1.0); +} + +ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YUY22RGBA.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YUY22RGBA.shader.meta new file mode 100644 index 0000000..af6fabd --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YUY22RGBA.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: d1ab837474c2da44594e57fab5f4d831 diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YV12.shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YV12.shader new file mode 100644 index 0000000..3682b03 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YV12.shader @@ -0,0 +1,125 @@ +Shader "Hidden/AVProLiveCamera/CompositeYUV_YV12" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _MainU ("Base (RGB)", 2D) = "white" {} + _MainV ("Base (RGB)", 2D) = "white" {} + _TextureWidth ("Texure Width", Float) = 256.0 + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + +CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF +#pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF +#pragma multi_compile YCBCR_RANGE_LIMITED YCBCR_RANGE_FULL +#include "UnityCG.cginc" +#include "AVProLiveCamera_Shared.cginc" + +uniform sampler2D _MainTex; +uniform sampler2D _MainU; +uniform sampler2D _MainV; +float _TextureWidth; +float4 _MainTex_ST; +float4 _MainU_ST; +float4 _MainTex_TexelSize; + +struct myappdata { + float4 vertex : POSITION; + float4 texcoord : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; +}; + +struct v2f { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + float2 uv2 : TEXCOORD1; +}; + +v2f vert( myappdata v ) +{ + v2f o; + o.pos = UnityObjectToClipPos(v.vertex); + o.uv.xy = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uv2.xy = TRANSFORM_TEX(v.texcoord1, _MainU); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + + return o; +} + +float4 frag (v2f i) : COLOR +{ + float4 lumaPacked = tex2D(_MainTex, i.uv); + + float f = (i.uv.x * _TextureWidth); + float fr = frac(f); + float y = lumaPacked.r; + if (fr >= 0.25) + y = lumaPacked.g; + if (fr >= 0.5) + y = lumaPacked.b; + if (fr >= 0.75) + y = lumaPacked.a; + + float4 uPacked = tex2D(_MainU, i.uv2); + float4 vPacked = tex2D(_MainV, i.uv2); + + fr = frac(i.uv.x * _TextureWidth / 2); + float u = uPacked.r; + float v = vPacked.r; + if (fr >= 0.25) + { + u = uPacked.g; + v = vPacked.g; + } + if (fr >= 0.5) + { + u = uPacked.b; + v = vPacked.b; + } + if (fr >= 0.75) + { + u = uPacked.a; + v = vPacked.a; + } + +#if defined(YCBCR_RANGE_LIMITED) + float4 oCol = convertYUV_BT709_Limited_RGB(y, u, v); +#else + float4 oCol = convertYUV_BT709_Full_RGB(y, u, v); +#endif + +#if defined(AVPRO_GAMMACORRECTION) + oCol.rgb = TransferSRGB_GammaToLinear(oCol.rgb); +#endif + + return oCol; +} + +ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YV12.shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YV12.shader.meta new file mode 100644 index 0000000..3e9d7df --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YV12.shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 04afacd8ed181b341910528e6b31102a diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YVYU2RGBA .shader b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YVYU2RGBA .shader new file mode 100644 index 0000000..65052ee --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YVYU2RGBA .shader @@ -0,0 +1,108 @@ +Shader "Hidden/AVProLiveCamera/CompositeYVYU_2_RGBA" +{ + Properties + { + _MainTex ("Base (RGB)", 2D) = "white" {} + _TextureWidth ("Texure Width", Float) = 256.0 + _TextureScaleOffset ("Texure Scale Offset", Vector) = (1.0, 1.0, 0.0, 0.0) + } + SubShader + { + Pass + { + ZTest Always Cull Off ZWrite Off + Fog { Mode off } + +CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma exclude_renderers flash xbox360 ps3 gles +//#pragma fragmentoption ARB_precision_hint_fastest +#pragma fragmentoption ARB_precision_hint_nicest +#pragma multi_compile SWAP_RED_BLUE_ON SWAP_RED_BLUE_OFF +#pragma multi_compile HORIZONTAL_FLIP_ON HORIZONTAL_FLIP_OFF +#pragma multi_compile AVPRO_GAMMACORRECTION AVPRO_GAMMACORRECTION_OFF +#pragma multi_compile YCBCR_RANGE_LIMITED YCBCR_RANGE_FULL +#include "UnityCG.cginc" +#include "AVProLiveCamera_Shared.cginc" + +uniform sampler2D _MainTex; +uniform float _TextureWidth; +uniform float4 _TextureScaleOffset; +uniform float4 _MainTex_TexelSize; + +struct v2f { + float4 pos : POSITION; + float3 uv : TEXCOORD0; +}; + +v2f vert( appdata_img v ) +{ + v2f o; + o.pos = UnityObjectToClipPos (v.vertex); + + o.uv.xy = (v.texcoord.xy * _TextureScaleOffset.xy + _TextureScaleOffset.zw); + + // On D3D when AA is used, the main texture & scene depth texture + // will come out in different vertical orientations. + // So flip sampling of the texture when that is the case (main texture + // texel size will have negative Y). + #if SHADER_API_D3D9 + if (_MainTex_TexelSize.y < 0) + { + o.uv.y = 1-o.uv.y; + } + #endif + + o.uv.z = v.vertex.x * _TextureWidth * 0.5; + + return o; +} + +float4 frag (v2f i) : COLOR +{ + float4 col = tex2D(_MainTex, i.uv.xy); +#if defined(SWAP_RED_BLUE_ON) + col = col.bgra; +#endif + +#if defined(HORIZONTAL_FLIP_ON) + col = col.bgra; +#endif + + //uyvy + float y = col.z; + float u = col.w; + float v = col.y; + + if (frac(i.uv.z) > 0.5 ) + { + // ODD PIXELS + y = col.x; + + /*float4 col2 = tex2D(_MainTex, i.uv.xy + float2(_MainTex_TexelSize.x, 0.0)); +#if defined(SWAP_RED_BLUE_ON) + col2 = col2.bgra; +#endif + u = (col.w + col2.w) * 0.5; + v = (col.y + col2.y) * 0.5;*/ + } + +#if defined(YCBCR_RANGE_LIMITED) + float4 oCol = convertYUV_BT709_Limited_RGB(y, v, u); +#else + float4 oCol = convertYUV_BT709_Full_RGB(y, v, u); +#endif + +#if defined(AVPRO_GAMMACORRECTION) + oCol.rgb = TransferSRGB_GammaToLinear(oCol.rgb); +#endif + + return float4(oCol.rgb, 1); +} +ENDCG + } + } + + FallBack Off +} \ No newline at end of file diff --git a/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YVYU2RGBA .shader.meta b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YVYU2RGBA .shader.meta new file mode 100644 index 0000000..f0ef9fb --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/AVProLiveCamera_YUV_YVYU2RGBA .shader.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 1 +guid: add9070511111234fb8d9e7048c60b5c diff --git a/Assets/AVProLiveCamera/Shaders/FillBackground.shader b/Assets/AVProLiveCamera/Shaders/FillBackground.shader new file mode 100644 index 0000000..bb2a2fb --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/FillBackground.shader @@ -0,0 +1,75 @@ +Shader "AVProLiveCamera/FillBackground" +{ + Properties + { + _MainTex ("Texture", 2D) = "black" {} + } + SubShader + { + Tags { "RenderType"="Opaque" "Queue"="Background" } + LOD 100 + Cull Off + ZWrite Off + ZTest Always + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct v2f + { + float4 vertex : SV_POSITION; + float2 uv : TEXCOORD0; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + float4 _MainTex_TexelSize; + + float2 ScaleZoomToFit(float targetWidth, float targetHeight, float sourceWidth, float sourceHeight) + { + float targetAspect = targetHeight / targetWidth; + float sourceAspect = sourceHeight / sourceWidth; + float2 scale = float2(1.0, sourceAspect / targetAspect); + if (targetAspect < sourceAspect) + { + scale = float2(targetAspect / sourceAspect, 1.0); + } + return scale; + } + + v2f vert (appdata_img v) + { + v2f o; + + float2 scale = ScaleZoomToFit(_ScreenParams.x, _ScreenParams.y, _MainTex_TexelSize.z, _MainTex_TexelSize.w); + float2 pos = ((v.vertex.xy) * scale * 2.0); + + // we're rendering with upside-down flipped projection, + // so flip the vertical UV coordinate too + if (_ProjectionParams.x < 0) + { + pos.y = (1 - pos.y) - 1; + } + + o.vertex = float4(pos, UNITY_NEAR_CLIP_VALUE, 1); + + o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + // Sample the texture + fixed4 col = tex2D(_MainTex, i.uv); + return col; + } + ENDCG + } + } +} diff --git a/Assets/AVProLiveCamera/Shaders/FillBackground.shader.meta b/Assets/AVProLiveCamera/Shaders/FillBackground.shader.meta new file mode 100644 index 0000000..a5aff00 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/FillBackground.shader.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 14851b8a808c53b49bb32085e4dc0f75 +ShaderImporter: + defaultTextures: [] + userData: diff --git a/Assets/AVProLiveCamera/Shaders/FillBackground_Transparent.shader b/Assets/AVProLiveCamera/Shaders/FillBackground_Transparent.shader new file mode 100644 index 0000000..185aab7 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/FillBackground_Transparent.shader @@ -0,0 +1,76 @@ +Shader "AVProLiveCamera/FillBackground Transparent" +{ + Properties + { + _MainTex ("Texture", 2D) = "black" {} + } + SubShader + { + Tags { "RenderType"="Transparent" "Queue"="Transparent" } + LOD 100 + Cull Off + ZWrite Off + ZTest Always + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct v2f + { + float4 vertex : SV_POSITION; + float2 uv : TEXCOORD0; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + float4 _MainTex_TexelSize; + + float2 ScaleZoomToFit(float targetWidth, float targetHeight, float sourceWidth, float sourceHeight) + { + float targetAspect = targetHeight / targetWidth; + float sourceAspect = sourceHeight / sourceWidth; + float2 scale = float2(1.0, sourceAspect / targetAspect); + if (targetAspect < sourceAspect) + { + scale = float2(targetAspect / sourceAspect, 1.0); + } + return scale; + } + + v2f vert (appdata_img v) + { + v2f o; + + float2 scale = ScaleZoomToFit(_ScreenParams.x, _ScreenParams.y, _MainTex_TexelSize.z, _MainTex_TexelSize.w); + float2 pos = ((v.vertex.xy) * scale * 2.0); + + // we're rendering with upside-down flipped projection, + // so flip the vertical UV coordinate too + if (_ProjectionParams.x < 0) + { + pos.y = (1 - pos.y) - 1; + } + + o.vertex = float4(pos, UNITY_NEAR_CLIP_VALUE, 1); + + o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + // Sample the texture + fixed4 col = tex2D(_MainTex, i.uv); + return col; + } + ENDCG + } + } +} diff --git a/Assets/AVProLiveCamera/Shaders/FillBackground_Transparent.shader.meta b/Assets/AVProLiveCamera/Shaders/FillBackground_Transparent.shader.meta new file mode 100644 index 0000000..55a3c49 --- /dev/null +++ b/Assets/AVProLiveCamera/Shaders/FillBackground_Transparent.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8a51f8bce57fbb64e9566c361a1fc252 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86.meta b/Assets/Plugins/x86.meta new file mode 100644 index 0000000..f932539 --- /dev/null +++ b/Assets/Plugins/x86.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1105a9c3e82ba4844a681bd9360f7f07 +DefaultImporter: + userData: diff --git a/Assets/Plugins/x86/AVProLiveCamera.dll b/Assets/Plugins/x86/AVProLiveCamera.dll new file mode 100644 index 0000000..3cba197 Binary files /dev/null and b/Assets/Plugins/x86/AVProLiveCamera.dll differ diff --git a/Assets/Plugins/x86/AVProLiveCamera.dll.meta b/Assets/Plugins/x86/AVProLiveCamera.dll.meta new file mode 100644 index 0000000..b5cd94a --- /dev/null +++ b/Assets/Plugins/x86/AVProLiveCamera.dll.meta @@ -0,0 +1,78 @@ +fileFormatVersion: 2 +guid: 1133c571e02493b4881a6eb99fd14406 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: Windows + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 1 + settings: + CPU: None + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 1 + settings: + CPU: None + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: None + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86_64.meta b/Assets/Plugins/x86_64.meta new file mode 100644 index 0000000..33f6ee2 --- /dev/null +++ b/Assets/Plugins/x86_64.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a912dd31b3769d54d9462f50728fbc2b +DefaultImporter: + userData: diff --git a/Assets/Plugins/x86_64/AVProLiveCamera.dll b/Assets/Plugins/x86_64/AVProLiveCamera.dll new file mode 100644 index 0000000..a02c26e Binary files /dev/null and b/Assets/Plugins/x86_64/AVProLiveCamera.dll differ diff --git a/Assets/Plugins/x86_64/AVProLiveCamera.dll.meta b/Assets/Plugins/x86_64/AVProLiveCamera.dll.meta new file mode 100644 index 0000000..d72eeb7 --- /dev/null +++ b/Assets/Plugins/x86_64/AVProLiveCamera.dll.meta @@ -0,0 +1,78 @@ +fileFormatVersion: 2 +guid: 712727eb65883d842a1b89bf41026e48 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + Linux: + enabled: 1 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: None + OSXIntel64: + enabled: 1 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 1 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/daoNiaoShu/ExcelData/Excel/BaseData.xlsx b/Assets/Resources/daoNiaoShu/ExcelData/Excel/BaseData.xlsx index b508890..e60c148 100644 Binary files a/Assets/Resources/daoNiaoShu/ExcelData/Excel/BaseData.xlsx and b/Assets/Resources/daoNiaoShu/ExcelData/Excel/BaseData.xlsx differ diff --git a/Assets/Resources/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json b/Assets/Resources/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json index d707197..5ae62bb 100644 --- a/Assets/Resources/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json +++ b/Assets/Resources/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json @@ -1 +1 @@ -[{"id":1,"parentName":"病例","name":"病例","owner":"1","txt":"5岁雄性拉布拉多,体重35kg,因持续18小时无法自主排尿就诊。患犬频繁呈现排尿姿势但无尿液排出,伴腹部进行性膨隆、食欲废绝及精神沉郁。临床检查示:膀胱高度充盈(触诊直径>12cm,叩诊浊音),DR显示膀胱过度充盈,未见高密度阴影,床旁超声确认急性膀胱扩张(14×8 cm),未见腔内沉积物或结石。诊断为急性尿潴留后,立即静脉给予布托:0.02ml/Kg镇痛,丙泊酚4-6mg/Kg(1mg=0.1ml)+多咪静(0.01-0.02ml/Kg)进行诱导麻醉,经无菌操作置入10Fr硅胶导尿管导尿。","sound":"daoNiaoShu/Sounds/配音1","obj":"","state":"BingLiState","score_kh":"6","score":"","score_sx":"","type":""},{"id":2,"parentName":"知识回顾","name":"知识回顾","owner":"1","txt":"","sound":"","obj":"","state":"ZhiShiHuiGuState","score_kh":"","score":"","score_sx":"","type":""},{"id":3,"parentName":"操作前准备","name":"解释","owner":"1","txt":"打字输入/语音输入“先生,您好。一会需要给您的宠物实施导尿术,最主要目的是建立一个将尿液排出的通道,解除它膀胱过度膨胀的危险。我们已经给您的宠物进行了深度镇静和镇痛,您别太担心。我们会尽量轻一点。”","sound":"daoNiaoShu/Sounds/配音2","obj":"男护士文字位置|女助手文字位置","state":"JieShiState","score_kh":"5","score":"","score_sx":"5","type":"人文关怀"},{"id":4,"parentName":"操作前准备","name":"物品准备","owner":"1","txt":"","sound":"","obj":"","state":"WuPinZhunBeiState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":5,"parentName":"操作前准备","name":"医生准备","owner":"1","txt":"","sound":"","obj":"","state":"YiShengZhunBeiState","score_kh":"5","score":"","score_sx":"5","type":"无菌观念"},{"id":6,"parentName":"操作前准备","name":"患犬准备","owner":"1","txt":"用电推剪小心剃除包皮口周围的长毛,范围约直径5-10cm,以充分暴露清洁区域。去除碎毛。","sound":"daoNiaoShu/Sounds/配音3","obj":"","state":"HuanQuanZhunBeiState","score_kh":"","score":"","score_sx":"","type":""},{"id":7,"parentName":"操作前准备","name":"铺巾","owner":"1","txt":"点击高亮一次性医用垫单。","sound":"daoNiaoShu/Sounds/配音4","obj":"医用垫单","state":"PuJinState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":8,"parentName":"操作前准备","name":"体位","owner":"1","txt":"打字输入/语音输入“请助手将宠物犬体位摆放为右侧卧位。”","sound":"daoNiaoShu/Sounds/配音5","obj":"","state":"TiWeiState","score_kh":"5","score":"","score_sx":"5","type":"基础操作"},{"id":9,"parentName":"操作前准备","name":"戴无菌手套","owner":"1","txt":"","sound":"","obj":"","state":"DaiWuJunShouTaoState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":10,"parentName":"操作前准备","name":"清理生殖器","owner":"1","txt":"请助手轻柔地将包皮向后(向犬只腹部方向)推,使龟头部分暴露。","sound":"daoNiaoShu/Sounds/配音6","obj":"","state":"QingLiShengZhiQiState","score_kh":"","score":"","score_sx":"","type":""},{"id":11,"parentName":"操作前准备","name":"冲洗包皮腔","owner":"1","txt":"点击高亮20ml生理盐水。|将20ml生理盐水推入包皮腔内冲洗污物,冲洗完毕后,将注射器放置于弯盘内。","sound":"daoNiaoShu/Sounds/配音7|daoNiaoShu/Sounds/配音8","obj":"20ml注射器|20ml注射器放置后","state":"ChongXiBaoPiQiangState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":12,"parentName":"操作前准备","name":"清洁包皮口及周围皮肤","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁包皮口及其外围约5-10cm半径范围内的皮肤。","sound":"daoNiaoShu/Sounds/配音10|daoNiaoShu/Sounds/配音11","obj":"氯己定棉球|手拿镊子消毒","state":"QingJieBaoPiKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":13,"parentName":"操作前准备","name":"清洁尿道口","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁尿道口、龟头。","sound":"daoNiaoShu/Sounds/配音12|daoNiaoShu/Sounds/配音13","obj":"","state":"QingJieNiaoDaoKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":14,"parentName":"操作前准备","name":"涂抹利多卡因","owner":"1","txt":"点击高亮利多卡因凝胶。","sound":"daoNiaoShu/Sounds/配音14","obj":"利多卡因凝胶","state":"TuMoLiDuoKaYinState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":15,"parentName":"操作前准备","name":"更换无菌手套","owner":"1","txt":"","sound":"","obj":"治疗盘中手套","state":"GengHuanWuJunShouTaoState","score_kh":"","score":"","score_sx":"","type":""},{"id":16,"parentName":"测量导尿管","name":"打开导尿管","owner":"1","txt":"","sound":"","obj":"打开导尿管后","state":"DaKaiDaoNiaoGuanState","score_kh":"","score":"","score_sx":"","type":""},{"id":17,"parentName":"测量导尿管","name":"取出导尿管","owner":"1","txt":"点击高亮一次性导尿管。","sound":"daoNiaoShu/Sounds/配音15","obj":"导尿管","state":"QuChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":18,"parentName":"测量导尿管","name":"测量方法","owner":"1","txt":"体外测量预估法:起点为尿道口,终点为坐骨结节。|点击高亮尿道口。|点击高亮坐骨结节。","sound":"daoNiaoShu/Sounds/配音16|daoNiaoShu/Sounds/配音17|daoNiaoShu/Sounds/配音18","obj":"","state":"CeLiangFangFaState","score_kh":"9","score":"","score_sx":"10","type":"技能重点"},{"id":19,"parentName":"插入导尿管","name":"连接集尿袋","owner":"1","txt":"用实物,将导尿管末端与集尿袋连接。","sound":"daoNiaoShu/Sounds/配音19","obj":"连接集尿袋","state":"LianJieJiNiaoDaiState","score_kh":"2","score":"","score_sx":"2","type":"基础操作"},{"id":20,"parentName":"插入导尿管","name":"涂抹抗生素软膏","owner":"1","txt":"点击高亮抗生素软膏。","sound":"daoNiaoShu/Sounds/配音20","obj":"抗生素软膏","state":"TuMoKangShengSuRuanGaoState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":21,"parentName":"插入导尿管","name":"暴露阴茎","owner":"1","txt":"打字输入/语音输入“请助手继续将包皮向后推压,暴露阴茎2-5cm。”","sound":"daoNiaoShu/Sounds/配音21","obj":"","state":"BaoLuYinJingState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":22,"parentName":"插入导尿管","name":"插管","owner":"1","txt":"按箭头指示,将导尿管从尿道口插入膀胱,将尿液引流出来。","sound":"daoNiaoShu/Sounds/配音22","obj":"","state":"ChaGuanState","score_kh":"13","score":"","score_sx":"10","type":"技能重点"},{"id":23,"parentName":"拔出导尿管","name":"拔出导尿管","owner":"1","txt":"待尿液全部流出后,将导尿管缓慢拔除。","sound":"daoNiaoShu/Sounds/配音23","obj":"","state":"BaChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"5","type":"技能重点"},{"id":24,"parentName":"操作后处理","name":"整理用物","owner":"1","txt":"","sound":"","obj":"","state":"ZhengLiYongWuState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":25,"parentName":"操作后处理","name":"医生洗手","owner":"1","txt":"","sound":"","obj":"","state":"YiShengXiShouState","score_kh":"2","score":"","score_sx":"2","type":"无菌观念"},{"id":26,"parentName":"操作后处理","name":"操作后嘱咐","owner":"1","txt":"打字输入/语音输入“先生,您好。已经将患宠膀胱内潴留的尿液通过导尿管已经引流出来了,下一步需要查找导致急性尿潴留的病因,然后再对因治疗。”","sound":"daoNiaoShu/Sounds/配音24","obj":"","state":"CaoZuoHouZhuFuState","score_kh":"2","score":"","score_sx":"5","type":"临床思维"}] +[{"id":1,"parentName":"病例","name":"病例","owner":"1","txt":"5岁雄性拉布拉多,体重35kg,因持续18小时无法自主排尿就诊。患犬频繁呈现排尿姿势但无尿液排出,伴腹部进行性膨隆、食欲废绝及精神沉郁。临床检查示:膀胱高度充盈(触诊直径>12cm,叩诊浊音),DR显示膀胱过度充盈,未见高密度阴影,床旁超声确认急性膀胱扩张(14×8 cm),未见腔内沉积物或结石。诊断为急性尿潴留后,立即静脉给予布托:0.02ml/Kg镇痛,丙泊酚4-6mg/Kg(1mg=0.1ml)+多咪静(0.01-0.02ml/Kg)进行诱导麻醉,经无菌操作置入10Fr硅胶导尿管导尿。","sound":"daoNiaoShu/Sounds/配音1","obj":"","state":"BingLiState","score_kh":"6","score":"","score_sx":"","type":""},{"id":2,"parentName":"知识回顾","name":"知识回顾","owner":"1","txt":"","sound":"","obj":"","state":"ZhiShiHuiGuState","score_kh":"","score":"","score_sx":"","type":""},{"id":3,"parentName":"操作前准备","name":"解释","owner":"1","txt":"打字输入/语音输入“先生,您好。一会需要给您的宠物实施导尿术,最主要目的是建立一个将尿液排出的通道,解除它膀胱过度膨胀的危险。我们已经给您的宠物进行了深度镇静和镇痛,您别太担心。我们会尽量轻一点。”","sound":"daoNiaoShu/Sounds/配音2","obj":"男护士文字位置|女助手文字位置","state":"JieShiState","score_kh":"5","score":"","score_sx":"5","type":"人文关怀"},{"id":4,"parentName":"操作前准备","name":"物品准备","owner":"1","txt":"","sound":"","obj":"","state":"WuPinZhunBeiState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":5,"parentName":"操作前准备","name":"医生准备","owner":"1","txt":"","sound":"","obj":"","state":"YiShengZhunBeiState","score_kh":"5","score":"","score_sx":"5","type":"无菌观念"},{"id":6,"parentName":"操作前准备","name":"患犬准备","owner":"1","txt":"用电推剪小心剃除包皮口周围的长毛,范围约直径5-10cm,以充分暴露清洁区域。去除碎毛。","sound":"daoNiaoShu/Sounds/配音3","obj":"","state":"HuanQuanZhunBeiState","score_kh":"","score":"","score_sx":"","type":""},{"id":7,"parentName":"操作前准备","name":"铺巾","owner":"1","txt":"点击高亮一次性医用垫单。","sound":"daoNiaoShu/Sounds/配音4","obj":"医用垫单","state":"PuJinState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":8,"parentName":"操作前准备","name":"体位","owner":"1","txt":"打字输入/语音输入“请助手将宠物犬体位摆放为右侧卧位。”","sound":"daoNiaoShu/Sounds/配音5","obj":"","state":"TiWeiState","score_kh":"5","score":"","score_sx":"5","type":"基础操作"},{"id":9,"parentName":"操作前准备","name":"戴无菌手套","owner":"1","txt":"","sound":"","obj":"","state":"DaiWuJunShouTaoState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":10,"parentName":"操作前准备","name":"清理生殖器","owner":"1","txt":"请助手轻柔地将包皮向后(向犬只腹部方向)推,使龟头部分暴露。","sound":"daoNiaoShu/Sounds/配音6","obj":"","state":"QingLiShengZhiQiState","score_kh":"","score":"","score_sx":"","type":""},{"id":11,"parentName":"操作前准备","name":"冲洗包皮腔","owner":"1","txt":"点击高亮含20ml生理盐水的注射器。|请操作实物注射器进行冲洗。","sound":"daoNiaoShu/Sounds/配音7|daoNiaoShu/Sounds/配音8","obj":"20ml注射器|20ml注射器放置后","state":"ChongXiBaoPiQiangState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":12,"parentName":"操作前准备","name":"清洁包皮口及周围皮肤","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁包皮口及其外围约5-10cm半径范围内的皮肤。","sound":"daoNiaoShu/Sounds/配音10|daoNiaoShu/Sounds/配音11","obj":"氯己定棉球|手拿镊子消毒","state":"QingJieBaoPiKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":13,"parentName":"操作前准备","name":"清洁尿道口","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁尿道口、龟头。","sound":"daoNiaoShu/Sounds/配音12|daoNiaoShu/Sounds/配音13","obj":"","state":"QingJieNiaoDaoKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":14,"parentName":"操作前准备","name":"涂抹利多卡因","owner":"1","txt":"点击高亮利多卡因凝胶。","sound":"daoNiaoShu/Sounds/配音14","obj":"利多卡因凝胶","state":"TuMoLiDuoKaYinState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":15,"parentName":"操作前准备","name":"更换无菌手套","owner":"1","txt":"","sound":"","obj":"治疗盘中手套","state":"GengHuanWuJunShouTaoState","score_kh":"","score":"","score_sx":"","type":""},{"id":16,"parentName":"测量导尿管","name":"打开导尿管","owner":"1","txt":"","sound":"","obj":"打开导尿管后","state":"DaKaiDaoNiaoGuanState","score_kh":"","score":"","score_sx":"","type":""},{"id":17,"parentName":"测量导尿管","name":"取出导尿管","owner":"1","txt":"点击高亮一次性导尿管。","sound":"daoNiaoShu/Sounds/配音15","obj":"导尿管","state":"QuChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":18,"parentName":"测量导尿管","name":"测量方法","owner":"1","txt":"体外测量预估法:起点为尿道口,终点为坐骨结节。|点击高亮尿道口。|点击高亮坐骨结节。","sound":"daoNiaoShu/Sounds/配音16|daoNiaoShu/Sounds/配音17|daoNiaoShu/Sounds/配音18","obj":"","state":"CeLiangFangFaState","score_kh":"9","score":"","score_sx":"10","type":"技能重点"},{"id":19,"parentName":"插入导尿管","name":"连接集尿袋","owner":"1","txt":"用实物,将导尿管末端与集尿袋连接。","sound":"daoNiaoShu/Sounds/配音19","obj":"连接集尿袋","state":"LianJieJiNiaoDaiState","score_kh":"2","score":"","score_sx":"2","type":"基础操作"},{"id":20,"parentName":"插入导尿管","name":"涂抹抗生素软膏","owner":"1","txt":"点击高亮抗生素软膏。","sound":"daoNiaoShu/Sounds/配音20","obj":"抗生素软膏","state":"TuMoKangShengSuRuanGaoState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":21,"parentName":"插入导尿管","name":"暴露阴茎","owner":"1","txt":"打字输入/语音输入“请助手继续将包皮向后推压,暴露阴茎2-5cm。”","sound":"daoNiaoShu/Sounds/配音21","obj":"","state":"BaoLuYinJingState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":22,"parentName":"插入导尿管","name":"插管","owner":"1","txt":"按箭头指示,将导尿管从尿道口插入膀胱,将尿液引流出来。","sound":"daoNiaoShu/Sounds/配音22","obj":"","state":"ChaGuanState","score_kh":"13","score":"","score_sx":"10","type":"技能重点"},{"id":23,"parentName":"拔出导尿管","name":"拔出导尿管","owner":"1","txt":"待尿液全部流出后,将导尿管缓慢拔除。","sound":"daoNiaoShu/Sounds/配音23","obj":"","state":"BaChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"5","type":"技能重点"},{"id":24,"parentName":"操作后处理","name":"整理用物","owner":"1","txt":"","sound":"","obj":"","state":"ZhengLiYongWuState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":25,"parentName":"操作后处理","name":"医生洗手","owner":"1","txt":"","sound":"","obj":"","state":"YiShengXiShouState","score_kh":"2","score":"","score_sx":"2","type":"无菌观念"},{"id":26,"parentName":"操作后处理","name":"操作后嘱咐","owner":"1","txt":"打字输入/语音输入“先生,您好。已经将患宠膀胱内潴留的尿液通过导尿管已经引流出来了,下一步需要查找导致急性尿潴留的病因,然后再对因治疗。”","sound":"daoNiaoShu/Sounds/配音24","obj":"","state":"CaoZuoHouZhuFuState","score_kh":"2","score":"","score_sx":"5","type":"临床思维"}] diff --git a/Assets/StreamingAssets/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json b/Assets/StreamingAssets/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json index d707197..5ae62bb 100644 --- a/Assets/StreamingAssets/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json +++ b/Assets/StreamingAssets/daoNiaoShu/ExcelData/ExcelToJson/BaseData.json @@ -1 +1 @@ -[{"id":1,"parentName":"病例","name":"病例","owner":"1","txt":"5岁雄性拉布拉多,体重35kg,因持续18小时无法自主排尿就诊。患犬频繁呈现排尿姿势但无尿液排出,伴腹部进行性膨隆、食欲废绝及精神沉郁。临床检查示:膀胱高度充盈(触诊直径>12cm,叩诊浊音),DR显示膀胱过度充盈,未见高密度阴影,床旁超声确认急性膀胱扩张(14×8 cm),未见腔内沉积物或结石。诊断为急性尿潴留后,立即静脉给予布托:0.02ml/Kg镇痛,丙泊酚4-6mg/Kg(1mg=0.1ml)+多咪静(0.01-0.02ml/Kg)进行诱导麻醉,经无菌操作置入10Fr硅胶导尿管导尿。","sound":"daoNiaoShu/Sounds/配音1","obj":"","state":"BingLiState","score_kh":"6","score":"","score_sx":"","type":""},{"id":2,"parentName":"知识回顾","name":"知识回顾","owner":"1","txt":"","sound":"","obj":"","state":"ZhiShiHuiGuState","score_kh":"","score":"","score_sx":"","type":""},{"id":3,"parentName":"操作前准备","name":"解释","owner":"1","txt":"打字输入/语音输入“先生,您好。一会需要给您的宠物实施导尿术,最主要目的是建立一个将尿液排出的通道,解除它膀胱过度膨胀的危险。我们已经给您的宠物进行了深度镇静和镇痛,您别太担心。我们会尽量轻一点。”","sound":"daoNiaoShu/Sounds/配音2","obj":"男护士文字位置|女助手文字位置","state":"JieShiState","score_kh":"5","score":"","score_sx":"5","type":"人文关怀"},{"id":4,"parentName":"操作前准备","name":"物品准备","owner":"1","txt":"","sound":"","obj":"","state":"WuPinZhunBeiState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":5,"parentName":"操作前准备","name":"医生准备","owner":"1","txt":"","sound":"","obj":"","state":"YiShengZhunBeiState","score_kh":"5","score":"","score_sx":"5","type":"无菌观念"},{"id":6,"parentName":"操作前准备","name":"患犬准备","owner":"1","txt":"用电推剪小心剃除包皮口周围的长毛,范围约直径5-10cm,以充分暴露清洁区域。去除碎毛。","sound":"daoNiaoShu/Sounds/配音3","obj":"","state":"HuanQuanZhunBeiState","score_kh":"","score":"","score_sx":"","type":""},{"id":7,"parentName":"操作前准备","name":"铺巾","owner":"1","txt":"点击高亮一次性医用垫单。","sound":"daoNiaoShu/Sounds/配音4","obj":"医用垫单","state":"PuJinState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":8,"parentName":"操作前准备","name":"体位","owner":"1","txt":"打字输入/语音输入“请助手将宠物犬体位摆放为右侧卧位。”","sound":"daoNiaoShu/Sounds/配音5","obj":"","state":"TiWeiState","score_kh":"5","score":"","score_sx":"5","type":"基础操作"},{"id":9,"parentName":"操作前准备","name":"戴无菌手套","owner":"1","txt":"","sound":"","obj":"","state":"DaiWuJunShouTaoState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":10,"parentName":"操作前准备","name":"清理生殖器","owner":"1","txt":"请助手轻柔地将包皮向后(向犬只腹部方向)推,使龟头部分暴露。","sound":"daoNiaoShu/Sounds/配音6","obj":"","state":"QingLiShengZhiQiState","score_kh":"","score":"","score_sx":"","type":""},{"id":11,"parentName":"操作前准备","name":"冲洗包皮腔","owner":"1","txt":"点击高亮20ml生理盐水。|将20ml生理盐水推入包皮腔内冲洗污物,冲洗完毕后,将注射器放置于弯盘内。","sound":"daoNiaoShu/Sounds/配音7|daoNiaoShu/Sounds/配音8","obj":"20ml注射器|20ml注射器放置后","state":"ChongXiBaoPiQiangState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":12,"parentName":"操作前准备","name":"清洁包皮口及周围皮肤","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁包皮口及其外围约5-10cm半径范围内的皮肤。","sound":"daoNiaoShu/Sounds/配音10|daoNiaoShu/Sounds/配音11","obj":"氯己定棉球|手拿镊子消毒","state":"QingJieBaoPiKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":13,"parentName":"操作前准备","name":"清洁尿道口","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁尿道口、龟头。","sound":"daoNiaoShu/Sounds/配音12|daoNiaoShu/Sounds/配音13","obj":"","state":"QingJieNiaoDaoKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":14,"parentName":"操作前准备","name":"涂抹利多卡因","owner":"1","txt":"点击高亮利多卡因凝胶。","sound":"daoNiaoShu/Sounds/配音14","obj":"利多卡因凝胶","state":"TuMoLiDuoKaYinState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":15,"parentName":"操作前准备","name":"更换无菌手套","owner":"1","txt":"","sound":"","obj":"治疗盘中手套","state":"GengHuanWuJunShouTaoState","score_kh":"","score":"","score_sx":"","type":""},{"id":16,"parentName":"测量导尿管","name":"打开导尿管","owner":"1","txt":"","sound":"","obj":"打开导尿管后","state":"DaKaiDaoNiaoGuanState","score_kh":"","score":"","score_sx":"","type":""},{"id":17,"parentName":"测量导尿管","name":"取出导尿管","owner":"1","txt":"点击高亮一次性导尿管。","sound":"daoNiaoShu/Sounds/配音15","obj":"导尿管","state":"QuChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":18,"parentName":"测量导尿管","name":"测量方法","owner":"1","txt":"体外测量预估法:起点为尿道口,终点为坐骨结节。|点击高亮尿道口。|点击高亮坐骨结节。","sound":"daoNiaoShu/Sounds/配音16|daoNiaoShu/Sounds/配音17|daoNiaoShu/Sounds/配音18","obj":"","state":"CeLiangFangFaState","score_kh":"9","score":"","score_sx":"10","type":"技能重点"},{"id":19,"parentName":"插入导尿管","name":"连接集尿袋","owner":"1","txt":"用实物,将导尿管末端与集尿袋连接。","sound":"daoNiaoShu/Sounds/配音19","obj":"连接集尿袋","state":"LianJieJiNiaoDaiState","score_kh":"2","score":"","score_sx":"2","type":"基础操作"},{"id":20,"parentName":"插入导尿管","name":"涂抹抗生素软膏","owner":"1","txt":"点击高亮抗生素软膏。","sound":"daoNiaoShu/Sounds/配音20","obj":"抗生素软膏","state":"TuMoKangShengSuRuanGaoState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":21,"parentName":"插入导尿管","name":"暴露阴茎","owner":"1","txt":"打字输入/语音输入“请助手继续将包皮向后推压,暴露阴茎2-5cm。”","sound":"daoNiaoShu/Sounds/配音21","obj":"","state":"BaoLuYinJingState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":22,"parentName":"插入导尿管","name":"插管","owner":"1","txt":"按箭头指示,将导尿管从尿道口插入膀胱,将尿液引流出来。","sound":"daoNiaoShu/Sounds/配音22","obj":"","state":"ChaGuanState","score_kh":"13","score":"","score_sx":"10","type":"技能重点"},{"id":23,"parentName":"拔出导尿管","name":"拔出导尿管","owner":"1","txt":"待尿液全部流出后,将导尿管缓慢拔除。","sound":"daoNiaoShu/Sounds/配音23","obj":"","state":"BaChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"5","type":"技能重点"},{"id":24,"parentName":"操作后处理","name":"整理用物","owner":"1","txt":"","sound":"","obj":"","state":"ZhengLiYongWuState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":25,"parentName":"操作后处理","name":"医生洗手","owner":"1","txt":"","sound":"","obj":"","state":"YiShengXiShouState","score_kh":"2","score":"","score_sx":"2","type":"无菌观念"},{"id":26,"parentName":"操作后处理","name":"操作后嘱咐","owner":"1","txt":"打字输入/语音输入“先生,您好。已经将患宠膀胱内潴留的尿液通过导尿管已经引流出来了,下一步需要查找导致急性尿潴留的病因,然后再对因治疗。”","sound":"daoNiaoShu/Sounds/配音24","obj":"","state":"CaoZuoHouZhuFuState","score_kh":"2","score":"","score_sx":"5","type":"临床思维"}] +[{"id":1,"parentName":"病例","name":"病例","owner":"1","txt":"5岁雄性拉布拉多,体重35kg,因持续18小时无法自主排尿就诊。患犬频繁呈现排尿姿势但无尿液排出,伴腹部进行性膨隆、食欲废绝及精神沉郁。临床检查示:膀胱高度充盈(触诊直径>12cm,叩诊浊音),DR显示膀胱过度充盈,未见高密度阴影,床旁超声确认急性膀胱扩张(14×8 cm),未见腔内沉积物或结石。诊断为急性尿潴留后,立即静脉给予布托:0.02ml/Kg镇痛,丙泊酚4-6mg/Kg(1mg=0.1ml)+多咪静(0.01-0.02ml/Kg)进行诱导麻醉,经无菌操作置入10Fr硅胶导尿管导尿。","sound":"daoNiaoShu/Sounds/配音1","obj":"","state":"BingLiState","score_kh":"6","score":"","score_sx":"","type":""},{"id":2,"parentName":"知识回顾","name":"知识回顾","owner":"1","txt":"","sound":"","obj":"","state":"ZhiShiHuiGuState","score_kh":"","score":"","score_sx":"","type":""},{"id":3,"parentName":"操作前准备","name":"解释","owner":"1","txt":"打字输入/语音输入“先生,您好。一会需要给您的宠物实施导尿术,最主要目的是建立一个将尿液排出的通道,解除它膀胱过度膨胀的危险。我们已经给您的宠物进行了深度镇静和镇痛,您别太担心。我们会尽量轻一点。”","sound":"daoNiaoShu/Sounds/配音2","obj":"男护士文字位置|女助手文字位置","state":"JieShiState","score_kh":"5","score":"","score_sx":"5","type":"人文关怀"},{"id":4,"parentName":"操作前准备","name":"物品准备","owner":"1","txt":"","sound":"","obj":"","state":"WuPinZhunBeiState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":5,"parentName":"操作前准备","name":"医生准备","owner":"1","txt":"","sound":"","obj":"","state":"YiShengZhunBeiState","score_kh":"5","score":"","score_sx":"5","type":"无菌观念"},{"id":6,"parentName":"操作前准备","name":"患犬准备","owner":"1","txt":"用电推剪小心剃除包皮口周围的长毛,范围约直径5-10cm,以充分暴露清洁区域。去除碎毛。","sound":"daoNiaoShu/Sounds/配音3","obj":"","state":"HuanQuanZhunBeiState","score_kh":"","score":"","score_sx":"","type":""},{"id":7,"parentName":"操作前准备","name":"铺巾","owner":"1","txt":"点击高亮一次性医用垫单。","sound":"daoNiaoShu/Sounds/配音4","obj":"医用垫单","state":"PuJinState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":8,"parentName":"操作前准备","name":"体位","owner":"1","txt":"打字输入/语音输入“请助手将宠物犬体位摆放为右侧卧位。”","sound":"daoNiaoShu/Sounds/配音5","obj":"","state":"TiWeiState","score_kh":"5","score":"","score_sx":"5","type":"基础操作"},{"id":9,"parentName":"操作前准备","name":"戴无菌手套","owner":"1","txt":"","sound":"","obj":"","state":"DaiWuJunShouTaoState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":10,"parentName":"操作前准备","name":"清理生殖器","owner":"1","txt":"请助手轻柔地将包皮向后(向犬只腹部方向)推,使龟头部分暴露。","sound":"daoNiaoShu/Sounds/配音6","obj":"","state":"QingLiShengZhiQiState","score_kh":"","score":"","score_sx":"","type":""},{"id":11,"parentName":"操作前准备","name":"冲洗包皮腔","owner":"1","txt":"点击高亮含20ml生理盐水的注射器。|请操作实物注射器进行冲洗。","sound":"daoNiaoShu/Sounds/配音7|daoNiaoShu/Sounds/配音8","obj":"20ml注射器|20ml注射器放置后","state":"ChongXiBaoPiQiangState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":12,"parentName":"操作前准备","name":"清洁包皮口及周围皮肤","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁包皮口及其外围约5-10cm半径范围内的皮肤。","sound":"daoNiaoShu/Sounds/配音10|daoNiaoShu/Sounds/配音11","obj":"氯己定棉球|手拿镊子消毒","state":"QingJieBaoPiKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":13,"parentName":"操作前准备","name":"清洁尿道口","owner":"1","txt":"点击高亮无菌镊、氯己定棉球。|按箭头指示,用实物氯己定棉球,清洁尿道口、龟头。","sound":"daoNiaoShu/Sounds/配音12|daoNiaoShu/Sounds/配音13","obj":"","state":"QingJieNiaoDaoKouState","score_kh":"8","score":"","score_sx":"9","type":"无菌观念"},{"id":14,"parentName":"操作前准备","name":"涂抹利多卡因","owner":"1","txt":"点击高亮利多卡因凝胶。","sound":"daoNiaoShu/Sounds/配音14","obj":"利多卡因凝胶","state":"TuMoLiDuoKaYinState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":15,"parentName":"操作前准备","name":"更换无菌手套","owner":"1","txt":"","sound":"","obj":"治疗盘中手套","state":"GengHuanWuJunShouTaoState","score_kh":"","score":"","score_sx":"","type":""},{"id":16,"parentName":"测量导尿管","name":"打开导尿管","owner":"1","txt":"","sound":"","obj":"打开导尿管后","state":"DaKaiDaoNiaoGuanState","score_kh":"","score":"","score_sx":"","type":""},{"id":17,"parentName":"测量导尿管","name":"取出导尿管","owner":"1","txt":"点击高亮一次性导尿管。","sound":"daoNiaoShu/Sounds/配音15","obj":"导尿管","state":"QuChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"3","type":"无菌观念"},{"id":18,"parentName":"测量导尿管","name":"测量方法","owner":"1","txt":"体外测量预估法:起点为尿道口,终点为坐骨结节。|点击高亮尿道口。|点击高亮坐骨结节。","sound":"daoNiaoShu/Sounds/配音16|daoNiaoShu/Sounds/配音17|daoNiaoShu/Sounds/配音18","obj":"","state":"CeLiangFangFaState","score_kh":"9","score":"","score_sx":"10","type":"技能重点"},{"id":19,"parentName":"插入导尿管","name":"连接集尿袋","owner":"1","txt":"用实物,将导尿管末端与集尿袋连接。","sound":"daoNiaoShu/Sounds/配音19","obj":"连接集尿袋","state":"LianJieJiNiaoDaiState","score_kh":"2","score":"","score_sx":"2","type":"基础操作"},{"id":20,"parentName":"插入导尿管","name":"涂抹抗生素软膏","owner":"1","txt":"点击高亮抗生素软膏。","sound":"daoNiaoShu/Sounds/配音20","obj":"抗生素软膏","state":"TuMoKangShengSuRuanGaoState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":21,"parentName":"插入导尿管","name":"暴露阴茎","owner":"1","txt":"打字输入/语音输入“请助手继续将包皮向后推压,暴露阴茎2-5cm。”","sound":"daoNiaoShu/Sounds/配音21","obj":"","state":"BaoLuYinJingState","score_kh":"3","score":"","score_sx":"3","type":"技能重点"},{"id":22,"parentName":"插入导尿管","name":"插管","owner":"1","txt":"按箭头指示,将导尿管从尿道口插入膀胱,将尿液引流出来。","sound":"daoNiaoShu/Sounds/配音22","obj":"","state":"ChaGuanState","score_kh":"13","score":"","score_sx":"10","type":"技能重点"},{"id":23,"parentName":"拔出导尿管","name":"拔出导尿管","owner":"1","txt":"待尿液全部流出后,将导尿管缓慢拔除。","sound":"daoNiaoShu/Sounds/配音23","obj":"","state":"BaChuDaoNiaoGuanState","score_kh":"3","score":"","score_sx":"5","type":"技能重点"},{"id":24,"parentName":"操作后处理","name":"整理用物","owner":"1","txt":"","sound":"","obj":"","state":"ZhengLiYongWuState","score_kh":"3","score":"","score_sx":"3","type":"基础操作"},{"id":25,"parentName":"操作后处理","name":"医生洗手","owner":"1","txt":"","sound":"","obj":"","state":"YiShengXiShouState","score_kh":"2","score":"","score_sx":"2","type":"无菌观念"},{"id":26,"parentName":"操作后处理","name":"操作后嘱咐","owner":"1","txt":"打字输入/语音输入“先生,您好。已经将患宠膀胱内潴留的尿液通过导尿管已经引流出来了,下一步需要查找导致急性尿潴留的病因,然后再对因治疗。”","sound":"daoNiaoShu/Sounds/配音24","obj":"","state":"CaoZuoHouZhuFuState","score_kh":"2","score":"","score_sx":"5","type":"临床思维"}] diff --git a/Assets/StreamingAssets/daoNiaoShu/Sounds/配音7.mp3 b/Assets/StreamingAssets/daoNiaoShu/Sounds/配音7.mp3 index 136eded..b901009 100644 Binary files a/Assets/StreamingAssets/daoNiaoShu/Sounds/配音7.mp3 and b/Assets/StreamingAssets/daoNiaoShu/Sounds/配音7.mp3 differ diff --git a/Assets/StreamingAssets/daoNiaoShu/Sounds/配音8.mp3 b/Assets/StreamingAssets/daoNiaoShu/Sounds/配音8.mp3 index ee5537e..2b56a7d 100644 Binary files a/Assets/StreamingAssets/daoNiaoShu/Sounds/配音8.mp3 and b/Assets/StreamingAssets/daoNiaoShu/Sounds/配音8.mp3 differ diff --git a/Assets/Yolo.meta b/Assets/Yolo.meta new file mode 100644 index 0000000..f9825a1 --- /dev/null +++ b/Assets/Yolo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce6f59045e231ec42a3f5d51c8888a4c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/CameraPlayer.prefab b/Assets/Yolo/CameraPlayer.prefab new file mode 100644 index 0000000..74a75fb --- /dev/null +++ b/Assets/Yolo/CameraPlayer.prefab @@ -0,0 +1,186 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2950996777235568073 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5426027566368428313} + - component: {fileID: 5367677083586103749} + m_Layer: 0 + m_Name: LiveCamera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5426027566368428313 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2950996777235568073} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 1.423842, y: -2.5615242, z: -1.4961268} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1303103261994163661} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5367677083586103749 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2950996777235568073} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1015dbb0b69fdd446b617191771ffcce, type: 3} + m_Name: + m_EditorClassIdentifier: + _deviceSelection: 2 + _desiredDeviceNames: + - Logitech HD Pro Webcam C920 + - Decklink Video Capture + - Logitech Webcam Pro 9000 + _desiredDeviceIndex: 0 + _modeSelection: 0 + _desiredAnyResolution: 1 + _desiredResolutions: + - {x: 1920, y: 1080} + - {x: 1280, y: 720} + - {x: 640, y: 360} + - {x: 640, y: 480} + _desiredModeIndex: -1 + _maintainAspectRatio: 0 + _desiredFrameRate: 0 + _desiredFormatAny: 1 + _desiredTransparencyFormat: 0 + _desiredFormat: 4 + _videoInputSelection: 0 + _desiredVideoInputs: 0600000003000000 + _desiredVideoInputIndex: 0 + _preferPreviewPin: 0 + _clockMode: 0 + _deinterlace: 0 + _playOnStart: 1 + _allowTransparency: 1 + _flipX: 0 + _flipY: 0 + _yCbCrRange: 0 + _updateHotSwap: 0 + _updateFrameRates: 0 + _updateSettings: 0 +--- !u!1 &6315013461938804625 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1303103261994163661} + - component: {fileID: 1905098217726728362} + m_Layer: 0 + m_Name: CameraPlayer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1303103261994163661 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6315013461938804625} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.423842, y: 2.5615242, z: 1.4961268} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5426027566368428313} + - {fileID: 8719219494378611883} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1905098217726728362 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6315013461938804625} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1a93b137f98d24844bffd7ca80d3dc54, type: 3} + m_Name: + m_EditorClassIdentifier: + _liveCamera: {fileID: 5367677083586103749} + wsUri: ws://127.0.0.1:8000/ai/identify + modelName: link + confidence: 0.7 + sendInterval: 0.5 + jpgQuality: 0.8 +--- !u!1 &8048979940770003626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8719219494378611883} + - component: {fileID: 8907005485093912063} + m_Layer: 0 + m_Name: LiveCameraManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8719219494378611883 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8048979940770003626} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 1.423842, y: -2.5615242, z: -1.4961268} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1303103261994163661} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8907005485093912063 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8048979940770003626} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edba0400f2985f145bfd6428f24d2110, type: 3} + m_Name: + m_EditorClassIdentifier: + _supportHotSwapping: 0 + _supportInternalFormatConversion: 1 + _shaderBGRA32: {fileID: 4800000, guid: 55de6cd535b200d4c9e41052d04ec1e5, type: 3} + _shaderMONO8: {fileID: 4800000, guid: 48acad89159eb1e448777379baab7384, type: 3} + _shaderYUY2: {fileID: 4800000, guid: d1ab837474c2da44594e57fab5f4d831, type: 3} + _shaderUYVY: {fileID: 4800000, guid: cae66dddac87aba4d8af6f0f8829133b, type: 3} + _shaderYVYU: {fileID: 4800000, guid: add9070511111234fb8d9e7048c60b5c, type: 3} + _shaderHDYC: {fileID: 4800000, guid: d15eca7ae06474249b354472a6bf9265, type: 3} + _shaderI420: {fileID: 4800000, guid: 3e319fd1d6f9b4a47b871fb185c665e7, type: 3} + _shaderYV12: {fileID: 4800000, guid: 04afacd8ed181b341910528e6b31102a, type: 3} + _shaderDeinterlace: {fileID: 4800000, guid: 33f55a5d4bd45ae40abfc13543f7bada, type: 3} diff --git a/Assets/Yolo/CameraPlayer.prefab.meta b/Assets/Yolo/CameraPlayer.prefab.meta new file mode 100644 index 0000000..5187b1e --- /dev/null +++ b/Assets/Yolo/CameraPlayer.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b2133fadb8982f34f83197fd2359c080 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Canvas.prefab b/Assets/Yolo/Canvas.prefab new file mode 100644 index 0000000..dfdd677 --- /dev/null +++ b/Assets/Yolo/Canvas.prefab @@ -0,0 +1,331 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1208104104518057737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2924335040025649025} + - component: {fileID: 1216571802081137081} + - component: {fileID: 4090131864949217548} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2924335040025649025 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1208104104518057737} + 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_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 5286542917132367704} + - {fileID: 1287616386044208498} + m_Father: {fileID: 2846392609044518962} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1216571802081137081 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1208104104518057737} + m_CullTransparentMesh: 1 +--- !u!114 &4090131864949217548 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1208104104518057737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4549437955373324211 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5286542917132367704} + - component: {fileID: 3516953690655746650} + - component: {fileID: 6550077597505307180} + m_Layer: 0 + m_Name: AVPro Live Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5286542917132367704 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4549437955373324211} + 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_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 2924335040025649025} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3516953690655746650 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4549437955373324211} + m_CullTransparentMesh: 1 +--- !u!114 &6550077597505307180 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4549437955373324211} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0da62b8b54c37da4a8826e97a78df85f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_liveCamera: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + _setNativeSize: 0 + _keepAspectRatio: 1 + _defaultTexture: {fileID: 0} +--- !u!1 &5139200365634282250 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1287616386044208498} + - component: {fileID: 2808749516779331883} + - component: {fileID: 4564282263989599396} + m_Layer: 0 + m_Name: AABB + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1287616386044208498 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5139200365634282250} + 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_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 2924335040025649025} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2808749516779331883 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5139200365634282250} + m_CullTransparentMesh: 1 +--- !u!114 &4564282263989599396 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5139200365634282250} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: 97af68fe815641544be6c51d6a533fee, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &5774889890294658406 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2846392609044518962} + - component: {fileID: 3822392023124456521} + - component: {fileID: 3381623292424259920} + - component: {fileID: 3362206752654958682} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2846392609044518962 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774889890294658406} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 2924335040025649025} + m_Father: {fileID: 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} +--- !u!223 &3822392023124456521 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774889890294658406} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &3381623292424259920 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774889890294658406} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &3362206752654958682 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774889890294658406} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 diff --git a/Assets/Yolo/Canvas.prefab.meta b/Assets/Yolo/Canvas.prefab.meta new file mode 100644 index 0000000..5b7cf46 --- /dev/null +++ b/Assets/Yolo/Canvas.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8f5f761eabd51cf48b138800883d43bc +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Materials.meta b/Assets/Yolo/Materials.meta new file mode 100644 index 0000000..870fea6 --- /dev/null +++ b/Assets/Yolo/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0bdf4bad7a591aa4682854366f68eb2f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Materials/Unlit_boundBoxRender.mat b/Assets/Yolo/Materials/Unlit_boundBoxRender.mat new file mode 100644 index 0000000..7e379d5 --- /dev/null +++ b/Assets/Yolo/Materials/Unlit_boundBoxRender.mat @@ -0,0 +1,29 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Unlit_boundBoxRender + m_Shader: {fileID: 4800000, guid: b9e3a56c3913e5743bc84538309cf44d, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Ints: [] + m_Floats: [] + m_Colors: [] + m_BuildTextureStacks: [] diff --git a/Assets/Yolo/Materials/Unlit_boundBoxRender.mat.meta b/Assets/Yolo/Materials/Unlit_boundBoxRender.mat.meta new file mode 100644 index 0000000..d270e0f --- /dev/null +++ b/Assets/Yolo/Materials/Unlit_boundBoxRender.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 97af68fe815641544be6c51d6a533fee +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Resources.meta b/Assets/Yolo/Resources.meta new file mode 100644 index 0000000..8e7cc21 --- /dev/null +++ b/Assets/Yolo/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4021ac5d236b64f49a2cfe4dd26a35e7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Resources/Shaders.meta b/Assets/Yolo/Resources/Shaders.meta new file mode 100644 index 0000000..2d7e2e6 --- /dev/null +++ b/Assets/Yolo/Resources/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cc08dfb9b9e3f843aa6de03a9ca80e9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Resources/Shaders/AABB.shader b/Assets/Yolo/Resources/Shaders/AABB.shader new file mode 100644 index 0000000..c3cb1a0 --- /dev/null +++ b/Assets/Yolo/Resources/Shaders/AABB.shader @@ -0,0 +1,55 @@ +Shader "Unlit/AABB" +{ + Properties + { + + } + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + Pass + { + Cull off + ZWrite off + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + + + float4 linkColor; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + float4 col=linkColor; + return col; + } + ENDCG + } + } +} diff --git a/Assets/Yolo/Resources/Shaders/AABB.shader.meta b/Assets/Yolo/Resources/Shaders/AABB.shader.meta new file mode 100644 index 0000000..8f6d6e4 --- /dev/null +++ b/Assets/Yolo/Resources/Shaders/AABB.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c6143f5d4dd613642abbb6149fc0bda5 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Resources/Shaders/boundBoxRender.shader b/Assets/Yolo/Resources/Shaders/boundBoxRender.shader new file mode 100644 index 0000000..83eaa63 --- /dev/null +++ b/Assets/Yolo/Resources/Shaders/boundBoxRender.shader @@ -0,0 +1,61 @@ +Shader "Unlit/boundBoxRender" +{ + Properties + { + _MainTex("MainTex",2D)="white"{} + + } + SubShader + { + Tags { "RenderType"="Opaque" "Queue"="Transparent"} + LOD 100 + + Pass + { + ZWrite off + Cull off + Blend SrcAlpha OneMinusSrcAlpha + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + + sampler2D boundBoxTex; + + + + 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(boundBoxTex, i.uv); + col.a=step(0.51,col.a); + return col; + } + ENDCG + } + } +} diff --git a/Assets/Yolo/Resources/Shaders/boundBoxRender.shader.meta b/Assets/Yolo/Resources/Shaders/boundBoxRender.shader.meta new file mode 100644 index 0000000..f2c3c12 --- /dev/null +++ b/Assets/Yolo/Resources/Shaders/boundBoxRender.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b9e3a56c3913e5743bc84538309cf44d +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Scripts.meta b/Assets/Yolo/Scripts.meta new file mode 100644 index 0000000..9676b8f --- /dev/null +++ b/Assets/Yolo/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5ea93660b545e9341ae8d978f8dff27d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Scripts/AABB.cs b/Assets/Yolo/Scripts/AABB.cs new file mode 100644 index 0000000..c51f445 --- /dev/null +++ b/Assets/Yolo/Scripts/AABB.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using RenderHeads.Media.AVProLiveCamera; +using UnityEngine; + +public class AABB : MonoBehaviour +{ + public WebSocketCameraSender webSocketCameraSender; + [SerializeField] private AVProLiveCamera _liveCamera; + [Range(0,20)]public float width = 20f; + + public Color linkTrueColor=Color.green; + public Color linkFalseColor = Color.red; + + private RenderTexture _renderTexture; + private RenderTexture tempRenderTex; + private DetectionRoot detectionRoot; + Material _material; + // Start is called before the first frame update + void Start() + { + _material=new Material(Shader.Find("Unlit/AABB")); + webSocketCameraSender.OnMessageReceived.AddListener(AnalyticJson); + webSocketCameraSender.OnCaptureTex.AddListener(DrawAABB); + } + + + + + void AnalyticJson(string json) + { + detectionRoot=JsonUtility.FromJson(json); + // if (detectionRoot.detections.Count > 0) + // Debug.Log(detectionRoot.detections[0].class_name+" "+detectionRoot.detections[0].box.x1+" "+detectionRoot.detections[0].box.x2+" "+detectionRoot.detections[0].box.y1+" "+detectionRoot.detections[0].box.y2); + } + + void DrawAABB(RenderTexture renderTexture) + { + //没有就创建渲染贴图 + if (_renderTexture == null) + { + _renderTexture = new RenderTexture( + renderTexture.width, + renderTexture.height, + renderTexture.depth, + renderTexture.format + ); + _renderTexture.antiAliasing = renderTexture.antiAliasing; + _renderTexture.enableRandomWrite = true; + // 激活新纹理(可选,根据业务需求决定是否激活) + _renderTexture.Create(); + + Shader.SetGlobalTexture("boundBoxTex", _renderTexture); + } + tempRenderTex = RenderTexture.active; + RenderTexture.active = _renderTexture; + GL.PushMatrix(); + GL.LoadPixelMatrix(0, renderTexture.width, renderTexture.height, 0); + + _material.SetColor("linkColor",Color.clear); + Rect rectBlack = new Rect(0, 0, renderTexture.width, renderTexture.height); + Graphics.DrawTexture(rectBlack,Texture2D.whiteTexture,_material,0); + + + for (int i = 0; i < detectionRoot.detections.Count; i++) + { + if(detectionRoot.detections[i].class_name=="link-true") _material.SetColor("linkColor",linkTrueColor); + else _material.SetColor("linkColor",linkFalseColor); + Rect rect = new Rect(detectionRoot.detections[i].box.x1-width, detectionRoot.detections[i].box.y1-width, + Mathf.Abs(detectionRoot.detections[i].box.x1-detectionRoot.detections[i].box.x2)+width*2, Mathf.Abs(detectionRoot.detections[i].box.y1-detectionRoot.detections[i].box.y2)+width*2); + Graphics.DrawTexture(rect,Texture2D.whiteTexture,_material,0); + + _material.SetColor("linkColor",Color.clear); + Rect rectScoop = new Rect(detectionRoot.detections[i].box.x1, detectionRoot.detections[i].box.y1, + Mathf.Abs(detectionRoot.detections[i].box.x1-detectionRoot.detections[i].box.x2), Mathf.Abs(detectionRoot.detections[i].box.y1-detectionRoot.detections[i].box.y2)); + Graphics.DrawTexture(rectScoop,Texture2D.whiteTexture,_material,0); + } + + + GL.PopMatrix(); + RenderTexture.active = tempRenderTex; + + } + + private void OnDestroy() + { + webSocketCameraSender.OnMessageReceived.RemoveListener(AnalyticJson); + webSocketCameraSender.OnCaptureTex.RemoveListener(DrawAABB); + + _renderTexture?.Release(); + Destroy(_renderTexture); + _renderTexture = null; + + Destroy(_material); + _material = null; + } +} + +[System.Serializable] +public class DetectionRoot +{ + public string model; + public int count; + public int class_count; + public List classes_detected; + public List detections; +} + +// 检测结果子项 +[System.Serializable] +public class DetectionItem +{ + public int class_id; + public string class_name; + public float confidence; + public BoxData box; +} + +// 矩形框坐标数据 +[System.Serializable] +public class BoxData +{ + public float x1; + public float y1; + public float x2; + public float y2; +} \ No newline at end of file diff --git a/Assets/Yolo/Scripts/AABB.cs.meta b/Assets/Yolo/Scripts/AABB.cs.meta new file mode 100644 index 0000000..41365e2 --- /dev/null +++ b/Assets/Yolo/Scripts/AABB.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b0be399d31db7fa4e92715ed07a664ff +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Scripts/WebSocketCameraSender.cs b/Assets/Yolo/Scripts/WebSocketCameraSender.cs new file mode 100644 index 0000000..8e26d72 --- /dev/null +++ b/Assets/Yolo/Scripts/WebSocketCameraSender.cs @@ -0,0 +1,166 @@ +using System; +using System.Net.WebSockets; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Newtonsoft.Json; +using RenderHeads.Media.AVProLiveCamera; +using UnityEngine; +using UnityEngine.Events; + +public class WebSocketCameraSender : MonoBehaviour +{ + [SerializeField] private AVProLiveCamera _liveCamera; + [Header("核心配置")] + public string wsUri = "ws://127.0.0.1:8000/ai/identify"; + public string modelName = "link"; + public float confidence = 0.7f; + public float sendInterval = 0.5f; // 每0.5秒发一帧 + public float jpgQuality = 0.8f; + + private ClientWebSocket _ws; + private CancellationTokenSource _cts; + private Texture2D _captureTex; + private UnityMainThreadDispatcher1 _dispatcher; // 仅声明,不初始化 + + public UnityEvent OnMessageReceived=new UnityEvent(); + public UnityEvent OnCaptureTex=new UnityEvent(); + + private RenderTexture renderTexture; + private async void Start() + { + + // 1. 延迟初始化调度器(放到Start中,避免字段初始化阶段创建GameObject) + _dispatcher = UnityMainThreadDispatcher1.Instance; + + if (_liveCamera == null) { Debug.LogError("未绑定摄像头组件"); return; } + + _cts = new CancellationTokenSource(); + _ws = new ClientWebSocket(); + + try + { + // 连接WebSocket并开始推流 + await _ws.ConnectAsync(new Uri(wsUri), _cts.Token); + Debug.Log("WS连接成功"); + await RunStream(); + } + catch (TaskCanceledException) + { + // 正常取消(如退出运行模式),仅打印调试日志 + Debug.Log("WebSocket任务已正常取消(应用退出)"); + } + catch (Exception e) { Debug.LogError($"异常: {e.Message}"); Cleanup(); } + } + + private async Task RunStream() + { + + while (!_cts.Token.IsCancellationRequested && _ws.State == WebSocketState.Open && _liveCamera.Device != null) + { + + + // 采集摄像头画面(主线程) + string base64 = await _dispatcher.DispatchAsync(() => + { + renderTexture = _liveCamera.OutputTexture as RenderTexture; + if (renderTexture == null) return ""; + + // 初始化纹理 + if (_captureTex == null) + _captureTex = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.RGBA32, false); + + // 读取画面并转Base64 + RenderTexture.active = renderTexture; + _captureTex.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0); + RenderTexture.active = null; + return Convert.ToBase64String(_captureTex.EncodeToJPG((int)(jpgQuality * 100))); + }); + + if (string.IsNullOrEmpty(base64)) { await Task.Delay((int)(sendInterval * 1000)); continue; } + + // 构建并发送JSON + var payload = new { image_base64 = base64, model_name = modelName, confidence = confidence }; + byte[] jsonBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload)); + + await _ws.SendAsync(new ArraySegment(jsonBytes), WebSocketMessageType.Text, true, _cts.Token); + + // 接收返回结果 + byte[] buffer = new byte[2 * 1024 * 1024]; + var result = await _ws.ReceiveAsync(new ArraySegment(buffer), _cts.Token); + if (result.MessageType == WebSocketMessageType.Close) break; + + string resJson = Encoding.UTF8.GetString(buffer, 0, result.Count); + Debug.Log($"返回结果: {resJson}"); + if (_liveCamera.Device.IsRunning) + { + OnMessageReceived?.Invoke(resJson); + OnCaptureTex?.Invoke(renderTexture); + } + + await Task.Delay((int)(sendInterval * 1000), _cts.Token); + } + } + + private void Cleanup() + { + _cts?.Cancel(); + _cts?.Dispose(); + _ws?.Dispose(); + + _cts = null; + _ws = null; + if (_captureTex != null) Destroy(_captureTex); + } + + private void OnDestroy() => Cleanup(); + private void OnApplicationQuit() => Cleanup(); +} + +// 修正GameObject创建时机的主线程调度器 +public class UnityMainThreadDispatcher1 : MonoBehaviour +{ + private static UnityMainThreadDispatcher1 _instance; + private readonly System.Collections.Queue _actions = new(); + + // 静态属性:延迟创建实例(仅在首次调用时创建,且确保在合法生命周期) + public static UnityMainThreadDispatcher1 Instance + { + get + { + if (_instance == null) + { + // 确保创建GameObject的操作在Unity合法上下文执行 + GameObject dispatcherObj = new GameObject("MainThreadDispatcher"); + _instance = dispatcherObj.AddComponent(); + DontDestroyOnLoad(dispatcherObj); + } + return _instance; + } + } + + // 显式转换lambda为Action,避免类型错误 + public async Task DispatchAsync(Func func) + { + var tcs = new TaskCompletionSource(); + Action action = () => + { + try { tcs.SetResult(func()); } + catch (Exception e) { tcs.SetException(e); } + }; + lock (_actions) _actions.Enqueue(action); + return await tcs.Task; + } + + private void Update() + { + lock (_actions) + { + while (_actions.Count > 0) + { + var action = _actions.Dequeue() as Action; + action?.Invoke(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Yolo/Scripts/WebSocketCameraSender.cs.meta b/Assets/Yolo/Scripts/WebSocketCameraSender.cs.meta new file mode 100644 index 0000000..0098946 --- /dev/null +++ b/Assets/Yolo/Scripts/WebSocketCameraSender.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a93b137f98d24844bffd7ca80d3dc54 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Yolo/Scripts/WebSocketCameraSender2.cs b/Assets/Yolo/Scripts/WebSocketCameraSender2.cs new file mode 100644 index 0000000..6d55b6f --- /dev/null +++ b/Assets/Yolo/Scripts/WebSocketCameraSender2.cs @@ -0,0 +1,192 @@ +using System; +using System.Net.WebSockets; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Newtonsoft.Json; +using RenderHeads.Media.AVProLiveCamera; +using UnityEngine; +using UnityEngine.Events; + +public class WebSocketCameraSender2 : MonoBehaviour +{ + [SerializeField] private AVProLiveCamera _liveCamera; + public AVProLiveCameraUGUIComponent AVProLiveCamera; + [Header("核心配置")] + public string wsUri = "ws://127.0.0.1:8000/ai/identify"; + public string modelName = "link"; + public float confidence = 0.7f; + public float sendInterval = 0.5f; // 每0.5秒发一帧 + public float jpgQuality = 0.8f; + + + + private ClientWebSocket _ws; + private CancellationTokenSource _cts; + private Texture2D _captureTex; + private UnityMainThreadDispatcher2 _dispatcher; + // 临时渲染纹理-用于固定分辨率缩放 + private RenderTexture _tempRenderTexture; + + public UnityEvent OnMessageReceived = new UnityEvent(); + + + + private async void Start() + { + + + _dispatcher = UnityMainThreadDispatcher2.Instance; + + if (_liveCamera == null) + { + Debug.LogError("未绑定摄像头组件 AVProLiveCamera"); + return; + } + + _cts = new CancellationTokenSource(); + _ws = new ClientWebSocket(); + + try + { + await _ws.ConnectAsync(new Uri(wsUri), _cts.Token); + Debug.Log("WS连接成功"); + await RunStream(); + } + catch (TaskCanceledException) + { + Debug.Log("WebSocket任务已正常取消(应用退出)"); + } + catch (Exception e) + { + Debug.LogError($"异常: {e.Message}"); + Cleanup(); + } + } + + private async Task RunStream() + { + while (!_cts.Token.IsCancellationRequested && _ws.State == WebSocketState.Open) + { + // 采集摄像头画面(主线程)- 增加完整的相机异常容错,永不卡死 + string base64 = await _dispatcher.DispatchAsync(() => + { + // 【核心修改1】多重相机状态校验,相机异常直接返回空,不阻塞不报错 + if (_liveCamera == null || _liveCamera.OutputTexture == null) + { + Debug.LogWarning("摄像头未初始化/摄像头已断开连接"); + return string.Empty; + } + + var sourceRt = _liveCamera.OutputTexture as RenderTexture; + if (!sourceRt.IsCreated()) + { + Debug.LogWarning("摄像头纹理失效,采集失败"); + return string.Empty; + } + + + + // 将原相机画面缩放到 1024*1024 分辨率 + //Graphics.Blit(sourceRt, _tempRenderTexture); + + // 读取缩放后的画面像素 + // RenderTexture.active = _tempRenderTexture; + // _captureTex.ReadPixels(new Rect(0, 0, captureWidth, captureHeight), 0, 0); + // RenderTexture.active = null; + + // 编码为JPG并转Base64 + byte[] jpgData = _captureTex.EncodeToJPG((int)(jpgQuality * 100)); + return Convert.ToBase64String(jpgData); + }); + + // 相机异常时,仅延迟等待,不执行后续发送逻辑,程序正常运行永不卡死 + if (string.IsNullOrEmpty(base64)) + { + await Task.Delay(TimeSpan.FromSeconds(sendInterval), _cts.Token); + continue; + } + + // 构建并发送JSON + var payload = new { image_base64 = base64, model_name = modelName, confidence = confidence }; + byte[] jsonBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload)); + await _ws.SendAsync(new ArraySegment(jsonBytes), WebSocketMessageType.Text, true, _cts.Token); + + // 接收返回结果 + byte[] buffer = new byte[2 * 1024 * 1024]; + var result = await _ws.ReceiveAsync(new ArraySegment(buffer), _cts.Token); + if (result.MessageType == WebSocketMessageType.Close) break; + + string resJson = Encoding.UTF8.GetString(buffer, 0, result.Count); + Debug.Log($"返回结果: {resJson}"); + OnMessageReceived?.Invoke(resJson); + + await Task.Delay(TimeSpan.FromSeconds(sendInterval), _cts.Token); + } + } + + // 【优化】完善资源释放,新增临时RT的释放 + private void Cleanup() + { + _cts?.Cancel(); + _cts?.Dispose(); + _ws?.Dispose(); + + _cts = null; + _ws = null; + + if (_captureTex != null) Destroy(_captureTex); + if (_tempRenderTexture != null) RenderTexture.ReleaseTemporary(_tempRenderTexture); + + _captureTex = null; + _tempRenderTexture = null; + } + + private void OnDestroy() => Cleanup(); + private void OnApplicationQuit() => Cleanup(); +} + +// 原封未动 你的主线程调度器 +public class UnityMainThreadDispatcher2 : MonoBehaviour +{ + private static UnityMainThreadDispatcher2 _instance; + private readonly System.Collections.Queue _actions = new(); + + public static UnityMainThreadDispatcher2 Instance + { + get + { + if (_instance == null) + { + GameObject dispatcherObj = new GameObject("MainThreadDispatcher2"); + _instance = dispatcherObj.AddComponent(); + DontDestroyOnLoad(dispatcherObj); + } + return _instance; + } + } + + public async Task DispatchAsync(Func func) + { + var tcs = new TaskCompletionSource(); + Action action = () => + { + try { tcs.SetResult(func()); } + catch (Exception e) { tcs.SetException(e); } + }; + lock (_actions) _actions.Enqueue(action); + return await tcs.Task; + } + + private void Update() + { + lock (_actions) + { + while (_actions.Count > 0) + { + var action = _actions.Dequeue() as Action; + action?.Invoke(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Yolo/Scripts/WebSocketCameraSender2.cs.meta b/Assets/Yolo/Scripts/WebSocketCameraSender2.cs.meta new file mode 100644 index 0000000..4dea192 --- /dev/null +++ b/Assets/Yolo/Scripts/WebSocketCameraSender2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9dd9931bac2445042b452cb67ea93f0d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Init.unity b/Assets/_Scenes/Init.unity index f54833b..d577b99 100644 --- a/Assets/_Scenes/Init.unity +++ b/Assets/_Scenes/Init.unity @@ -140,63 +140,63 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 132536, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 22426080, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22426080, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.x - value: 136.33334 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.y - value: 36 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.x - value: 589.50006 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22428984, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -18 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22455554, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22455554, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22455554, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.x - value: 136.33334 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22455554, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.y - value: 36 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22455554, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.x - value: 725.83344 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22455554, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -18 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22457152, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_Pivot.x @@ -284,135 +284,135 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 22468896, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22468896, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22468896, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.x - value: 136.33334 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22468896, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.y - value: 36 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22468896, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.x - value: 998.5002 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22468896, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -18 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22488670, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22488670, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22488670, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.x - value: 136.33334 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22488670, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.y - value: 36 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22488670, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.x - value: 204.50002 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22488670, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -18 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22495692, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22495692, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22495692, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.x - value: 136.33334 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22495692, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.y - value: 36 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22495692, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.x - value: 862.1668 + value: 0 objectReference: {fileID: 0} - target: {fileID: 22495692, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -18 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224619367409363176, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224619367409363176, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224619367409363176, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.x - value: 248.66669 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224619367409363176, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.y - value: 36 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224619367409363176, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.x - value: 397.00003 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224619367409363176, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -18 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224856348943071238, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224856348943071238, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224856348943071238, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.x - value: 136.33334 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224856348943071238, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_SizeDelta.y - value: 36 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224856348943071238, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.x - value: 68.16667 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224856348943071238, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -18 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} diff --git a/Assets/_Scenes/daoNiaoShu.unity b/Assets/_Scenes/daoNiaoShu.unity index 9033428..ef1378f 100644 --- a/Assets/_Scenes/daoNiaoShu.unity +++ b/Assets/_Scenes/daoNiaoShu.unity @@ -86430,6 +86430,120 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: serializedGuid: 123eff2d507ebe4aa6f127fb37b31ef3 +--- !u!1001 &976602800 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalPosition.x + value: -1.423842 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalPosition.y + value: 2.5615242 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalPosition.z + value: 1.4961268 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303103261994163661, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1905098217726728362, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: modelName + value: QDN + objectReference: {fileID: 0} + - target: {fileID: 1905098217726728362, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: confidence + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 1905098217726728362, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: jpgQuality + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6315013461938804625, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + propertyPath: m_Name + value: CameraPlayer + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: b2133fadb8982f34f83197fd2359c080, type: 3} +--- !u!1 &976602801 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6315013461938804625, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + m_PrefabInstance: {fileID: 976602800} + m_PrefabAsset: {fileID: 0} +--- !u!114 &976602802 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5367677083586103749, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + m_PrefabInstance: {fileID: 976602800} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1015dbb0b69fdd446b617191771ffcce, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &976602803 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1905098217726728362, guid: b2133fadb8982f34f83197fd2359c080, + type: 3} + m_PrefabInstance: {fileID: 976602800} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976602801} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1a93b137f98d24844bffd7ca80d3dc54, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &976984620 MonoBehaviour: m_ObjectHideFlags: 0 @@ -123683,6 +123797,246 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d894c6102eb3a89499290dc6e695bf69, type: 3} +--- !u!1001 &1308056959 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2846392609044518962, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 2924335040025649025, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMin.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2924335040025649025, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2924335040025649025, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_SizeDelta.x + value: 273.9387 + objectReference: {fileID: 0} + - target: {fileID: 2924335040025649025, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_SizeDelta.y + value: 253.9098 + objectReference: {fileID: 0} + - target: {fileID: 2924335040025649025, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchoredPosition.x + value: -152 + objectReference: {fileID: 0} + - target: {fileID: 2924335040025649025, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchoredPosition.y + value: -338 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3001667837868121615, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3381623292424259920, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_UiScaleMode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3381623292424259920, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_ReferenceResolution.x + value: 1920 + objectReference: {fileID: 0} + - target: {fileID: 3381623292424259920, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_ReferenceResolution.y + value: 1080 + objectReference: {fileID: 0} + - target: {fileID: 5774889890294658406, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6550077597505307180, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_liveCamera + value: + objectReference: {fileID: 976602802} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMin.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_SizeDelta.x + value: 273.9387 + objectReference: {fileID: 0} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_SizeDelta.y + value: 253.9098 + objectReference: {fileID: 0} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchoredPosition.x + value: -152 + objectReference: {fileID: 0} + - target: {fileID: 7137262931760640183, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_AnchoredPosition.y + value: -338 + objectReference: {fileID: 0} + - target: {fileID: 7609792175490490817, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_Name + value: Canvas + objectReference: {fileID: 0} + - target: {fileID: 7770370876360668215, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_UiScaleMode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7770370876360668215, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_ReferenceResolution.x + value: 1920 + objectReference: {fileID: 0} + - target: {fileID: 7770370876360668215, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + propertyPath: m_ReferenceResolution.y + value: 1080 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 8f5f761eabd51cf48b138800883d43bc, type: 3} +--- !u!1 &1308056960 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5774889890294658406, guid: 8f5f761eabd51cf48b138800883d43bc, + type: 3} + m_PrefabInstance: {fileID: 1308056959} + m_PrefabAsset: {fileID: 0} --- !u!114 &1308169106 MonoBehaviour: m_ObjectHideFlags: 0 @@ -191996,6 +192350,10 @@ MonoBehaviour: _prefab: "Assets/\u72AC\u5BFC\u5C3F\u672F/\u624B\u52BF\u52A8\u753B/\u8FDE\u63A5\u96C6\u5C3F\u888B\u3001\u6D82\u62B9\u6297\u751F\u7D20\u8F6F\u818F/Aim_tumokanshengshu.fbx" - _gameObject: {fileID: 2113228454} _prefab: "Assets/\u72AC\u5BFC\u5C3F\u672F/\u624B\u52BF\u52A8\u753B/\u63D2\u7BA1\u3001\u62D4\u7BA1/Aim_chabaguan.fbx" + - _gameObject: {fileID: 976602801} + _prefab: Assets/Yolo/CameraPlayer.prefab + - _gameObject: {fileID: 1308056960} + _prefab: Assets/Yolo/Canvas.prefab --- !u!4 &2125265332 Transform: m_ObjectHideFlags: 11 @@ -330330,7 +330688,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: baudRate: 115200 - dataType: 1 + dataType: 0 --- !u!114 &6827219332398779375 MonoBehaviour: m_ObjectHideFlags: 0 @@ -339616,6 +339974,8 @@ MonoBehaviour: m_EditorClassIdentifier: yingJianCanvas: {fileID: 6827219334165435743} senSor: {fileID: 6827219332398779374} + videoUI: {fileID: 1308056960} + webSockerCameraSender: {fileID: 976602803} interactionManager: {fileID: 0} timelineManager: {fileID: 0} fsm: {fileID: 0} @@ -347030,6 +347390,7 @@ MonoBehaviour: Y: 0 Z: 0 txt: {fileID: 9084052908992392372} + isOpen: 0 --- !u!1 &9084052909658758006 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/ChongXiBaoPiQiangState.cs b/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/ChongXiBaoPiQiangState.cs index e0bd2d7..cca193d 100644 --- a/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/ChongXiBaoPiQiangState.cs +++ b/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/ChongXiBaoPiQiangState.cs @@ -47,6 +47,8 @@ namespace DongWuYiXue.DaoNiaoShu fsm.ShowCamera("ϴƤǻ2_Camera"); fsm.Show("20mlעú"); isTui = true; + fsm.ShowTip(1); + fsm.PlayBgm(1); }); } bool isOpen; diff --git a/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/LianJieJiNiaoDaiState.cs b/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/LianJieJiNiaoDaiState.cs index d27edc9..8109abf 100644 --- a/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/LianJieJiNiaoDaiState.cs +++ b/Assets/_Scripts/Application/daoNiaoShu/FSMManager/State/LianJieJiNiaoDaiState.cs @@ -1,4 +1,5 @@ using FSM; +using LitJson; using UnityEngine; using ZXKFramework; namespace DongWuYiXue.DaoNiaoShu @@ -7,15 +8,24 @@ namespace DongWuYiXue.DaoNiaoShu { bool isLianJie = false; Coroutine cor; + + bool link; + public override void OnStateEnter() { base.OnStateEnter(); this.Log("Ӽ״̬"); fsm.Show("Ӽ"); isLianJie = false; + link = false; fsm.ShowTip(0); fsm.PlayBgm(0); fsm.ShowCamera("Ӽ1_Camera"); + + GameManager.Instance.webSockerCameraSender.modelName = "QDN"; + GameManager.Instance.webSockerCameraSender.OnMessageReceived.AddListener(Test); + GameManager.Instance.videoUI.SetActive(true); + cor = Game.Instance.IEnumeratorManager.Run(5.0f, () => { isLianJie = true; @@ -29,10 +39,37 @@ namespace DongWuYiXue.DaoNiaoShu } }); } + + public void Test(string str) + { + //Debug.LogError(str); + JsonData responseBody = JsonMapper.ToObject(str); + if (responseBody["classes_detected"].Count > 0) + { + if (responseBody["classes_detected"][0].ToString() == "link-false") + { + link = false; + } + if (responseBody["classes_detected"][0].ToString() == "link-true") + { + link = true; + } + } + } + public override void OnStateStay() { base.OnStateStay(); - if (isLianJie) + if (isLianJie && Input.GetKeyDown(KeyCode.L)) + { + isLianJie = false; + fsm.ShowCamera("Ӽ2_Camera"); + fsm.PlayClip("Ӽ_TimeLine", () => + { + fsm.nextState = true; + }); + } + if (isLianJie && link) { isLianJie = false; fsm.ShowCamera("Ӽ2_Camera"); @@ -45,12 +82,14 @@ namespace DongWuYiXue.DaoNiaoShu public override void OnStateExit() { base.OnStateExit(); + GameManager.Instance.videoUI.SetActive(false); if (null != cor) { Game.Instance.IEnumeratorManager.Stop(cor); cor = null; } isLianJie = false; + link = false; fsm.nextState = false; } } diff --git a/Assets/_Scripts/Application/daoNiaoShu/GameManager.cs b/Assets/_Scripts/Application/daoNiaoShu/GameManager.cs index fefaf7d..9acc85c 100644 --- a/Assets/_Scripts/Application/daoNiaoShu/GameManager.cs +++ b/Assets/_Scripts/Application/daoNiaoShu/GameManager.cs @@ -11,6 +11,13 @@ namespace DongWuYiXue.DaoNiaoShu [SerializeField] GameObject yingJianCanvas; public SensorManager senSor; + public GameObject videoUI; + + /// + /// ͼʶ + /// + public WebSocketCameraSender webSockerCameraSender; + //ģ [HideInInspector] public InteractionManager interactionManager;