Пример #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.DrawScript();
            m_setter.Clear();

            using (EditorGUILayout.VerticalScope box = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                switch (m_sdfOperation.Type)
                {
                case SDFOperationType.Elongate:
                    m_setter.DrawVector3Setting(Labels.Elongation, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFOperationType.Onion:
                    m_setter.DrawVectorSettingX(Labels.Rounding, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingYInt(Labels.Layers, m_serializedProperties.Data, min: 0);
                    break;

                case SDFOperationType.Round:
                    m_setter.DrawVectorSettingX(Labels.Rounding, m_serializedProperties.Data, min: 0f);
                    break;
                }
            }

            m_setter.Update();
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            m_setter.Clear();
            serializedObject.DrawScript();

            GUI.enabled = false;
            EditorGUILayout.PropertyField(m_serializedProperties.SDFGroup, Labels.SDFGroup);
            EditorGUILayout.PropertyField(m_serializedProperties.Material, Labels.Material);
            GUI.enabled = true;

            if (m_isVisualSettingsOpen = EditorGUILayout.Foldout(m_isVisualSettingsOpen, Labels.VisualSettings, true))
            {
                using (EditorGUILayout.VerticalScope box = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    using (EditorGUI.IndentLevelScope indent = new EditorGUI.IndentLevelScope())
                    {
                        m_setter.DrawVector3Setting(Labels.Size, m_serializedProperties.Size, onValueChangedCallback: m_raymarcher.UpdateCubeMesh);
                        m_setter.DrawColourSetting(Labels.DiffuseColour, m_serializedProperties.DiffuseColour, m_raymarcher.OnVisualsChanged);
                        m_setter.DrawColourSetting(Labels.AmbientColour, m_serializedProperties.AmbientColour, m_raymarcher.OnVisualsChanged);
                        m_setter.DrawFloatSetting(Labels.GlossPower, m_serializedProperties.GlossPower, onValueChangedCallback: m_raymarcher.OnVisualsChanged);
                        m_setter.DrawFloatSetting(Labels.GlossMultiplier, m_serializedProperties.GlossMultiplier, onValueChangedCallback: m_raymarcher.OnVisualsChanged);
                    }
                }
            }

            m_setter.Update();
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.DrawScript();
            m_setter.Clear();

            m_setter.DrawProperty(Labels.Type, m_serializedProperties.Type);
            m_setter.DrawProperty(Labels.Operation, m_serializedProperties.Operation);
            m_setter.DrawProperty(Labels.Flip, m_serializedProperties.Flip);

            using (EditorGUILayout.VerticalScope box = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                switch (m_sdfPrimitive.Type)
                {
                case SDFPrimitiveType.Sphere:
                    m_setter.DrawVectorSettingX(Labels.Radius, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFPrimitiveType.Torus:
                    m_setter.DrawVectorSettingX(Labels.MajorRadius, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingY(Labels.MinorRadius, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFPrimitiveType.Cuboid:
                    m_setter.DrawVector3Setting(Labels.Bounds, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingW(Labels.Roundedness, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFPrimitiveType.BoxFrame:
                    m_setter.DrawVector3Setting(Labels.Bounds, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingW(Labels.Thickness, m_serializedProperties.Data, min: 0f);
                    break;
                }
            }

            m_setter.Update();
        }
Пример #4
0
        public override void OnInspectorGUI()
        {
            serializedObject.DrawScript();
            m_setter.Clear();

            m_setter.DrawProperty(Labels.Type, m_serializedProperties.Type);
            m_setter.DrawProperty(Labels.Operation, m_serializedProperties.Operation);
            m_setter.DrawProperty(Labels.Flip, m_serializedProperties.Flip);
            m_setter.DrawFloatSetting(Labels.Smoothing, m_serializedProperties.Smoothing, min: 0f);

            using (EditorGUILayout.VerticalScope box = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                switch (m_sdfPrimitive.Type)
                {
                case SDFPrimitiveType.Sphere:
                    m_setter.DrawVectorSettingX(Labels.Radius, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFPrimitiveType.Torus:
                    m_setter.DrawVectorSettingX(Labels.MajorRadius, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingY(Labels.MinorRadius, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFPrimitiveType.Cuboid:
                    m_setter.DrawVector3Setting(Labels.Bounds, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingW(Labels.Roundedness, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFPrimitiveType.BoxFrame:
                    m_setter.DrawVector3Setting(Labels.Bounds, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingW(Labels.Thickness, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFPrimitiveType.Cylinder:
                    m_setter.DrawVectorSettingX(Labels.CylinderRadius, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingY(Labels.CylinderLength, m_serializedProperties.Data, min: 0f);
                    break;
                }
            }

            if (m_isMaterialOpen = EditorGUILayout.Foldout(m_isMaterialOpen, Labels.Material, true))
            {
                using (EditorGUILayout.VerticalScope box = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    using (EditorGUI.IndentLevelScope indent = new EditorGUI.IndentLevelScope())
                    {
                        m_setter.DrawProperty(Labels.MaterialType, m_serializedProperties.MaterialType);

                        if (m_sdfPrimitive.Material.Type != SDFMaterial.MaterialType.None)
                        {
                            if (m_sdfPrimitive.Material.Type == SDFMaterial.MaterialType.Texture)
                            {
                                m_setter.DrawProperty(Labels.MaterialTexture, m_serializedProperties.MaterialTexture);
                            }

                            m_setter.DrawProperty(Labels.Colour, m_serializedProperties.Colour);
                            m_setter.DrawFloatSetting(Labels.MaterialSmoothing, m_serializedProperties.MaterialSmoothing, min: 0f);
                            m_setter.DrawProperty(Labels.Emission, m_serializedProperties.Emission);
                            m_setter.DrawProperty(Labels.Metallic, m_serializedProperties.Metallic);
                            m_setter.DrawProperty(Labels.Smoothness, m_serializedProperties.Smoothness);
                            m_setter.DrawProperty(Labels.SubsurfaceColour, m_serializedProperties.SubsurfaceColour);
                            m_setter.DrawProperty(Labels.SubsurfaceScatteringPower, m_serializedProperties.SubsurfaceScatteringPower);
                        }
                    }
                }
            }

            m_setter.Update();
        }