Exemple #1
0
 protected override bool RenderThumbnail(RenderTarget renderTarget)
 {
     var sceneManager = new SceneManager(this.framework.Device, this.framework.AssetManager);
     sceneManager.AddRenderable(new MeshNode(this.framework.Device, Mesh));
     sceneManager.LocateCameraLookingMesh(Mesh);
     return sceneManager.Render(this.framework.Renderer, renderTarget, false);
 }
Exemple #2
0
 protected override bool RenderThumbnail(RenderTarget renderTarget)
 {
     var mesh = Mesh.CreateSphere(this.framework.Device, this.framework.AssetManager, Material, 5.0f, 80, 80);
     var sceneManager = new SceneManager(this.framework.Device, this.framework.AssetManager);
     sceneManager.AddRenderable(new MeshNode(this.framework.Device, mesh));
     sceneManager.LocateCameraLookingMesh(mesh);
     return sceneManager.Render(this.framework.Renderer, renderTarget, false);
 }
        public MaterialEditorViewModel(MaterialAsset materialAsset, Framework framework)
        {
            MaterialEditor = new MaterialEditor(materialAsset.Material);
            ResetCommand = new DelegateCommand<PropertyItem>((item) => System.Windows.MessageBox.Show(item.ToString()));
            AdvancedOptions = new List<MenuItem>();
            AdvancedOptions.Add(new MenuItem() { Header = "Reset", Command = ResetCommand });
            SaveCommand = new DelegateCommand(() =>
                {
                    materialAsset.Material.Save(materialAsset.FullPath);
                    StatusBarService.StatusText = "Material saved: " + materialAsset.ShortName;
                });

            var mesh = Mesh.CreateSphere(framework.Device, framework.AssetManager, materialAsset.Material, 5.0f, 80, 80);
            this.meshNode = new MeshNode(framework.Device, mesh);

            var sceneManager = new SceneManager(framework.Device, framework.AssetManager);
            sceneManager.LocateCameraLookingMesh(mesh);
            sceneManager.AddRenderable(this.meshNode);

            RenderViewModel = new RenderViewModel(framework, sceneManager);
            RenderViewModel.MouseMove += RenderViewModel_MouseMove;
        }
        public ImportMeshViewModel(Framework framework, Mesh mesh, string initialSaveFolder)
        {
            this.framework = framework;

            // Actually, import already done. See argument "mesh" :)
            Mesh = mesh;

            var sceneManager = new SceneManager(framework.Device, framework.AssetManager);
            sceneManager.LocateCameraLookingMesh(mesh);
            sceneManager.AddRenderable(new MeshNode(framework.Device, Mesh));
            
            RenderViewModel = new RenderViewModel(framework, sceneManager);

            MaterialEditor = new MaterialEditor(mesh.Material);
            SaveName = Path.GetFileNameWithoutExtension(Mesh.Name);
            SaveFolder = initialSaveFolder;

            OkCommand = new DelegateCommand(ExecuteOk, CanExecuteOk);
            CancelCommand = new DelegateCommand(() => { RequestCancel(); });
            BrowseCommand = new DelegateCommand(ExecuteBrowse);
            FlipVCommand = new DelegateCommand(() => Mesh.FlipTextureV());
        }