Esempio n. 1
0
        protected override void DrawForSelection(GfxDrawForSelectionParams data)
        {
            if (DrawSubItemsForSelection)
            {
                var prev = vp.SuspendSetColorForSelection;
                vp.SuspendSetColorForSelection = false;

                // Draws the lines with the color-coding needed for visibility computation
                for (int index = 0; index < SelectedSubItems.Count; index++)
                {
                    Point3D p1 = Vertices[Lines[SelectedSubItems[index]].V1];
                    Point3D p2 = Vertices[Lines[SelectedSubItems[index]].V2];


                    vp.SetColorDrawForSelection(SelectedSubItems[index]);

                    IndexLine tri = Lines[SelectedSubItems[index]];
                    data.RenderContext.DrawLine(p1, p2);
                }

                vp.SuspendSetColorForSelection = prev;

                // reset the color to avoid issues with the entities drawn after this one
                data.RenderContext.SetColorWireframe(System.Drawing.Color.White);
            }

            else
            {
                data.RenderContext.DrawIndexLines(Lines, Vertices);
            }
        }
Esempio n. 2
0
 protected override void DrawForSelection(GfxDrawForSelectionParams data)
 {
     if (entityNature == entityNatureType.Wire)
     {
         data.RenderContext.Draw(wireGraphicsData);
     }
     else
     {
         base.DrawForSelection(data);
     }
 }
Esempio n. 3
0
        protected override void DrawForSelection(GfxDrawForSelectionParams data)
        {
            if (DrawSubItemsForSelection)
            {
                var prev = vp.SuspendSetColorForSelection;
                vp.SuspendSetColorForSelection = false;

                // Draws the triangles with the color-coding needed for visibility computation
                for (int index = 0; index < selectedSubItems.Count; index++)
                {
                    //draws only the triangles with normals directions towards the Camera
                    int i = selectedSubItems[index];

                    Point3D p1 = Vertices[Triangles[i].V1];

                    Point3D p2 = Vertices[Triangles[i].V2];
                    Point3D p3 = Vertices[Triangles[i].V3];

                    double[] u = new[] { p1.X - p3.X, p1.Y - p3.Y, p1.Z - p3.Z };
                    double[] v = new[] { p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z };

                    // cross product
                    Vector3D Normal = new Vector3D(u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]);
                    Normal.Normalize();

                    if (Vector3D.Dot(vp.Camera.NearPlane.AxisZ, Normal) <= 0)
                    {
                        continue;
                    }


                    vp.SetColorDrawForSelection(i);

                    IndexTriangle tri = Triangles[i];
                    data.RenderContext.DrawTriangles(new Point3D[]
                    {
                        Vertices[tri.V1],
                        Vertices[tri.V2],
                        Vertices[tri.V3],
                    },
                                                     Vector3D.AxisZ);
                }

                vp.SuspendSetColorForSelection = prev;

                // reset the color to avoid issues with the entities drawn after this one
                data.RenderContext.SetColorWireframe(System.Drawing.Color.White);
            }

            else
            {
                base.DrawForSelection(data);
            }
        }