public override void OnInspectorGUI()
        {
            VolumeRenderedObject volrendObj = (VolumeRenderedObject)target;

            // Render mode
            RenderMode oldRenderMode = volrendObj.GetRenderMode();
            RenderMode newRenderMode = (RenderMode)EditorGUILayout.EnumPopup("Render mode", oldRenderMode);

            if (newRenderMode != oldRenderMode)
            {
                volrendObj.SetRenderMode(newRenderMode);
            }

            // Lighting settings
            if (volrendObj.GetRenderMode() == RenderMode.DirectVolumeRendering)
            {
                volrendObj.SetLightingEnabled(GUILayout.Toggle(volrendObj.GetLightingEnabled(), "Enable lighting"));
            }
            else
            {
                volrendObj.SetLightingEnabled(false);
            }

            // Visibility window
            Vector2 visibilityWindow = volrendObj.GetVisibilityWindow();

            EditorGUILayout.MinMaxSlider("Visible value range", ref visibilityWindow.x, ref visibilityWindow.y, 0.0f, 1.0f);
            EditorGUILayout.Space();
            volrendObj.SetVisibilityWindow(visibilityWindow);

            // Transfer function type
            TFRenderMode tfMode = (TFRenderMode)EditorGUILayout.EnumPopup("Transfer function type", volrendObj.GetTransferFunctionMode());

            if (tfMode != volrendObj.GetTransferFunctionMode())
            {
                volrendObj.SetTransferFunctionMode(tfMode);
            }

            // Show TF button
            if (GUILayout.Button("Edit transfer function"))
            {
                if (tfMode == TFRenderMode.TF1D)
                {
                    TransferFunctionEditorWindow.ShowWindow();
                }
                else
                {
                    TransferFunction2DEditorWindow.ShowWindow();
                }
            }
        }
示例#2
0
        static void ShowWindow()
        {
            TransferFunctionEditorWindow tf1dWnd = (TransferFunctionEditorWindow)EditorWindow.GetWindow(typeof(TransferFunctionEditorWindow));

            if (tf1dWnd != null)
            {
                tf1dWnd.Close();
            }

            TransferFunction2DEditorWindow tf2dWnd = (TransferFunction2DEditorWindow)EditorWindow.GetWindow(typeof(TransferFunction2DEditorWindow));

            tf2dWnd.Show();
            tf2dWnd.SetInitialPosition();
        }
示例#3
0
        public static void ShowWindow()
        {
            // Close all (if any) 1D TF editor windows
            TransferFunctionEditorWindow[] tf1dWnds = Resources.FindObjectsOfTypeAll <TransferFunctionEditorWindow>();
            foreach (TransferFunctionEditorWindow tf1dWnd in tf1dWnds)
            {
                tf1dWnd.Close();
            }

            TransferFunction2DEditorWindow tf2dWnd = (TransferFunction2DEditorWindow)EditorWindow.GetWindow(typeof(TransferFunction2DEditorWindow));

            tf2dWnd.Show();
            tf2dWnd.SetInitialPosition();
        }
示例#4
0
 public static void Show2DTFWindow()
 {
     TransferFunction2DEditorWindow.ShowWindow();
 }