diff --git a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
index cdb4dbd..9ecad4e 100644
--- a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
+++ b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
@@ -12,9 +12,9 @@
-
+
+
-
@@ -61,90 +61,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -160,25 +77,25 @@
- {
- "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"
+
+}]]>
@@ -243,6 +160,7 @@
+
diff --git a/enginecustom/imgui.ini b/enginecustom/imgui.ini
index f0a9069..e2e8eae 100644
--- a/enginecustom/imgui.ini
+++ b/enginecustom/imgui.ini
@@ -4,8 +4,8 @@ Size=400,400
Collapsed=0
[Window][Khaotic Engine]
-Pos=1187,27
-Size=389,826
+Pos=1233,27
+Size=343,826
Collapsed=0
DockId=0x00000005,0
@@ -37,7 +37,7 @@ DockId=0x00000001,2
Pos=1187,27
Size=389,826
Collapsed=0
-DockId=0x00000005,1
+DockId=0x00000008,1
[Window][DockSpace Demo]
Size=1584,861
@@ -45,9 +45,9 @@ Collapsed=0
[Window][Render Window]
Pos=8,27
-Size=1177,826
+Size=1223,826
Collapsed=0
-DockId=0x00000002,0
+DockId=0x00000008,0
[Window][DockSpace]
Pos=0,0
@@ -72,18 +72,18 @@ Collapsed=0
DockId=0x00000006,0
[Docking][Data]
-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=Y
- DockNode ID=0x00000004 Parent=0xCCBD8CF7 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 Split=X
- DockNode ID=0x00000002 Parent=0x00000008 SizeRef=1177,826 CentralNode=1 Selected=0x9204953B
- DockNode ID=0x00000005 Parent=0x00000008 SizeRef=389,826 Selected=0x9F035453
- DockNode ID=0x0000000C Parent=0x00000004 SizeRef=1568,335 Selected=0x139FDA3F
- DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=2032,226 Selected=0xAB74BEE9
+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
diff --git a/enginecustom/shader-error.txt b/enginecustom/shader-error.txt
index e2b3b9c..b9fbbc5 100644
Binary files a/enginecustom/shader-error.txt and b/enginecustom/shader-error.txt differ
diff --git a/enginecustom/src/hlsl/font.ps b/enginecustom/src/hlsl/font.ps
index 4e9dc57..57d3e70 100644
--- a/enginecustom/src/hlsl/font.ps
+++ b/enginecustom/src/hlsl/font.ps
@@ -31,8 +31,7 @@ float4 FontPixelShader(PixelInputType input) : SV_TARGET
// If the color is black on the texture then treat this pixel as transparent.
if (color.r == 0.0f && color.g == 0.0f && color.b == 0.0f)
{
- color.a = 0.0f;
- return color;
+ return color / color;
}
// If the color is other than black on the texture then this is a pixel in the font so draw it using the font pixel color.
diff --git a/enginecustom/src/inc/system/applicationclass.h b/enginecustom/src/inc/system/applicationclass.h
index 6c0c062..6b07296 100644
--- a/enginecustom/src/inc/system/applicationclass.h
+++ b/enginecustom/src/inc/system/applicationclass.h
@@ -64,7 +64,11 @@ public:
ApplicationClass();
~ApplicationClass();
D3DClass* GetDirect3D();
- RenderTextureClass* GetRenderTexture() const { return m_SceneTexture; };
+ RenderTextureClass* GetSceneTexture() const { return m_SceneTexture; };
+ RenderTextureClass* GetRenderTexture() const { return m_RenderTexture; };
+ RenderTextureClass* GetRefractionTexture() const { return m_RefractionTexture; };
+ RenderTextureClass* GetReflectionTexture() const { return m_ReflectionTexture; };
+
bool Initialize(int, int, HWND);
void Shutdown();
@@ -140,6 +144,8 @@ public:
bool GetCanFixedUpdate() const { return CanFixedUpdate; };
void SetCanFixedUpdate(bool canFixedUpdate) { CanFixedUpdate = canFixedUpdate; };
+ ID3D11ShaderResourceView* GetBackBufferSRV() const {return m_BackBufferSRV;};
+
private:
bool Render(float, float, float, float, float);
bool RenderPhysics(bool keyLeft, bool keyRight, bool keyUp, bool keyDown, float deltaTime);
@@ -256,6 +262,9 @@ private :
bool CanFixedUpdate = false;
std::thread m_PhysicsThread;
+ ID3D11Texture2D* m_BackBufferTexture;
+ ID3D11ShaderResourceView* m_BackBufferSRV;
+
// ------------------------------------------------- //
// ------------------- Culling --------------------- //
// ------------------------------------------------- //
diff --git a/enginecustom/src/inc/system/imguiManager.h b/enginecustom/src/inc/system/imguiManager.h
index 1c71b01..cc3e7f0 100644
--- a/enginecustom/src/inc/system/imguiManager.h
+++ b/enginecustom/src/inc/system/imguiManager.h
@@ -21,7 +21,7 @@ public:
bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext);
void Shutdown();
- void Render();
+ void Render(ApplicationClass* app);
void NewFrame();
void SetupDockspace();
diff --git a/enginecustom/src/src/shader/fontshaderclass.cpp b/enginecustom/src/src/shader/fontshaderclass.cpp
index e0fa051..e85bb8a 100644
--- a/enginecustom/src/src/shader/fontshaderclass.cpp
+++ b/enginecustom/src/src/shader/fontshaderclass.cpp
@@ -178,6 +178,7 @@ bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[1].InstanceDataStepRate = 0;
+
// Get a count of the elements in the layout.
numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
diff --git a/enginecustom/src/src/system/Systemclass.cpp b/enginecustom/src/src/system/Systemclass.cpp
index 506768d..60b519f 100644
--- a/enginecustom/src/src/system/Systemclass.cpp
+++ b/enginecustom/src/src/system/Systemclass.cpp
@@ -213,7 +213,7 @@ bool SystemClass::Frame()
Logger::Get().Log("Failed to render ImGui widgets", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
-
+
m_Application->GetDirect3D()->EndScene();
return true;
diff --git a/enginecustom/src/src/system/applicationclass.cpp b/enginecustom/src/src/system/applicationclass.cpp
index 3ab76de..46166e4 100644
--- a/enginecustom/src/src/system/applicationclass.cpp
+++ b/enginecustom/src/src/system/applicationclass.cpp
@@ -994,7 +994,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
m_SceneTexture->Shutdown();
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);
@@ -1085,48 +1085,6 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
return false;
}
- // Setup matrices - Top display plane.
- worldMatrix = XMMatrixTranslation(0.0f, 1.5f, 0.0f);
-
- // Render the display plane using the texture shader and the render texture resource.
- m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
-
- result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
- m_RenderTexture->GetShaderResourceView());
- if (!result)
- {
- Logger::Get().Log("Could not render the display plane using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
- return false;
- }
-
- // Setup matrices - Bottom left display plane.
- worldMatrix = XMMatrixTranslation(-1.5f, -1.5f, 0.0f);
-
- // Render the display plane using the texture shader and the render texture resource.
- m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
-
- result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
- m_RenderTexture->GetShaderResourceView());
- if (!result)
- {
- Logger::Get().Log("Could not render the display plane using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
- return false;
- }
-
- // Setup matrices - Bottom right display plane.
- worldMatrix = XMMatrixTranslation(1.5f, -1.5f, 0.0f);
-
- // Render the display plane using the texture shader and the render texture resource.
- m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
-
- result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
- m_RenderTexture->GetShaderResourceView());
- if (!result)
- {
- Logger::Get().Log("Could not render the display plane using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
- return false;
- }
-
// Disable the Z buffer and enable alpha blending for 2D rendering.
m_Direct3D->TurnZBufferOff();
m_Direct3D->EnableAlphaBlending();
@@ -1361,6 +1319,8 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
m_Direct3D->TurnZBufferOn();
m_Direct3D->DisableAlphaBlending();
+
+
return true;
}
diff --git a/enginecustom/src/src/system/imguiManager.cpp b/enginecustom/src/src/system/imguiManager.cpp
index bf2f16d..bc84c7d 100644
--- a/enginecustom/src/src/system/imguiManager.cpp
+++ b/enginecustom/src/src/system/imguiManager.cpp
@@ -29,8 +29,6 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
// Setup style
ImGui::StyleColorsDark();
- ImGuiStyle& style = ImGui::GetStyle();
- style.Colors[ImGuiCol_WindowBg] = ImVec4(1.0f, 0.1f, 0.1f, 1.0f);
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@@ -46,10 +44,17 @@ void imguiManager::Shutdown()
Logger::Get().Log("imgui shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
}
-void imguiManager::Render()
+void imguiManager::Render(ApplicationClass* app)
{
ImGui::Render();
+
+ app->GetDirect3D()->TurnZBufferOff();
+ app->GetDirect3D()->EnableAlphaBlending();
+
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
+
+ app->GetDirect3D()->DisableAlphaBlending();
+ app->GetDirect3D()->TurnZBufferOn();
}
void imguiManager::NewFrame()
@@ -403,7 +408,7 @@ bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
WidgetRenderWindow(app, ImVec2(800, 600));
//render imgui
- Render();
+ Render(app);
return true;
}
@@ -604,9 +609,9 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
ImGui::End();
}
-
void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSize)
{
+
ImGui::Begin("Render Window");
ImVec2 oldWindowSize = windowSize;
@@ -617,7 +622,6 @@ void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSiz
{
app->SetWindowSize(windowSize);
}
-
// Get the aspect ratio of the scene in app
@@ -631,17 +635,13 @@ void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSiz
{
windowSize.y = windowSize.x / aspectRatio;
}
-
- // Assurez-vous que la texture est valide
- m_renderTexture = app->GetRenderTexture();
- if (m_renderTexture)
+
+ ID3D11ShaderResourceView* texture = app->GetSceneTexture()->GetShaderResourceView();
+ if (texture)
{
- // Obtenez la vue de la ressource shader de la texture rendue
- ID3D11ShaderResourceView* texture = m_renderTexture->GetShaderResourceView();
-
// Affichez la texture dans une fenêtre ImGui
- ImGui::Image((ImTextureID)texture, windowSize);
+ ImGui::Image((ImTextureID)texture, windowSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(1, 1, 1, 1));
}
else
{