port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<UserControl x:Class="Intromat.Views.Previews.DxMeshPreview"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:Intromat.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="5">
<views:DxView x:Name="_dxView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
</UserControl>

View File

@@ -0,0 +1,63 @@
using System;
using System.Reactive.Disposables;
using Intromat.Graphics;
using Intromat.Pipelines;
using Intromat.ViewModels;
using Intromat.ViewModels.Previews;
using ReactiveUI;
using SharpDX.Direct3D11;
using Splat;
namespace Intromat.Views.Previews
{
/// <summary>
/// Interaction logic for DxMeshPreview.xaml
/// </summary>
public partial class DxMeshPreview : IViewFor<DxMeshPreviewViewModel>
{
private DisplayMeshPipeline? _pipeline;
public DxMeshPreview()
{
InitializeComponent();
MouseDoubleClick += (_, _) =>
{
if (ViewModel == null)
return;
var network = (CodeGenNetworkViewModel)ViewModel.Parent.Parent;
var main = network.Document.MainViewModel;
main.Preview3dContext = ViewModel;
};
this.WhenActivated(d =>
{
_pipeline = Locator.Current.GetService<DisplayMeshPipeline>()!;
this.WhenAnyObservable(v => v.ViewModel!.MeshValue).Subscribe(meshValue =>
{
//var srv = meshValue?.ShaderResourceView;
//if (srv != null)
//{
// _pipeline.ShaderResourceView = srv;
// _dxView.Render();
//}
}).DisposeWith(d);
_dxView.SetUpdateHandler(UpdateFrameAction);
});
}
private void UpdateFrameAction(Device device, DeviceContext context)
{
_pipeline?.Apply();
}
object? IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (DxMeshPreviewViewModel?)value;
}
public DxMeshPreviewViewModel? ViewModel { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
<UserControl x:Class="Intromat.Views.Previews.DxTexturePreview"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:Intromat.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="5">
<views:DxView x:Name="_dxView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
</UserControl>

View File

@@ -0,0 +1,63 @@
using System;
using System.Reactive.Disposables;
using Intromat.Graphics;
using Intromat.Pipelines;
using Intromat.ViewModels;
using Intromat.ViewModels.Previews;
using ReactiveUI;
using SharpDX.Direct3D11;
using Splat;
namespace Intromat.Views.Previews
{
/// <summary>
/// Interaction logic for DxTexturePreview.xaml
/// </summary>
public partial class DxTexturePreview : IViewFor<DxTexturePreviewViewModel>
{
private DisplayTexturePipeline? _pipeline;
public DxTexturePreview()
{
InitializeComponent();
MouseDoubleClick += (_, _) =>
{
if (ViewModel == null)
return;
var network = (CodeGenNetworkViewModel)ViewModel.Parent.Parent;
var main = network.Document.MainViewModel;
main.Preview2dContext = ViewModel;
};
this.WhenActivated(d =>
{
_pipeline = Locator.Current.GetService<DisplayTexturePipeline>()!;
this.WhenAnyObservable(v => v.ViewModel!.TextureValue).Subscribe(textureValue =>
{
var srv = textureValue?.ShaderResourceView;
if (srv != null)
{
_pipeline.ShaderResourceView = srv;
_dxView.Render();
}
}).DisposeWith(d);
_dxView.SetUpdateHandler(UpdateFrameAction);
});
}
private void UpdateFrameAction(Device device, DeviceContext context)
{
_pipeline?.Apply();
}
object? IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (DxTexturePreviewViewModel?)value;
}
public DxTexturePreviewViewModel? ViewModel { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
<UserControl x:Class="Intromat.Views.Previews.StringPreview"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Intromat.Views.Previews"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock x:Name="_textBlock" TextTrimming="WordEllipsis" VerticalAlignment="Center" HorizontalAlignment="Stretch" TextAlignment="Center" />
</Grid>
</UserControl>

View File

@@ -0,0 +1,30 @@
using System.Reactive.Disposables;
using Intromat.ViewModels.Previews;
using ReactiveUI;
namespace Intromat.Views.Previews
{
/// <summary>
/// Interaction logic for StringPreview.xaml
/// </summary>
public partial class StringPreview : IViewFor<StringPreviewViewModel>
{
public StringPreview()
{
InitializeComponent();
this.WhenActivated(d =>
{
this.Bind(ViewModel, vm => vm.Value, v => v._textBlock.Text).DisposeWith(d);
});
}
object? IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (StringPreviewViewModel?)value;
}
public StringPreviewViewModel? ViewModel { get; set; }
}
}