La fenetre se referme instant

This commit is contained in:
GolfOcean334
2024-04-03 12:15:53 +02:00
parent 83c85cfa29
commit cb1187b358
2 changed files with 49 additions and 59 deletions

View File

@@ -503,64 +503,6 @@ bool ApplicationClass::Frame(InputClass* Input)
return false;
}
XMMATRIX worldMatrix, viewMatrix, projectionMatrix, rotateMatrix, translateMatrix;
// Clear the buffers to begin the scene.
m_Direct3D->BeginScene(0.0f, 0.0f, 0.0f, 1.0f);
// Get the world, view, and projection matrices from the camera and d3d objects.
m_Direct3D->GetWorldMatrix(worldMatrix);
m_Camera->GetViewMatrix(viewMatrix);
m_Direct3D->GetProjectionMatrix(projectionMatrix);
// Setup matrices.
rotateMatrix = XMMatrixRotationY(rotation);
translateMatrix = XMMatrixTranslation(0.0f, 1.0f, 0.0f);
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
// Render the model using the texture shader.
m_Model->Render(m_Direct3D->GetDeviceContext());
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
m_Model->GetTexture(0));
if (!result)
{
return false;
}
// Setup matrices.
rotateMatrix = XMMatrixRotationY(rotation);
translateMatrix = XMMatrixTranslation(-1.5f, -1.0f, 0.0f);
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
// Render the model using the light shader.
m_Model->Render(m_Direct3D->GetDeviceContext());
result = m_ShaderManager->RenderLightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
m_Model->GetTexture(0), m_Light->GetDirection(), m_Light->GetDiffuseColor());
if (!result)
{
return false;
}
// Setup matrices.
rotateMatrix = XMMatrixRotationY(rotation);
translateMatrix = XMMatrixTranslation(1.5f, -1.0f, 0.0f);
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
// Render the model using the normal map shader.
m_Model->Render(m_Direct3D->GetDeviceContext());
result = m_ShaderManager->RenderNormalMapShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
m_Model->GetTexture(0), m_Model->GetTexture(1), m_Light->GetDirection(), m_Light->GetDiffuseColor());
if (!result)
{
return false;
}
// Present the rendered scene to the screen.
m_Direct3D->EndScene();
// Get the location of the mouse from the input object,
Input->GetMouseLocation(mouseX, mouseY);
@@ -714,6 +656,43 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z)
// Render the model using the multitexture shader.
m_Model->Render(m_Direct3D->GetDeviceContext());
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
m_Model->GetTexture(0));
if (!result)
{
return false;
}
// Setup matrices.
rotateMatrix = XMMatrixRotationY(rotation);
translateMatrix = XMMatrixTranslation(-1.5f, -1.0f, 0.0f);
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
// Render the model using the light shader.
m_Model->Render(m_Direct3D->GetDeviceContext());
result = m_ShaderManager->RenderLightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
m_Model->GetTexture(0), m_Light->GetDirection(), m_Light->GetDiffuseColor());
if (!result)
{
return false;
}
// Setup matrices.
rotateMatrix = XMMatrixRotationY(rotation);
translateMatrix = XMMatrixTranslation(1.5f, -1.0f, 0.0f);
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
// Render the model using the normal map shader.
m_Model->Render(m_Direct3D->GetDeviceContext());
result = m_ShaderManager->RenderNormalMapShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
m_Model->GetTexture(0), m_Model->GetTexture(1), m_Light->GetDirection(), m_Light->GetDiffuseColor());
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);