diff --git a/.idea/.idea.KhaoticEngineReborn/.idea/git_toolbox_prj.xml b/.idea/.idea.KhaoticEngineReborn/.idea/git_toolbox_prj.xml
new file mode 100644
index 0000000..02b915b
--- /dev/null
+++ b/.idea/.idea.KhaoticEngineReborn/.idea/git_toolbox_prj.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
index f7995e8..cdb4dbd 100644
--- a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
+++ b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
@@ -7,7 +7,14 @@
-
+
+
+
+
+
+
+
+
@@ -22,6 +29,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -51,7 +175,7 @@
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "preferences.pluginManager",
+ "settings.editor.selected.configurable": "preferences.keymap",
"vue.rearranger.settings.migration": "true"
}
}
@@ -113,7 +237,12 @@
-
+
+
+
+
+
+
@@ -123,7 +252,15 @@
1738175474520
-
+
+
+ 1738181617050
+
+
+
+ 1738181617050
+
+
@@ -131,9 +268,21 @@
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/enginecustom/imgui.ini b/enginecustom/imgui.ini
index 86c6a64..f0a9069 100644
--- a/enginecustom/imgui.ini
+++ b/enginecustom/imgui.ini
@@ -4,8 +4,8 @@ Size=400,400
Collapsed=0
[Window][Khaotic Engine]
-Pos=1180,27
-Size=396,826
+Pos=1187,27
+Size=389,826
Collapsed=0
DockId=0x00000005,0
@@ -34,8 +34,8 @@ Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
-Pos=1644,27
-Size=396,866
+Pos=1187,27
+Size=389,826
Collapsed=0
DockId=0x00000005,1
@@ -45,7 +45,7 @@ Collapsed=0
[Window][Render Window]
Pos=8,27
-Size=1170,826
+Size=1177,826
Collapsed=0
DockId=0x00000002,0
@@ -66,8 +66,8 @@ Collapsed=0
DockId=0x0000000C,0
[Window][Log Window]
-Pos=8,895
-Size=2032,226
+Pos=8,627
+Size=1568,226
Collapsed=0
DockId=0x00000006,0
@@ -82,8 +82,8 @@ DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=Y
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=878,826 CentralNode=1 Selected=0x9204953B
- DockNode ID=0x00000005 Parent=0x00000008 SizeRef=396,826 Selected=0x9F035453
+ 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
diff --git a/enginecustom/shader-error.txt b/enginecustom/shader-error.txt
index 1cff77c..e2b3b9c 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 7de7ce3..4e9dc57 100644
--- a/enginecustom/src/hlsl/font.ps
+++ b/enginecustom/src/hlsl/font.ps
@@ -9,7 +9,6 @@ cbuffer PixelBuffer
float4 pixelColor;
};
-
//////////////
// TYPEDEFS //
//////////////
@@ -25,23 +24,19 @@ struct PixelInputType
float4 FontPixelShader(PixelInputType input) : SV_TARGET
{
float4 color;
-
-
+
// Sample the texture pixel at this location.
color = shaderTexture.Sample(SampleType, input.tex);
-
+
// If the color is black on the texture then treat this pixel as transparent.
- if(color.r == 0.0f)
+ if (color.r == 0.0f && color.g == 0.0f && color.b == 0.0f)
{
color.a = 0.0f;
- }
-
- // 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.
- else
- {
- color.a = 1.0f;
- color = color * pixelColor;
+ return 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.
+ color = color * pixelColor;
+
return color;
-}
+}
\ No newline at end of file
diff --git a/enginecustom/src/hlsl/font.vs b/enginecustom/src/hlsl/font.vs
index 0b71af3..1489bcb 100644
--- a/enginecustom/src/hlsl/font.vs
+++ b/enginecustom/src/hlsl/font.vs
@@ -8,7 +8,6 @@ cbuffer MatrixBuffer
matrix projectionMatrix;
};
-
//////////////
// TYPEDEFS //
//////////////
@@ -24,14 +23,12 @@ struct PixelInputType
float2 tex : TEXCOORD0;
};
-
////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType FontVertexShader(VertexInputType input)
{
PixelInputType output;
-
// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;
@@ -40,9 +37,9 @@ PixelInputType FontVertexShader(VertexInputType input)
output.position = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix);
output.position = mul(output.position, projectionMatrix);
-
+
// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
-
+
return output;
-}
+}
\ No newline at end of file
diff --git a/enginecustom/src/inc/system/applicationclass.h b/enginecustom/src/inc/system/applicationclass.h
index cf3afbe..6c0c062 100644
--- a/enginecustom/src/inc/system/applicationclass.h
+++ b/enginecustom/src/inc/system/applicationclass.h
@@ -179,7 +179,8 @@ private :
// ------------------------------------- //
XMMATRIX m_baseViewMatrix;
- RenderTextureClass* m_RenderTexture, * m_RefractionTexture, * m_ReflectionTexture, * m_SceneTexture;
+ RenderTextureClass* m_RenderTexture, * m_RefractionTexture, * m_ReflectionTexture;
+ RenderTextureClass* m_SceneTexture;
DisplayPlaneClass* m_DisplayPlane;
int m_screenWidth, m_screenHeight;
CameraClass* m_Camera;
diff --git a/enginecustom/src/inc/system/imguiManager.h b/enginecustom/src/inc/system/imguiManager.h
index 0333dc0..1c71b01 100644
--- a/enginecustom/src/inc/system/imguiManager.h
+++ b/enginecustom/src/inc/system/imguiManager.h
@@ -9,6 +9,7 @@
#include
#include
#include
+#include "rendertextureclass.h"
class ApplicationClass;
@@ -47,6 +48,16 @@ public:
bool m_EnableCelShading;
private:
+
+ // --------------------------------------------- //
+ // ----------------- Functions ----------------- //
+ // --------------------------------------------- //
+
+ // --------------------------------------------- //
+ // ----------------- Variables ----------------- //
+ // --------------------------------------------- //
+
+
bool showObjectWindow;
bool showTerrainWindow;
bool showLightWindow;
@@ -62,6 +73,8 @@ private:
ID3D11DeviceContext* m_deviceContext;
ImVec2 windowSize;
+ RenderTextureClass* m_renderTexture;
+
const std::deque& logBuffer = Logger::Get().GetLogBuffer();
};
diff --git a/enginecustom/src/inc/system/textclass.h b/enginecustom/src/inc/system/textclass.h
index c3acffa..005c7ff 100644
--- a/enginecustom/src/inc/system/textclass.h
+++ b/enginecustom/src/inc/system/textclass.h
@@ -6,8 +6,6 @@
// MY CLASS INCLUDES //
///////////////////////
#include "fontclass.h"
-
-
////////////////////////////////////////////////////////////////////////////////
// Class name: TextClass
////////////////////////////////////////////////////////////////////////////////
diff --git a/enginecustom/src/src/system/applicationclass.cpp b/enginecustom/src/src/system/applicationclass.cpp
index 4bdf65b..3ab76de 100644
--- a/enginecustom/src/src/system/applicationclass.cpp
+++ b/enginecustom/src/src/system/applicationclass.cpp
@@ -1040,6 +1040,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
return false;
}
+
// Update the render count text.
result = UpdateRenderCountString(GetRenderCount());
if (!result)
@@ -1185,6 +1186,9 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
return false;
}
+ // Turn off alpha blending after rendering the 2D text.
+ m_Direct3D->DisableAlphaBlending();
+
// turn on the Z buffer
m_Direct3D->TurnZBufferOn();
diff --git a/enginecustom/src/src/system/d3dclass.cpp b/enginecustom/src/src/system/d3dclass.cpp
index 034e248..188a10e 100644
--- a/enginecustom/src/src/system/d3dclass.cpp
+++ b/enginecustom/src/src/system/d3dclass.cpp
@@ -405,7 +405,7 @@ bool D3DClass::Initialize(int screenWidth, int screenHeight, bool vsync, HWND hw
blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
- blendStateDescription.RenderTarget[0].RenderTargetWriteMask = 0x0f;
+ blendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
// Create the blend state using the description.
result = m_device->CreateBlendState(&blendStateDescription, &m_alphaEnableBlendingState);
diff --git a/enginecustom/src/src/system/imguiManager.cpp b/enginecustom/src/src/system/imguiManager.cpp
index b873dfc..bf2f16d 100644
--- a/enginecustom/src/src/system/imguiManager.cpp
+++ b/enginecustom/src/src/system/imguiManager.cpp
@@ -1,6 +1,5 @@
#include "imguiManager.h"
#include "applicationclass.h"
-#include
imguiManager::imguiManager()
{
@@ -17,7 +16,7 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
m_device = device;
m_deviceContext = deviceContext;
-
+
IMGUI_CHECKVERSION();
ImGui::CreateContext();
io = &ImGui::GetIO();
@@ -27,7 +26,11 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
ImGui_ImplWin32_Init(hwnd);
ImGui_ImplDX11_Init(m_device, m_deviceContext);
+
+ // 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);
@@ -606,7 +609,16 @@ void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSiz
{
ImGui::Begin("Render Window");
+ ImVec2 oldWindowSize = windowSize;
windowSize = ImGui::GetContentRegionAvail();
+
+ // Si la taille de la fenêtre a changé, ajustez la taille de la fenêtre de l'application
+ if (oldWindowSize.x != windowSize.x || oldWindowSize.y != windowSize.y)
+ {
+ app->SetWindowSize(windowSize);
+ }
+
+
// Get the aspect ratio of the scene in app
float aspectRatio = app->GetAspectRatio();
@@ -619,15 +631,14 @@ void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSiz
{
windowSize.y = windowSize.x / aspectRatio;
}
-
- app->SetWindowSize(windowSize);
// Assurez-vous que la texture est valide
- RenderTextureClass* renderTexture = app->GetRenderTexture();
- if (renderTexture)
+ m_renderTexture = app->GetRenderTexture();
+ if (m_renderTexture)
{
+
// Obtenez la vue de la ressource shader de la texture rendue
- ID3D11ShaderResourceView* texture = renderTexture->GetShaderResourceView();
+ ID3D11ShaderResourceView* texture = m_renderTexture->GetShaderResourceView();
// Affichez la texture dans une fenêtre ImGui
ImGui::Image((ImTextureID)texture, windowSize);