Exemple #1
0
        public static void Bunny(Model model)
        {
            ReadFile readFile = new ReadFile(MainWindow.GetAssetsPath() + "Bunny.eye");

            readFile.DoWork();

            // scales file contents by 100
            foreach (Entity entity in readFile.Entities)
            {
                entity.Scale(100, 100, 100);
            }

            readFile.AddToScene(model);

            if (model.Entities.Count > 0 && model.Entities[0] is FastPointCloud)
            {
                FastPointCloud fpc = (FastPointCloud)model.Entities[0];

                fpc.Rotate(Math.PI / 2, Vector3D.AxisX, Point3D.Origin);

                model.Entities.Regen();

                model.ZoomFit();

                BallPivoting bp = new BallPivoting(fpc);

                model.StartWork(bp);
            }
        }
Exemple #2
0
        public static void MotherBoard(Model model)
        {
            ReadFile rf = new ReadFile(MainWindow.GetAssetsPath() + "Motherboard_ASRock_A330ION.eye");

            model.StartWork(rf);
        }
Exemple #3
0
        public static void Medal(Model model)
        {
            // materials
            Material alu = Material.Aluminium;

            alu.Diffuse     = Color.White;
            alu.Environment = 0.4f;

            string medalMatName = "Alu";

            alu.Name = medalMatName;

            model.Materials.Add(alu);


            string woodMatName = "Wood";

            Material wood = new Material(woodMatName, new Bitmap(MainWindow.GetAssetsPath() + "Textures/Wenge.jpg"));

            model.Materials.Add(wood);



            // medal
            Solid sphere = Solid.CreateSphere(200, 120, 60);

            sphere.Rotate(Math.PI / 2, Vector3D.AxisY);

            sphere.Translate(0, 0, -190);

            Solid cylinder = Region.CreateCircle(Plane.XY, 0, 0, 50).ExtrudeAsSolid(100, 0.1);

            Solid[] intersection = Solid.Intersection(sphere, cylinder);

            Solid lens = intersection[0];

            Text eyeshotText = new Text(-45.5, -8, 0, "eyeshot", 19);

            eyeshotText.Translate(0, 0, 2);

            List <Solid> solidItems = new List <Solid>();

            solidItems.Add(lens);

            solidItems.AddRange(model.ExtrudeText(eyeshotText, 0.01, new Vector3D(0, 0, 10), true));

            Solid medal = Solid.Union(solidItems.ToArray())[0];

            medal.ColorMethod  = colorMethodType.byEntity;
            medal.MaterialName = "alu";
            medal.Translate(0, 0, 2);

            model.Entities.Add(medal, Color.White);


            // jewel case
            Solid b1 = Solid.CreateBox(140, 140, 12);

            b1.Translate(-70, -70, 0);

            Solid b2 = Solid.CreateBox(108, 108, 12);

            b2.Translate(-54, -54, 2);

            Solid[] diff1 = Solid.Difference(b1, b2);

            Plane pln = Plane.YZ;

            Line ln1 = new Line(pln, 0, 0, 4, 0);
            Line ln2 = new Line(pln, 4, 0, 4, 4);
            Line ln3 = new Line(pln, 4, 4, 8, 4);
            Arc  a1  = new Arc(pln, new Point2D(12, 4), 4, Math.PI / 2, Math.PI);
            Line ln4 = new Line(pln, 12, 8, 12, 12);
            Line ln5 = new Line(pln, 12, 12, 0, 12);
            Line ln6 = new Line(pln, 0, 12, 0, 0);

            CompositeCurve sect = new CompositeCurve(ln1, ln2, ln3, a1, ln4, ln5, ln6);

            sect.Translate(0, -70, 0);

            devDept.Eyeshot.Entities.Region sectReg = new devDept.Eyeshot.Entities.Region(sect);

            LinearPath rail = new LinearPath(new Point3D[] { new Point3D(0, -70, 0), new Point3D(70, -70, 0), new Point3D(70, +70, 0), new Point3D(-70, +70, 0), new Point3D(-70, -70, 0), new Point3D(0, -70, 0) });

            Solid frame = sectReg.SweepAsSolid(rail, 0.1);

            Solid[] diff2 = Solid.Difference(diff1[0], frame);

            Solid jewelCase = diff2[0];

            jewelCase.ApplyMaterial(woodMatName, textureMappingType.Cubic, 1, 1);

            model.Entities.Add(jewelCase, Color.FromArgb(32, 0, 0));
        }