port from perforce
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using Intromat.Model.Compiler;
|
||||
using Intromat.Nodes.Textures;
|
||||
using Intromat.Views.Editors;
|
||||
using NodeNetwork.Toolkit.ValueNode;
|
||||
using ReactiveUI;
|
||||
using SharpDX.Direct3D11;
|
||||
using Splat;
|
||||
|
||||
namespace Intromat.ViewModels.Editors
|
||||
{
|
||||
public class SamplerEditorViewModel : ExpressionEditorBaseViewModel<SamplerDesc, SamplerLiteralValue, SamplerLiteralModel>
|
||||
{
|
||||
private Filter _filter = SamplerStateDescription.Default().Filter;
|
||||
private TextureAddressMode _address = SamplerStateDescription.Default().AddressU;
|
||||
|
||||
static SamplerEditorViewModel()
|
||||
{
|
||||
Locator.CurrentMutable.Register(() => new SamplerEditorView(), typeof(IViewFor<SamplerEditorViewModel>));
|
||||
}
|
||||
|
||||
public SamplerEditorViewModel()
|
||||
{
|
||||
this.WhenAnyValue(vm => vm.CustomValue)
|
||||
.Where(s => s != null)
|
||||
.Subscribe(s =>
|
||||
{
|
||||
Filter = s.Filter;
|
||||
Address = s.Address;
|
||||
});
|
||||
|
||||
this.WhenAnyValue(vm => vm.Filter, vm => vm.Address)
|
||||
.Subscribe((p) =>
|
||||
{
|
||||
CustomValue = new SamplerDesc()
|
||||
{
|
||||
Filter = p.Item1,
|
||||
Address = p.Item2
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public Filter Filter
|
||||
{
|
||||
get => _filter;
|
||||
set => this.RaiseAndSetIfChanged(ref _filter, value);
|
||||
}
|
||||
|
||||
public TextureAddressMode Address
|
||||
{
|
||||
get => _address;
|
||||
set => this.RaiseAndSetIfChanged(ref _address, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user