Minor Update - Log pour plus de fichier
This commit is contained in:
@@ -23,6 +23,8 @@ LightMapShaderClass::~LightMapShaderClass()
|
||||
|
||||
bool LightMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
{
|
||||
logger.Log("Initializing LightMapShaderClass", __FILE__, __LINE__);
|
||||
|
||||
bool result;
|
||||
wchar_t vsFilename[128];
|
||||
wchar_t psFilename[128];
|
||||
@@ -32,6 +34,7 @@ bool LightMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
error = wcscpy_s(vsFilename, 128, L"lightmap.vs");
|
||||
if (error != 0)
|
||||
{
|
||||
logger.Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,6 +42,7 @@ bool LightMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
error = wcscpy_s(psFilename, 128, L"lightmap.ps");
|
||||
if (error != 0)
|
||||
{
|
||||
logger.Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -46,9 +50,12 @@ bool LightMapShaderClass::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;
|
||||
}
|
||||
|
||||
logger.Log("LightMapShaderClass initialized", __FILE__, __LINE__);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,6 +79,7 @@ bool LightMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCo
|
||||
result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,7 +120,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
|
||||
// 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;
|
||||
@@ -131,7 +139,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
|
||||
// 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;
|
||||
@@ -141,6 +149,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -148,6 +157,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -184,6 +194,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
|
||||
vertexShaderBuffer->GetBufferSize(), &m_layout);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -206,6 +217,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
|
||||
result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -228,15 +240,20 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
|
||||
result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
|
||||
if (FAILED(result))
|
||||
{
|
||||
logger.Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.Log("Shader initialized", __FILE__, __LINE__);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void LightMapShaderClass::ShutdownShader()
|
||||
{
|
||||
logger.Log("Shutting down LightMapShaderClass", __FILE__, __LINE__);
|
||||
|
||||
// Release the sampler state.
|
||||
if (m_sampleState)
|
||||
{
|
||||
@@ -272,6 +289,8 @@ void LightMapShaderClass::ShutdownShader()
|
||||
m_vertexShader = 0;
|
||||
}
|
||||
|
||||
logger.Log("LightMapShaderClass shut down", __FILE__, __LINE__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -330,6 +349,7 @@ bool LightMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user