コード例 #1
0
        private static void GizmoTest(ObiBezierCurve spline, GizmoType gizmoType)
        {
            Matrix4x4 prevMatrix = Handles.matrix;
            Color     oldColor   = Handles.color;

            // Draw the curve:
            int curveSegments = spline.GetNumSpans() * curvePreviewResolution;

            Vector3[] samples = new Vector3[curveSegments + 1];
            for (int i = 0; i <= curveSegments; ++i)
            {
                samples[i] = spline.GetPositionAt(i / (float)curveSegments);
            }

            Handles.matrix = spline.transform.localToWorldMatrix;
            Handles.color  = Color.white;
            Handles.zTest  = UnityEngine.Rendering.CompareFunction.LessEqual;
            Handles.DrawPolyLine(samples);

            Handles.color = new Color(1, 1, 1, 0.25f);
            Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
            Handles.DrawPolyLine(samples);

            Handles.color  = oldColor;
            Handles.matrix = prevMatrix;
        }
コード例 #2
0
        //Rect uirect;

        public void OnEnable()
        {
            spline           = (ObiBezierCurve)target;
            hideSplineHandle = false;
            selectedStatus   = new bool[spline.controlPoints.Count];
            handleVectors    = new Vector3[spline.controlPoints.Count];
        }