AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

This commit is contained in:
2025-02-01 00:46:41 +01:00
parent 118e967412
commit af01f223c1
12 changed files with 227 additions and 44 deletions

View File

@@ -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

Binary file not shown.

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -9,6 +9,7 @@
#include <imgui_impl_win32.h>
#include <windows.h>
#include <deque>
#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<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer();
};

View File

@@ -6,8 +6,6 @@
// MY CLASS INCLUDES //
///////////////////////
#include "fontclass.h"
////////////////////////////////////////////////////////////////////////////////
// Class name: TextClass
////////////////////////////////////////////////////////////////////////////////

View File

@@ -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();

View File

@@ -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);

View File

@@ -1,6 +1,5 @@
#include "imguiManager.h"
#include "applicationclass.h"
#include <string>
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<65>tre a chang<6E>, ajustez la taille de la fen<65>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<65>tre ImGui
ImGui::Image((ImTextureID)texture, windowSize);