Beispiel #1
0
        public void Update()
        {
            input.Update();

            if (visuals.drawSlicer == false)
            {
                return;
            }

            visuals.Clear();

            for (int id = 0; id < 10; id++)
            {
                if (linearPair[id].a == Vector2.zero && linearPair[id].b == Vector2.zero)
                {
                    continue;
                }

                if (input.GetVisualsEnabled(id) == false)
                {
                    continue;
                }

                visuals.GenerateLinearMesh(linearPair[id]);
            }

            visuals.Draw();
        }
        public void Update()
        {
            input.Update();

            if (visuals.drawSlicer == false)
            {
                return;
            }

            visuals.Clear();

            for (int id = 0; id < 10; id++)
            {
                if (points[id].Count() < 1)
                {
                    continue;
                }

                if (input.GetVisualsEnabled(id) == false)
                {
                    continue;
                }

                visuals.GenerateComplexMesh(points[id]);
            }

            visuals.Draw();
        }
        public void Update()
        {
            input.Update();

            visuals.Clear();

            if (points.Count() > 0)
            {
                visuals.GenerateComplexMesh(points);
            }

            visuals.Draw();
        }
Beispiel #4
0
        void Update()
        {
            trackerObject.Update(transform.position);

            visuals.lineWidth   = lineWidth;
            visuals.zPosition   = zPosition;
            visuals.slicerColor = color;

            visuals.Clear();

            visuals.GenerateComplexTrackerMesh(transform.position, trackerObject.trackerList);             //, transform, lineWidth, transform.position.z + 0.001f

            visuals.Draw();
        }
Beispiel #5
0
        public void Update()
        {
            input.Update();

            if (visuals.drawSlicer == false)
            {
                return;
            }

            if (linearPair.a == Vector2.zero && linearPair.b == Vector2.zero)
            {
                return;
            }

            visuals.Clear();
            visuals.GenerateLinearMesh(linearPair);
            visuals.Draw();


            if (target != null)
            {
                Polygon2D poly = target.shape.GetWorld();

                int pointIDA = ((verticeID - 1) + poly.pointsList.Count) % poly.pointsList.Count;
                int pointIDB = verticeID;
                int pointIDC = (verticeID + 1) % poly.pointsList.Count;

                Vector2 pointA = poly.pointsList[pointIDA].ToVector2();
                Vector2 pointB = poly.pointsList[pointIDB].ToVector2();
                Vector2 pointC = poly.pointsList[pointIDC].ToVector2();

                Vector2 offset    = pointB;
                float   angle     = Math2D.FindAngle(pointA, pointB, pointC);
                float   angleZero = pointA.Atan2(pointB);

                offset = offset.Push(-angle / 2 + angleZero, 0.5f);

                linearPair.a = offset;
            }

            if (Input.GetMouseButtonDown(1))
            {
                Vector2D point = new Vector2D(input.GetInputPosition(0));

                if (target != null)
                {
                    Polygon2D poly = target.shape.GetWorld();
                    if (poly.PointInPoly(point) == false)
                    {
                        target = null;

                        linearPair.a = Vector2.zero;
                        linearPair.b = Vector2.zero;
                    }
                }

                foreach (Slicer2D slicer in Slicer2D.GetList())
                {
                    Polygon2D poly = slicer.shape.GetWorld();
                    if (poly.PointInPoly(point))
                    {
                        int    id       = 0;
                        double distance = 1000000;

                        foreach (Vector2D p in poly.pointsList)
                        {
                            double newDistance = Vector2D.Distance(p, point);
                            if (newDistance < distance)
                            {
                                distance = newDistance;
                                id       = poly.pointsList.IndexOf(p);
                            }
                        }

                        verticeID = id;
                        target    = slicer;

                        break;
                    }
                }
            }
        }