public static void DrawCurve(Rect r, AudioCurveEvaluator eval, Color curveColor) { if (Event.current.type != EventType.Repaint) { return; } HandleUtility.ApplyWireMaterial(); int numpoints = (int)Mathf.Ceil(r.width); float cy = r.height * 0.5f; float ws = 1.0f / (numpoints - 1); var line = GetPointCache(numpoints); for (int n = 0; n < numpoints; n++) { line[n].x = (int)n + r.x; line[n].y = cy - cy * eval(n * ws) + r.y; line[n].z = 0.0f; } GUI.BeginClip(r); Handles.color = curveColor; Handles.DrawAAPolyLine(3.0f, numpoints, line); GUI.EndClip(); }
// ------------- // Curve rendering -- do not remove any of these, as they may be used by custom GUIs of native audio plugins // ------------- public static void DrawFilledCurve(Rect r, AudioCurveEvaluator eval, Color curveColor) { DrawFilledCurve( r, delegate(float x, out Color color) { color = curveColor; return(eval(x)); } ); }
public static void DrawCurve(Rect r, AudioCurveEvaluator eval, Color curveColor) { if (Event.current.type == EventType.Repaint) { HandleUtility.ApplyWireMaterial(); int width = (int)r.width; float num2 = r.height * 0.5f; float num3 = 1f / ((float)(width - 1)); Vector3[] pointCache = GetPointCache(width); for (int i = 0; i < width; i++) { pointCache[i].x = i + r.x; pointCache[i].y = (num2 - (num2 * eval(i * num3))) + r.y; pointCache[i].z = 0f; } GUI.BeginClip(r); Handles.color = curveColor; Handles.DrawAAPolyLine(3f, width, pointCache); GUI.EndClip(); } }
public static void DrawFilledCurve(Rect r, AudioCurveEvaluator eval, Color curveColor) {