public MainWindow() { InitializeComponent(); try { models = new ModelsEx(this); ViewModel = new ViewModels.ViewModels(models); } catch (Exception exception) { Console.WriteLine(exception); MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); Close(); return; } DataContext = ViewModel; Width = models.Settings.WindowWidth; Height = models.Settings.WindowHeight; if (models.Settings.IsMaximized) { WindowState = WindowState.Maximized; } // handle startup arguments if (App.StartupArgs.Length == 0) { return; } LoadStartupArgsAsync(); }
public SSIMViewModel(SSIMsViewModel parent, ModelsEx models, int id) { this.parent = parent; this.models = models; this.models.Display.PropertyChanged += DisplayOnPropertyChanged; this.id = id; }
public Vector4 GetCrop(ModelsEx models, int layer) { if (models.Export.Layer != -1) // only single layer { // darken due to layer mismatch? if (models.Export.IsExporting && models.Export.Layer != layer) { // everything is gray return(Vector4.Zero); } if (models.Export.UseCropping && (models.Export.IsExporting || models.Display.ShowCropRectangle)) { int mipmap = Math.Max(models.Export.Mipmap, 0); float cropMaxX = models.Images.GetWidth(mipmap); float cropMaxY = models.Images.GetHeight(mipmap); Vector4 res; // crop start x res.X = models.Export.CropStartX / cropMaxX; res.Y = (models.Export.CropEndX + 1) / cropMaxX; res.Z = models.Export.CropStartY / cropMaxY; res.W = (models.Export.CropEndY + 1) / cropMaxY; return(res); } } // nothing is gray return(new Vector4(0.0f, 1.0f, 0.0f, 1.0f)); }
public ExportCommand(ModelsEx models) { this.models = models; path = models.ExportPath; this.models.PropertyChanged += ModelsOnPropertyChanged; this.models.Images.PropertyChanged += ImagesOnPropertyChanged; }
public PaintController(ModelsEx models) { this.models = models; this.gpuTimer = new AdvancedGpuTimer(); viewMode = new ViewModeController(models); // model events models.Display.PropertyChanged += DisplayOnPropertyChanged; models.Window.PropertyChanged += WindowOnPropertyChanged; models.Overlay.PropertyChanged += OverlayOnPropertyChanged; // client mouse events models.Window.Window.BorderHost.PreviewMouseMove += (sender, e) => ScheduleRedraw(); models.Window.Window.BorderHost.PreviewMouseWheel += (sender, e) => ScheduleRedraw(); foreach (var pipe in models.Pipelines) { pipe.PropertyChanged += PipeOnPropertyChanged; } models.Window.Window.Loaded += WindowOnLoaded; // clear color var col = models.Window.ThemeColor; clearColor.R = col.Red; clearColor.G = col.Green; clearColor.B = col.Blue; clearColor.A = 1.0f; }
public static ViewerConfig LoadFromModels(ModelsEx models, Components c) { var res = new ViewerConfig(); if (c.HasFlag(Components.Images)) { res.Images = ImagesConfig.LoadFromModels(models); } if (c.HasFlag(Components.Equations)) { res.Equation = EquationConfig.LoadFromModels(models); } if (c.HasFlag(Components.Filter)) { res.Filter = FilterConfig.LoadFromModels(models); } if (c.HasFlag(Components.Display)) { res.Display = DisplayConfig.LoadFromModels(models); } if (c.HasFlag(Components.Export)) { res.Export = ExportConfig.LoadFromModels(models); } return(res); }
public void ApplyToModels(ModelsEx models) { var filters = new List <FilterModel>(); if (ImportMode == ViewerConfig.ImportMode.Add) { filters.AddRange(models.Filter.Filter); } foreach (var filter in Filters) { var model = models.CreateFilter(filter.Filename); // set parameters model.IsEnabled = filter.IsEnabled; for (var i = 0; i < filter.IsPipelineEnabled.Count; i++) { model.SetIsPipelineEnabled(i, filter.IsPipelineEnabled[i]); } foreach (var fp in filter.Parameters) { SetFilterParameter(model, fp.Name, fp.Value); } filters.Add(model); } models.Filter.SetFilter(filters); }
//private readonly SamplerState maxSampler; //private readonly SamplerState minSampler; public SmoothVolumeShader(ModelsEx models) : base(models, GetPixelSource(), "SmoothVolumeShader") { var clamp = TextureAddressMode.Clamp; sampler = new SamplerState(Device.Get().Handle, new SamplerStateDescription { //AddressU = TextureAddressMode.Border, //AddressV = TextureAddressMode.Border, //AddressW = TextureAddressMode.Border, AddressU = clamp, AddressV = clamp, AddressW = clamp, Filter = Filter.MinMagMipLinear, BorderColor = new RawColor4(0.0f, 0.0f, 0.0f, 0.0f), }); /*maxSampler = new SamplerState(Device.Get().Handle, new SamplerStateDescription * { * AddressU = clamp, * AddressV = clamp, * AddressW = clamp, * Filter = Filter.MaximumMinMagMipLinear * }); * * minSampler = new SamplerState(Device.Get().Handle, new SamplerStateDescription * { * AddressU = clamp, * AddressV = clamp, * AddressW = clamp, * Filter = Filter.MinimumMinMagMipLinear * });*/ }
public CheckersShader(ModelsEx models) { this.models = models; vertex = new ImageFramework.DirectX.Shader(ImageFramework.DirectX.Shader.Type.Vertex, GetVertexSource(), "CheckersVertexShader"); pixel = new ImageFramework.DirectX.Shader(ImageFramework.DirectX.Shader.Type.Pixel, GetPixelSource(), "CheckersPixelShader"); themeColor = new Vector3(models.Window.ThemeColor.Red, models.Window.ThemeColor.Green, models.Window.ThemeColor.Blue); }
public ImageItemViewModel(ModelsEx models, int id) { this.Id = id; this.models = models; this.images = models.Images; var imgData = images.Images[id]; Prefix = $"I{id} - "; ToolTip = imgData.Filename + "\n" + imgData.OriginalFormat; if (imgData.Alias.StartsWith("__imported")) { imageName = ""; images.RenameImage(id, ""); System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke((Action)OnRename); } else { imageName = imgData.Alias; } RenameCommand = new ActionCommand(OnRename); DeleteCommand = new ActionCommand(() => images.DeleteImage(id)); ReplaceEquationCommand = new ActionCommand <int>(OnReplaceWithEquation); }
public PixelDisplayViewModel(ModelsEx models) { this.models = models; this.models.Display.PropertyChanged += DisplayOnPropertyChanged; this.models.Settings.PropertyChanged += SettingsOnPropertyChanged; this.decimalPlaces = models.Settings.TexelDecimalPlaces; this.radius = models.Display.TexelRadius; AvailableFormats.Add(new ListItemViewModel <SettingsModel.TexelDisplayMode> { Cargo = SettingsModel.TexelDisplayMode.LinearDecimal, Name = "decimal (linear)" }); AvailableFormats.Add(new ListItemViewModel <SettingsModel.TexelDisplayMode> { Cargo = SettingsModel.TexelDisplayMode.LinearFloat, Name = "float (linear)" }); AvailableFormats.Add(new ListItemViewModel <SettingsModel.TexelDisplayMode> { Cargo = SettingsModel.TexelDisplayMode.SrgbDecimal, Name = "decimal (sRGB)" }); AvailableFormats.Add(new ListItemViewModel <SettingsModel.TexelDisplayMode> { Cargo = SettingsModel.TexelDisplayMode.SrgbByte, Name = "byte (sRGB)" }); selectedFormat = AvailableFormats.Find(box => box.Cargo == models.Settings.TexelDisplay); }
public ZoomBoxOverlay(ModelsEx models) : base(models) { this.models = models; IsEnabled = true; Layer = models.Display.ActiveLayer; models.Overlay.Overlays.Add(this); models.Display.UserInfo = "Click left to start zoombox"; }
public ImportArrayViewModel(ModelsEx models) { this.models = models; this.CancelCommand = new ActionCommand(Cancel); this.ImportCommand = new ActionCommand(Import); this.ApplyCommand = new ApplyCommandImpl(models, this); importDialog = new ImportDialogController(models); }
public RayCastingView(ModelsEx models) : base(models) { shader = new RayCastingShader(models); marchingShader = new RayMarchingShader(models); emptySpaceSkippingShader = new EmptySpaceSkippingShader(); displayEx = (RayCastingDisplayModel)models.Display.ExtendedViewData; helpTextures = new SpaceSkippingTexture3D[models.NumPipelines]; }
public ExportOverwriteCommand(ModelsEx models) { this.models = models; foreach (var pipe in models.Pipelines) { pipe.PropertyChanged += PipeOnPropertyChanged; } }
public ImagesViewModel(ModelsEx models) { this.models = models; import = new ImportDialogController(models); models.Images.PropertyChanged += ImagesOnPropertyChanged; versionString = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3); }
public RayCastingDisplayViewModel(ModelsEx models) { this.models = models; this.displayViewEx = (RayCastingDisplayModel)models.Display.ExtendedViewData; displayViewEx.PropertyChanged += DisplayViewExOnPropertyChanged; models.Display.PropertyChanged += DisplayOnPropertyChanged; }
public ImportEquationImageCommand(ModelsEx models) { this.models = models; foreach (var pipe in models.Pipelines) { pipe.PropertyChanged += PipeOnPropertyChanged; } }
public ComputeImageController(ModelsEx models) { this.models = models; foreach (var pipe in models.Pipelines) { pipe.PropertyChanged += PipeOnPropertyChanged; } }
public void ApplyToModels(ModelsEx models) { models.Display.ShowCropRectangle = ShowCropBox; models.ExportConfig.CropStart = new Float3(CropStartX, CropStartY, CropStartZ); models.ExportConfig.CropEnd = new Float3(CropEndX, CropEndY, CropEndZ); models.ExportConfig.UseCropping = UseCropping; ZoomBox?.ApplyToModels(models); }
public Single3DDisplayViewModel(ModelsEx models) { this.models = models; displayEx = (Single3DDisplayModel)models.Display.ExtendedViewData; displayEx.PropertyChanged += DisplayExOnPropertyChanged; models.Display.PropertyChanged += DisplayOnPropertyChanged; }
public EquationsViewModel(ModelsEx models) { this.models = models; this.Apply = new ApplyImageFormulasCommand(this); changesBrush = new SolidColorBrush(Color.FromRgb(237, 28, 36)); noChangesBrush = (SolidColorBrush)models.Window.Window.FindResource("FontBrush"); RefreshEquations(); }
public void ApplyToModels(ModelsEx models) { models.Display.LinearInterpolation = LinearInterpolation; models.Display.DisplayNegative = DisplayNegative; models.Settings.AlphaBackground = AlphaBackground; models.Display.TexelRadius = TexelRadius; models.Settings.TexelDecimalPlaces = TexelDecimalPlaces; models.Settings.TexelDisplay = TexelDisplayMode; }
public VolumeView(ModelsEx models) : base(models) { smooth = new SmoothVolumeShader(models); cube = new CubeVolumeShader(models); emptySpaceSkippingShader = new EmptySpaceSkippingShader(); cubeSkippingShader = new CubeSkippingShader(); displayEx = (RayCastingDisplayModel)models.Display.ExtendedViewData; helpTextures = new HelpTextureData[models.NumPipelines]; textureCache = new ImageModelTextureCache(models.Images, Format.R8_UInt, true, false); }
public RayCastingDisplayViewModel(ModelsEx models) { this.models = models; this.displayViewEx = (RayCastingDisplayModel)models.Display.ExtendedViewData; displayViewEx.PropertyChanged += DisplayViewExOnPropertyChanged; models.Display.PropertyChanged += DisplayOnPropertyChanged; models.Images.PropertyChanged += ImagesOnPropertyChanged; Crop = models.ExportConfig.GetViewModel(models); Crop.Mipmap = models.Display.ActiveMipmap; }
private static List <bool> GetPipelineEnabled(ModelsEx models, FilterModel filter) { var res = new List <bool>(models.NumPipelines); for (int i = 0; i < models.NumPipelines; ++i) { res.Add(filter.IsPipelineEnabled(i)); } return(res); }
public DisplayViewModel(ModelsEx models) { this.models = models; selectedSplitMode = AvailableSplitModes[models.Display.Split == DisplayModel.SplitMode.Vertical ? 0 : 1]; models.PropertyChanged += ModelsOnPropertyChanged; models.Display.PropertyChanged += DisplayOnPropertyChanged; models.Images.PropertyChanged += ImagesOnPropertyChanged; models.Settings.PropertyChanged += SettingsOnPropertyChanged; CreateViewModes(); }
public ClientDropController(ModelsEx models) { this.models = models; var dxHost = models.Window.Window.BorderHost; dxHost.DragOver += (o, args) => args.Effects = DragDropEffects.Copy; dxHost.AllowDrop = true; dxHost.Drop += DxHostOnDrop; import = new ImportDialogController(models); }
public CropOverlay(ModelsEx models) : base(models) { this.models = models; models.Display.PropertyChanged += DisplayOnPropertyChanged; models.ExportConfig.PropertyChanged += ExportOnPropertyChanged; Start = models.ExportConfig.CropStart; End = models.ExportConfig.CropEnd; Layer = models.ExportConfig.Layer; EvaluateIsEnabled(); }
public RayCastingShader(ModelsEx models) : base(models, GetVertexSource(), GetPixelSource(), "RayCastingShader") { sampler = new SamplerState(Device.Get().Handle, new SamplerStateDescription { AddressU = TextureAddressMode.Border, AddressV = TextureAddressMode.Border, AddressW = TextureAddressMode.Border, Filter = Filter.MinMagMipLinear, BorderColor = new RawColor4(0.0f, 0.0f, 0.0f, 0.0f), }); }