Minor Update - Log pour plus de fichier
This commit is contained in:
@@ -21,6 +21,8 @@ ReflectionShaderClass::~ReflectionShaderClass()
|
||||
|
||||
bool ReflectionShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
{
|
||||
logger.Log("Initializing reflection shader", __FILE__, __LINE__);
|
||||
|
||||
bool result;
|
||||
wchar_t vsFilename[128];
|
||||
wchar_t psFilename[128];
|
||||
@@ -30,6 +32,7 @@ bool ReflectionShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
error = wcscpy_s(vsFilename, 128, L"../Engine/reflection.vs");
|
||||
if (error != 0)
|
||||
{
|
||||
logger.Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,6 +40,7 @@ bool ReflectionShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
error = wcscpy_s(psFilename, 128, L"../Engine/reflection.ps");
|
||||
if (error != 0)
|
||||
{
|
||||
logger.Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,6 +48,7 @@ bool ReflectionShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
result = InitializeShader(device, hwnd, vsFilename, psFilename);
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,6 +73,7 @@ bool ReflectionShaderClass::Render(ID3D11DeviceContext* deviceContext, int index
|
||||
result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, reflectionTexture, reflectionMatrix);
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -79,6 +85,8 @@ bool ReflectionShaderClass::Render(ID3D11DeviceContext* deviceContext, int index
|
||||
|
||||
bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
|
||||
{
|
||||
logger.Log("Initializing reflection shader", __FILE__, __LINE__);
|
||||
|
||||
HRESULT result;
|
||||
ID3D10Blob* errorMessage;
|
||||
ID3D10Blob* vertexShaderBuffer;
|
||||
@@ -108,7 +116,7 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
// If there was nothing in the error message then it simply could not find the shader file itself.
|
||||
else
|
||||
{
|
||||
MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
|
||||
logger.Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -126,7 +134,7 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
// If there was nothing in the error message then it simply could not find the file itself.
|
||||
else
|
||||
{
|
||||
MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
|
||||
logger.Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -136,6 +144,7 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -143,6 +152,7 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -171,6 +181,7 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
vertexShaderBuffer->GetBufferSize(), &m_layout);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,6 +204,7 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
// Create a texture sampler state description.
|
||||
@@ -214,6 +226,7 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
// Setup the description of the reflection dynamic constant buffer that is in the vertex shader.
|
||||
@@ -228,14 +241,18 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC
|
||||
result = device->CreateBuffer(&reflectionBufferDesc, NULL, &m_reflectionBuffer);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.Log("Reflection shader initialized", __FILE__, __LINE__);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReflectionShaderClass::ShutdownShader()
|
||||
{
|
||||
logger.Log("Shutting down reflection shader", __FILE__, __LINE__);
|
||||
|
||||
// Release the reflection constant buffer.
|
||||
if (m_reflectionBuffer)
|
||||
@@ -279,6 +296,8 @@ void ReflectionShaderClass::ShutdownShader()
|
||||
m_vertexShader = 0;
|
||||
}
|
||||
|
||||
logger.Log("Reflection shader shut down", __FILE__, __LINE__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -340,6 +359,7 @@ bool ReflectionShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceConte
|
||||
result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -364,6 +384,7 @@ bool ReflectionShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceConte
|
||||
result = deviceContext->Map(m_reflectionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user