public Renderer()
 {
     InitializeComponent();
     vm           = new RendererViewModel();
     DataContext  = vm;
     Rtb.Document = vm.Root;
 }
Beispiel #2
0
        private void RendererView_OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            RendererView_OnUnloaded(sender, null);

            _model = (RendererViewModel)DataContext;
            if (_model == null)
            {
                return;
            }
            _taskName = _model.TaskName;

            _window = Window.GetWindow(this);

            _window.KeyDown   += HandleKeyPress;
            _window.MouseDown += WindowOnMouseDown;
            _window.MouseUp   += WindowOnMouseUp;
            _window.MouseMove += WindowOnMouseMove;

            CompositionTarget.Rendering += CompositionTargetOnRendering;
            if (_taskName == "Task6")
            {
                _meshes            = new[] { JsonModelLoader.LoadMesh("Mesh/cylinder.babylon") };
                _meshes[0].Texture = new Texture("Mesh/yoba.png");
            }
            else
            {
                _meshes             = new Mesh[] { new Plane(10, 10, 20, 20, 20, (x, y) => (float)(Math.Cos(x) * Math.Cos(y))) };
                _meshes[0].Texture  = new Texture("Mesh/wireframe.png");
                _meshes[0].Rotation = new Vector3((float)Math.PI / 2, 0, 0);
                _model.Wireframe    = true;
            }
        }
Beispiel #3
0
        public ViewModels(Models models)
        {
            m_models = models;

            // view model initialization
            ConsoleOutput = new ConsoleOutputViewModel(m_models);
            Display       = new DisplayViewModel(m_models);
            Cameras       = new CamerasViewModel(m_models);
            Lights        = new LightsViewModel(m_models);
            Materials     = new MaterialsViewModel(m_models);

            Toolbar   = new ToolbarViewModel(m_models);
            Statusbar = new StatusbarViewModel(m_models);

            Profiler = new ProfilerViewModel(m_models);

            Renderer = new RendererViewModel(m_models, Toolbar.PlayPauseCommand, Toolbar.ResetCommand);
            Scene    = new SceneViewModel(m_models);

            RenderTargetSelection = new RenderTargetSelectionViewModel(m_models, Toolbar.ResetCommand);

            LoadWorld       = new LoadWorldViewModel(m_models);
            AnimationFrames = new AnimationFrameViewModel(m_models);
            Tessellation    = new TessellationViewModel(m_models);

            // command initialization
            AddLightCommand               = new AddLightCommand(m_models);
            LoadSceneCommand              = new LoadSceneCommand(m_models);
            SaveSceneCommand              = new SaveSceneCommand(m_models);
            SelectRendererCommand         = new SelectRendererCommand(m_models);
            OpenSettingsCommand           = new OpenSettingsCommand(m_models);
            DenoiseImageCommand           = new SaveDenoisedScreenshotCommand(m_models);
            RenderAnimatedSequenceCommand = new RenderSequenceCommand(m_models, 0, false, true);

            KeyGestures = new KeyGestureViewModel(models);
        }