private void Draw() { var worldBezier = targetPath.WorldSpaceBezier; var vertexCount = DynamicBezier.GoodNumMidPoints * worldBezier.Knots.Count; vertexCount /= 2; var cPointCache = new EvaluationCache(worldBezier, vertexCount).Values; // draw bezier PathEditorUtility.DrawSplineInScene(cPointCache); // draw direction cone cap if (!settings.HideDirectionCones && targetScript.transform.lossyScale != Vector3.zero && targetPath.LocalBezier.Knots.Count > 1) // also hide cones if virtually a dot { float startConeSize = PathEditorUtility.Nice3DHandleSize(worldBezier.Evaluate(0f)); float endConeSize = PathEditorUtility.Nice3DHandleSize(worldBezier.Evaluate(1f)); Handles.color = Color.yellow; Handles.ConeCap(0, worldBezier.Evaluate(0f), Quaternion.LookRotation(worldBezier.Evaluate(0.01f) - worldBezier.Evaluate(0f)), startConeSize); Handles.color = Color.magenta; Handles.ConeCap(0, worldBezier.Evaluate(1f), Quaternion.LookRotation(worldBezier.Evaluate(1f) - worldBezier.Evaluate(1f - 0.01f)), endConeSize); } // draw tangent lines if (!settings.HideTangentLines) { Handles.color = Color.cyan; for (int i = 0; i < worldBezier.Knots.Count - 1; i++) { Handles.DrawDottedLine(worldBezier.Knots[i], worldBezier.Knots[i + 1], 7.5f); } } // Draw knot labels var knotLabelStyle = new GUIStyle(); knotLabelStyle.fontStyle = FontStyle.Bold; knotLabelStyle.fontSize = 17; knotLabelStyle.alignment = TextAnchor.UpperRight; knotLabelStyle.contentOffset = new Vector2(25f, -50f); for (int i = 0; i < worldBezier.Knots.Count; i++) { knotLabelStyle.normal.textColor = PathEditorUtility.GetTColor((float)i / worldBezier.Knots.Count); Handles.Label(worldBezier.Knots[i], i.ToString(), knotLabelStyle); } // test t if (settings.TestInterpolate) { PathEditorUtility.DrawTestInterpolate(worldBezier, settings.EditorData.T); } // draw GUI InterpolateSceneGUI(); ToolShelf(); }
private void Draw() { QuadraticBezier worldBezier = qdrBezierPath.WorldSpaceBezier; var cPointCache = new EvaluationCache(worldBezier, QuadraticBezier.GoodNumMidPoints).Values; // draw bezier PathEditorUtility.DrawSplineInScene(cPointCache); // draw direction cone cap if (!settings.HideDirectionCones && targetScript.transform.lossyScale != Vector3.zero) // also hide cones if virtually a dot { float startConeSize = PathEditorUtility.Nice3DHandleSize(worldBezier.Evaluate(0f)); float endConeSize = PathEditorUtility.Nice3DHandleSize(worldBezier.Evaluate(1f)); Handles.color = Color.yellow; Handles.ConeCap(0, worldBezier.Evaluate(0f), Quaternion.LookRotation(worldBezier.Evaluate(0.01f) - worldBezier.Evaluate(0f)), startConeSize); Handles.color = Color.magenta; Handles.ConeCap(0, worldBezier.Evaluate(1f), Quaternion.LookRotation(worldBezier.Evaluate(1f) - worldBezier.Evaluate(1f - 0.01f)), endConeSize); } // draw tangent lines if (!settings.HideTangentLines) { Handles.color = Color.cyan; Handles.DrawDottedLine(worldBezier.StartPosition, worldBezier.MidTangent, 7.5f); Handles.DrawDottedLine(worldBezier.MidTangent, worldBezier.EndPosition, 7.5f); } // test t if (settings.TestInterpolate) { PathEditorUtility.DrawTestInterpolate(worldBezier, settings.EditorData.T); } // draw GUI InterpolateSceneGUI(); ToolShelf(); }