Minor: Ajout du Light Map Shader au Sheder Manager

This commit is contained in:
GolfOcean334
2024-04-11 09:49:49 +02:00
parent 1345537486
commit c6f97490d1
5 changed files with 86 additions and 63 deletions

View File

@@ -99,17 +99,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
return false;
}
// Create and initialize the texture shader object.
m_TextureShader = new TextureShaderClass;
result = m_TextureShader->Initialize(m_Direct3D->GetDevice(), hwnd);
if (!result)
{
logger.Log("Could not initialize the texture shader object", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Create and initialize the render to texture object.
m_RenderTexture = new RenderTextureClass;
@@ -198,16 +187,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
return false;
}
// Create and initialize the light shader object.
m_LightShader = new LightShaderClass;
result = m_LightShader->Initialize(m_Direct3D->GetDevice(), hwnd);
if (!result)
{
logger.Log("Could not initialize the light shader object", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Create and initialize the light object.
m_Light = new LightClass;
@@ -1083,27 +1062,20 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
return false;
}
// Turn off alpha blending.
m_Direct3D->DisableAlphaBlending();
// Setup matrices.
rotateMatrix = XMMatrixRotationY(rotation);
translateMatrix = XMMatrixTranslation(-10.0f, 1.0f, -20.0f);
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
// Render the model using the transparent shader.
m_Model->Render(m_Direct3D->GetDeviceContext());
result = m_ShaderManager->RenderlightMapShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0), m_Model->GetTexture(4));
if (!result)
{
return false;
}
// Lighting, utilise plusieurs lights donc Multiple Points Lighting
//result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
// diffuseColor, lightPosition);
//if (!result)
//{
// return false;
//}
// Lightmapping, utiliser light01.tga en deuxieme texture
//result = m_LightMapShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
// m_Model->GetTexture(0), m_Model->GetTexture(1));
//if (!result)
//{
// return false;
//}
// Enable the Z buffer and disable alpha blending now that 2D rendering is complete.
m_Direct3D->TurnZBufferOn();
m_Direct3D->DisableAlphaBlending();