Esempio n. 1
0
        public Window()
            : base(1280, 720, new GraphicsMode(32, 0, 0, 4), "OpenCAD")
        {
            stl = new STL("Models/elephant.stl", Color.Green, STLType.Binary);

            var s1 = new Sphere {Center = Vect3.Zero, Radius = 4};
            var s2 = new Sphere {Center = new Vect3(0,5,0), Radius = 4};
            var t1 = new Octree<Voxel>(Vect3.Zero, 32.0);
            var t2 = new Octree<Voxel>(Vect3.Zero, 32.0);

            Test2(t1, node => s1.Intersects(node.AABB));
            Test(t2, stl.Elements);

            _tree = t1.Union(t2);

            //_tree.Test(node => sphere.Intersects(node.AABB),maxLevel);
            //Test2(t, node => sphere.Intersects(node.AABB));

            //t[0].Clear();
            //t[0].Clear();
            //Test(_tree,stl.Elements);
            //create from stl
            //foreach (var tri in stl.Elements)
            //{
            //    Intersect(_tree, tri);
            //}

            VSync = VSyncMode.On;

            _camera = new Camera();
            Mouse.WheelChanged += (sender, args) =>
                {
                    _camera.View = _camera.View * Mat4.Translate(0, 0, args.DeltaPrecise * -10.0);
                    //_camera.Eye += new Vect3(0, 0, args.DeltaPrecise * -10.0);
                    // Console.WriteLine(_camera.Eye);
                };
        }