Add semantic pixel asserts for lighting scenes
This commit is contained in:
@@ -60,8 +60,6 @@ public:
|
||||
::XCEngine::Editor::XCUIBackend::XCUIShellChromeCommandIds::ToggleXCUIDemoPanel;
|
||||
static constexpr const char* ToggleXCUILayoutLabPanel =
|
||||
::XCEngine::Editor::XCUIBackend::XCUIShellChromeCommandIds::ToggleXCUILayoutLabPanel;
|
||||
static constexpr const char* ToggleLegacyHostDemoWindow =
|
||||
::XCEngine::Editor::XCUIBackend::XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow;
|
||||
static constexpr const char* ToggleNativeBackdrop =
|
||||
::XCEngine::Editor::XCUIBackend::XCUIShellChromeCommandIds::ToggleNativeBackdrop;
|
||||
static constexpr const char* TogglePulseAccent =
|
||||
@@ -81,8 +79,6 @@ public:
|
||||
std::function<void(bool)> setXCUIDemoPanelVisible = {};
|
||||
std::function<bool()> getXCUILayoutLabPanelVisible = {};
|
||||
std::function<void(bool)> setXCUILayoutLabPanelVisible = {};
|
||||
std::function<bool()> getLegacyHostDemoWindowVisible = {};
|
||||
std::function<void(bool)> setLegacyHostDemoWindowVisible = {};
|
||||
std::function<bool()> getNativeBackdropVisible = {};
|
||||
std::function<void(bool)> setNativeBackdropVisible = {};
|
||||
std::function<bool()> getPulseAccentEnabled = {};
|
||||
@@ -213,15 +209,6 @@ public:
|
||||
ctrlOnly,
|
||||
true,
|
||||
false } });
|
||||
bindToggleCommand(
|
||||
ShellCommandIds::ToggleLegacyHostDemoWindow,
|
||||
bindings.getLegacyHostDemoWindowVisible,
|
||||
bindings.setLegacyHostDemoWindowVisible,
|
||||
{ XCUIEditorCommandAccelerator{
|
||||
static_cast<std::int32_t>(KeyCode::Three),
|
||||
ctrlOnly,
|
||||
true,
|
||||
false } });
|
||||
bindToggleCommand(
|
||||
ShellCommandIds::ToggleNativeBackdrop,
|
||||
bindings.getNativeBackdropVisible,
|
||||
@@ -469,6 +456,7 @@ private:
|
||||
::XCEngine::Editor::XCUIBackend::NativeXCUIPanelCanvasHost m_nativeDemoCanvasHost;
|
||||
::XCEngine::Editor::XCUIBackend::NativeXCUIPanelCanvasHost m_nativeLayoutCanvasHost;
|
||||
ShellPanelId m_nativeActivePanel = ShellPanelId::XCUIDemo;
|
||||
bool m_legacyHostDemoWindowVisible = false;
|
||||
bool m_nativeDemoReloadSucceeded = false;
|
||||
bool m_nativeLayoutReloadSucceeded = false;
|
||||
::XCEngine::Editor::XCUIBackend::XCUILayoutLabRuntime m_nativeOverlayRuntime;
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace NewEditor {
|
||||
namespace {
|
||||
|
||||
constexpr float kLegacyHostClearColor[4] = { 0.08f, 0.09f, 0.11f, 1.0f };
|
||||
constexpr const char* kLegacyHostDemoWindowCommandId = "new_editor.view.legacy_host_demo";
|
||||
|
||||
std::uint64_t MakeLegacyHostFrameTimestampNanoseconds() {
|
||||
return static_cast<std::uint64_t>(
|
||||
@@ -65,6 +66,37 @@ const char* GetHostedPreviewStateLabel(
|
||||
return "idle";
|
||||
}
|
||||
|
||||
void RegisterLegacyHostDemoWindowCommand(
|
||||
::XCEngine::Editor::XCUIBackend::XCUIEditorCommandRouter& router,
|
||||
const std::function<bool()>& getter,
|
||||
const std::function<void(bool)>& setter) {
|
||||
if (!getter || !setter) {
|
||||
return;
|
||||
}
|
||||
|
||||
using ::XCEngine::Editor::XCUIBackend::XCUIEditorCommandAccelerator;
|
||||
using ::XCEngine::Editor::XCUIBackend::XCUIEditorCommandDefinition;
|
||||
using ::XCEngine::Input::KeyCode;
|
||||
|
||||
XCUIEditorCommandDefinition definition = {};
|
||||
definition.commandId = kLegacyHostDemoWindowCommandId;
|
||||
definition.isEnabled = [getter, setter]() {
|
||||
return static_cast<bool>(getter) && static_cast<bool>(setter);
|
||||
};
|
||||
definition.invoke = [getter, setter]() {
|
||||
setter(!getter());
|
||||
};
|
||||
definition.accelerators = {
|
||||
XCUIEditorCommandAccelerator{
|
||||
static_cast<std::int32_t>(KeyCode::Three),
|
||||
{ false, true, false, false },
|
||||
true,
|
||||
false,
|
||||
},
|
||||
};
|
||||
router.RegisterCommand(definition);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Application::Application() = default;
|
||||
@@ -155,12 +187,6 @@ void Application::ConfigureShellCommandRouter() {
|
||||
m_layoutLabPanel->SetVisible(visible);
|
||||
}
|
||||
};
|
||||
bindings.getLegacyHostDemoWindowVisible = [this]() {
|
||||
return IsShellViewToggleEnabled(ShellViewToggleId::LegacyHostDemoWindow);
|
||||
};
|
||||
bindings.setLegacyHostDemoWindowVisible = [this](bool visible) {
|
||||
SetShellViewToggleEnabled(ShellViewToggleId::LegacyHostDemoWindow, visible);
|
||||
};
|
||||
bindings.getNativeBackdropVisible = [this]() {
|
||||
return IsShellViewToggleEnabled(ShellViewToggleId::NativeBackdrop);
|
||||
};
|
||||
@@ -204,6 +230,10 @@ void Application::ConfigureShellCommandRouter() {
|
||||
bindings.onHostedPreviewModeChanged = [this]() { ConfigureHostedPreviewPresenters(); };
|
||||
|
||||
Application::RegisterShellViewCommands(m_shellCommandRouter, bindings);
|
||||
RegisterLegacyHostDemoWindowCommand(
|
||||
m_shellCommandRouter,
|
||||
[this]() { return m_legacyHostDemoWindowVisible; },
|
||||
[this](bool visible) { m_legacyHostDemoWindowVisible = visible; });
|
||||
}
|
||||
|
||||
::XCEngine::Editor::XCUIBackend::XCUIInputBridgeFrameDelta
|
||||
@@ -308,9 +338,9 @@ void Application::RenderLegacyImGuiUiFrame() {
|
||||
m_layoutLabPanel->RenderIfVisible();
|
||||
}
|
||||
|
||||
bool showLegacyHostDemoWindow = IsShellViewToggleEnabled(ShellViewToggleId::LegacyHostDemoWindow);
|
||||
bool showLegacyHostDemoWindow = m_legacyHostDemoWindowVisible;
|
||||
if (::XCEngine::Editor::XCUIBackend::RenderLegacyImGuiDemoWindow(showLegacyHostDemoWindow)) {
|
||||
SetShellViewToggleEnabled(ShellViewToggleId::LegacyHostDemoWindow, showLegacyHostDemoWindow);
|
||||
m_legacyHostDemoWindowVisible = showLegacyHostDemoWindow;
|
||||
}
|
||||
|
||||
SyncShellChromePanelStateFromPanels();
|
||||
@@ -371,8 +401,8 @@ void Application::RenderShellChrome() {
|
||||
drawCommandMenuItem(
|
||||
"Legacy Host Demo",
|
||||
"Ctrl+3",
|
||||
IsShellViewToggleEnabled(ShellViewToggleId::LegacyHostDemoWindow),
|
||||
ShellCommandIds::ToggleLegacyHostDemoWindow);
|
||||
m_legacyHostDemoWindowVisible,
|
||||
kLegacyHostDemoWindowCommandId);
|
||||
ImGui::Separator();
|
||||
drawCommandMenuItem(
|
||||
"Native Backdrop",
|
||||
|
||||
@@ -13,7 +13,6 @@ constexpr std::size_t ToIndex(XCUIShellPanelId panelId) {
|
||||
constexpr std::string_view kViewMenuLabel = "View";
|
||||
constexpr std::string_view kXCUIDemoShortcut = "Ctrl+1";
|
||||
constexpr std::string_view kXCUILayoutLabShortcut = "Ctrl+2";
|
||||
constexpr std::string_view kLegacyHostDemoShortcut = "Ctrl+3";
|
||||
constexpr std::string_view kNativeBackdropShortcut = "Ctrl+Shift+B";
|
||||
constexpr std::string_view kPulseAccentShortcut = "Ctrl+Shift+P";
|
||||
constexpr std::string_view kNativeXCUIOverlayShortcut = "Ctrl+Shift+O";
|
||||
@@ -164,8 +163,6 @@ bool XCUIShellChromeState::ToggleHostedPreviewMode(XCUIShellPanelId panelId) {
|
||||
|
||||
bool XCUIShellChromeState::GetViewToggle(XCUIShellViewToggleId toggleId) const {
|
||||
switch (toggleId) {
|
||||
case XCUIShellViewToggleId::LegacyHostDemoWindow:
|
||||
return m_viewToggles.legacyHostDemoWindowVisible;
|
||||
case XCUIShellViewToggleId::NativeBackdrop:
|
||||
return m_viewToggles.nativeBackdropVisible;
|
||||
case XCUIShellViewToggleId::PulseAccent:
|
||||
@@ -183,9 +180,6 @@ bool XCUIShellChromeState::GetViewToggle(XCUIShellViewToggleId toggleId) const {
|
||||
bool XCUIShellChromeState::SetViewToggle(XCUIShellViewToggleId toggleId, bool enabled) {
|
||||
bool* target = nullptr;
|
||||
switch (toggleId) {
|
||||
case XCUIShellViewToggleId::LegacyHostDemoWindow:
|
||||
target = &m_viewToggles.legacyHostDemoWindowVisible;
|
||||
break;
|
||||
case XCUIShellViewToggleId::NativeBackdrop:
|
||||
target = &m_viewToggles.nativeBackdropVisible;
|
||||
break;
|
||||
@@ -227,9 +221,6 @@ bool XCUIShellChromeState::InvokeCommand(std::string_view commandId) {
|
||||
if (commandId == XCUIShellChromeCommandIds::ToggleXCUILayoutLabPanel) {
|
||||
return TogglePanelVisible(XCUIShellPanelId::XCUILayoutLab);
|
||||
}
|
||||
if (commandId == XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow) {
|
||||
return ToggleViewToggle(XCUIShellViewToggleId::LegacyHostDemoWindow);
|
||||
}
|
||||
if (commandId == XCUIShellChromeCommandIds::ToggleNativeBackdrop) {
|
||||
return ToggleViewToggle(XCUIShellViewToggleId::NativeBackdrop);
|
||||
}
|
||||
@@ -288,15 +279,6 @@ bool XCUIShellChromeState::TryGetCommandDescriptor(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (commandId == GetViewToggleCommandId(XCUIShellViewToggleId::LegacyHostDemoWindow)) {
|
||||
outDescriptor.label = "Legacy Host Demo";
|
||||
outDescriptor.shortcut = kLegacyHostDemoShortcut;
|
||||
outDescriptor.commandId = commandId;
|
||||
outDescriptor.checkable = true;
|
||||
outDescriptor.checked = GetViewToggle(XCUIShellViewToggleId::LegacyHostDemoWindow);
|
||||
outDescriptor.enabled = true;
|
||||
return true;
|
||||
}
|
||||
if (commandId == GetViewToggleCommandId(XCUIShellViewToggleId::NativeBackdrop)) {
|
||||
outDescriptor.label = "Native Backdrop";
|
||||
outDescriptor.shortcut = kNativeBackdropShortcut;
|
||||
@@ -358,7 +340,7 @@ bool XCUIShellChromeState::TryGetCommandDescriptor(
|
||||
XCUIShellMenuDescriptor XCUIShellChromeState::BuildViewMenuDescriptor() const {
|
||||
XCUIShellMenuDescriptor descriptor = {};
|
||||
descriptor.label = kViewMenuLabel;
|
||||
descriptor.items.reserve(10u);
|
||||
descriptor.items.reserve(9u);
|
||||
|
||||
const auto appendCommandItem = [this, &descriptor](std::string_view commandId) {
|
||||
XCUIShellCommandDescriptor commandDescriptor = {};
|
||||
@@ -374,7 +356,6 @@ XCUIShellMenuDescriptor XCUIShellChromeState::BuildViewMenuDescriptor() const {
|
||||
|
||||
appendCommandItem(GetPanelVisibilityCommandId(XCUIShellPanelId::XCUIDemo));
|
||||
appendCommandItem(GetPanelVisibilityCommandId(XCUIShellPanelId::XCUILayoutLab));
|
||||
appendCommandItem(GetViewToggleCommandId(XCUIShellViewToggleId::LegacyHostDemoWindow));
|
||||
|
||||
descriptor.items.push_back({ XCUIShellMenuItemKind::Separator, {} });
|
||||
|
||||
@@ -414,8 +395,6 @@ std::string_view XCUIShellChromeState::GetPanelPreviewModeCommandId(XCUIShellPan
|
||||
|
||||
std::string_view XCUIShellChromeState::GetViewToggleCommandId(XCUIShellViewToggleId toggleId) {
|
||||
switch (toggleId) {
|
||||
case XCUIShellViewToggleId::LegacyHostDemoWindow:
|
||||
return XCUIShellChromeCommandIds::ToggleLegacyHostDemoWindow;
|
||||
case XCUIShellViewToggleId::NativeBackdrop:
|
||||
return XCUIShellChromeCommandIds::ToggleNativeBackdrop;
|
||||
case XCUIShellViewToggleId::PulseAccent:
|
||||
|
||||
@@ -16,8 +16,7 @@ enum class XCUIShellPanelId : std::uint8_t {
|
||||
};
|
||||
|
||||
enum class XCUIShellViewToggleId : std::uint8_t {
|
||||
LegacyHostDemoWindow = 0,
|
||||
NativeBackdrop,
|
||||
NativeBackdrop = 0,
|
||||
PulseAccent,
|
||||
NativeXCUIOverlay,
|
||||
HostedPreviewHud,
|
||||
@@ -46,7 +45,6 @@ struct XCUIShellPanelChromeState {
|
||||
};
|
||||
|
||||
struct XCUIShellViewToggleState {
|
||||
bool legacyHostDemoWindowVisible = false;
|
||||
bool nativeBackdropVisible = true;
|
||||
bool pulseAccentEnabled = true;
|
||||
bool nativeXCUIOverlayVisible = true;
|
||||
@@ -56,7 +54,6 @@ struct XCUIShellViewToggleState {
|
||||
struct XCUIShellChromeCommandIds {
|
||||
static constexpr const char* ToggleXCUIDemoPanel = "new_editor.view.xcui_demo";
|
||||
static constexpr const char* ToggleXCUILayoutLabPanel = "new_editor.view.xcui_layout_lab";
|
||||
static constexpr const char* ToggleLegacyHostDemoWindow = "new_editor.view.legacy_host_demo";
|
||||
static constexpr const char* ToggleNativeBackdrop = "new_editor.view.native_backdrop";
|
||||
static constexpr const char* TogglePulseAccent = "new_editor.view.pulse_accent";
|
||||
static constexpr const char* ToggleNativeXCUIOverlay = "new_editor.view.native_xcui_overlay";
|
||||
|
||||
Reference in New Issue
Block a user