Fix: Normal Shader

This commit is contained in:
GolfOcean334
2024-04-08 16:11:58 +02:00
parent 9aea925c3d
commit e502033b89
6 changed files with 38 additions and 124 deletions

View File

@@ -3,7 +3,6 @@
ShaderManagerClass::ShaderManagerClass()
{
m_TextureShader = 0;
m_LightShader = 0;
m_NormalMapShader = 0;
m_MultitextureShader = 0;
m_TranslateShader = 0;
@@ -34,15 +33,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
return false;
}
// Create and initialize the light shader object.
m_LightShader = new LightShaderClass;
result = m_LightShader->Initialize(device, hwnd);
if (!result)
{
return false;
}
// Create and initialize the normal map shader object.
m_NormalMapShader = new NormalMapShaderClass;
@@ -92,14 +82,6 @@ void ShaderManagerClass::Shutdown()
m_NormalMapShader = 0;
}
// Release the light shader object.
if (m_LightShader)
{
m_LightShader->Shutdown();
delete m_LightShader;
m_LightShader = 0;
}
// Release the texture shader object.
if (m_TextureShader)
{
@@ -151,30 +133,6 @@ bool ShaderManagerClass::RenderTextureShader(ID3D11DeviceContext* deviceContext,
return true;
}
bool ShaderManagerClass::RenderLightShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
{
bool result;
// Allouer de la m<>moire pour stocker XMFLOAT4 pour la direction de la lumi<6D>re
XMFLOAT4* lightDirection4Ptr = new XMFLOAT4(lightDirection.x, lightDirection.y, lightDirection.z, 1.0f);
// Allouer de la m<>moire pour stocker XMFLOAT4 pour la couleur diffuse
XMFLOAT4* diffuseColorPtr = new XMFLOAT4(diffuseColor);
result = m_LightShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection4Ptr, diffuseColorPtr);
if (!result)
{
delete lightDirection4Ptr;
delete diffuseColorPtr;
return false;
}
delete lightDirection4Ptr;
delete diffuseColorPtr;
return true;
}
bool ShaderManagerClass::RenderNormalMapShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* colorTexture, ID3D11ShaderResourceView* normalTexture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
{