public void PopulateMesh(VertexHelper vh, Matrix4x4 viewMatrix, Rect viewBounds) { if (showHandles) { var bounds = MathUtils.CenterSizeRect(position, 2 * Vector2.one * (_pointRadius + _pointSkin)); bounds = bounds.Encapsulate(MathUtils.CenterSizeRect(position + _inHandlePosition, 2 * Vector2.one * (_handleRadius + _handleSkin))); bounds = bounds.Encapsulate(MathUtils.CenterSizeRect(position + _outHandlePosition, 2 * Vector2.one * (_handleRadius + _handleSkin))); if (!viewBounds.Overlaps(bounds)) { return; } } else { if (!viewBounds.Overlaps(new Rect(position - Vector2.one * _pointRadius, 2 * Vector2.one * _pointRadius))) { return; } } if (showHandles) { vh.AddLine(position, position + _outHandlePosition, _handleThickness, lineColor, viewMatrix); vh.AddLine(position, position + _inHandlePosition, _handleThickness, lineColor, viewMatrix); } vh.AddCircle(position, _pointRadius, pointColor, viewMatrix); if (showHandles) { vh.AddCircle(position + _outHandlePosition, _handleRadius, outHandleColor, viewMatrix); vh.AddCircle(position + _inHandlePosition, _handleRadius, inHandleColor, viewMatrix); } }
public void PopulateScrubberPoints(VertexHelper vh, Matrix4x4 viewMatrix, Rect viewBounds, float x) { var min = _drawScale.inverse.Multiply(viewBounds.min); var max = _drawScale.inverse.Multiply(viewBounds.max); if (x + 0.06f < min.x || x - 0.06f > max.x) { return; } var y = curve.Evaluate(x); if (y + 0.06f < min.y || y - 0.06f > max.y) { return; } vh.AddCircle(_drawScale.Multiply(new Vector2(x, y)), 0.03f, Color.white, viewMatrix); }