feat(render): implement Campaign AR and terrain fidelity
This commit is contained in:
parent
99cf26e00c
commit
7a5f96ede5
368 changed files with 50611 additions and 950 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using AcDream.Core.Plugins;
|
||||
using AcDream.Core.Selection;
|
||||
using AcDream.Plugin.Abstractions;
|
||||
using AcDream.Plugin.Abstractions.Rendering;
|
||||
|
||||
namespace AcDream.Core.Tests.Plugins;
|
||||
|
||||
|
|
@ -69,6 +70,36 @@ public class PluginLoaderTests
|
|||
}
|
||||
}
|
||||
|
||||
private sealed class RecordingRenderPackRegistry : IRenderPackRegistry, IDisposable
|
||||
{
|
||||
private readonly List<Registration> _registrations = [];
|
||||
|
||||
public int ActiveCount => _registrations.Count(static item => item.Active);
|
||||
public RenderPackDescriptor? Descriptor { get; private set; }
|
||||
|
||||
public IDisposable Register(
|
||||
RenderPackDescriptor descriptor,
|
||||
IRenderPackAssets assets)
|
||||
{
|
||||
Descriptor = descriptor;
|
||||
var registration = new Registration();
|
||||
_registrations.Add(registration);
|
||||
return registration;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (Registration registration in _registrations)
|
||||
registration.Dispose();
|
||||
}
|
||||
|
||||
private sealed class Registration : IDisposable
|
||||
{
|
||||
public bool Active { get; private set; } = true;
|
||||
public void Dispose() => Active = false;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Load_FixtureDll_InstantiatesPluginAndCallsInitialize()
|
||||
{
|
||||
|
|
@ -89,13 +120,42 @@ public class PluginLoaderTests
|
|||
manifest: manifest,
|
||||
host: host);
|
||||
|
||||
Assert.True(loaded.Success);
|
||||
Assert.True(loaded.Success, loaded.Error?.ToString());
|
||||
Assert.NotNull(loaded.Plugin);
|
||||
Assert.Equal("HelloPlugin", loaded.Plugin!.GetType().Name);
|
||||
loaded.Plugin.Disable();
|
||||
loaded.LoadContext!.Unload();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Load_RenderPackOnlyFixture_RegistersWithoutGameplayEntrypointRequirement()
|
||||
{
|
||||
string dllPath = FixturePluginPath();
|
||||
var host = new StubHost();
|
||||
using var registry = new RecordingRenderPackRegistry();
|
||||
var manifest = new PluginManifest(
|
||||
Id: "acdream.test.render-pack",
|
||||
DisplayName: "Render pack",
|
||||
Version: "1.0.0",
|
||||
EntryDll: Path.GetFileName(dllPath),
|
||||
ApiVersion: 1,
|
||||
Dependencies: [],
|
||||
Kinds: [PluginKind.RenderPack]);
|
||||
|
||||
LoadedPlugin loaded = PluginLoader.Load(
|
||||
Path.GetDirectoryName(dllPath)!,
|
||||
manifest,
|
||||
host,
|
||||
registry);
|
||||
|
||||
Assert.True(loaded.Success, loaded.Error?.ToString());
|
||||
Assert.Null(loaded.Plugin);
|
||||
Assert.NotNull(loaded.RenderPackPlugin);
|
||||
Assert.Equal(1, registry.ActiveCount);
|
||||
Assert.Equal("acdream.test.noop-pack", registry.Descriptor?.Id);
|
||||
loaded.LoadContext!.Unload();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Load_UnsupportedApiVersion_IsRefusedBeforeAnyCodeLoads()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue