Major Update - Scene Window Rework

This commit is contained in:
CatChow0 2025-03-11 17:46:36 +01:00
parent 5e68105fe1
commit 8b9e860c00
8 changed files with 106 additions and 66 deletions

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="singleClickDiffPreview" value="1" />
<option name="vcsConfiguration" value="3" />
<option name="vcsConfiguration" value="2" />
</component>
</project>

View File

@ -5,14 +5,11 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/projectSettingsUpdater.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/shader-error.txt" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/shader-error.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/font.ps" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/font.ps" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/font.vs" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/font.vs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/shader/fontshaderclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/shader/fontshaderclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/systemclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/systemclass.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/Systemclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/Systemclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" afterDir="false" />
@ -62,7 +59,7 @@
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="cidr-memory-view://5" root0="FORCE_HIGHLIGHTING" />
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/../../../../../Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/src/shader/CelShadingShader.cpp" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
@ -77,30 +74,38 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"C++ Project.enginecustom.executor": "Run",
"C/C++ Project.enginecustom.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "main",
"ignore.virus.scanning.warn.message": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "preferences.keymap",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;C/C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.keymap&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
},
&quot;keyToStringList&quot;: {
&quot;rider.external.source.directories&quot;: [
&quot;C:\\Users\\arivas\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache&quot;,
&quot;C:\\Users\\arivas\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache&quot;,
&quot;C:\\Users\\arivas\\AppData\\Local\\Symbols\\src&quot;
]
}
}]]></component>
<component name="RunManager" selected="C/C++ Project.enginecustom">
}</component>
<component name="RunManager" selected="C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<configuration_1>
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
@ -108,19 +113,18 @@
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
</configuration_1>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration name="enginecustom" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<configuration_1>
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
@ -128,10 +132,8 @@
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</configuration_1>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
@ -161,6 +163,8 @@
<workItem from="1738358091089" duration="6675000" />
<workItem from="1738364887298" duration="2275000" />
<workItem from="1738515031789" duration="14018000" />
<workItem from="1741705445392" duration="138000" />
<workItem from="1741706018301" duration="5499000" />
</task>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" />

View File

@ -11,21 +11,21 @@ DockId=0x00000005,0
[Window][Objects]
Pos=8,27
Size=290,826
Size=289,974
Collapsed=0
DockId=0x0000000A,0
DockId=0x00000009,0
[Window][Terrain]
Pos=8,27
Size=290,866
Size=250,826
Collapsed=0
DockId=0x00000009,0
DockId=0x00000007,0
[Window][Light]
Pos=8,27
Size=290,866
Collapsed=0
DockId=0x00000009,1
DockId=0x00000007,1
[Window][Shader Manager]
Pos=8,27
@ -34,10 +34,10 @@ Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
Pos=1187,27
Size=389,826
Pos=8,27
Size=1223,826
Collapsed=0
DockId=0x00000008,1
DockId=0x00000009,1
[Window][DockSpace Demo]
Size=1584,861
@ -45,9 +45,9 @@ Collapsed=0
[Window][Render Window]
Pos=8,27
Size=1223,826
Size=1559,974
Collapsed=0
DockId=0x00000008,0
DockId=0x00000009,0
[Window][DockSpace]
Pos=0,0
@ -76,14 +76,14 @@ DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=1223,826 Split=Y
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=2032,866 Split=Y
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=1568,637 Split=X
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=290,826 Split=Y Selected=0x393905AB
DockNode ID=0x00000009 Parent=0x00000007 SizeRef=395,413 Selected=0x321620B2
DockNode ID=0x0000000A Parent=0x00000007 SizeRef=395,411 Selected=0x031DC75C
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1276,826 CentralNode=1 Selected=0x9204953B
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=2032,226 Selected=0xAB74BEE9
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=343,826 Selected=0x9F035453
DockNode ID=0x00000009 Parent=0xCCBD8CF7 SizeRef=289,974 Selected=0x031DC75C
DockNode ID=0x0000000D Parent=0xCCBD8CF7 SizeRef=1613,974 Split=X
DockNode ID=0x00000002 Parent=0x0000000D SizeRef=1268,826 Split=Y
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=2032,866 Split=Y
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=1568,637 Split=X
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=250,826 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=971,826 CentralNode=1 Selected=0x031DC75C
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=2032,226 Selected=0xAB74BEE9
DockNode ID=0x00000005 Parent=0x0000000D SizeRef=343,826 Selected=0x9F035453

View File

@ -61,7 +61,7 @@ private:
bool showObjectWindow;
bool showTerrainWindow;
bool showLightWindow;
bool showShaderWindow;
bool showOldSceneWindow;
bool showEngineSettingsWindow;
bool showLogWindow;

View File

