Minor: Ajout du Shader de l'eau

This commit is contained in:
GolfOcean334
2024-04-12 17:34:59 +02:00
parent df55562d59
commit 5aa2621a76
17 changed files with 577 additions and 29 deletions

View File

@@ -10,6 +10,7 @@ ShaderManagerClass::ShaderManagerClass()
m_SpecMapShader = 0;
m_TransparentShader = 0;
m_LightShader = 0;
m_LightShaderWater = 0;
m_LightMapShader = 0;
m_RefractionShader = 0;
m_WaterShader = 0;
@@ -102,6 +103,15 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
return false;
}
// Create and initialize the light shader object.
m_LightShaderWater = new LightShaderClass;
result = m_LightShaderWater->Initialize(device, hwnd);
if (!result)
{
return false;
}
// Create and initialize the light map shader object.
m_LightMapShader = new LightMapShaderClass;
@@ -198,6 +208,14 @@ void ShaderManagerClass::Shutdown()
m_LightShader = 0;
}
// Release the light shader object.
if (m_LightShaderWater)
{
m_LightShaderWater->Shutdown();
delete m_LightShaderWater;
m_LightShaderWater = 0;
}
// Release the light map shader object.
if (m_LightMapShader)
{
@@ -334,12 +352,27 @@ bool ShaderManagerClass::RenderTransparentShader(ID3D11DeviceContext* deviceCont
}
bool ShaderManagerClass::RenderlightShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[])
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientColor[])
{
bool result;
result = m_LightShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition);
result = m_LightShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientColor);
if (!result)
{
return false;
}
return true;
}
bool ShaderManagerClass::RenderlightShaderWater(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT4 getDirection[], XMFLOAT4 ambientColor[], XMFLOAT4 diffuseColor[])
{
bool result;
result = m_LightShaderWater->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, getDirection, ambientColor, diffuseColor);
if (!result)
{
return false;