Major Update - Scene Window Rework
This commit is contained in:
@@ -61,7 +61,7 @@ private:
|
||||
bool showObjectWindow;
|
||||
bool showTerrainWindow;
|
||||
bool showLightWindow;
|
||||
bool showShaderWindow;
|
||||
bool showOldSceneWindow;
|
||||
bool showEngineSettingsWindow;
|
||||
bool showLogWindow;
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
||||
/////////////
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
@@ -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<65>tre ImGui
|
||||
// Affichez la scenne projet<65> sur texture dans une fen<65>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
|
||||
|
Reference in New Issue
Block a user