示例#1
0
        private void CompositeGUI()
        {
            EditorGUILayout.BeginVertical("Box");
            {
                //Title
                CompositionManager compositionManager = GetCompositionManager();
                {
                    string title;
                    if (compositionManager != null && compositionManager.IsVideoFrameProviderInitialized)
                    {
                        float framesPerSecond = compositionManager.GetVideoFramerate();
                        title = string.Format("Composite [{0} x {1} @ {2:F2} frames/sec]", renderFrameWidth, renderFrameHeight, framesPerSecond);
                    }
                    else
                    {
                        title = "Composite";
                    }

                    RenderTitle(title, Color.green);
                }

                EditorGUILayout.BeginHorizontal("Box");
                {
                    string[]   compositionOptions = new string[] { "Final composite", "Intermediate textures" };
                    GUIContent renderingModeLabel = new GUIContent("Preview display", "Choose between displaying the composited video texture or seeing intermediate textures displayed in 4 sections (bottom left: input video, top left: opaque hologram, top right: hologram alpha mask, bottom right: hologram alpha-blended onto video)");
                    textureRenderMode = EditorGUILayout.Popup(renderingModeLabel, textureRenderMode, compositionOptions);
                    if (compositionManager != null && compositionManager.TextureManager != null)
                    {
                        compositionManager.TextureManager.IsQuadrantVideoFrameNeededForPreviewing = textureRenderMode == (int)VideoRecordingFrameLayout.Quad;
                    }
                    FullScreenCompositorWindow fullscreenWindow = FullScreenCompositorWindow.TryGetWindow();
                    if (fullscreenWindow != null)
                    {
                        fullscreenWindow.TextureRenderMode = textureRenderMode;
                    }

                    if (GUILayout.Button("Fullscreen", GUILayout.Width(120)))
                    {
                        FullScreenCompositorWindow.ShowFullscreen();
                    }
                }
                EditorGUILayout.EndHorizontal();

                // Rendering
                CompositeTextureGUI(textureRenderMode);
            }
            EditorGUILayout.EndVertical();
        }
