Example #1
0
        protected override bool ThroughTriangle(FrustumParams data)
        {
            SelectedSubItems.Sort();

            //if selection filter is ByPick/VisibleByPick selects only the first triangle
            if (vp.firstOnlyInternal && !vp.processVisibleOnly && SelectedSubItems.Count > 0)
            {
                return(false);
            }

            bool through = false;

            for (int i = 0; i < Triangles.Length; i++)
            {
                if (SelectedSubItems.BinarySearch(i) >= 0)
                {
                    continue;
                }

                if (ThroughTriangle(data, GetTriangleVertices(Triangles[i])))
                {
                    SelectedSubItems.Add(i);

                    through = true;

                    if (vp.firstOnlyInternal && !vp.processVisibleOnly)
                    {
                        return(true);
                    }
                }
            }

            return(through);
        }
Example #2
0
        protected override bool ThroughTriangleScreenPolygon(ScreenPolygonParams data)
        {
            SelectedSubItems.Sort();

            for (int i = 0; i < Triangles.Length; i++)
            {
                if (SelectedSubItems.BinarySearch(i) >= 0)
                {
                    continue;
                }

                var verts = GetTriangleVertices(Triangles[i]);
                if (ThroughTriangleScreenPolygon(verts[0], verts[1], verts[2], data))
                {
                    SelectedSubItems.Add(i);
                }
            }
            return(false);
        }
Example #3
0
        protected override void Draw(DrawParams data)
        {
            data.RenderContext.SetLineSize(LineWeight);

            if (Color.A != 255)
            {
                // draws only non-selected transparent lines to avoid blended color
                List <IndexLine> linesToDraw = Lines.ToList();
                SelectedSubItems.Sort();
                for (int i = SelectedSubItems.Count - 1; i >= 0; i--)
                {
                    linesToDraw.RemoveAt(SelectedSubItems[i]);
                }

                data.RenderContext.DrawIndexLines(linesToDraw, Vertices);
            }
            else
            {
                data.RenderContext.DrawIndexLines(Lines, Vertices);
            }
            data.RenderContext.SetLineSize(1);

            DrawSelectedSubItems(data);
        }