예제 #1
0
        /// <summary>
        ///     Przygotowuje bitmapę oraz scenę.
        /// </summary>
        /// <param name="view"></param>
        public Zadanie1(IZadanie1 view)
        {
            _view         = view;
            _view.Loaded += OnLoaded;

            _bmp = new BufferedBitmap(750, 450);

            _device = new Device(_bmp,
                                 new Bresenham(),
                                 new LiangBarskyClipping());

            _scene = new Scene
            {
                Camera = new Camera
                {
                    Position      = Vector3.Zero,
                    LookDirection = Vector3.UnitZ,
                    FieldOfView   = 60
                }
            };

            _scene = SceneImporter.LoadJsonFile(Path.Combine("Resources", "scene.unity.babylon"));
            // Przypisujemy płaszczyźnie kolor szary, aby mieć punkt odniesienia do "podłogi".
            _scene.Meshes.First(m => m.Name == "Plane").Color = Colors.DarkGrey;

            _fpsCounter.StatsChanged += UpdateDebugInfo;
        }
예제 #2
0
        // Prepares the bitmap and the scene.
        public SceneViewModel(ISceneViewModel view)
        {
            _view         = view;
            _view.Loaded += OnLoaded;

            _bmp = new BufferedBitmap(750, 450);

            _device = new Device(_bmp, new Bresenham(), new LiangBarskyClipping());

            _scene = new Scene
            {
                Camera = new Camera
                {
                    Position      = Vector3.Zero,
                    LookDirection = Vector3.UnitZ,
                    FieldOfView   = 60
                }
            };

            _scene = SceneImporter.LoadJsonFile(Path.Combine("Resources", "scene.unity.babylon"));
            _scene.Meshes.First(m => m.Name == "Plane").Color = Engine.Utilities.Colors.DarkGrey;

            //_scene.Meshes.Add(new Cube());
            //_scene.Meshes.Add(new Sphere());
            //_scene.Meshes.Add(new Cone());
            //_scene.Meshes.Add(new Tube());
        }