示例#2
0
        private void CompositeGUI()
        {
            EditorGUILayout.BeginVertical("Box");
            {
                //Title
                CompositionManager compositionManager = GetCompositionManager();
                {
                    string title;
                    if (compositionManager != null && compositionManager.IsVideoFrameProviderInitialized)
                    {
                        float framesPerSecond = compositionManager.GetVideoFramerate();
                        title = string.Format("Composite [{0} x {1} @ {2:F2} frames/sec]", renderFrameWidth, renderFrameHeight, framesPerSecond);
                    }
                    else
                    {
                        title = "Composite";
                    }

                    RenderTitle(title, Color.green);
                }

                EditorGUILayout.BeginVertical("Box");
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.BeginHorizontal();
                    {
                        if (compositionManager != null)
                        {
                            GUI.enabled = compositionManager == null || !compositionManager.IsVideoFrameProviderInitialized;
                            GUIContent label = new GUIContent("Video source", "The video capture card you want to use as input for compositing.");

                            var supportedDevices = Enum.GetValues(typeof(FrameProviderDeviceType))
                                                   .Cast <FrameProviderDeviceType>()
                                                   .Where(provider => compositionManager.IsFrameProviderSupported(provider) || (provider == FrameProviderDeviceType.None)).ToList();
                            var selectedIndex = supportedDevices.IndexOf(compositionManager.CaptureDevice);
                            if (selectedIndex < 0)
                            {
                                selectedIndex = supportedDevices.Count - 1;
                            }

                            selectedIndex = EditorGUILayout.Popup(label, selectedIndex,
                                                                  supportedDevices
                                                                  .Select(x => x.ToString())
                                                                  .ToArray());

                            compositionManager.CaptureDevice = supportedDevices[selectedIndex];

                            if ((supportedDevices[selectedIndex] != FrameProviderDeviceType.AzureKinect_DepthCamera_NFOV && supportedDevices[selectedIndex] != FrameProviderDeviceType.AzureKinect_DepthCamera_WFOV) || compositionManager.VideoRecordingLayout == VideoRecordingFrameLayout.Quad)
                            {
                                GUI.enabled = false;
                            }

                            EditorGUILayout.EndHorizontal();
                            EditorGUILayout.Space();
                            EditorGUILayout.BeginHorizontal();

                            GUIContent occlusionLabel = new GUIContent("Occlusion Mode", "The occlusion mode used to determine if real-world or holographic content is displayed using depth information from supported cameras.");

                            var occlusionModes = Enum.GetValues(typeof(OcclusionSetting))
                                                 .Cast <OcclusionSetting>()
                                                 .Where(setting => compositionManager.IsOcclusionSettingSupported(setting))
                                                 .ToList();

                            if (occlusionModes.Count > 0)
                            {
                                selectedIndex = occlusionModes.IndexOf(compositionManager.OcclusionMode);

                                if (selectedIndex < 0)
                                {
                                    selectedIndex = 0;
                                }

                                selectedIndex = EditorGUILayout.Popup(occlusionLabel, selectedIndex, occlusionModes
                                                                      .Select(x => x.ToString())
                                                                      .ToArray());

                                compositionManager.OcclusionMode = occlusionModes[selectedIndex];
                            }

                            GUI.enabled = true;

                            if (IsAzureKinectFrameProvider(compositionManager.CaptureDevice) && compositionManager.OcclusionMode == OcclusionSetting.BodyTracking && !IsAzureKinectBodyTrackingSDKInstalledInUnity())
                            {
                                var previousColor = GUI.backgroundColor;
                                GUI.backgroundColor = Color.red;
                                if (GUILayout.Button(new GUIContent("Install Required Components", "Copies components needed for the Azure Kinect Body Tracking into your Unity installation directory (requires elevation)"), GUILayout.Width(250.0f)))
                                {
                                    InstallAzureKinectBodyTrackingComponents();
                                }
                                GUI.backgroundColor = previousColor;
                            }
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                    EditorGUILayout.BeginHorizontal();
                    {
                        string[]   compositionOptions = new string[] { "Final composite", "Intermediate textures", "Occlusion Mask" };
                        GUIContent renderingModeLabel = new GUIContent("Preview display", "Choose between displaying the composited video texture, seeing intermediate textures displayed in 4 sections (bottom left: input video, top left: opaque hologram, top right: hologram alpha mask, bottom right: hologram alpha-blended onto video), or viewing the occlusion mask.");
                        previewTextureMode = (PreviewTextureMode)EditorGUILayout.Popup(renderingModeLabel, (int)previewTextureMode, compositionOptions);
                        if (compositionManager != null && compositionManager.TextureManager != null)
                        {
                            // Make sure the textures required for quadrant viewing are created if needed.
                            compositionManager.TextureManager.IsQuadrantVideoFrameNeededForPreviewing = (previewTextureMode == PreviewTextureMode.Quad);
                        }
                        FullScreenCompositorWindow fullscreenWindow = FullScreenCompositorWindow.TryGetWindow();
                        if (fullscreenWindow != null)
                        {
                            fullscreenWindow.PreviewTextureMode = previewTextureMode;
                        }

                        if (GUILayout.Button("Fullscreen", GUILayout.Width(120)))
                        {
                            FullScreenCompositorWindow.ShowFullscreen();
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                }
                EditorGUILayout.EndVertical();

                // Rendering
                CompositeTextureGUI(previewTextureMode);
            }
            EditorGUILayout.EndVertical();
        }
示例#3
0
        private void CompositeGUI()
        {
            EditorGUILayout.BeginVertical("Box");
            {
                //Title
                CompositionManager compositionManager = GetCompositionManager();
                {
                    string title;
                    if (compositionManager != null && compositionManager.IsVideoFrameProviderInitialized)
                    {
                        float framesPerSecond = compositionManager.GetVideoFramerate();
                        title = string.Format("Composite [{0} x {1} @ {2:F2} frames/sec]", renderFrameWidth, renderFrameHeight, framesPerSecond);
                    }
                    else
                    {
                        title = "Composite";
                    }

                    RenderTitle(title, Color.green);
                }

                EditorGUILayout.BeginVertical("Box");
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.BeginHorizontal();
                    {
                        if (compositionManager != null)
                        {
                            GUI.enabled = compositionManager == null || !compositionManager.IsVideoFrameProviderInitialized;
                            GUIContent label = new GUIContent("Video source", "The video capture card you want to use as input for compositing.");
                            compositionManager.CaptureDevice = (FrameProviderDeviceType)EditorGUILayout.Popup(label, ((int)compositionManager.CaptureDevice),
                                                                                                              Enum.GetValues(typeof(FrameProviderDeviceType))
                                                                                                              .Cast <FrameProviderDeviceType>()
                                                                                                              .Where(provider => compositionManager.IsFrameProviderSupported(provider) || (provider == FrameProviderDeviceType.None))
                                                                                                              .Select(x => x.ToString())
                                                                                                              .ToArray());
                            GUI.enabled = true;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.Space();

                    EditorGUILayout.BeginHorizontal();
                    {
                        string[]   compositionOptions = new string[] { "Final composite", "Intermediate textures" };
                        GUIContent renderingModeLabel = new GUIContent("Preview display", "Choose between displaying the composited video texture or seeing intermediate textures displayed in 4 sections (bottom left: input video, top left: opaque hologram, top right: hologram alpha mask, bottom right: hologram alpha-blended onto video)");
                        textureRenderMode = EditorGUILayout.Popup(renderingModeLabel, textureRenderMode, compositionOptions);
                        if (compositionManager != null && compositionManager.TextureManager != null)
                        {
                            compositionManager.TextureManager.IsQuadrantVideoFrameNeededForPreviewing = textureRenderMode == (int)VideoRecordingFrameLayout.Quad;
                        }
                        FullScreenCompositorWindow fullscreenWindow = FullScreenCompositorWindow.TryGetWindow();
                        if (fullscreenWindow != null)
                        {
                            fullscreenWindow.TextureRenderMode = textureRenderMode;
                        }

                        if (GUILayout.Button("Fullscreen", GUILayout.Width(120)))
                        {
                            FullScreenCompositorWindow.ShowFullscreen();
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                }
                EditorGUILayout.EndVertical();

                // Rendering
                CompositeTextureGUI(textureRenderMode);
            }
            EditorGUILayout.EndVertical();
        }