public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label) { rect.height = 20; var prop = property.FindPropertyRelative("Value"); EditorGUI.Slider(rect, prop, 0.01f, 1, label); float value = prop.floatValue; bool weighted = value < 1; property.FindPropertyRelative("Weighted").boolValue = weighted; if (Event.current.type == EventType.Repaint) { rect.y += 22; rect.height = 30; GUI.BeginClip(rect); GL.PushMatrix(); GL.Clear(true, false, Color.black); EditorUtil.GLMaterial.SetPass(0); GL.Begin(GL.QUADS); GL.Color(s_BGColor); GL.Vertex3(0, 0, 0); GL.Vertex3(rect.width, 0, 0); GL.Vertex3(rect.width, rect.height, 0); GL.Vertex3(0, rect.height, 0); GL.End(); GL.Begin(GL.LINES); GL.Color(s_CurveColor); for (int x = 0; x <= rect.width; x++) { float t = x / rect.width; float s = weighted ? DistanceNormalization.Sigmoid(t, value) : 1 - t; GL.Vertex3(x, rect.height, 0); GL.Vertex3(x, rect.height - s * rect.height, 0); } GL.End(); GL.PopMatrix(); GUI.EndClip(); } rect.x += 4; EditorGUI.LabelField(rect, "Near"); rect.x = rect.width - 8; EditorGUI.LabelField(rect, "Far"); }