forked from Misaki/GhostEngine
Refactor AppState and rendering pipeline components
Changed the `AppStateMachine` to implement `IDisposable` and `IAsyncDisposable` for better resource management. Changed the `IAppState` interface to include asynchronous methods for state transitions. Changed the `App` class to start the host asynchronously and added an `OnClosed` method for proper shutdown. Changed the `EditorState` class to ensure the window closes correctly when exiting the state. Changed the `LandingState` class to improve window activation and deactivation management. Changed the `HostHelper` class to register `LandingWindow` and `EngineEditorWindow` as singletons for better performance. Changed the `ScenePage` class to utilize a new interface for swap chain management. Changed the `OpenProjectPage` and `CreateProjectPage` classes to enhance navigation handling. Changed the `ConsoleViewModel` to improve log update handling with a new context structure. Changed the `OpenProjectViewModel` to clear project lists when navigating away. Changed the `EngineCore` class to start the graphics pipeline asynchronously. Changed the `Logger` class to use a new context structure for log changes. Added the `ICommandBuffer`, `IGraphicsDevice`, and `IRenderView` interfaces to enhance the rendering pipeline. Changed the `DX12CommandBuffer`, `DX12GraphicsDevice`, and `DX12RenderView` classes for improved resource management and rendering efficiency. Refactored the `Mesh` class to use a new `Vertex` structure for simplified vertex management. Added the `TextureUtility` class for texture management utilities, including mip count calculation. Changed the `launchSettings.json` to include a new profile for the graphics project with native debugging enabled. Changed the `MeshBuilder` class to utilize the new `Vertex` structure for vertex creation.
This commit is contained in:
@@ -3,7 +3,6 @@ using Ghost.Editor.Core.Notifications;
|
||||
using Ghost.Editor.Core.Progress;
|
||||
using Ghost.Editor.ViewModels.Windows;
|
||||
using Ghost.Engine.Resources;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using WinUIEx;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
@@ -15,8 +14,6 @@ namespace Ghost.Editor.View.Windows;
|
||||
/// </summary>
|
||||
internal sealed partial class EngineEditorWindow : WindowEx
|
||||
{
|
||||
private IServiceScope? _editorScope;
|
||||
|
||||
private readonly NotificationService _notificationService;
|
||||
private readonly ProgressService _progressService;
|
||||
|
||||
@@ -45,17 +42,12 @@ internal sealed partial class EngineEditorWindow : WindowEx
|
||||
{
|
||||
Bindings.Update();
|
||||
|
||||
_editorScope?.Dispose();
|
||||
_editorScope = App.CreateScope();
|
||||
|
||||
_notificationService.SetReference(InfoBar, NotificationQueue);
|
||||
_progressService.SetReference(ProgressBarContainer);
|
||||
}
|
||||
|
||||
private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
|
||||
{
|
||||
_editorScope?.Dispose();
|
||||
|
||||
_notificationService.ClearReference();
|
||||
_progressService.ClearReference();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Ghost.Editor.Core.Notifications;
|
||||
using Ghost.Editor.View.Pages.Landing;
|
||||
using Ghost.Engine.Resources;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using WinUIEx;
|
||||
@@ -11,8 +10,6 @@ namespace Ghost.Editor.View.Windows;
|
||||
|
||||
internal sealed partial class LandingWindow : WindowEx
|
||||
{
|
||||
private IServiceScope? _landingScope;
|
||||
|
||||
private readonly NotificationService _notificationService;
|
||||
|
||||
private int _previousSelectedIndex;
|
||||
@@ -34,14 +31,11 @@ internal sealed partial class LandingWindow : WindowEx
|
||||
|
||||
private void WindowEx_Activated(object sender, Microsoft.UI.Xaml.WindowActivatedEventArgs args)
|
||||
{
|
||||
_landingScope?.Dispose();
|
||||
_landingScope = App.CreateScope();
|
||||
_notificationService.SetReference(InfoBar, NotificationQueue);
|
||||
}
|
||||
|
||||
private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
|
||||
{
|
||||
_landingScope?.Dispose();
|
||||
_notificationService.ClearReference();
|
||||
}
|
||||
|
||||
@@ -58,7 +52,7 @@ internal sealed partial class LandingWindow : WindowEx
|
||||
var slideNavigationTransitionEffect = currentSelectedIndex - _previousSelectedIndex > 0 ?
|
||||
SlideNavigationTransitionEffect.FromRight : SlideNavigationTransitionEffect.FromLeft;
|
||||
|
||||
ContentFrame.Navigate(pageType, _landingScope, new SlideNavigationTransitionInfo() { Effect = slideNavigationTransitionEffect });
|
||||
ContentFrame.Navigate(pageType, null, new SlideNavigationTransitionInfo() { Effect = slideNavigationTransitionEffect });
|
||||
|
||||
_previousSelectedIndex = currentSelectedIndex;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user