예제 #1
0
        public static void DrawPath(string jsonString)
        {
            var origin = ApiManager.Instance.BrushPosition;
            var path   = JsonConvert.DeserializeObject <List <List <float> > >($"[{jsonString}]");

            DrawStrokes.SinglePathToStroke(path, origin);
        }
예제 #2
0
        public static void Text(string text)
        {
            var origin       = ApiManager.Instance.BrushPosition;
            var font         = Resources.Load <CHRFont>("arcade");
            var textToStroke = new TextToStrokes(font);
            var polyline2d   = textToStroke.Build(text);

            DrawStrokes.MultiPositionPathsToStrokes(polyline2d, null, null, origin);
        }
예제 #3
0
        public static void SvgPath(string svgPathString)
        {
            var     origin  = ApiManager.Instance.BrushPosition;
            SVGData svgData = new SVGData();

            svgData.Path(svgPathString);
            SVGPolyline svgPolyline = new SVGPolyline();

            svgPolyline.Fill(svgData);
            DrawStrokes.MultiPath2dToStrokes(svgPolyline.Polyline, origin, 0.01f, true);
        }
예제 #4
0
        public static void BrushDraw(float distance)
        {
            Vector3 directionVector = ApiManager.Instance.BrushRotation * Vector3.forward;
            var     end             = directionVector * distance;
            var     path            = new List <List <Vector3> >
            {
                new List <Vector3> {
                    Vector3.zero, end
                }
            };
            var origin = ApiManager.Instance.BrushPosition;

            DrawStrokes.MultiPositionPathsToStrokes(path, null, null, origin);
            ApiManager.Instance.BrushPosition += end;
        }
예제 #5
0
        public static void DrawPolygon(int sides, float radius, float angle)
        {
            var path = new List <Vector3>();

            for (float i = 0; i <= sides; i++)
            {
                var theta = Mathf.PI * (i / sides) * 2f;
                theta += angle * Mathf.Deg2Rad;
                var point = new Vector3(
                    Mathf.Cos(theta),
                    Mathf.Sin(theta),
                    0
                    ) * radius;
                point = ApiManager.Instance.BrushRotation * point;
                path.Add(point);
            }
            DrawStrokes.PositionPathsToStroke(path, ApiManager.Instance.BrushPosition);
        }
예제 #6
0
        public static void DrawCameraPath(int index)
        {
            CameraPathWidget widget = WidgetManager.m_Instance.CameraPathWidgets.ElementAt(index).WidgetScript;
            CameraPath       path   = widget.Path;
            var positions           = new List <Vector3>();
            var rotations           = new List <Quaternion>();

            for (float t = 0; t < path.Segments.Count; t += .1f)
            {
                positions.Add(path.GetPosition(new PathT(t)));
                rotations.Add(path.GetRotation(new PathT(t)));
            }
            DrawStrokes.MultiPositionPathsToStrokes(
                new List <List <Vector3> > {
                positions
            },
                new List <List <Quaternion> > {
                rotations
            },
                null,
                Vector3.zero
                );
        }
예제 #7
0
        public static void DrawStroke(string jsonString)
        {
            var strokeData = JsonConvert.DeserializeObject <List <List <float> > >($"[{jsonString}]");

            DrawStrokes.SinglePathToStroke(strokeData, Vector3.zero, rawStroke: true);
        }