Add new interfaces and refactor rendering logic

Added a new `ConstPtr<T>` struct for type-safe pointers.
Added a new `ICommandBuffer` interface for resource copying.
Added a new `IRenderPass` interface to define render passes.
Added a new `IResource` interface for GPU resources.
Added a new `IResourceAllocator` interface for resource management.
Added a new `ISwapChainPanelNative` struct for native interactions.
Added a new `D3D12Utility` class for Direct3D 12 utilities.
Added a new package reference for `Vortice.Win32.Graphics.D3D12MemoryAllocator`.

Changed project file to allow unsafe code blocks.
Changed `Result` struct methods to improve clarity.
Changed error handling in `ProjectService` and `AssetDatabase` to use `Result.Failure()`.
Changed `launchSettings.json` to enable native debugging.
Changed rendering logic in `ScenePage.xaml.cs` to use `IRenderer`.
Changed `IGraphicsDevice` interface to include renderer properties.
Changed `IRenderView` to `IRenderer` and updated its methods.
Changed `Mesh` class to use the new `IResource` interface for buffers.
Changed `GraphicsAPI` enum to include a `None` value.
Changed various aspects of the `GraphicsPipeline` class for new architecture.

Removed the old `DX12RenderView` class and replaced it with `DX12Renderer`.
Removed unnecessary code in the `ResourceView` class.
This commit is contained in:
2025-06-30 13:50:06 +09:00
parent 8fd1222780
commit 300ae7251b
27 changed files with 765 additions and 486 deletions

View File

@@ -75,29 +75,29 @@ internal partial class ProjectService
{
if (string.IsNullOrWhiteSpace(projectDirectory) || !Directory.Exists(projectDirectory))
{
return Result<ProjectMetadataInfo>.Error("Project directory is invalid or does not exist.");
return Result<ProjectMetadataInfo>.Failure("Project directory is invalid or does not exist.");
}
var projectAssetsPath = Path.Combine(projectDirectory, ASSETS_FOLDER);
var projectConfigPath = Path.Combine(projectDirectory, CONFIG_FOLDER);
if (!Directory.Exists(projectAssetsPath) || !Directory.Exists(projectConfigPath))
{
return Result<ProjectMetadataInfo>.Error("Project folder structure is invalid.");
return Result<ProjectMetadataInfo>.Failure("Project folder structure is invalid.");
}
var metadataPath = Directory.GetFiles(projectDirectory, $"*.{ProjectMetadata.PROJECT_EXTENSION}", SearchOption.TopDirectoryOnly).FirstOrDefault();
if (string.IsNullOrWhiteSpace(metadataPath) || !File.Exists(metadataPath))
{
return Result<ProjectMetadataInfo>.Error("Project metadata file not found.");
return Result<ProjectMetadataInfo>.Failure("Project metadata file not found.");
}
var metadata = await LoadMetadataAsync(metadataPath);
if (metadata == null)
{
return Result<ProjectMetadataInfo>.Error("Project metadata file is corrupted or invalid.");
return Result<ProjectMetadataInfo>.Failure("Project metadata file is corrupted or invalid.");
}
return Result<ProjectMetadataInfo>.OK(new(metadataPath, metadata));
return Result<ProjectMetadataInfo>.Success(new(metadataPath, metadata));
}
private static async ValueTask SetupRequestFolderAsync(string projectDirectory, string templateDirectory)
@@ -186,7 +186,7 @@ internal partial class ProjectService
}
catch (Exception e)
{
return Result<ProjectMetadataInfo>.Error($"Failed to create project: {e.Message}");
return Result<ProjectMetadataInfo>.Failure($"Failed to create project: {e.Message}");
}
}
@@ -200,7 +200,7 @@ internal partial class ProjectService
if (await HasProjectAsync(result.value.Path))
{
return Result<ProjectMetadataInfo>.Error("Project already exists.");
return Result<ProjectMetadataInfo>.Failure("Project already exists.");
}
await AddProjectAsync(result.value.Metadata.Name, result.value.Path);