AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
@@ -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();
|
||||
};
|
||||
|
||||
|
@@ -6,8 +6,6 @@
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "fontclass.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: TextClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user