public override void OnInspectorGUI()
    {
        ONSPPropagationMaterial material = target as ONSPPropagationMaterial;

        EditorGUI.BeginChangeCheck();

        Rect r = EditorGUILayout.GetControlRect();

        r.width -= rightMargin;

        ONSPPropagationMaterial.Preset newPreset =
            (ONSPPropagationMaterial.Preset)EditorGUI.EnumPopup(r, "Preset", material.preset);

        Event     e    = Event.current;
        EventType type = e.type;

        absorption.Draw(e);
        scattering.Draw(e);
        transmission.Draw(e);

        if (EditorGUI.EndChangeCheck())
        {
            string groupName = Undo.GetCurrentGroupName();

            Undo.RegisterCompleteObjectUndo(material, groupName);

            if (groupName == "Point Added")
            {
                Undo.CollapseUndoOperations(Undo.GetCurrentGroup() - 1);
            }

            if (material.preset != newPreset)
            {
                material.preset = newPreset;
            }
            else
            {
                material.preset = ONSPPropagationMaterial.Preset.Custom;
            }

            if (Application.isPlaying)
            {
                material.UploadMaterial();
            }
        }
    }
Example #2
0
        private void DrawWaveForm()
        {
            _spectrumBackground.Draw();

            if (Crossfader.ChannelIndexCurrent == -1)
            {
                return;
            }
            float[] levels        = Core.Audio.GetChannelSpectrum(Crossfader.ChannelIndexCurrent, SPECTRUM_POINTS);
            var     averageLevels = new float[SPECTRUM_POINTS / SPECTRUM_CLUSTER_SIZE];

            for (int x = 0; x < levels.Length; x += SPECTRUM_CLUSTER_SIZE)
            {
                averageLevels[x / SPECTRUM_CLUSTER_SIZE] = levels.Skip(x).Take(SPECTRUM_CLUSTER_SIZE).Average();
            }
            _spectrumDrawer.Draw(averageLevels);
        }