@ -27,7 +27,7 @@ public:
void SendPath(wchar_t* path, std::filesystem::path WFolder);
private:
protected:
bool Frame();
void InitializeWindows(int&, int&);
void ShutdownWindows();
@ -54,6 +54,7 @@ private:
// FUNCTION PROTOTYPES //
/////////////////////////
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK SecondaryWndProc(HWND, UINT, WPARAM, LPARAM);
/////////////

View File

@ -468,3 +468,15 @@ void SystemClass::SendPath(wchar_t* path, std::filesystem::path WFolder)
m_Application->SetWFolder(WFolder);
}
LRESULT CALLBACK SecondaryWndProc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam)
{
switch (umessage)
{
case WM_DESTROY:
case WM_CLOSE:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd, umessage, wparam, lparam);
}
}

View File

@ -995,8 +995,15 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
m_SceneTexture->Initialize(m_Direct3D->GetDevice(), (int)windowSize.x, (int)windowSize.y, SCREEN_DEPTH, SCREEN_NEAR, 1);
}
m_SceneTexture->SetRenderTarget(m_Direct3D->GetDeviceContext());
m_SceneTexture->ClearRenderTarget(m_Direct3D->GetDeviceContext(), 0.0f, 0.0f, 0.0f, 1.0f);
m_Direct3D->SetBackBufferRenderTarget();
m_Direct3D->ResetViewport();
/// CPT ALED C'EST ICI QUE CA SE PASSE ///
//m_SceneTexture->SetRenderTarget(m_Direct3D->GetDeviceContext());
//m_SceneTexture->ClearRenderTarget(m_Direct3D->GetDeviceContext(), 0.0f, 0.0f, 0.0f, 0.0f);
scaleMatrix = XMMatrixScaling(0.5f, 0.5f, 0.5f); // Build the scaling matrix.
rotateMatrix = XMMatrixRotationY(rotation); // Build the rotation matrix.
@ -1186,7 +1193,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
Logger::Get().Log("Could not render the model using the alpha map shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Setup matrices.
rotateMatrix = XMMatrixRotationY(rotation);
translateMatrix = XMMatrixTranslation(-5.0f, -5.0f, -20.0f);

View File

@ -29,6 +29,11 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
// Setup style
ImGui::StyleColorsDark();
// Set the window background color to be a transparent black/gray
ImGui::GetStyle().Colors[ImGuiCol_WindowBg] = ImVec4(0, 0, 0, 0.5f);
// Set the menu bar background color to be a transparent black/gray
ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg] = ImVec4(0, 0, 0, 0.5f);
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -48,13 +53,13 @@ void imguiManager::Render(ApplicationClass* app)
{
ImGui::Render();
app->GetDirect3D()->TurnZBufferOff();
app->GetDirect3D()->EnableAlphaBlending();
//app->GetDirect3D()->TurnZBufferOff();
//app->GetDirect3D()->EnableAlphaBlending();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
app->GetDirect3D()->DisableAlphaBlending();
app->GetDirect3D()->TurnZBufferOn();
//app->GetDirect3D()->DisableAlphaBlending();
//app->GetDirect3D()->TurnZBufferOn();
}
void imguiManager::NewFrame()
@ -75,15 +80,19 @@ void imguiManager::SetupDockspace() {
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
ImGui::Begin("DockSpace", nullptr, window_flags);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor();
if (ImGui::BeginMenuBar()) {
if (ImGui::BeginMenu("Windows")) {
ImGui::MenuItem("Object Window", NULL, &showObjectWindow);
ImGui::MenuItem("Terrain Window", NULL, &showTerrainWindow);
ImGui::MenuItem("Light Window", NULL, &showLightWindow);
ImGui::MenuItem("Shader Window", NULL, &showShaderWindow);
ImGui::MenuItem("Old Scene Window", NULL, &showOldSceneWindow);
ImGui::MenuItem("Engine Settings Window", NULL, &showEngineSettingsWindow);
ImGui::MenuItem("Log Window", NULL, &showLogWindow);
ImGui::EndMenu();
@ -405,7 +414,11 @@ bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
WidgetLogWindow(app);
}
WidgetRenderWindow(app, ImVec2(800, 600));
if (showOldSceneWindow)
{
WidgetRenderWindow(app, ImVec2(800, 600));
}
//render imgui
Render(app);
@ -611,7 +624,6 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSize)
{
ImGui::Begin("Render Window");
ImVec2 oldWindowSize = windowSize;
@ -640,7 +652,12 @@ void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSiz
if (texture)
{
// Affichez la texture dans une fenêtre ImGui
// Affichez la scenne projeté sur texture dans une fenêtre ImGui
// alpha blend is not enable to render the texture
app->GetDirect3D()->TurnZBufferOff();
app->GetDirect3D()->EnableAlphaBlending();
ImGui::Image((ImTextureID)texture, windowSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(1, 1, 1, 1));
}
else